
Own fork of MbedSmartRestMain
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Revision 84:5dc5a50e4b06, committed 2015-03-06
- Comitter:
- xinlei
- Date:
- Fri Mar 06 11:20:07 2015 +0000
- Parent:
- 83:3c8ceb12b773
- Child:
- 85:b49c4cfecc43
- Commit message:
- Measurements: Removed LCD display flashing when do not send sensor readings.
Changed in this revision
--- a/measurement/AccelerationMeasurement.cpp Fri Mar 06 11:10:48 2015 +0000 +++ b/measurement/AccelerationMeasurement.cpp Fri Mar 06 11:20:07 2015 +0000 @@ -44,6 +44,7 @@ bool AccelerationMeasurement::run() { + extern bool lastSensorReadingSent; if (!_test) return false; @@ -56,7 +57,10 @@ if (0.15 > abs(data[0]) && 0.1 > abs(data[1])) { if (sendingTimer.read() < TIME_LIMIT_ACCE) { - _io.lcdPrint(_displayInfo.getFirstLine(), _displayInfo.getSecondLine()); + if (lastSensorReadingSent) { + _io.lcdPrint(_displayInfo.getFirstLine(), _displayInfo.getSecondLine()); + lastSensorReadingSent=false; + } aDebug("Similar acceleration readings found, no sending!\r\n"); return true; } else { @@ -89,5 +93,6 @@ oldValues[1] = data[1]; oldValues[2] = data[2]; sendingTimer.reset(); + lastSensorReadingSent=true; return true; }
--- a/measurement/AnalogMeasurement.cpp Fri Mar 06 11:10:48 2015 +0000 +++ b/measurement/AnalogMeasurement.cpp Fri Mar 06 11:20:07 2015 +0000 @@ -42,6 +42,7 @@ bool AnalogMeasurement::run() { + extern bool lastSensorReadingSent; float data[2] = {0, 0}; data[0] = _analog1.read()*100; data[1] = _analog2.read()*100; @@ -49,7 +50,10 @@ if (abs(oldValues[0]-data[0]) <= abs(oldValues[0])*THRESHOLD_PERCENT_ANA && abs(oldValues[1]-data[1]) <= abs(oldValues[1])*THRESHOLD_PERCENT_ANA) { if (sendingTimer.read() < TIME_LIMIT_ANA) { - _io.lcdPrint(_displayInfo.getFirstLine(), _displayInfo.getSecondLine()); + if (lastSensorReadingSent) { + _io.lcdPrint(_displayInfo.getFirstLine(), _displayInfo.getSecondLine()); + lastSensorReadingSent=false; + } aDebug("Similar analog readings found, no sending!\r\n"); return true; } else { @@ -80,5 +84,6 @@ oldValues[0] = data[0]; oldValues[1] = data[1]; sendingTimer.reset(); + lastSensorReadingSent=true; return true; }
--- a/measurement/LocationUpdate.cpp Fri Mar 06 11:10:48 2015 +0000 +++ b/measurement/LocationUpdate.cpp Fri Mar 06 11:20:07 2015 +0000 @@ -48,6 +48,7 @@ bool LocationUpdate::run() { + extern bool lastSensorReadingSent; GPSTracker::Position position; if (!_gpsTracker.position(&position)) { aError("No GPS data available.\r\n"); @@ -62,7 +63,10 @@ abs(oldValues[1]-data[1]) <= abs(oldValues[1])*THRESHOLD_PERCENT_LOC && abs(oldValues[2]-data[2]) <= abs(oldValues[2])*THRESHOLD_PERCENT_LOC) { if (sendingTimer.read() < TIME_LIMIT_LOC) { - _io.lcdPrint(_displayInfo.getFirstLine(), _displayInfo.getSecondLine()); + if (lastSensorReadingSent) { + _io.lcdPrint(_displayInfo.getFirstLine(), _displayInfo.getSecondLine()); + lastSensorReadingSent=false; + } aDebug("Similar location readings found, no sending!\r\n"); return true; } else { @@ -101,5 +105,6 @@ oldValues[1] = data[1]; oldValues[2] = data[2]; sendingTimer.reset(); + lastSensorReadingSent=true; return true; }
--- a/measurement/SignalQualityMeasurement.cpp Fri Mar 06 11:10:48 2015 +0000 +++ b/measurement/SignalQualityMeasurement.cpp Fri Mar 06 11:20:07 2015 +0000 @@ -40,6 +40,7 @@ bool SignalQualityMeasurement::run() { + extern bool lastSensorReadingSent; DeviceInfo::SignalQuality *signalQuality; if ((signalQuality = _deviceInfo.signalQuality()) == NULL) return false; @@ -48,7 +49,10 @@ if (abs(oldValues[0]-data[0]) <= abs(oldValues[0])*THRESHOLD_PERCENT_SIG && abs(oldValues[1]-data[1]) <= abs(oldValues[1])*THRESHOLD_PERCENT_SIG) { if (sendingTimer.read() < TIME_LIMIT_SIG) { - _io.lcdPrint(_displayInfo.getFirstLine(), _displayInfo.getSecondLine()); + if (lastSensorReadingSent) { + _io.lcdPrint(_displayInfo.getFirstLine(), _displayInfo.getSecondLine()); + lastSensorReadingSent=false; + } aDebug("Similar signal readings found, no sending!\r\n"); return true; } else { @@ -79,5 +83,6 @@ oldValues[0] = data[0]; oldValues[1] = data[1]; sendingTimer.reset(); + lastSensorReadingSent=true; return true; }
--- a/measurement/TemperatureMeasurement.cpp Fri Mar 06 11:10:48 2015 +0000 +++ b/measurement/TemperatureMeasurement.cpp Fri Mar 06 11:20:07 2015 +0000 @@ -44,12 +44,16 @@ if (!_open) return false; + extern bool lastSensorReadingSent; float data = 0; data = _sensor.temp(); if (abs(oldValue-data) <= abs(oldValue)*THRESHOLD_PERCENT_TEMP) { if (sendingTimer.read() < TIME_LIMIT_TEMP) { - _io.lcdPrint(_displayInfo.getFirstLine(), _displayInfo.getSecondLine()); + if (lastSensorReadingSent) { + _io.lcdPrint(_displayInfo.getFirstLine(), _displayInfo.getSecondLine()); + lastSensorReadingSent=false; + } aDebug("Similar temperature readings found, no sending!\r\n"); return true; } else { @@ -78,5 +82,6 @@ aInfo("Temperature readings sent in %.1f.\r\n", t_end-t_start); oldValue = data; sendingTimer.reset(); + lastSensorReadingSent=true; return true; }