mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-30 10:13:04 +05:00
refactor: define OTA upgrade flag and MQTT mutex inline
This commit is contained in:
1 parent
aa7385c70f
commit
cc6131eac9
7 files changed
+22
-27
No files matched your search
+2
-4
@@ -18,8 +18,6 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
std::mutex mqttMutex;
|
||||
|
||||
static std::unique_ptr<MQTT> mqttClient;
|
||||
|
||||
// Keep the applied prefix separate from settings until MQTT is reconfigured.
|
||||
@@ -55,7 +53,7 @@ static bool isSensorReconfigurationPending(uint8_t sensorId) {
|
||||
}
|
||||
|
||||
static bool isMqttBlocked() {
|
||||
return vars.states.upgrading || restartTask.scheduled() || restartTask.active();
|
||||
return upgrading || restartTask.scheduled() || restartTask.active();
|
||||
}
|
||||
|
||||
static bool isMqttReady() {
|
||||
@@ -1154,7 +1152,7 @@ Task mqttConfigureTask("Configure MQTT", Task::Type::ONCE, [](void*) {
|
||||
void initMqtt() {
|
||||
// Keep only the configuration dispatcher when MQTT publications are disabled.
|
||||
mqttConfigureTask.pause().setEnabledWhen([] {
|
||||
return !vars.states.upgrading && !restartTask.scheduled() && !restartTask.active();
|
||||
return !upgrading && !restartTask.scheduled() && !restartTask.active();
|
||||
});
|
||||
|
||||
coreTaskManager.addTask(mqttConfigureTask);
|
||||
|
||||
Reference in new issue
Block a user