Add used Modbus UART debug information

This commit is contained in:
Theo Arends 2025-09-01 11:19:59 +02:00
parent 6d4b49c88b
commit 120308f969
15 changed files with 51 additions and 6 deletions

View File

@ -122,6 +122,9 @@ void PzemAcSnsInit(void)
uint8_t result = PzemAcModbus->Begin(9600); uint8_t result = PzemAcModbus->Begin(9600);
if (result) { if (result) {
if (2 == result) { ClaimSerial(); } if (2 == result) { ClaimSerial(); }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("PAC: Serial UART%d"), PzemAcModbus->getUart());
#endif
Energy->phase_count = ENERGY_MAX_PHASES; // Start off with three phases Energy->phase_count = ENERGY_MAX_PHASES; // Start off with three phases
PzemAc.phase = 0; PzemAc.phase = 0;
} else { } else {

View File

@ -130,6 +130,9 @@ void PzemDcSnsInit(void)
uint8_t result = PzemDc->modbus->Begin(9600, SERIAL_8N2); uint8_t result = PzemDc->modbus->Begin(9600, SERIAL_8N2);
if (result) { if (result) {
if (2 == result) { ClaimSerial(); } if (2 == result) { ClaimSerial(); }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("PDC: Serial UART%d"), PzemDc->modbus->getUart());
#endif
Energy->type_dc = true; Energy->type_dc = true;
Energy->phase_count = ENERGY_MAX_PHASES; // Start off with three channels Energy->phase_count = ENERGY_MAX_PHASES; // Start off with three channels
PzemDc->channel = 0; PzemDc->channel = 0;

View File

@ -181,6 +181,9 @@ void Sdm120SnsInit(void)
uint8_t result = Sdm120Modbus->Begin(SDM120_SPEED); uint8_t result = Sdm120Modbus->Begin(SDM120_SPEED);
if (result) { if (result) {
if (2 == result) { ClaimSerial(); } if (2 == result) { ClaimSerial(); }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("SDM: Serial UART%d"), Sdm120Modbus->getUart());
#endif
} else { } else {
TasmotaGlobal.energy_driver = ENERGY_NONE; TasmotaGlobal.energy_driver = ENERGY_NONE;
} }

View File

@ -94,6 +94,9 @@ void Dds2382SnsInit(void)
uint8_t result = Dds2382Modbus->Begin(DDS2382_SPEED); uint8_t result = Dds2382Modbus->Begin(DDS2382_SPEED);
if (result) { if (result) {
if (2 == result) { ClaimSerial(); } if (2 == result) { ClaimSerial(); }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("DDS: Serial UART%d"), Dds2382Modbus->getUart());
#endif
} else { } else {
TasmotaGlobal.energy_driver = ENERGY_NONE; TasmotaGlobal.energy_driver = ENERGY_NONE;
} }

View File

