-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocoCommandManager.cpp
More file actions
43 lines (37 loc) · 1.16 KB
/
Copy pathLocoCommandManager.cpp
File metadata and controls
43 lines (37 loc) · 1.16 KB
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
40
41
42
43
#include "LocoCommandManager.h"
void LocoCommandManager::setSpeed(int speed) {
if (!lastSpeed.has_value() || lastSpeed.value() != speed) {
lastSpeed = speed;
sendSpeedCommand(speed);
}
}
void LocoCommandManager::setBrake(int brake) {
if (!lastBrake.has_value() || lastBrake.value() != brake) {
lastBrake = brake;
sendBrakeCommand(brake);
}
}
void LocoCommandManager::setFrontLights(LightStatus status) {
if (!lastFrontLights.has_value() || lastFrontLights.value() != status) {
lastFrontLights = status;
sendFrontLightsCommand(status);
}
}
void LocoCommandManager::setBackLights(LightStatus status) {
if (!lastBackLights.has_value() || lastBackLights.value() != status) {
lastBackLights = status;
sendBackLightsCommand(status);
}
}
void LocoCommandManager::setBell(bool active) {
if (!lastBell.has_value() || lastBell.value() != active) {
lastBell = active;
sendBellCommand(active);
}
}
void LocoCommandManager::setHorn(bool active) {
if (!lastHorn.has_value() || lastHorn.value() != active) {
lastHorn = active;
sendHornCommand(active);
}
}