try to save battery by not sending VCC anymore
This commit is contained in:
parent
34a6dbef65
commit
5f42a8fb27
@ -17,4 +17,8 @@ public:
|
|||||||
void sendStateAndVoltage(bool state) {
|
void sendStateAndVoltage(bool state) {
|
||||||
sendInfo(ID(id) | VCC(readVcc()) | STATE(!state) | TYPE(7));
|
sendInfo(ID(id) | VCC(readVcc()) | STATE(!state) | TYPE(7));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sendState(bool state) {
|
||||||
|
sendInfo(ID(id) | VCC(0) | STATE(!state) | TYPE(7));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -28,7 +28,7 @@ void loop() {
|
|||||||
if (shouldSend) {
|
if (shouldSend) {
|
||||||
shouldSend = false;
|
shouldSend = false;
|
||||||
currentState = digitalRead(SWITCH);
|
currentState = digitalRead(SWITCH);
|
||||||
sensor.sendStateAndVoltage(currentState);
|
sensor.sendState(currentState);
|
||||||
}
|
}
|
||||||
TinyPower::sleep();
|
TinyPower::sleep();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ void loop() {
|
|||||||
if (shouldSend) {
|
if (shouldSend) {
|
||||||
shouldSend = false;
|
shouldSend = false;
|
||||||
currentState = digitalRead(SWITCH);
|
currentState = digitalRead(SWITCH);
|
||||||
sensor.sendStateAndVoltage(currentState);
|
sensor.sendState(currentState);
|
||||||
}
|
}
|
||||||
TinyPower::sleep();
|
TinyPower::sleep();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user