limit tare based on uplink count

This commit is contained in:
Joerg Lehmann 2019-10-04 07:20:26 +02:00
parent eb5ca48a86
commit 89ee03f1f4
1 changed files with 5 additions and 6 deletions

View File

@ -129,7 +129,7 @@ sMyExtraCommands_top(
| |
\****************************************************************************/ \****************************************************************************/
static const int32_t fwVersion = 20191003; static const int32_t fwVersion = 20191004;
static const byte MAX_VALUES_TO_SEND = 8; static const byte MAX_VALUES_TO_SEND = 8;
static const uint8_t LORA_DATA_VERSION = 1; static const uint8_t LORA_DATA_VERSION = 1;
static const uint8_t LORA_DATA_VERSION_FIRST_PACKAGE = 129; static const uint8_t LORA_DATA_VERSION_FIRST_PACKAGE = 129;
@ -188,7 +188,6 @@ 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;
@ -241,7 +240,6 @@ void sensorJob_cb(osjob_t* pJob);
void setup(void) void setup(void)
{ {
timer_boot = millis();
gCatena.begin(); gCatena.begin();
ClearLoraData(); ClearLoraData();
@ -929,16 +927,17 @@ static void receiveMessage(void *pContext, uint8_t port, const uint8_t *pMessage
port, nMessage port, nMessage
); );
// we print out the received message... // we print out the received message...
gCatena.SafePrintf("Current LMIC.seqnoUp: %d\n",LMIC.seqnoUp);
gCatena.SafePrintf("Received Data (Payload): \n"); gCatena.SafePrintf("Received Data (Payload): \n");
for (byte i = 0; i < nMessage; i++) { for (byte i = 0; i < nMessage; i++) {
gCatena.SafePrintf("%c", pMessage[i]); gCatena.SafePrintf("%02x", pMessage[i]);
} }
gCatena.SafePrintf("\n"); gCatena.SafePrintf("\n");
} }
if ((millis() - timer_boot) > 120000) { if (LMIC.seqnoUp > 2) {
if (config_data.debug_level > 0) { if (config_data.debug_level > 0) {
gCatena.SafePrintf("tare with downlink is only possible within 2 minutes after boot!\n"); gCatena.SafePrintf("tare with downlink is only possible within first two uplink packets!\n");
return; return;
} }