diff --git a/include/Const.h b/include/Const.h index 9a18ea18..ca9718bb 100644 --- a/include/Const.h +++ b/include/Const.h @@ -109,8 +109,8 @@ enum TimerTask_t { WIFI_SCAN, WIFI_MQTT_CONNECTION_CHECK, TIME, - TIME_SYNC, - UPTIME, + // TIME_SYNC, // не используется + // UPTIME, // не используется UDPt, // UDPP TIMES, // периодические секундные проверки PTASK, @@ -119,12 +119,12 @@ enum TimerTask_t { END }; -// задачи которые надо протащить через loop -enum NotAsyncActions { - do_ZERO, - do_MQTTPARAMSCHANGED, - do_LAST, -}; +// задачи которые надо протащить через loop // не используется +// enum NotAsyncActions { +// do_ZERO, +// do_MQTTPARAMSCHANGED, +// do_LAST, +// }; // состояния обновления enum UpdateStates { UPDATE_COMPLETED, UPDATE_FAILED, PATH_ERROR }; @@ -132,7 +132,7 @@ enum UpdateStates { UPDATE_COMPLETED, UPDATE_FAILED, PATH_ERROR }; enum distination { TO_MQTT, TO_WS, - TO_MQTT_WS, + TO_MQTT_WS }; -#define WS_BROADCAST -1 +// #define WS_BROADCAST -1 // не используется diff --git a/include/ESPConfiguration.h b/include/ESPConfiguration.h index 1e185219..c795becd 100644 --- a/include/ESPConfiguration.h +++ b/include/ESPConfiguration.h @@ -6,4 +6,4 @@ extern std::list IoTItems; // вектор ссылок базово extern void configure(String path); void clearConfigure(); -extern IoTItem* myIoTItem; +// extern IoTItem* myIoTItem; // экономим память, используется в одном месте diff --git a/include/MqttClient.h b/include/MqttClient.h index f7614f94..0085401f 100644 --- a/include/MqttClient.h +++ b/include/MqttClient.h @@ -29,8 +29,8 @@ bool publishChartFileToMqtt(String path, String id, int maxCount); void publishWidgets(); void mqttCallback(char* topic, uint8_t* payload, size_t length); -void handleMqttStatus(bool send); -void handleMqttStatus(bool send, int state); +//void handleMqttStatus(bool send); +void handleMqttStatus(bool send, int state == -1); const String getStateStr(int e); diff --git a/src/ESPConfiguration.cpp b/src/ESPConfiguration.cpp index 64db3e5e..af81f47c 100644 --- a/src/ESPConfiguration.cpp +++ b/src/ESPConfiguration.cpp @@ -23,6 +23,7 @@ void configure(String path) { jsonArrayElement = ""; } if (jsonArrayElement != "") { + IoTItem* myIoTItem; String subtype; if (!jsonRead(jsonArrayElement, F("subtype"), subtype)) { //если нет такого ключа в представленном json или он не валидный SerialPrint(F("E"), F("Config"), "json error " + subtype); diff --git a/src/Global.cpp b/src/Global.cpp index 0e00c731..9843a65d 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -4,7 +4,8 @@ *****************************************глобальные объекты классов*************************************************** **********************************************************************************************************************/ -TickerScheduler ts(END + 1); +// TickerScheduler ts(END + 1); // зачем на 1 больше? +TickerScheduler ts(END); WiFiClient espClient; PubSubClient mqtt(espClient); diff --git a/src/MqttClient.cpp b/src/MqttClient.cpp index 2f5a205d..199aef48 100644 --- a/src/MqttClient.cpp +++ b/src/MqttClient.cpp @@ -343,14 +343,17 @@ bool publishChartFileToMqtt(String path, String id, int maxCount) { return true; } -void handleMqttStatus(bool send) { - String stateStr = getStateStr(mqtt.state()); - // Serial.println(stateStr); - jsonWriteStr_(errorsHeapJson, F("mqtt"), stateStr); - if (!send) sendStringToWs("errors", errorsHeapJson, -1); -} +// void handleMqttStatus(bool send) { +// String stateStr = getStateStr(mqtt.state()); +// // Serial.println(stateStr); +// jsonWriteStr_(errorsHeapJson, F("mqtt"), stateStr); +// if (!send) sendStringToWs("errors", errorsHeapJson, -1); +// } void handleMqttStatus(bool send, int state) { + if (state == -1) { + state = mqtt.state(); + } String stateStr = getStateStr(state); // Serial.println(stateStr); jsonWriteStr_(errorsHeapJson, F("mqtt"), stateStr); diff --git a/src/classes/IoTItem.cpp b/src/classes/IoTItem.cpp index 60cadc34..33984eda 100644 --- a/src/classes/IoTItem.cpp +++ b/src/classes/IoTItem.cpp @@ -289,7 +289,7 @@ unsigned long IoTItem::getRtcUnixTime() //========================================================================================================================================= -IoTItem* myIoTItem; +// IoTItem* myIoTItem; // экономим память, используется в одном месте // поиск элемента модуля в существующей конфигурации IoTItem* findIoTItem(const String& name) { diff --git a/src/modules/sensors/AnalogAdc/AnalogAdc.cpp b/src/modules/sensors/AnalogAdc/AnalogAdc.cpp index 4ee91d51..f5a2cb51 100644 --- a/src/modules/sensors/AnalogAdc/AnalogAdc.cpp +++ b/src/modules/sensors/AnalogAdc/AnalogAdc.cpp @@ -46,7 +46,7 @@ class AnalogAdc : public IoTItem { // и выполнить за несколько тактов void doByInterval() { if (_avgSteps <= 1) value.valD = IoTgpio.analogRead(_pin); - value.valD = adCresult;/// + else value.valD = adCresult;/// regEvent(value.valD, "AnalogAdc"); //обязательный вызов хотяб один }