Fixed MODBUS and seneca drivers, added partial counter reset

This commit is contained in:
Emanuele Trabattoni
2025-07-13 13:16:24 +02:00
parent d2eba9085e
commit 7e02f3cef2
5 changed files with 96 additions and 60 deletions

View File

@@ -59,7 +59,6 @@ void loop()
auto io = digitalIO(i2c, bus, {relayBoardAddr});
delay(100);
auto seneca = drivers::S50140(bus, senecadAddr);
delay(100);
Network.onEvent([&eth](arduino_event_id_t event, arduino_event_info_t info)
{ eth.onEvent(event, info); });
@@ -116,16 +115,23 @@ void loop()
for (auto j(0); j < io.getOutNum(); j++)
{
// io.digitalIOWrite(j, true);
LOG_INFO("Input", j, io.digitalIORead(j) ? "True" : "False");
delay(500);
// io.digitalIOWrite(j, false);
delay(50);
}
drivers::S50140::powerinfo_t pinfo = seneca.getAll();
LOG_INFO("Power Info\nV:", pinfo.v, "\nA:", pinfo.a, "\nW:", pinfo.pAct, "\nWh_t:", pinfo.whTot, "\nWh_p:", pinfo.whPar);
LOG_INFO("Power Info ==> V:", pinfo.v, "- A:", pinfo.a, "- W:", pinfo.pAct, "- F:", pinfo.f, "- Wh_t:", pinfo.whTot, "- Wh_p:", pinfo.whPar);
delay(5000);
if (io.digitalIORead(0))
{
uint8_t regset(seneca.getRegset());
uint16_t countStat(seneca.getCounterStatus());
LOG_INFO("Register Set: ", regset);
LOG_INFO("Counter Status: ", countStat);
seneca.resetPartialCounters();
}
delay(2000);
}
////////////////////////////////////////