mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-20 17:52:35 +00:00
a lot of thread housekeeping. Switch them off when not needed / disabled.
This commit is contained in:
@@ -128,12 +128,18 @@ void mqttInit()
|
||||
|
||||
MQTT::MQTT() : concurrency::OSThread("mqtt"), pubSub(mqttClient), mqttQueue(MAX_MQTT_QUEUE)
|
||||
{
|
||||
assert(!mqtt);
|
||||
mqtt = this;
|
||||
if(moduleConfig.mqtt.enabled) {
|
||||
|
||||
pubSub.setCallback(mqttCallback);
|
||||
assert(!mqtt);
|
||||
mqtt = this;
|
||||
|
||||
// preflightSleepObserver.observe(&preflightSleep);
|
||||
pubSub.setCallback(mqttCallback);
|
||||
|
||||
// preflightSleepObserver.observe(&preflightSleep);
|
||||
} else {
|
||||
setInterval(INT32_MAX);
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool MQTT::connected()
|
||||
@@ -238,6 +244,10 @@ bool MQTT::wantsLink() const
|
||||
|
||||
int32_t MQTT::runOnce()
|
||||
{
|
||||
if(!moduleConfig.mqtt.enabled) {
|
||||
enabled = false;
|
||||
return INT32_MAX;
|
||||
}
|
||||
bool wantConnection = wantsLink();
|
||||
|
||||
// If connected poll rapidly, otherwise only occasionally check for a wifi connection change and ability to contact server
|
||||
|
||||
Reference in New Issue
Block a user