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:
- 240:34e560c86cff
- Parent:
- 235:ce028fbf054d
- Parent:
- 239:cfb1a917e7f7
- Child:
- 242:3b0086a6d625
--- a/src/CommandParser/cmd.cpp Wed Oct 19 22:28:28 2016 +0000
+++ b/src/CommandParser/cmd.cpp Wed Oct 19 23:45:44 2016 +0000
@@ -64,6 +64,7 @@
{"cmf", "create a manual control file", cmd_cmf },
{"cmt", "create multiple timers", cmd_cmt },
{"cof", "create a test output file", cmd_cof },
+ {"create-fs", "create a failsafe file", cmd_create_fs },
{"create-ca", "create a control algorithm file", cmd_createCAlg },
{"create-comp", "craete a composite control file", cmd_createComposite },
{"create-mn", "create a manual control", cmd_createManual },
@@ -71,7 +72,7 @@
{"create-tm", "create a timer control", cmd_createTimer },
{"create-temp", "create temperature input", cmd_createTemp },
{"deep", "dump EEP", cmd_deep },
- {"preload", "pre-load phase-1 demo files", cmd_preload },
+ {"preload", "pre-load phase-1 demo files", cmd_preload },
{"destroy-control", "destroy a control", cmd_destroy },
{"heap", "show heap statistics", cmd_heap },
{"help", "help command", cmd_help },
@@ -599,6 +600,45 @@
}
}
+void cmd_create_fs(int argc, char **argv)
+{
+ char buf[MAX_FILE_SIZE];
+ bool status;
+
+ std::string filename = "control_fs_rly01.json";
+ snprintf(buf, sizeof(buf),
+ "{"
+ "\"id\": \"o_rly01\", "
+ "\"hfsr\": \"10%%\", "
+ "\"lfsr\": \"10%%\", "
+ "\"priority\": \"750\" "
+ "}");
+
+ status = GLOBAL_mdot->saveUserFile(filename.c_str(), (void *)buf, MAX_FILE_SIZE);
+ if ( status != true ) {
+ printf("\rFailed to create %s\n", filename.c_str());
+ return;
+ }
+
+ filename = "control_fs_rly02.json";
+ snprintf(buf, sizeof(buf),
+ "{"
+ "\"id\": \"o_rly02\", "
+ "\"hfsr\": \"10%%\", "
+ "\"lfsr\": \"10%%\", "
+ "\"priority\": \"750\" "
+ "}");
+
+ status = GLOBAL_mdot->saveUserFile(filename.c_str(), (void *)buf, MAX_FILE_SIZE);
+ if ( status != true ) {
+ printf("\rFailed to create %s\n", filename.c_str());
+ return;
+ }
+
+
+
+}
+
void cmd_createCAlg(int argc, char **argv)
{
if ( argc != 1 ) {
@@ -1997,7 +2037,7 @@
} else {
printf("\r...generated %s\n", filename.c_str());
}
-
+
printf("\r\nIssue \"reset\" command to invoke changes\r\n\r\n\r\n");
}
