This commit is contained in:
Emmanuel HC
2026-06-05 10:17:43 -05:00
parent 90cf94e8c9
commit 8b64f22e88
5 changed files with 56 additions and 54 deletions

View File

@@ -10,7 +10,7 @@
[platformio] [platformio]
default_envs = CH_York_YVA_RTU_PHXA7 ; Select here the name of the configuration you want to download default_envs = GEN_Kohler_KD2500_RTU_PHXA7 ; Select here the name of the configuration you want to download
[env] [env]
upload_port = COM15 upload_port = COM15

View File

@@ -40,7 +40,7 @@
const int RX_PIN = 17; /**< @brief The GPIO pin used for receiving data (RX). */ const int RX_PIN = 17; /**< @brief The GPIO pin used for receiving data (RX). */
const int TX_PIN = 16; /**< @brief The GPIO pin used for transmitting data (TX). */ const int TX_PIN = 16; /**< @brief The GPIO pin used for transmitting data (TX). */
const int RST_PIN = 4; /**< @brief The GPIO pin connected to the RS485 driver's DE/RE pins for direction control. */ const int RST_PIN = 4; /**< @brief The GPIO pin connected to the RS485 driver's DE/RE pins for direction control. */
const int MODBUS_ID = 106; /**< @brief The unique slave ID for this device on the Modbus bus. */ const int MODBUS_ID = 111; /**< @brief The unique slave ID for this device on the Modbus bus. */
/** @} */ /** @} */
/** @brief Global instance of the Modbus RTU server. */ /** @brief Global instance of the Modbus RTU server. */
@@ -62,6 +62,8 @@ modbusMap mb_map[] =
{HR_LONG, 91, 0, "Sts_Energy"}, {HR_LONG, 91, 0, "Sts_Energy"},
{HR, 0, 0, "Cmd_Reset"}, {HR, 0, 0, "Cmd_Reset"},
{HR, 31, 0, "Alm_NotAuto"}, {HR, 31, 0, "Alm_NotAuto"},
{HR, 34691, 0, "VFD_Bypass"},
}; };
//Size of modbus map used in FOR cycles, automatically calculated. //Size of modbus map used in FOR cycles, automatically calculated.

View File

