From abd850399a4a58196d7fa1c5ac5178b5e5445214 Mon Sep 17 00:00:00 2001 From: Matt Way Date: Tue, 2 Jan 2024 21:57:10 +1100 Subject: [PATCH] Fetch the current position of the blind every 10 seconds --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index eddd988..494bc7f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,8 @@ void sendStopPacket(uint16_t destination); void sendSetPosition(uint16_t destination, float percentage); void sendFetchPosition(uint16_t destination); +unsigned long lastCommandMillis = 0; + void setup() { Serial.begin(SER_BAUDRATE); @@ -49,12 +51,18 @@ void setup() { client.enableDebuggingMessages(); delay(100); + lastCommandMillis = millis(); Serial.println("Ready"); } void loop() { powerView.loop(); client.loop(); + + if ((millis() - lastCommandMillis) > 10000) { + lastCommandMillis = millis(); + sendFetchPosition(0x4EF1); + } } void processPacket(const Packet *packet) {