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
Revision 52:eaddbde192f1, committed 2016-06-17
- Comitter:
- sbouber1
- Date:
- Fri Jun 17 11:38:26 2016 +0000
- Parent:
- 51:4a70184ff7dc
- Child:
- 53:4e3ee54157ad
- Commit message:
- some documentation added
Changed in this revision
--- a/AlarmController.cpp Fri Jun 17 11:02:01 2016 +0000
+++ b/AlarmController.cpp Fri Jun 17 11:38:26 2016 +0000
@@ -184,9 +184,6 @@
return this->error_msg;
}
-void AlarmController::activate_buzzer() {
- printf("Should activate buzzer now\r\n");
-}
void AlarmController::buzzOnce() {
--- a/AlarmController.h Fri Jun 17 11:02:01 2016 +0000
+++ b/AlarmController.h Fri Jun 17 11:38:26 2016 +0000
@@ -6,13 +6,18 @@
#include "PIDController.h"
#include "testing.h"
+/** The number of iterations before the AlarmController registers unsafe values */
#define STARTUP_ITERATIONS 10
-
+/** The AlarmController monitors the Temperature/Salinity/Proximity sensors and registers unsafe values.
+ * After a specified amount of time an alarm is raised by means of a buzzer.
+ */
class AlarmController : public Controller {
public:
+
+ /** Contructs a new AlarmController which monitors the given Temperature/Salinity/Proximity controllers. */
AlarmController(bool threaded, int interval_ms, SensorController *temp, SensorController *salt, SensorController *proximity)
: Controller(threaded, interval_ms) {
this->temp = temp;
@@ -22,34 +27,42 @@
this->error = false;
this->tempiscrit = false;
this->saltiscrit = false;
- this->overflowiscrit = false;
-
+ this->overflowiscrit = false;
}
+ /** Overrides update() in the Controller class */
virtual void update();
+ /** Overrides get_name() in the Controller class */
virtual std::string get_name();
+ /** Return \a true if there is an error condition and the alarm was raised. */
bool is_error();
+ /** Returns a message describing the last error */
char *get_error_message();
-
- void buzzOnce();
- void raiseAlarmTemp(bool);
- void raiseAlarmSalt(bool);
- void raiseAlarmOverFlow(bool);
private:
SensorController *temp;
SensorController *salt;
- SensorController *proximity;
-
+ SensorController *proximity;
bool error;
char *error_msg;
+
+ /** Activates the buzzer */
+ void buzzOnce();
- void activate_buzzer();
+ /** Activates an alarm for the temperature controller */
+ void raiseAlarmTemp(bool);
+
+ /** Activates an alarm for the salinity controller */
+ void raiseAlarmSalt(bool);
+
+ /** Activates an alarm for the proximity controller */
+ void raiseAlarmOverFlow(bool);
+
bool tempiscrit;
bool saltiscrit;
bool overflowiscrit;
--- a/LCDController.h Fri Jun 17 11:02:01 2016 +0000
+++ b/LCDController.h Fri Jun 17 11:38:26 2016 +0000
@@ -14,17 +14,23 @@
public:
LCDController();
+ /** Displays temperature / salinity values and shows if the heater is active or not */
+ static void updateScreen(float, float, PIDController *pidc);
- static void updateScreen(float, float, PIDController *pidc);
+ /** Displays the volume in the water tank */
static void updateScreen(float);
+
+ /** Shows the splash screen */
static void splash();
+
+ /** Shows the given error, this is used by the AlarmController */
static void error(const char *msg);
+
+ /** Displays a message showing the pumps are active */
static void showPumping();
private:
-
-
};
#endif
\ No newline at end of file
--- a/testing.cpp Fri Jun 17 11:02:01 2016 +0000
+++ b/testing.cpp Fri Jun 17 11:38:26 2016 +0000
@@ -85,7 +85,7 @@
START_TESTS();
- /TESTCASE("Test if alarm is raised when temp > 40 for 30 seconds", testTempDangerousHighAlarm); // PASSED
+ TESTCASE("Test if alarm is raised when temp > 40 for 30 seconds", testTempDangerousHighAlarm); // PASSED
TESTCASE("Test if alarm is raised when temp < 30 for 30 seconds", testTempDangerousLowAlarm); // PASSED
TESTCASE("Test if alarm is raised when temp > 30 and < 32 for 5 minutes", testTempLowRangeAlarm); // PASSED
TESTCASE("Test if alarm is raised when temp > 38 and < 40 for 5 minutes", testTempHighRangeAlarm); // PASSED