Adjusted mutex lock and delay for modbus

This commit is contained in:
Emanuele Trabattoni
2025-07-24 16:18:42 +02:00
parent 07dd200de8
commit cdbc904bec
11 changed files with 130 additions and 80 deletions

View File

@@ -140,17 +140,8 @@ void loop()
{
LOG_INFO("Temperature channel", i++, "->", v);
}
i = 0;
delay(10);
for (auto v : tmp.getCorrection())
{
LOG_INFO("Temperature correction channel", i++, "tc", v);
}
delay(100);
drivers::S50140::powerinfo_t pinfo = seneca.getAll();
LOG_INFO("Power Info ==> V:", pinfo.v, "- A:", pinfo.a, "- W:", pinfo.pAct, "- F:", pinfo.f, "- Wh_t:", pinfo.whTot, "- Wh_p:", pinfo.whPar);
LOG_INFO("Read Red");
if (io.digitalInRead(0)) // rosso
{
std::vector<bool> v1 = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
@@ -159,13 +150,11 @@ void loop()
LOG_INFO("SET Digital Outputs V1: ", printBoolVec(v1).c_str());
io.digitalOutWritePort(v1);
delay(100);
LOG_INFO("GET Digital Outputs V1: ", printBoolVec(io.digitalOutReadPort()).c_str());
delay(2000);
LOG_INFO("SET Digital Outputs V2: ", printBoolVec(v2).c_str());
io.digitalOutWritePort(v2);
delay(100);
LOG_INFO("GET Digital Outputs V2: ", printBoolVec(io.digitalOutReadPort()).c_str());
delay(2000);
@@ -173,9 +162,10 @@ void loop()
delay(2000);
io.digitalOutWritePort(v0);
delay(2000);
}
delay(100);
LOG_INFO("Read Blue");
if (io.digitalInRead(8)) // blu
{
if (!buzzing)
@@ -192,17 +182,22 @@ void loop()
}
LOG_INFO("Buzzing -> ", buzzing ? "True" : "False");
}
LOG_INFO("Read Green");
if (io.digitalInRead(9))
{ // verde
conf.resetConfig();
}
LOG_INFO("Read Yellow");
if (io.digitalInRead(10))
{ // giallo
esp_restart();
}
drivers::S50140::powerinfo_t pinfo = seneca.getAll();
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(conf.m_globalLoopDelay);
}