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:
- 176:492cfa856521
- Parent:
- 174:515a8b684803
- Child:
- 178:335b2e1ff30c
- Child:
- 179:a31ea334e2b7
--- a/src/ModbusMaster/ModbusMaster.cpp Tue Oct 04 12:35:18 2016 +0000
+++ b/src/ModbusMaster/ModbusMaster.cpp Tue Oct 04 15:05:33 2016 +0000
@@ -116,27 +116,24 @@
std::map<std::string, ModbusRegister>::iterator iter;
for (iter = ModbusRegisterMap.begin(); iter != ModbusRegisterMap.end(); ++iter) {
if( iter->second.simulated == true ) {
- std::map<std::string, SimulateInput>::iterator simiter;
- for (simiter = SimulateInputMap.begin(); simiter != SimulateInputMap.end(); ++simiter) {
-// logInfo("simulating input=%s, min=%2.2f, max=%2.2f, start_value=%2.2f, up_step=%2.2f, down_step=%2.2f",iter->first.c_str(), SimulateInputMap[iter->first].min, SimulateInputMap[iter->first].max, SimulateInputMap[iter->first].start_value, SimulateInputMap[iter->first].up_step, SimulateInputMap[iter->first].down_step);
- if( (SimulateInputMap[iter->first].min == 0) && (SimulateInputMap[iter->first].max == 0) ) {
- ModbusRegisterMap[iter->first].float_value = SimulateInputMap[iter->first].start_value;
+// logInfo("simulating input=%s, min=%2.2f, max=%2.2f, start_value=%2.2f, up_step=%2.2f, down_step=%2.2f",iter->first.c_str(), SimulateInputMap[iter->first].min, SimulateInputMap[iter->first].max, SimulateInputMap[iter->first].start_value, SimulateInputMap[iter->first].up_step, SimulateInputMap[iter->first].down_step);
+ if( (SimulateInputMap[iter->first].min == 0) && (SimulateInputMap[iter->first].max == 0) ) {
+ ModbusRegisterMap[iter->first].float_value = SimulateInputMap[iter->first].start_value;
+ } else {
+ if( ModbusRegisterMap[iter->first].float_value >= SimulateInputMap[iter->first].max ) {
+ move_up = false;
+ ModbusRegisterMap[iter->first].float_value = ModbusRegisterMap[iter->first].float_value - SimulateInputMap[iter->first].down_step;
+ } else if( ModbusRegisterMap[iter->first].float_value <= SimulateInputMap[iter->first].min ) {
+ move_up = true;
+ ModbusRegisterMap[iter->first].float_value = ModbusRegisterMap[iter->first].float_value + SimulateInputMap[iter->first].up_step;
} else {
- if( ModbusRegisterMap[iter->first].float_value >= SimulateInputMap[iter->first].max ) {
- move_up = false;
- ModbusRegisterMap[iter->first].float_value = ModbusRegisterMap[iter->first].float_value - SimulateInputMap[iter->first].down_step;
- } else if( ModbusRegisterMap[iter->first].float_value <= SimulateInputMap[iter->first].min ) {
- move_up = true;
+ if( move_up == true ) {
ModbusRegisterMap[iter->first].float_value = ModbusRegisterMap[iter->first].float_value + SimulateInputMap[iter->first].up_step;
} else {
- if( move_up == true ) {
- ModbusRegisterMap[iter->first].float_value = ModbusRegisterMap[iter->first].float_value + SimulateInputMap[iter->first].up_step;
- } else {
- ModbusRegisterMap[iter->first].float_value = ModbusRegisterMap[iter->first].float_value - SimulateInputMap[iter->first].down_step;
- }
+ ModbusRegisterMap[iter->first].float_value = ModbusRegisterMap[iter->first].float_value - SimulateInputMap[iter->first].down_step;
}
- logInfo("simulating input=%s, value=%2.2f",iter->first.c_str(), ModbusRegisterMap[iter->first].float_value);
}
+ printf("simulating input=%s, value=%2.2f\r\n",iter->first.c_str(), ModbusRegisterMap[iter->first].float_value);
}
continue;
}
