fix bug where voltage is always sent

This commit is contained in:
Nicu Hodos 2025-10-02 16:29:54 +02:00
parent 82df106df1
commit 7c9678a57c

View File

@ -22,15 +22,16 @@ void setup() {
}
void loop() {
if (counter % SEND_VCC_INTERVAL == 0) {
sensor.sendStateAndVoltage(true);
counter = 0;
if (counter == 0) {
sensor.sendStateAndVoltage(false);
} else if (counter % SEND_INTERVAL == 0) {
sensor.sendState(true);
sensor.sendState(false);
}
TinyPower::sleep();
}
ISR(WDT_vect) {
counter++;
if (++counter % SEND_VCC_INTERVAL == 0) {
counter = 0;
}
}