-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControllerScreen.cpp
More file actions
41 lines (31 loc) · 819 Bytes
/
ControllerScreen.cpp
File metadata and controls
41 lines (31 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "ControllerScreen.h"
#include "MemoryTest.h"
void ControllerScreen::init(LiquidCrystal *lcd, const __FlashStringHelper *nameString,
Controller *controller, char measureUnit) {
_lcd = lcd;
_controller = controller;
_measureUnit = measureUnit;
name = nameString;
}
void ControllerScreen::refresh () {
char str[5];
_lcd->clear();
_lcd->print(F("Set "));
_lcd->print(name);
_lcd->print(':');
_lcd->setCursor(0,1);
dtostrf(_controller->getTarget(), -4, 1, str);
_lcd->print(str);
_lcd->print(_measureUnit);
}
void ControllerScreen::modify(float step) {
float target;
target = _controller->getTarget();
target += step;
if (target > MAXVALUE)
target = MINVALUE;
if (target < MINVALUE)
target = MAXVALUE;
_controller->setTarget(target);
refresh();
}