only accept downlink message to tare within certain time

This commit is contained in:
Joerg Lehmann 2019-10-03 20:55:51 +02:00
parent df2178e6e0
commit eb5ca48a86
1 changed files with 10 additions and 0 deletions

View File

@ -188,6 +188,7 @@ typedef struct {
byte my_position = 0; // what is our actual measurement, starts with 0 byte my_position = 0; // what is our actual measurement, starts with 0
long timer_pos0; long timer_pos0;
long timer_boot; // timer when node booted
// Global Variables // Global Variables
LORA_data lora_data; LORA_data lora_data;
@ -240,6 +241,7 @@ void sensorJob_cb(osjob_t* pJob);
void setup(void) void setup(void)
{ {
timer_boot = millis();
gCatena.begin(); gCatena.begin();
ClearLoraData(); ClearLoraData();
@ -934,6 +936,14 @@ static void receiveMessage(void *pContext, uint8_t port, const uint8_t *pMessage
gCatena.SafePrintf("\n"); 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 (port == 1 && nMessage == 1) {
if (pMessage[0] == 0) { if (pMessage[0] == 0) {
if (config_data.debug_level > 0) { if (config_data.debug_level > 0) {