@ -322,6 +322,9 @@ void Sdm630SnsInit(void)
uint8_t result = Sdm630Modbus->Begin(SDM630_SPEED); uint8_t result = Sdm630Modbus->Begin(SDM630_SPEED);
if (result) { if (result) {
if (2 == result) { ClaimSerial(); } if (2 == result) { ClaimSerial(); }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("SDM: Serial UART%d"), Sdm630Modbus->getUart());
#endif
Energy->phase_count = 3; Energy->phase_count = 3;
Energy->frequency_common = true; // Use common frequency Energy->frequency_common = true; // Use common frequency
} else { } else {

View File

@ -66,7 +66,7 @@ void DDSU666Every250ms(void)
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, Ddsu666Modbus->ReceiveCount()); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, Ddsu666Modbus->ReceiveCount());
if (error) { if (error) {
AddLog(LOG_LEVEL_DEBUG, PSTR("SDM: Ddsu666 error %d"), error); AddLog(LOG_LEVEL_DEBUG, PSTR("DDS: Ddsu666 error %d"), error);
} else { } else {
Energy->data_valid[0] = 0; Energy->data_valid[0] = 0;
@ -136,6 +136,9 @@ void Ddsu666SnsInit(void)
uint8_t result = Ddsu666Modbus->Begin(DDSU666_SPEED); uint8_t result = Ddsu666Modbus->Begin(DDSU666_SPEED);
if (result) { if (result) {
if (2 == result) { ClaimSerial(); } if (2 == result) { ClaimSerial(); }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("DDS: Serial UART%d"), Ddsu666Modbus->getUart());
#endif
} else { } else {
TasmotaGlobal.energy_driver = ENERGY_NONE; TasmotaGlobal.energy_driver = ENERGY_NONE;
} }

View File

@ -123,7 +123,7 @@ void FifLEEvery250ms(void)
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, FifLEModbus->ReceiveCount()); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, FifLEModbus->ReceiveCount());
if (error) { if (error) {
AddLog(LOG_LEVEL_DEBUG, PSTR("FiF-LE: LE01MR Modbus error %d"), error); AddLog(LOG_LEVEL_DEBUG, PSTR("FIF: LE01MR Modbus error %d"), error);
} else { } else {
Energy->data_valid[0] = 0; Energy->data_valid[0] = 0;
@ -218,6 +218,9 @@ void FifLESnsInit(void)
uint8_t result = FifLEModbus->Begin(LE01MR_SPEED); uint8_t result = FifLEModbus->Begin(LE01MR_SPEED);
if (result) { if (result) {
if (2 == result) { ClaimSerial(); } if (2 == result) { ClaimSerial(); }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("FIF: Serial UART%d"), FifLEModbus->getUart());
#endif
} else { } else {
TasmotaGlobal.energy_driver = ENERGY_NONE; TasmotaGlobal.energy_driver = ENERGY_NONE;
} }

View File

@ -81,7 +81,7 @@ void IEM3000Every250ms(void)
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, Iem3000Modbus->ReceiveCount()); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, Iem3000Modbus->ReceiveCount());
if (error) { if (error) {
AddLog(LOG_LEVEL_DEBUG, PSTR("SDM: Iem3000 error %d"), error); AddLog(LOG_LEVEL_DEBUG, PSTR("IEM: Iem3000 error %d"), error);
} else { } else {
Energy->data_valid[0] = 0; Energy->data_valid[0] = 0;
@ -185,6 +185,9 @@ void Iem3000SnsInit(void)
uint8_t result = Iem3000Modbus->Begin(IEM3000_SPEED); uint8_t result = Iem3000Modbus->Begin(IEM3000_SPEED);
if (result) { if (result) {
if (2 == result) { ClaimSerial(); } if (2 == result) { ClaimSerial(); }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("IEM: Serial UART%d"), Iem3000Modbus->getUart());
#endif
Energy->phase_count = 3; Energy->phase_count = 3;
Energy->frequency_common = true; // Use common frequency Energy->frequency_common = true; // Use common frequency
} else { } else {

View File

@ -82,7 +82,7 @@ void WE517Every250ms(void)
AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, We517Modbus->ReceiveCount()); AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, We517Modbus->ReceiveCount());
if (error) { if (error) {
AddLog(LOG_LEVEL_DEBUG, PSTR("ORNO: WE517 error %d"), error); AddLog(LOG_LEVEL_DEBUG, PSTR("ORN: WE517 error %d"), error);
} else { } else {
Energy->data_valid[0] = 0; Energy->data_valid[0] = 0;
Energy->data_valid[1] = 0; Energy->data_valid[1] = 0;
@ -192,6 +192,9 @@ void We517SnsInit(void) {
Serial.begin(WE517_SPEED, SERIAL_8E1); Serial.begin(WE517_SPEED, SERIAL_8E1);
ClaimSerial(); ClaimSerial();
} }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("ORN: Serial UART%d"), We517Modbus->getUart());
#endif
Energy->phase_count = 3; Energy->phase_count = 3;
Energy->frequency_common = true; // Use common frequency Energy->frequency_common = true; // Use common frequency
} else { } else {

View File

@ -136,6 +136,9 @@ void Sdm72SnsInit(void)
if (2 == result) { if (2 == result) {
ClaimSerial(); ClaimSerial();
} }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("SDM: Serial UART%d"), Sdm72Modbus->getUart());
#endif
} else { } else {
TasmotaGlobal.energy_driver = ENERGY_NONE; TasmotaGlobal.energy_driver = ENERGY_NONE;
} }

View File

@ -192,6 +192,9 @@ void Sdm230SnsInit(void)
uint8_t result = Sdm230Modbus->Begin(SDM230_SPEED); uint8_t result = Sdm230Modbus->Begin(SDM230_SPEED);
if (result) { if (result) {
if (2 == result) { ClaimSerial(); } if (2 == result) { ClaimSerial(); }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("SDM: Serial UART%d"), Sdm230Modbus->getUart());
#endif
Energy->phase_count = 1; Energy->phase_count = 1;
Energy->frequency_common = true; // Use common frequency Energy->frequency_common = true; // Use common frequency
} else { } else {

View File

@ -236,6 +236,9 @@ void BioPduSnsInit(void)
{ {
ClaimSerial(); ClaimSerial();
} }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("PDU: Serial UART%d"), BioPduModbus->getUart());
#endif
BioPdu.phase = Energy->phase_count - 1; BioPdu.phase = Energy->phase_count - 1;
} }
else else

View File

@ -741,6 +741,9 @@ void EnergyModbusSnsInit(void) {
uint8_t result = EnergyModbus->Begin(NrgMbsParam.serial_bps, NrgMbsParam.serial_config); uint8_t result = EnergyModbus->Begin(NrgMbsParam.serial_bps, NrgMbsParam.serial_config);
if (result) { if (result) {
if (2 == result) { ClaimSerial(); } if (2 == result) { ClaimSerial(); }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("NRG: Serial UART%d"), EnergyModbus->getUart());
#endif
#ifdef ENERGY_MODBUS_TICKER #ifdef ENERGY_MODBUS_TICKER
ticker_energy_modbus.attach_ms(NrgMbsParam.ticker_poll, EnergyModbusLoop); ticker_energy_modbus.attach_ms(NrgMbsParam.ticker_poll, EnergyModbusLoop);

View File

@ -216,6 +216,9 @@ void SenseairInit(void)
// We have hardware serial, so claim it // We have hardware serial, so claim it
ClaimSerial(); ClaimSerial();
} }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_SENSEAIR "Serial UART%d"), SenseairModbus->getUart());
#endif
senseair_type = SENSOR_TYPE_UNKNOWN; senseair_type = SENSOR_TYPE_UNKNOWN;
} }
} }

View File

@ -1450,6 +1450,9 @@ void NeoPoolInit(void) {
if (2 == result) { if (2 == result) {
ClaimSerial(); ClaimSerial();
} }
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("NEO: Serial UART%d"), NeoPoolModbus->getUart());
#endif
if (NeoPoolInitData()) { // Claims heap space if (NeoPoolInitData()) { // Claims heap space
neopool_active = true; neopool_active = true;
} }