diff --git a/firmware/src/backend_anycubic.cpp b/firmware/src/backend_anycubic.cpp index 33f7618..ffabf8c 100644 --- a/firmware/src/backend_anycubic.cpp +++ b/firmware/src/backend_anycubic.cpp @@ -191,6 +191,10 @@ void AnycubicBackend::begin(const PrinterCfg& cfg) { // like to the person holding it. Nothing here is worth more than a few // seconds; a failed attempt is retried anyway. mqtt_.setSocketTimeout(4); + // And the TCP connect, which neither of those bounds: the client waits + // thirty seconds for a host that does not answer - as long as the loop + // watchdog - so a printer switched off restarted the box. + net_.setTimeout(4); net_.setHandshakeTimeout(5); mqtt_.setCallback([this](char*, uint8_t* p, unsigned int l) { onMqtt(p, l); }); status_ = "Anycubic: connecting..."; diff --git a/firmware/src/backend_bambu.cpp b/firmware/src/backend_bambu.cpp index 882172d..1a29631 100644 --- a/firmware/src/backend_bambu.cpp +++ b/firmware/src/backend_bambu.cpp @@ -245,6 +245,12 @@ void BambuBackend::begin(const PrinterCfg& cfg) { // like to the person holding it. Nothing here is worth more than a few // seconds; a failed attempt is retried anyway. mqtt_.setSocketTimeout(4); + // The TCP connect has its own limit, and it is not either of the two around + // it: WiFiClientSecure waits THIRTY seconds for a host that does not + // answer, which is exactly the loop watchdog. A printer that is switched + // off then froze the panel for half a minute and restarted the box, again + // and again, until somebody turned the printer on. + net_.setTimeout(4); net_.setHandshakeTimeout(5); mqtt_.setCallback([this](char*, uint8_t* p, unsigned int l) { onMqtt(p, l); }); lastTry_ = 0; diff --git a/firmware/src/bambu_cloud.cpp b/firmware/src/bambu_cloud.cpp index 3d6c7e0..a5bb666 100644 --- a/firmware/src/bambu_cloud.cpp +++ b/firmware/src/bambu_cloud.cpp @@ -53,6 +53,11 @@ void open() { // against, the same situation as a printer on the LAN; trust comes from // the account session Tiger Studio obtained. See net/tls.h. s_net->setInsecure(); + // The TCP connect is bounded on its own: the client's default is thirty + // seconds, as long as the loop watchdog, and an internet link that has gone + // silent would take the whole box down with it. Longer than a LAN printer's + // four - this is a host across the internet. + s_net->setTimeout(8); s_net->setHandshakeTimeout(5); // A full report from a four-unit X1 is about 50 KB and has to fit whole. // It lands in PSRAM - anything over 4 KB does on this build - so the size