fix HPlimits pin ordering and introduce pin naming map

This commit is contained in:
Emanuele Trabattoni
2025-08-30 10:55:40 +02:00
parent 6a6931bde0
commit 0952be3141
3 changed files with 49 additions and 11 deletions

View File

@@ -2,10 +2,10 @@
enum RO // relay output channels
{
P1 = 0,
P2 = 1,
P3 = 2,
P4 = 3,
P4 = 0,
P3 = 1,
P2 = 2,
P1 = 3,
RO_4 = 4,
FST_FLOOR = 5,
GND_FLOOR = 6,
@@ -21,6 +21,25 @@ enum RO // relay output channels
RO_MAX = 16 // unused to detect invalid values
};
static const std::map<const int, const char *> RO_2str = {
{RO::P1, "HPLimite1"},
{RO::P2, "HPLimite2"},
{RO::P3, "HPLimite3"},
{RO::P4, "HPLimite4"},
{RO::RO_4, "Out4"},
{RO::FST_FLOOR, "PianoPrimo"},
{RO::GND_FLOOR, "PianoTerra"},
{RO::PUMP_HT, "PompaRisc"},
{RO::PUMP_IRR, "PompaIrr"},
{RO::RETURN, "Ricircolo"},
{RO::ZONE1, "IrrZona1"},
{RO::ZONE2, "IrrZona2"},
{RO::ZONE3, "IrrZona3"},
{RO::DRIP, "IrrDrip"},
{RO::RO_14, "Out14"},
{RO::RO_15, "Out15"},
{RO::RO_MAX, "Invalid"}};
enum DI // digital input channels
{
CONFRESET = 0,
@@ -28,6 +47,7 @@ enum DI // digital input channels
DI_2 = 2,
DI_3 = 3,
DI_4 = 4,
DI_5 = 5,
DI_6 = 6,
OTAENABLE = 7,
PUMP_PRESSURE = 8,
@@ -38,5 +58,25 @@ enum DI // digital input channels
DI_13 = 13,
DI_14 = 14,
DI_15 = 15,
DI_MAX = 16
}; // unused to detect invalid values
DI_MAX = 16 // unused to detect invalid values
};
static const std::map<const int, const char *> DI_2str =
{
{DI::CONFRESET, "ConfigReset"},
{DI::RESTART, "Restart"},
{DI::DI_2, "In2"},
{DI::DI_3, "In3"},
{DI::DI_4, "In4"},
{DI::DI_5, "In5"},
{DI::DI_6, "In6"},
{DI::OTAENABLE, "OtaEnable"},
{DI::PUMP_PRESSURE, "IrrPumpPressure"},
{DI::RAIN, "IrrRainSensor"},
{DI::IRR_OVERRIDE, "IrrRainOverride"},
{DI::DI_11, "In11"},
{DI::DI_12, "In12"},
{DI::DI_13, "In13"},
{DI::DI_14, "In14"},
{DI::DI_15, "In15"},
{DI::DI_MAX, "Invalid"}};

View File

@@ -457,8 +457,7 @@ namespace commands
uint8_t i(0);
for (auto s : inStatus)
{
const std::string k("DI" + std::to_string(i));
response["values"][k.c_str()] = s;
response["values"][DI_2str.at(i++)] = s;
}
LOG_INFO("getInputStatus ->", printBoolVec(inStatus).c_str());
return response;
@@ -476,8 +475,7 @@ namespace commands
uint8_t i(0);
for (auto s : inStatus)
{
const std::string k("DO" + std::to_string(i));
response["values"][k.c_str()] = s;
response["values"][RO_2str.at(i++)] = s;
}
LOG_INFO("getOutputStatus ->", printBoolVec(inStatus).c_str());
return response;