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:
- 41:e8946fc01ea4
- Parent:
- 37:7e6986b77f01
- Child:
- 42:c703a60993b1
diff -r d6b24c02f63a -r e8946fc01ea4 src/CommandParser/cmd.cpp --- a/src/CommandParser/cmd.cpp Fri Sep 09 19:08:13 2016 +0000 +++ b/src/CommandParser/cmd.cpp Fri Sep 09 19:39:03 2016 +0000 @@ -158,7 +158,7 @@ /***************************************************************************** * Function: cmd_logLevel - * Description: get or set the current log-level + * Description: get or set the current log-level * * @param argc (not used) * @param argv (not used) @@ -167,18 +167,19 @@ void cmd_logLevel(int argc, char **argv) { uint8_t logLevel = 0; - - const char *mapper[] = { "NONE", - "FATAL", - "ERROR", - "WARNING", - "INFO", - "DEBUG", - "TRACE" }; - + + const char *mapper[] = { "NONE", + "FATAL", + "ERROR", + "WARNING", + "INFO", + "DEBUG", + "TRACE" + }; + if ( argc == 1 ) { - printf("\r current log-level set to %s\r\n", - mapper[GLOBAL_mdot->getLogLevel()]); + printf("\r current log-level set to %s\r\n", + mapper[GLOBAL_mdot->getLogLevel()]); goto usage; } @@ -194,14 +195,14 @@ printf("\r 6 = TRACE\r\n"); return; } - + logLevel = atoi(argv[1]); - if ( logLevel > 6 ) + if ( logLevel > 6 ) goto usage; - - // reassign the log level + + // reassign the log level printf("...setting log-level to %s\r\n", mapper[logLevel]); - GLOBAL_mdot->setLogLevel(logLevel); + GLOBAL_mdot->setLogLevel(logLevel); printf("\r\n"); } @@ -397,15 +398,18 @@ char data_buf[1024]; snprintf(data_buf, sizeof(data_buf), "{ " - "\"id\": \"i_tra1\", " + "\"id\": \"i_tra01\", " "\"name\": \"TRASAR\", " "\"units\": \"PPM\", " "\"min\": \"0\", " "\"max\": \"300\", " - "\"node\": \"20\", " - "\"reg\": \"21\", " + "\"node\": \"1\", " + "\"reg\": \"9\", " "\"rtype\": \"1\", " "\"type\": \"16\", " + "\"size\": \"2\", " + "\"order\": \"2\", " + "\"rfreq\": \"5\", " "\"fmt\": \"%%.2f\" } " ); @@ -413,6 +417,12 @@ if( status != true ) { logInfo("(%d)save file failed, status=%d", __LINE__, status); } + + logInfo("Sending Mail To ModbusMasterMailBox, filename=%s"); + Message_t *mail = ModbusMasterMailBox.alloc(); + mail->action = ACTION_READ_FILE; + strncpy( mail->controlFile, argv[1], (sizeof(mail->controlFile)-1)); + ModbusMasterMailBox.put(mail); } /***************************************************************************** @@ -433,9 +443,8 @@ char data_buf[1024]; snprintf(data_buf, sizeof(data_buf), "{ " - "\"id\": \"i_tra1\", " - "\"name\": \"TRASAR\", " - "\"units\": \"PPM\", " + "\"id\": \"o_r05\", " + "\"name\": \"Relay 5\", " "\"min\": \"0\", " "\"max\": \"300\", " "\"node\": \"20\", " @@ -446,12 +455,18 @@ "\"toperiod\": \"0\", " "\"scalelo\": \"0\", " "\"scalehi\": \"100\" }" - ); + ); bool status = GLOBAL_mdot->saveUserFile(argv[1], (void *)data_buf, 1024); if( status != true ) { logInfo("(%d)save file failed, status=%d", __LINE__, status); } + + logInfo("Sending Mail To ModbusMasterMailBox, filename=%s"); + Message_t *mail = ModbusMasterMailBox.alloc(); + mail->action = ACTION_READ_FILE; + strncpy( mail->controlFile, argv[1], (sizeof(mail->controlFile)-1)); + ModbusMasterMailBox.put(mail); } /***************************************************************************** @@ -590,11 +605,11 @@ for ( vector<pair<string, Thread*> >::iterator pos = taskList.begin(); pos != taskList.end(); ++ pos) { printf("\r %-32s size/free/used/max = %u/%u/%u/%u\n", - pos->first.c_str(), - pos->second->stack_size(), - pos->second->free_stack(), - pos->second->used_stack(), - pos->second->max_stack()); + pos->first.c_str(), + pos->second->stack_size(), + pos->second->free_stack(), + pos->second->used_stack(), + pos->second->max_stack()); } printf("\r\n");