mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 19:59:50 +03:00
bit more Modbus debug info and serial param N81 by default
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#-DW5500_CS_PIN=53
|
#-DW5500_CS_PIN=53
|
||||||
-DDMX_SMOOTH
|
-DDMX_SMOOTH
|
||||||
-DSYSLOG_ENABLE
|
-DSYSLOG_ENABLE
|
||||||
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
|
#-DMODBUS_DIMMER_PARAM=SERIAL_8E1
|
||||||
-DARTNET_ENABLE
|
-DARTNET_ENABLE
|
||||||
-DOTA
|
-DOTA
|
||||||
-DSTATUSLED
|
-DSTATUSLED
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
|
#-DMODBUS_DIMMER_PARAM=SERIAL_8E1
|
||||||
-DAVR_DMXOUT_PIN=18
|
-DAVR_DMXOUT_PIN=18
|
||||||
-DSYSLOG_ENABLE
|
-DSYSLOG_ENABLE
|
||||||
-DWiz5100
|
-DWiz5100
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
-DWiz5500
|
-DWiz5500
|
||||||
-DMODBUS_DIMMER_PARAM=SERIAL_8E1
|
#-DMODBUS_DIMMER_PARAM=SERIAL_8E1
|
||||||
-DAVR_DMXOUT_PIN=18
|
-DAVR_DMXOUT_PIN=18
|
||||||
-DSYSLOG_ENABLE
|
-DSYSLOG_ENABLE
|
||||||
#-DPID_DISABLE
|
#-DPID_DISABLE
|
||||||
@@ -13,3 +13,4 @@
|
|||||||
-DAC_DISABLE
|
-DAC_DISABLE
|
||||||
-DSYSLOG_ENABLE
|
-DSYSLOG_ENABLE
|
||||||
-DPID_DISABLE
|
-DPID_DISABLE
|
||||||
|
-DWiz5100
|
||||||
@@ -1391,8 +1391,8 @@ int Item::modbusDimmerSet(itemCmd st)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Item::mb_fail() {
|
void Item::mb_fail(int result) {
|
||||||
debugSerial<<F("Modbus op failed\n");
|
debugSerial<<F("Modbus op failed:")<<_HEX(result)<<endl;
|
||||||
setFlag(SEND_RETRY);
|
setFlag(SEND_RETRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1440,7 +1440,7 @@ int Item::VacomSetFan(itemCmd st) {
|
|||||||
modbusBusy = 0;
|
modbusBusy = 0;
|
||||||
|
|
||||||
if (result == node.ku8MBSuccess) return 1;
|
if (result == node.ku8MBSuccess) return 1;
|
||||||
mb_fail();
|
mb_fail(result);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1490,7 +1490,7 @@ int addr;
|
|||||||
result=node.writeSingleRegister(2004 - 1, regval);
|
result=node.writeSingleRegister(2004 - 1, regval);
|
||||||
modbusBusy = 0;
|
modbusBusy = 0;
|
||||||
if (result == node.ku8MBSuccess) return 1;
|
if (result == node.ku8MBSuccess) return 1;
|
||||||
mb_fail();
|
mb_fail(result);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1532,7 +1532,7 @@ int Item::modbusDimmerSet(int addr, uint16_t _reg, int _regType, int _mask, uint
|
|||||||
modbusBusy = 0;
|
modbusBusy = 0;
|
||||||
|
|
||||||
if (result == node.ku8MBSuccess) return 1;
|
if (result == node.ku8MBSuccess) return 1;
|
||||||
mb_fail();
|
mb_fail(result);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class Item
|
|||||||
int modbusDimmerSet(itemCmd st);
|
int modbusDimmerSet(itemCmd st);
|
||||||
|
|
||||||
int modbusDimmerSet(int addr, uint16_t _reg, int _regType, int _mask, uint16_t value);
|
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();
|
void Parse();
|
||||||
int checkModbusDimmer();
|
int checkModbusDimmer();
|
||||||
int checkModbusDimmer(int data);
|
int checkModbusDimmer(int data);
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ int str2regSize(char * str)
|
|||||||
bool out_Modbus::getConfig()
|
bool out_Modbus::getConfig()
|
||||||
{
|
{
|
||||||
// Retrieve and store template values from global modbus settings
|
// 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;
|
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;
|
return false;
|
||||||
@@ -216,7 +216,7 @@ switch (regType) {
|
|||||||
default:
|
default:
|
||||||
debugSerial<<F("Not supported reg type\n");
|
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);
|
return (result == node.ku8MBSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user