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/CommandParser/cmd.cpp
- Revision:
- 82:f3e495a98877
- Parent:
- 81:d45bfa16953a
- Child:
- 83:0f76cfbb4eba
- Child:
- 87:c466bde76fa0
--- a/src/CommandParser/cmd.cpp Tue Sep 20 13:41:31 2016 +0000 +++ b/src/CommandParser/cmd.cpp Tue Sep 20 15:35:13 2016 +0000 @@ -76,6 +76,8 @@ {"stats", "get current mDot statistics", cmd_stats }, {"time", "get current time", cmd_time }, {"sout", "set output", cmd_sout }, + {"simin", "simulate input", cmd_simin }, + {NULL, NULL, NULL} }; @@ -758,11 +760,44 @@ void cmd_sout(int argc, char **argv) { float value = atof( argv[2] ); - + if ( argc != 3 ) { printf("\rusage: sout <output> <value>\r\n"); printf("\rexample: sout o_rly1 1\r\n"); return; } ModbusRegisterMap[argv[1]].float_value = value; +} + +/***************************************************************************** + * Function: cmd_simin + * Description: simulat input + * + * @param argc-> number of args + * @param argv-> input + * @return none + *****************************************************************************/ +void cmd_simin(int argc, char **argv) +{ + float value = atof( argv[2] ); + + if ( argc < 3 ) { + printf("\rusage: simin <input> <value> <low> <hi> <step>\r\n"); + printf("\rexample: simin i_tra01 100 90 110 5\r\n"); + return; + } + + SimulateInputMap[argv[1]].start_value = atof(argv[2]); + + ModbusRegisterMap[argv[1]].simulated = true; + + if ( argc < 3 ) { + SimulateInputMap[argv[1]].min = 0; + SimulateInputMap[argv[1]].max = 0; + return; + } + SimulateInputMap[argv[1]].min = atof(argv[3]); + SimulateInputMap[argv[1]].max = atof(argv[4]); + SimulateInputMap[argv[1]].step = atof(argv[5]); + } \ No newline at end of file