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:
- 251:e730d7077e46
- Parent:
- 246:ca91a441b4dc
- Parent:
- 250:1cd8ec63e9e9
- Child:
- 252:3c9863f951b7
--- a/src/CommandParser/cmd.cpp Fri Oct 21 11:37:35 2016 +0000
+++ b/src/CommandParser/cmd.cpp Fri Oct 21 11:44:40 2016 +0000
@@ -553,7 +553,7 @@
"\"output\": \"o_rly1\", "
"\"priority\": \"750\", "
"\"starttime\": \"%s\", "
- "\"duration\": \"30\" ", counter, time_buf);
+ "\"duration\": \"30\" }", counter, time_buf);
sprintf(filename, "control_tm_%d_rly1.json", counter);
@@ -608,48 +608,86 @@
std::string filename = "control_fs_rly01.json";
snprintf(buf, sizeof(buf),
"{"
- "\"id\": \"o_rly01\", "
- "\"hfsr\": \"10%%\", "
- "\"lfsr\": \"10%%\", "
- "\"priority\": \"750\" "
+ "\"id\": \"FAILSAFE\", "
+ "\"input\": \"i_bdcond01\", "
+ "\"output\": \"o_rly01\", "
+ "\"priority\":\"700\", "
+ "\"lfsValue\":\"1700\", "
+ "\"lfsDutyCycle\":\"0\", "
+ "\"lfsInterval\":\"15\", "
+ "\"hfsValue\":\"1900\", "
+ "\"hfsDutyCycle\":\"100\", "
+ "\"hfsInterval\":\"15\" "
"}");
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;
+ } else {
+ printf("\r created %s\n", filename.c_str());
}
+ Message_t *msg = MailBox.alloc();
+ memset(msg, 0, sizeof(Message_t));
+ msg->action = ACTION_CREATE;
+ msg->control = CONTROL_FAILSAFE;
+ strncpy(msg->controlFile, filename.c_str(), sizeof(msg->controlFile)-1);
+
+ printf("%s: Sending a create request for control %s type = %u\r\n",
+ __func__, msg->controlFile, msg->control);
+
+ MailBox.put(msg);
+ Thread::wait(1000);
+
filename = "control_fs_rly02.json";
snprintf(buf, sizeof(buf),
- "{"
- "\"id\": \"o_rly02\", "
- "\"hfsr\": \"10%%\", "
- "\"lfsr\": \"10%%\", "
- "\"priority\": \"750\" "
+ " {"
+ "\"id\": \"TRASAR-FS\", "
+ "\"input\": \"i_tra01\", "
+ "\"output\": \"o_rly02\", "
+ "\"priority\":\"700\", "
+ "\"lfsValue\":\"100\", "
+ "\"lfsDutyCycle\":\"20\", "
+ "\"lfsInterval\":\"15\", "
+ "\"hfsValue\":\"150\", "
+ "\"hfsDutyCycle\":\"0\", "
+ "\"hfsInterval\":\"15\" "
"}");
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;
+ } else {
+ printf("\r created %s\n", filename.c_str());
}
+
+ msg = MailBox.alloc();
+ memset(msg, 0, sizeof(Message_t));
+ msg->action = ACTION_CREATE;
+ msg->control = CONTROL_FAILSAFE;
+ strncpy(msg->controlFile, filename.c_str(), sizeof(msg->controlFile)-1);
+ printf("%s: Sending a create request for control %s type = %u\r\n",
+ __func__, msg->controlFile, msg->control);
-
+ MailBox.put(msg);
}
+//
+//
void cmd_createCAlg(int argc, char **argv)
{
if ( argc != 1 ) {
- printf("\rusage: create-ca control_ca_equal.json");
+ printf("\rusage: create-ca control_ca_equal.json");
return;
}
char buf[MAX_FILE_SIZE];
std::string filename = "control_ca_eq1.json";
snprintf(buf, sizeof(buf),
- "{"
+ " {"
"\"id\": \"EQUAL_TO_1\", "
"\"opr\": \"1\", "
"\"op\": \"==\", "
@@ -665,7 +703,7 @@
printf("\r...generated %s\n", filename.c_str());
}
- // send a message to the configuration handler to create the control
+// send a message to the configuration handler to create the control
Message_t *msg = MailBox.alloc();
memset(msg, 0, sizeof(Message_t));
msg->action = ACTION_CREATE;
@@ -676,7 +714,7 @@
Thread::wait(2000);
- // == 129
+// == 129
filename = "control_ca_eq129.json";
snprintf(buf, sizeof(buf),
"{"
@@ -695,7 +733,7 @@
printf("\r...generated %s\n", filename.c_str());
}
- // send a message to the configuration handler to create the control
+// send a message to the configuration handler to create the control
msg = MailBox.alloc();
memset(msg, 0, sizeof(Message_t));
msg->action = ACTION_CREATE;
