Download the file
  1. #include "screen.h"
  2.  
  3. void ConfigScreen::refresh() {
  4. //Serial.println("refresh");
  5. if (! initialized)
  6. show_static();
  7. lcd.setCursor(0, 1);
  8. for (uint8_t i=0; i<format_width; i++)
  9. lcd.print(" ");
  10. lcd.setCursor(0, 1);
  11. lcd.print(format_value());
  12. }
  13.  
  14. uint8_t ConfigScreen::click() {
  15. if (selected) {
  16. on_deselected();
  17. lcd.noCursor();
  18. lcd.noBlink();
  19. selected = 0;
  20. }
  21. else {
  22. on_selected();
  23. //lcd.cursor();
  24. lcd.blink();
  25. selected = 1;
  26. }
  27. return 1;
  28. }
  29.  
  30. void ConfigScreen::show_static() {
  31. lcd.noCursor();
  32. lcd.clear();
  33. lcd.setCursor(0,0);
  34. lcd.print(title);
  35. lcd.setCursor(format_width+1,1);
  36. lcd.print(unit);
  37. initialized = 1;
  38. selected = 0;
  39. }
  40. // vim:ft=arduino
  41.