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

Committer:
joran
Date:
Wed Jun 15 10:37:50 2016 +0000
Revision:
44:7c932cc5991b
Parent:
41:dce2c29f49cd
Child:
57:8dc3192ff150
Nice stuff;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joran 6:067e999b9c6e 1 #include "LCDController.h"
joran 6:067e999b9c6e 2
joran 6:067e999b9c6e 3 TextLCD lcd(p5, p6, p7, p8, p9, p10, TextLCD::LCD16x2);
joran 6:067e999b9c6e 4
joran 6:067e999b9c6e 5
joran 6:067e999b9c6e 6
joran 6:067e999b9c6e 7 LCDController::LCDController()
joran 6:067e999b9c6e 8 {
joran 6:067e999b9c6e 9 printf("Initiate LCD Controller\n\r");
joran 6:067e999b9c6e 10 lcd.cls();
joran 41:dce2c29f49cd 11 }
joran 6:067e999b9c6e 12
joran 6:067e999b9c6e 13
joran 6:067e999b9c6e 14 void LCDController::splash()
joran 6:067e999b9c6e 15 {
joran 6:067e999b9c6e 16 lcd.cls();
joran 6:067e999b9c6e 17 lcd.printf("Welcome to\nSaltware");
joran 44:7c932cc5991b 18 wait(0.5);
joran 6:067e999b9c6e 19 }
joran 6:067e999b9c6e 20
joran 41:dce2c29f49cd 21 void LCDController::updateScreen(float displaytemp, float saltvolt, PIDController *pidc)
joran 6:067e999b9c6e 22 {
joran 6:067e999b9c6e 23 lcd.cls();
joran 17:17ea1372f64a 24
joran 17:17ea1372f64a 25 char tempbuffer[16];
joran 41:dce2c29f49cd 26 char saltbuffer[16];
joran 17:17ea1372f64a 27
joran 17:17ea1372f64a 28 if (displaytemp > 100)
joran 17:17ea1372f64a 29 {
joran 17:17ea1372f64a 30 sprintf(tempbuffer, "Temp: NC");
6366295 18:da84737ee427 31 } else {
6366295 18:da84737ee427 32 sprintf(tempbuffer,"Temp: %.1fC",displaytemp);
6366295 18:da84737ee427 33 }
joran 17:17ea1372f64a 34
joran 41:dce2c29f49cd 35 if (pidc->is_heating())
joran 41:dce2c29f49cd 36 {
joran 41:dce2c29f49cd 37 sprintf(tempbuffer,"%s *",tempbuffer);
joran 41:dce2c29f49cd 38 }
joran 41:dce2c29f49cd 39
joran 41:dce2c29f49cd 40 sprintf(saltbuffer,"Salt: %.3fPPT",saltvolt);
joran 41:dce2c29f49cd 41
joran 41:dce2c29f49cd 42 if (pidc->is_pumping())
joran 41:dce2c29f49cd 43 {
joran 41:dce2c29f49cd 44 sprintf(saltbuffer,"%s *",saltbuffer);
joran 41:dce2c29f49cd 45 }
joran 41:dce2c29f49cd 46
joran 41:dce2c29f49cd 47 lcd.printf("%s\n%s",tempbuffer,saltbuffer);
joran 6:067e999b9c6e 48 }
sbouber1 10:fd4670ec0806 49
joran 44:7c932cc5991b 50 void LCDController::showPumping() {
joran 44:7c932cc5991b 51 lcd.cls();
joran 44:7c932cc5991b 52 lcd.printf("Now pumping...");
joran 44:7c932cc5991b 53 }
joran 44:7c932cc5991b 54
sbouber1 10:fd4670ec0806 55 void LCDController::updateScreen(float distance) {
sbouber1 10:fd4670ec0806 56 lcd.cls();
joran 44:7c932cc5991b 57 lcd.printf("Volume:\n%.0fml", distance);
sbouber1 10:fd4670ec0806 58 }
sbouber1 10:fd4670ec0806 59
sbouber1 10:fd4670ec0806 60 void LCDController::error(const char *msg) {
sbouber1 10:fd4670ec0806 61 lcd.cls();
sbouber1 10:fd4670ec0806 62 lcd.printf("ERROR:\n%s", msg);
sbouber1 10:fd4670ec0806 63 }