diff --git a/lighthub/item.cpp b/lighthub/item.cpp index ac08b4a..11f0dbb 100644 --- a/lighthub/item.cpp +++ b/lighthub/item.cpp @@ -67,7 +67,7 @@ e-mail anklimov@gmail.com #endif short modbusBusy = 0; -bool isPendedModbusWrites = false; +//bool isPendedModbusWrites = false; extern aJsonObject *pollingItem; extern PubSubClient mqttClient; @@ -1615,7 +1615,8 @@ int Item::isActive() { int Item::Poll(int cause) { -if (isPendedModbusWrites) resumeModbus(); +//if (isPendedModbusWrites) resumeModbus(); +checkRetry(); aJsonObject *timestampObj = aJson.getArrayItem(itemArr, I_TIMESTAMP); if (timestampObj) @@ -1937,7 +1938,7 @@ return itemType; void Item::mb_fail(int result) { debugSerial<Ctrl(val); + + if (driver) + { + clearFlag(FLAG_SEND_RETRY); // Clean retry flag + debugSerial<Ctrl(val); + } #ifndef MODBUS_DISABLE else switch (itemType) { case CH_MODBUS: + if (modbusBusy) return M_BUSY; + clearFlag(FLAG_SEND_RETRY); // Clean retry flag + debugSerial<