mirror of
https://github.com/anklimov/lighthub
synced 2025-12-12 06:39:51 +03:00
bit more Modbus debug info and serial param N81 by default
This commit is contained in:
@@ -1391,8 +1391,8 @@ int Item::modbusDimmerSet(itemCmd st)
|
||||
}
|
||||
#endif
|
||||
|
||||
void Item::mb_fail() {
|
||||
debugSerial<<F("Modbus op failed\n");
|
||||
void Item::mb_fail(int result) {
|
||||
debugSerial<<F("Modbus op failed:")<<_HEX(result)<<endl;
|
||||
setFlag(SEND_RETRY);
|
||||
}
|
||||
|
||||
@@ -1440,7 +1440,7 @@ int Item::VacomSetFan(itemCmd st) {
|
||||
modbusBusy = 0;
|
||||
|
||||
if (result == node.ku8MBSuccess) return 1;
|
||||
mb_fail();
|
||||
mb_fail(result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1490,7 +1490,7 @@ int addr;
|
||||
result=node.writeSingleRegister(2004 - 1, regval);
|
||||
modbusBusy = 0;
|
||||
if (result == node.ku8MBSuccess) return 1;
|
||||
mb_fail();
|
||||
mb_fail(result);
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -1532,7 +1532,7 @@ int Item::modbusDimmerSet(int addr, uint16_t _reg, int _regType, int _mask, uint
|
||||
modbusBusy = 0;
|
||||
|
||||
if (result == node.ku8MBSuccess) return 1;
|
||||
mb_fail();
|
||||
mb_fail(result);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class Item
|
||||
int modbusDimmerSet(itemCmd st);
|
||||
|
||||
int modbusDimmerSet(int addr, uint16_t _reg, int _regType, int _mask, uint16_t value);
|
||||
void mb_fail();
|
||||
void mb_fail(int result=0);
|
||||
void Parse();
|
||||
int checkModbusDimmer();
|
||||
int checkModbusDimmer(int data);
|
||||
|
||||
@@ -101,7 +101,7 @@ int str2regSize(char * str)
|
||||
bool out_Modbus::getConfig()
|
||||
{
|
||||
// Retrieve and store template values from global modbus settings
|
||||
if (!store || !item || !item->itemArg || (item->itemArg->type != aJson_Array) || aJson.getArraySize(item->itemArg)<2)
|
||||
if (!store || !item || !item->itemArg || (item->itemArg->type != aJson_Array) || aJson.getArraySize(item->itemArg)<2 || !modbusObj)
|
||||
{
|
||||
errorSerial<<F("MBUS: config failed:")<<(bool)store<<F(",")<<(bool)item<<F(",")<<(bool)item->itemArg<<F(",")<<(item->itemArg->type != aJson_Array)<<F(",")<< (aJson.getArraySize(item->itemArg)<2)<<endl;
|
||||
return false;
|
||||
@@ -216,7 +216,7 @@ switch (regType) {
|
||||
default:
|
||||
debugSerial<<F("Not supported reg type\n");
|
||||
}
|
||||
if (result != node.ku8MBSuccess) errorSerial<<F("MBUS: Polling error ")<<result<<endl;
|
||||
if (result != node.ku8MBSuccess) errorSerial<<F("MBUS: Polling error ")<<_HEX(result)<<endl;
|
||||
return (result == node.ku8MBSuccess);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user