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:
- 203:9d735375f218
- Parent:
- 199:d65ed41d4dd4
- Child:
- 207:55aabde2d4bf
diff -r d65ed41d4dd4 -r 9d735375f218 src/CommandParser/cmd.cpp
--- a/src/CommandParser/cmd.cpp Fri Oct 07 11:40:51 2016 +0000
+++ b/src/CommandParser/cmd.cpp Fri Oct 07 17:49:20 2016 +0000
@@ -1296,7 +1296,7 @@
strncpy( mail->controlFile, "input_i_tra01.json", (sizeof(mail->controlFile)-1));
ModbusMasterMailBox.put(mail);
- Thread::wait(1000);
+ Thread::wait(5000);
// INPUT: Tag
snprintf(buf, sizeof(buf),
@@ -1328,7 +1328,7 @@
strncpy( mail->controlFile, "input_i_tag01.json", (sizeof(mail->controlFile)-1));
ModbusMasterMailBox.put(mail);
- Thread::wait(1000);
+ Thread::wait(5000);
// INPUT: Conductivity
@@ -1361,7 +1361,7 @@
strncpy( mail->controlFile, "input_i_bdcond01.json", (sizeof(mail->controlFile)-1));
ModbusMasterMailBox.put(mail);
- Thread::wait(1000);
+ Thread::wait(5000);
// INPUT: Conductivity Temperature
snprintf(buf, sizeof(buf),
@@ -1393,7 +1393,7 @@
strncpy( mail->controlFile, "input_i_cond_temp01.json", (sizeof(mail->controlFile)-1));
ModbusMasterMailBox.put(mail);
- Thread::wait(1000);
+ Thread::wait(5000);
// INPUT: pH Temperature
snprintf(buf, sizeof(buf),
@@ -1425,7 +1425,7 @@
strncpy( mail->controlFile, "input_i_ph_temp01.json", (sizeof(mail->controlFile)-1));
ModbusMasterMailBox.put(mail);
- Thread::wait(1000);
+ Thread::wait(5000);
// INPUT: pH
snprintf(buf, sizeof(buf),
@@ -1457,7 +1457,7 @@
strncpy( mail->controlFile, "input_i_ph01.json", (sizeof(mail->controlFile)-1));
ModbusMasterMailBox.put(mail);
- Thread::wait(1000);
+ Thread::wait(5000);
// INPUT: ORP
snprintf(buf, sizeof(buf),
@@ -1489,7 +1489,39 @@
strncpy( mail->controlFile, "input_i_orp01.json", (sizeof(mail->controlFile)-1));
ModbusMasterMailBox.put(mail);
- Thread::wait(1000);
+ Thread::wait(5000);
+
+ // INPUT: Flow Switch
+ snprintf(buf, sizeof(buf),
+ "{ "
+ "\"id\": \"i_flowsw01\","
+ "\"name\": \"Flow\","
+ "\"units\": \"\","
+ "\"min\": \"0\","
+ "\"max\": \"1\","
+ "\"node\": \"0\","
+ "\"reg\": \"1\","
+ "\"rtype\": \"0\","
+ "\"type\": \"3\","
+ "\"size\": \"2\","
+ "\"order\": \"0\","
+ "\"fmt\": \"%%d\","
+ "\"vcmd\": \"\","
+ "\"rfreq\": \"5\" }");
+ rc = GLOBAL_mdot->saveUserFile("input_i_flowsw01.json", (void *)buf, MAX_FILE_SIZE);
+ if ( rc != true ) {
+ printf("\rFailed to save input_i_flowsw01.json\n");
+ return;
+ } else {
+ printf("\r...generated input_i_flowsw01.json\n");
+ }
+
+ mail = ModbusMasterMailBox.alloc();
+ mail->action = ACTION_READ_FILE;
+ strncpy( mail->controlFile, "input_i_flowsw01.json", (sizeof(mail->controlFile)-1));
+ ModbusMasterMailBox.put(mail);
+
+ Thread::wait(5000);
// OUTPUT: Relay 01
snprintf(buf, sizeof(buf),
@@ -1525,7 +1557,7 @@
strncpy( modbus_mail->controlFile, "output_o_rly01.json", (sizeof(modbus_mail->controlFile)-1));
ModbusMasterMailBox.put(modbus_mail);
- Thread::wait(1000);
+ Thread::wait(5000);
// send a message to the output master
OutputControlMsg_t *output_mail = OutputMasterMailBox.alloc();
@@ -1533,7 +1565,7 @@
strncpy(output_mail->controlFile, "output_o_rly01.json", sizeof(output_mail->controlFile)-1);
OutputMasterMailBox.put(output_mail);
- Thread::wait(1000);
+ Thread::wait(2000);
// OUTPUT: Relay 02
snprintf(buf, sizeof(buf),
@@ -1569,7 +1601,7 @@
strncpy( modbus_mail->controlFile, "output_o_rly02.json", (sizeof(modbus_mail->controlFile)-1));
ModbusMasterMailBox.put(modbus_mail);
- Thread::wait(1000);
+ Thread::wait(5000);
// send a message to the output master
output_mail = OutputMasterMailBox.alloc();
@@ -1577,7 +1609,96 @@
strncpy(output_mail->controlFile, "output_o_rly02.json", sizeof(output_mail->controlFile)-1);
OutputMasterMailBox.put(output_mail);
- Thread::wait(1000);
+ Thread::wait(2000);
+
+ // OUTPUT: Relay 03
+ snprintf(buf, sizeof(buf),
+ "{ "
+ "\"id\": \"o_rly03\", "
+ "\"name\": \"Bleach\", "
+ "\"units\": \"\", "
+ "\"min\": \"0\", "
+ "\"max\": \"300\", "
+ "\"node\": \"50\", "
+ "\"reg\": \"3\", "
+ "\"rtype\": \"1\", "
+ "\"type\": \"0\", "
+ "\"size\": \"2\", "
+ "\"order\": \"2\", "
+ "\"fmt\": \"%%.2f\", "
+ "\"vcmd\": \"\", "
+ "\"rfreq\": \"5\", "
+ "\"toperiod\": \"0\", "
+ "\"scalelo\": \"0\", "
+ "\"scalehi\": \"100\" }");
+ rc = GLOBAL_mdot->saveUserFile("output_o_rly03.json", (void *)buf, MAX_FILE_SIZE);
+ if ( rc != true ) {
+ printf("\rFailed to save output_o_rly03.json\n");
+ return;
+ } else {
+ printf("\r...generated output_o_rly03.json\n");
+ }
+
+ // send a message to the modbus master
+ modbus_mail = ModbusMasterMailBox.alloc();
+ modbus_mail->action = ACTION_READ_FILE;
+ strncpy( modbus_mail->controlFile, "output_o_rly03.json", (sizeof(modbus_mail->controlFile)-1));
+ ModbusMasterMailBox.put(modbus_mail);
+
+ Thread::wait(5000);
+
+ // send a message to the output master
+ output_mail = OutputMasterMailBox.alloc();
+ output_mail->action = ACTION_NEW;
+ strncpy(output_mail->controlFile, "output_o_rly03.json", sizeof(output_mail->controlFile)-1);
+ OutputMasterMailBox.put(output_mail);
+
+ Thread::wait(2000);
+
+ // OUTPUT: Relay 04
+ snprintf(buf, sizeof(buf),
+ "{ "
+ "\"id\": \"o_rly04\", "
+ "\"name\": \"H2SO4\", "
+ "\"units\": \"\", "
+ "\"min\": \"0\", "
+ "\"max\": \"300\", "
+ "\"node\": \"50\", "
+ "\"reg\": \"4\", "
+ "\"rtype\": \"1\", "
+ "\"type\": \"0\", "
+ "\"size\": \"2\", "
+ "\"order\": \"2\", "
+ "\"fmt\": \"%%.2f\", "
+ "\"vcmd\": \"\", "
+ "\"rfreq\": \"5\", "
+ "\"toperiod\": \"0\", "
+ "\"scalelo\": \"0\", "
+ "\"scalehi\": \"100\" }");
+ rc = GLOBAL_mdot->saveUserFile("output_o_rly04.json", (void *)buf, MAX_FILE_SIZE);
+ if ( rc != true ) {
+ printf("\rFailed to save output_o_rly04.json\n");
+ return;
+ } else {
+ printf("\r...generated output_o_rly04.json\n");
+ }
+
+ // send a message to the modbus master
+ modbus_mail = ModbusMasterMailBox.alloc();
+ modbus_mail->action = ACTION_READ_FILE;
+ strncpy( modbus_mail->controlFile, "output_o_rly04.json", (sizeof(modbus_mail->controlFile)-1));
+ ModbusMasterMailBox.put(modbus_mail);
+
+ Thread::wait(5000);
+
+ // send a message to the output master
+ output_mail = OutputMasterMailBox.alloc();
+ output_mail->action = ACTION_NEW;
+ strncpy(output_mail->controlFile, "output_o_rly04.json", sizeof(output_mail->controlFile)-1);
+ OutputMasterMailBox.put(output_mail);
+
+ Thread::wait(2000);
+
// SETPOINT: Blowdown
snprintf(buf, sizeof(buf),
@@ -1610,7 +1731,7 @@
MailBox.put(sp_msg);
- Thread::wait(1000);
+ Thread::wait(2000);
// SETPOINT: Trasar
snprintf(buf, sizeof(buf),
@@ -1643,7 +1764,73 @@
strncpy(sp_msg->controlFile, "control_sp_tra01.json", sizeof(sp_msg->controlFile)-1);
MailBox.put(sp_msg);
- Thread::wait(1000);
+ Thread::wait(2000);
+
+ // SETPOINT: Acid Base
+ snprintf(buf, sizeof(buf),
+ "{ "
+ "\"id\": \"ACID_BASE_01\", "
+ "\"priority\": \"800\", "
+ "\"input\": \"i_ph01\", "
+ "\"output\": \"o_rly04\", "
+ "\"setpoint\": \"8\", "
+ "\"prodfact\": \"\", "
+ "\"actingDir\": \"1\", "
+ "\"halert\": \"9.10\", "
+ "\"lalert\": \"6.80\", "
+ "\"hfs\": \"9.40\", "
+ "\"lfs\": \"6.40\", "
+ "\"tol\": \".5\" }");
+ rc = GLOBAL_mdot->saveUserFile("control_sp_ph01.json", (void *)buf, MAX_FILE_SIZE);
+ if ( rc != true ) {
+ printf("\rFailed to save control_sp_ph01.json\n");
+ return;
+ } else {
+ printf("\r...generated control_sp_ph01.json\n");
+ Thread::wait(500);
+ }
+
+ sp_msg = MailBox.alloc();
+ memset(sp_msg, 0, sizeof(Message_t));
+ sp_msg->action = ACTION_CREATE;
+ sp_msg->control = CONTROL_SETPOINT;
+ strncpy(sp_msg->controlFile, "control_sp_ph01.json", sizeof(sp_msg->controlFile)-1);
+
+ MailBox.put(sp_msg);
+ Thread::wait(2000);
+
+ // SETPOINT: MicroBio
+ snprintf(buf, sizeof(buf),
+ "{ "
+ "\"id\": \"MICRO_BIO_01\", "
+ "\"priority\": \"800\", "
+ "\"input\": \"i_orp01\", "
+ "\"output\": \"o_rly03\", "
+ "\"setpoint\": \"350\", "
+ "\"prodfact\": \"\", "
+ "\"actingDir\": \"0\", "
+ "\"halert\": \"500\", "
+ "\"lalert\": \"200\", "
+ "\"hfs\": \"525\", "
+ "\"lfs\": \"150\", "
+ "\"tol\": \"25\" }");
+ rc = GLOBAL_mdot->saveUserFile("control_sp_orp01.json", (void *)buf, MAX_FILE_SIZE);
+ if ( rc != true ) {
+ printf("\rFailed to save control_sp_orp01.json\n");
+ return;
+ } else {
+ printf("\r...generated control_sp_orp01.json\n");
+ Thread::wait(500);
+ }
+
+ sp_msg = MailBox.alloc();
+ memset(sp_msg, 0, sizeof(Message_t));
+ sp_msg->action = ACTION_CREATE;
+ sp_msg->control = CONTROL_SETPOINT;
+ strncpy(sp_msg->controlFile, "control_sp_orp01.json", sizeof(sp_msg->controlFile)-1);
+
+ MailBox.put(sp_msg);
+ Thread::wait(2000);
}
/*****************************************************************************
