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: mbed DRV88255 TextLCD Ping mbed-rtos
Diff: main.cpp
- Revision:
- 72:f8c4f731f0fe
- Parent:
- 71:38bb6bf09933
- Child:
- 74:05f2188cfc0b
--- a/main.cpp Tue Jun 21 12:09:12 2016 +0000 +++ b/main.cpp Tue Jun 21 13:48:28 2016 +0000 @@ -41,7 +41,7 @@ controllers.push_back((void *)&salt); // Add alarms to monitor sensor values - SensorAlarmController temp_alarm = SensorAlarmController(false, 0, &temperature, + /*SensorAlarmController temp_alarm = SensorAlarmController(false, 0, &temperature, TEMP_MIN_CRIT, TEMP_MIN_UNDESIRED, TEMP_MAX_CRIT, TEMP_MAX_UNDESIRED); temp_alarm.setUndesiredErrorMsg("Temp undes!"); temp_alarm.setCriticalErrorMsg("Temp crit!"); @@ -52,6 +52,7 @@ salt_alarm.setUndesiredErrorMsg("Salt undes!"); salt_alarm.setCriticalErrorMsg("Salt crit!"); controllers.push_back((void *)&salt_alarm); + */ SensorAlarmController prox_alarm = SensorAlarmController(false, 0, &proximity, VOLUME_MIN_CRIT, VOLUME_MIN_UNDESIRED, VOLUME_MAX_CRIT, VOLUME_MAX_UNDESIRED); @@ -61,7 +62,6 @@ // PIDController last, as alarms should update first PIDController pidc(false, 0, &temperature,&salt,&proximity); - controllers.push_back((void *)&pidc); // ----------------------------------------------------------------------------- @@ -100,19 +100,24 @@ } // If the alarm controller detected a dangerous situation then update lcd and possibly exit - if(temp_alarm.isError() || salt_alarm.isError() || prox_alarm.isError()) { + /*if(temp_alarm.isError() || salt_alarm.isError() || prox_alarm.isError()) { - if(temp_alarm.isError()) + /*if(temp_alarm.isError()) LCDController::showError(temp_alarm.getErrorMessage().c_str()); else if(salt_alarm.isError()) LCDController::showError(salt_alarm.getErrorMessage().c_str()); - else + else*/ + + if(prox_alarm.isError()) { LCDController::showError(prox_alarm.getErrorMessage().c_str()); #ifdef HALT_ON_ALARM break; #endif } + + if(!prox_alarm.isActive()) + pidc.run(); //Show temperature, salinity and volume of the water tank on the PC if connected through serial