From eb5ca48a86e961f4eea03ceb34abfc5416d6d908 Mon Sep 17 00:00:00 2001 From: Joerg Lehmann Date: Thu, 3 Oct 2019 20:55:51 +0200 Subject: [PATCH] only accept downlink message to tare within certain time --- mini-beieli-node.ino | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mini-beieli-node.ino b/mini-beieli-node.ino index 0612222..a00957a 100644 --- a/mini-beieli-node.ino +++ b/mini-beieli-node.ino @@ -188,6 +188,7 @@ typedef struct { byte my_position = 0; // what is our actual measurement, starts with 0 long timer_pos0; +long timer_boot; // timer when node booted // Global Variables LORA_data lora_data; @@ -240,6 +241,7 @@ void sensorJob_cb(osjob_t* pJob); void setup(void) { + timer_boot = millis(); gCatena.begin(); ClearLoraData(); @@ -934,6 +936,14 @@ static void receiveMessage(void *pContext, uint8_t port, const uint8_t *pMessage gCatena.SafePrintf("\n"); } + if ((millis() - timer_boot) > 120000) { + if (config_data.debug_level > 0) { + gCatena.SafePrintf("tare with downlink is only possible within 2 minutes after boot!\n"); + return; + } + + } + if (port == 1 && nMessage == 1) { if (pMessage[0] == 0) { if (config_data.debug_level > 0) {