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

LCDController.cpp

Committer:
joran
Date:
2016-06-13
Revision:
24:eeef4009640d
Parent:
18:da84737ee427

File content as of revision 24:eeef4009640d:

#include "LCDController.h"

TextLCD lcd(p5, p6, p7, p8, p9, p10, TextLCD::LCD16x2);



LCDController::LCDController()
{
    printf("Initiate LCD Controller\n\r");
    lcd.cls();
    
}

void LCDController::splash()
{
    lcd.cls();
    lcd.printf("Welcome to\nSaltware");
    wait(2.0);   
}    

void LCDController::updateScreen(float displaytemp, float saltvolt)
{
     lcd.cls();
     
     char tempbuffer[16];
     bool is_heating = false;
     if (displaytemp > 100)
     {
         sprintf(tempbuffer, "Temp: NC");
     } else {
         if (is_heating)sprintf(tempbuffer,"Temp: %.1fC+",displaytemp);
         if (!is_heating)sprintf(tempbuffer,"Temp: %.1fC",displaytemp);
         
     }
     
     lcd.printf("%s\nSalt: %.3fPPT",tempbuffer,saltvolt);   
}

void LCDController::updateScreen(float distance) {
    lcd.cls();
    lcd.printf("Distance:\n%.3f", distance);    
}

void LCDController::error(const char *msg) {
    lcd.cls();
    lcd.printf("ERROR:\n%s", msg);    
}