Program for the water play project for the course Software Testing Practical 2016 given at the VU University

Dependencies:   mbed DRV88255 TextLCD Ping mbed-rtos

Revision:
38:930469a33001
Parent:
27:4f73f754fdc9
Child:
40:1668630544c7
Child:
45:bb33913d4fd2
--- a/AlarmController.cpp	Tue Jun 14 15:56:14 2016 +0000
+++ b/AlarmController.cpp	Tue Jun 14 17:49:08 2016 +0000
@@ -1,4 +1,14 @@
 #include "AlarmController.h"
+
+// ====================================================================================================================================
+// TODO
+// this could be refactored to something like:
+// {Temperature,Salinity,Proximity}Alarm = SensorAlarm(this->{temp,salt,proximity}, min_crit, undesired, max_crit, max_undesired)
+//
+// low priority though
+// ====================================================================================================================================
+
+
 //timers
 Timer temptimer;
 Timer salttimer;
@@ -34,6 +44,14 @@
 float readoverflow;
 
 void AlarmController::update() {
+    
+    #ifndef RUN_TESTS
+    if(this->num_iters < STARTUP_ITERATIONS) {
+        printf("AlarmController: not running, startup phase");
+        return;
+    }
+    #endif
+    
     readtemp = this->temp->getValue();
     
     if ((readtemp < temp_value_min_undesired) || (readtemp > temp_value_max_undesired))