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/AnalyticsLogger/AnalyticsLogger.cpp
- Revision:
- 247:a70c6c4923ff
- Parent:
- 235:ce028fbf054d
--- a/src/AnalyticsLogger/AnalyticsLogger.cpp Thu Oct 20 22:20:52 2016 +0000 +++ b/src/AnalyticsLogger/AnalyticsLogger.cpp Fri Oct 21 11:29:05 2016 +0000 @@ -38,16 +38,25 @@ if( ((ts->tm_min%5) == 0) && (ts->tm_min != last_min) ) { last_min = ts->tm_min; + int map_count = ModbusRegisterMap.size(); + int collected_count = 0; + log_event << "\"lr\":["; std::map<std::string, ModbusRegister>::iterator iter; for (iter = ModbusRegisterMap.begin(); iter != ModbusRegisterMap.end(); ++iter) { + + collected_count = collected_count + 1; log_event << "{\"t\":"<< "\"" << iter->first.c_str() << "\"," << "\"v\":"<< "\"" << iter->second.float_value<< "\"},"; log_sent = false; if( log_event.str().size() >= 150 ) { std::string str = log_event.str(); str.erase( str.size() - 1 ); - str.append("],\"seq\":\"1\""); + if( collected_count == map_count ) { + str.append("],\"seq\":\"0\""); + } else { + str.append("],\"seq\":\"1\""); + } // printf("%s:%d: Logging %s : len=%d\r\n", __func__, __LINE__, str.c_str(), str.length() ); LiveDataLoggerApi( str.c_str() ); log_event.str(""); @@ -60,7 +69,7 @@ std::string str = log_event.str(); str.erase( str.size() - 1 ); str.append("],\"seq\":\"0\""); - if( str.length() > 10 ) { + if( str.length() > 20 ) { // printf("%s:%d: Logging %s : len=%d\r\n", __func__, __LINE__, str.c_str(), str.length() ); LiveDataLoggerApi( str.c_str() ); }