@@ -31,29 +31,29 @@
*/ */
template<> template<>
StandbyState<ModbusRTU>::StandbyState() { StandbyState<ModbusRTU>::StandbyState() {
addStrategy("Avg_Current", new SingleValueStrategy(15000.0f, 500.0f, 1000)); addStrategy("Avg_Current", new SingleValueStrategy(3750.0f, 5.0f, 1000));
addStrategy("Batt_V", new SingleValueStrategy(400.0f, 50.0f, 1000)); addStrategy("Batt_V", new SingleValueStrategy(14.0f, 0.5f, 1000));
addStrategy("Cooling_Tmp", new SingleValueStrategy(15000.0f, 500.0f, 1000)); addStrategy("Cooling_Tmp", new SingleValueStrategy(90.0f, 3.0f, 1000));
addStrategy("Engine_RPM", new SingleValueStrategy(15000.0f, 500.0f, 1000)); addStrategy("Engine_RPM", new SingleValueStrategy(1800.0f, 5.0f, 1000));
addStrategy("Freq", new SingleValueStrategy(600.0f, 5.0f, 1000)); addStrategy("Freq", new SingleValueStrategy(60.0f, 1.0f, 1000));
addStrategy("Fuel_Rate", new SingleValueStrategy(15000.0f, 500.0f, 1000)); addStrategy("Fuel_Rate", new SingleValueStrategy(85.0f, 5.0f, 1000));
addStrategy("kVAR_Total", new SingleValueStrategy(15000.0f, 500.0f, 1000)); addStrategy("kVAR_Total", new SingleValueStrategy(1875.0f, 5.0f, 1000));
addStrategy("kW_Total", new SingleValueStrategy(15000.0f, 500.0f, 1000)); addStrategy("kW_Total", new SingleValueStrategy(2500.0f, 5.0f, 1000));
addStrategy("Manifold_Tmp", new SingleValueStrategy(1750.0f, 50.0f, 1000)); addStrategy("Manifold_Tmp", new SingleValueStrategy(70.0f, 5.0f, 1000));
addStrategy("Oil_Pres", new SingleValueStrategy(1800.0f, 50.0f, 1000)); addStrategy("Oil_Pres", new SingleValueStrategy(50.0f, 5.0f, 1000));
addStrategy("Oil_Tmp", new SingleValueStrategy(2300.0f, 50.0f, 1000)); addStrategy("Oil_Tmp", new SingleValueStrategy(100.0f, 5.0f, 1000));
addStrategy("PF_Total", new SingleValueStrategy(950.0f, 40.0f, 1000)); addStrategy("PF_Total", new SingleValueStrategy(0.9f, 0.1f, 1000));
addStrategy("VoltageA", new SingleValueStrategy(2400.0f, 50.0f, 1000)); addStrategy("VoltageA", new SingleValueStrategy(240.0f, 2.0f, 1000));
addStrategy("VoltageB", new SingleValueStrategy(2400.0f, 50.0f, 1000)); addStrategy("VoltageB", new SingleValueStrategy(240.0f, 2.0f, 1000));
addStrategy("VoltageC", new SingleValueStrategy(2400.0f, 50.0f, 1000)); addStrategy("VoltageC", new SingleValueStrategy(240.0f, 2.0f, 1000));
addStrategy("Fuel_Percent", new SingleValueStrategy(500.0f, 500.0f, 1000)); addStrategy("Fuel_Percent", new SingleValueStrategy(75.0f, 2.0f, 1000));
addStrategy("CurrentA", new SingleValueStrategy(1500.0f, 50.0f, 1000)); addStrategy("CurrentA", new SingleValueStrategy(3750.0f, 5.0f, 1000));
addStrategy("CurrentB", new SingleValueStrategy(1500.0f, 50.0f, 1000)); addStrategy("CurrentB", new SingleValueStrategy(3750.0f, 5.0f, 1000));
addStrategy("CurrentC", new SingleValueStrategy(1500.0f, 50.0f, 1000)); addStrategy("CurrentC", new SingleValueStrategy(3750.0f, 5.0f, 1000));
addStrategy("Fuel_Usage", new SingleValueStrategy(800.0f, 50.0f, 1000)); addStrategy("Fuel_Usage", new SingleValueStrategy(70.0f, 5.0f, 1000));
addStrategy("VoltageAB", new SingleValueStrategy(480.0f, 50.0f, 1000)); addStrategy("VoltageAB", new SingleValueStrategy(480.0f, 5.0f, 1000));
addStrategy("VoltageBC", new SingleValueStrategy(480.0f, 50.0f, 1000)); addStrategy("VoltageBC", new SingleValueStrategy(480.0f, 5.0f, 1000));
addStrategy("VoltageCA", new SingleValueStrategy(480.0f, 50.0f, 1000)); addStrategy("VoltageCA", new SingleValueStrategy(480.0f, 5.0f, 1000));
} }
/** /**

View File

@@ -55,26 +55,26 @@
modbusMap mb_map[] = modbusMap mb_map[] =
{ {
{COIL, 23, 0, "Alm_GenFault"}, {COIL, 23, 0, "Alm_GenFault"},
{HR_LONG, 668, 0, "Avg_Current"}, {HR_FLOAT, 668, 0, "Avg_Current"},
{HR_LONG, 672, 0, "Batt_V"}, {HR_FLOAT, 672, 0, "Batt_V"},
{HR_LONG, 260, 0, "Cooling_Tmp"}, {HR_FLOAT, 260, 0, "Cooling_Tmp"},
{HR_LONG, 256, 0, "Engine_RPM"}, {HR_FLOAT, 256, 0, "Engine_RPM"},
{HR_LONG, 20, 0, "Freq"}, {HR_FLOAT, 20, 0, "Freq"},
{HR_LONG, 254, 0, "Fuel_Rate"}, {HR_FLOAT, 254, 0, "Fuel_Rate"},
{HR_LONG, 656, 0, "kVAR_Total"}, {HR_FLOAT, 656, 0, "kVAR_Total"},
{HR_LONG, 654, 0, "kW_Total"}, {HR_FLOAT, 654, 0, "kW_Total"},
{HR_LONG, 262, 0, "Manifold_Tmp"}, {HR_FLOAT, 262, 0, "Manifold_Tmp"},
{HR_LONG, 278, 0, "Oil_Pres"}, {HR_FLOAT, 278, 0, "Oil_Pres"},
{HR_LONG, 258, 0, "Oil_Tmp"}, {HR_FLOAT, 258, 0, "Oil_Tmp"},
{HR_LONG, 658, 0, "PF_Total"}, {HR_FLOAT, 658, 0, "PF_Total"},
{HR_LONG, 6, 0, "VoltageA"}, {HR_FLOAT, 6, 0, "VoltageA"},
{HR_LONG, 8, 0, "VoltageB"}, {HR_FLOAT, 8, 0, "VoltageB"},
{HR_LONG, 10, 0, "VoltageC"}, {HR_FLOAT, 10, 0, "VoltageC"},
{COIL, 29, 0, "Breaker_Sts"}, {COIL, 29, 0, "Breaker_Sts"},
{COIL, 30, 0, "Tripped"}, {COIL, 30, 0, "Tripped"},
{HR_LONG, 284, 0, "Fuel_Percent"}, {HR_FLOAT, 284, 0, "Fuel_Percent"},
{HR, 999, 0, "Engine_Starts"}, {HR, 999, 0, "Engine_Starts"},
{HR_LONG, 266, 0, "Run_Hrs"}, {HR_FLOAT, 266, 0, "Run_Hrs"},
{COIL, 218, 0, "Run_Status"}, {COIL, 218, 0, "Run_Status"},
{COIL, 222, 0, "Charger_AC_Failure"}, {COIL, 222, 0, "Charger_AC_Failure"},
{COIL, 12, 0, "Emergency_Stop"}, {COIL, 12, 0, "Emergency_Stop"},
@@ -111,15 +111,15 @@ modbusMap mb_map[] =
{COIL, 267, 0, "Under_Voltage_5"}, {COIL, 267, 0, "Under_Voltage_5"},
{COIL, 268, 0, "Under_Voltage_6"}, {COIL, 268, 0, "Under_Voltage_6"},
{COIL, 209, 0, "Low_Cooling_Tmp"}, {COIL, 209, 0, "Low_Cooling_Tmp"},
{HR_LONG, 13, 0, "CurrentA"}, {HR_FLOAT, 12, 0, "CurrentA"},
{HR_LONG, 15, 0, "CurrentB"}, {HR_FLOAT, 14, 0, "CurrentB"},
{HR_LONG, 17, 0, "CurrentC"}, {HR_FLOAT, 16, 0, "CurrentC"},
{HR_LONG, 283, 0, "Fuel_Usage"}, {HR_FLOAT, 282, 0, "Fuel_Usage"},
{HR_LONG, 1, 0, "VoltageAB"}, {HR_FLOAT, 0, 0, "VoltageAB"},
{HR_LONG, 3, 0, "VoltageBC"}, {HR_FLOAT, 2, 0, "VoltageBC"},
{HR_LONG, 5, 0, "VoltageCA"}, {HR_FLOAT, 4, 0, "VoltageCA"},
{COIL, 246, 0, "ECU_CommLoss"}, {COIL, 1246, 0, "ECU_CommLoss"},
{HR_LONG, 671, 0, "Controller_Hours"}, {HR_FLOAT, 671, 0, "Controller_Hours"},
{COIL, 13, 0, "E_Stop"}, {COIL, 13, 0, "E_Stop"},
{COIL, 269, 0, "OV_Warning_1"}, {COIL, 269, 0, "OV_Warning_1"},
{COIL, 270, 0, "OV_Warning_2"}, {COIL, 270, 0, "OV_Warning_2"},
@@ -146,7 +146,7 @@ modbusMap mb_map[] =
{COIL, 250, 0, "RevVAR_Shutdown"}, {COIL, 250, 0, "RevVAR_Shutdown"},
{COIL, 317, 0, "Sys_NotReady"}, {COIL, 317, 0, "Sys_NotReady"},
{COIL, 240, 0, "Week_Battery"}, {COIL, 240, 0, "Week_Battery"},
{HR_FLOAT, 670, 0, "Controller_Hours"},
}; };
//Size of modbus map used in FOR cycles, automatically calculated. //Size of modbus map used in FOR cycles, automatically calculated.

View File

@@ -36,11 +36,11 @@
* @{ * @{
*/ */
#include <ModbusRTU.h> #include <ModbusRTU.h>
const int BAUDRATE = 19200; /**< @brief The serial communication speed in bits per second. */ const int BAUDRATE = 9600; /**< @brief The serial communication speed in bits per second. */
const int RX_PIN = 17; /**< @brief The GPIO pin used for receiving data (RX). */ const int RX_PIN = 17; /**< @brief The GPIO pin used for receiving data (RX). */
const int TX_PIN = 16; /**< @brief The GPIO pin used for transmitting data (TX). */ const int TX_PIN = 16; /**< @brief The GPIO pin used for transmitting data (TX). */
const int RST_PIN = 4; /**< @brief The GPIO pin connected to the RS485 driver's DE/RE pins for direction control. */ const int RST_PIN = 4; /**< @brief The GPIO pin connected to the RS485 driver's DE/RE pins for direction control. */
const int MODBUS_ID = 6; /**< @brief The unique slave ID for this device on the Modbus bus. */ const int MODBUS_ID = 1; /**< @brief The unique slave ID for this device on the Modbus bus. */
/** @} */ /** @} */
/** @brief Global instance of the Modbus RTU server. */ /** @brief Global instance of the Modbus RTU server. */