Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/ModbusMaster/ModbusMaster.cpp
- Revision:
- 235:ce028fbf054d
- Parent:
- 216:7783e894f7e0
- Child:
- 237:ecf34419ce5d
--- a/src/ModbusMaster/ModbusMaster.cpp Wed Oct 19 20:55:19 2016 +0000
+++ b/src/ModbusMaster/ModbusMaster.cpp Wed Oct 19 22:28:28 2016 +0000
@@ -59,6 +59,13 @@
for (modMap = ModbusRegisterMap.begin(); modMap != ModbusRegisterMap.end(); ++modMap) {
if( modMap->second.simulated == true ) {
UpdateSimulatedInput( modMap );
+ if( strncmp( modMap->first.c_str(), "i_ph", (strlen("i_ph")-1) ) == 0 ) {
+ ModbusRegisterMap[modMap->first].float_value = ModbusRegisterMap[modMap->first].float_value / 1000;
+ } else if( strncmp( modMap->first.c_str(), "i_cond_temp", (strlen("i_cond_temp")-1) ) == 0 ) {
+ ModbusRegisterMap[modMap->first].float_value = ModbusRegisterMap[modMap->first].float_value / 1000;
+ } else if( strncmp( modMap->first.c_str(), "i_ph_temp", (strlen("i_ph_temp")-1) ) == 0 ) {
+ ModbusRegisterMap[modMap->first].float_value = ModbusRegisterMap[modMap->first].float_value / 1000;
+ }
continue;
} else if( modMap->second.node != 0 ) {
ReadModbusRegister( modMap );
@@ -71,6 +78,13 @@
ModbusRegisterMap[modMap->first].float_value = (float)dinp2.read();
}
}
+ if( strncmp( modMap->first.c_str(), "i_ph", (strlen("i_ph")-1) ) == 0 ) {
+ ModbusRegisterMap[modMap->first].float_value = ModbusRegisterMap[modMap->first].float_value / 1000;
+ } else if( strncmp( modMap->first.c_str(), "i_cond_temp", (strlen("i_cond_temp")-1) ) == 0 ) {
+ ModbusRegisterMap[modMap->first].float_value = ModbusRegisterMap[modMap->first].float_value / 1000;
+ } else if( strncmp( modMap->first.c_str(), "i_ph_temp", (strlen("i_ph_temp")-1) ) == 0 ) {
+ ModbusRegisterMap[modMap->first].float_value = ModbusRegisterMap[modMap->first].float_value / 1000;
+ }
}
// now that all of the modbus registers are updated we can execute the register commands.
