diff --git a/mini-beieli-node.ino b/mini-beieli-node.ino index af8ce23..5d7a874 100644 --- a/mini-beieli-node.ino +++ b/mini-beieli-node.ino @@ -110,6 +110,7 @@ long iteration = 0; // what iteration number do we have, starts with 0 long package_counter = 0; // sent package counter bool send_in_progress = false; bool stop_iterations = false; +bool start_new_iteration = false; bool next_package_is_init_package = true; uint32_t gRebootMs; @@ -374,6 +375,9 @@ void setup_uplink(void) void loop() { gCatena.poll(); + if (start_new_iteration) { + StartNewIteration(); + } } void ClearLoraData(void) @@ -616,6 +620,7 @@ void ReadSensors(SENSOR_data &sensor_data) { } void StartNewIteration() { + start_new_iteration = false; uint32_t wait_time; wait_time = 0; @@ -767,7 +772,7 @@ void StartNewIteration() { if (!fUsbPower) { DoDeepSleep(sleep_time_sec); if (! stop_iterations) { - StartNewIteration(); + start_new_iteration = true; } } @@ -975,7 +980,7 @@ static void startNewIterationCb(osjob_t* pJob) } if (! stop_iterations) { - StartNewIteration(); + start_new_iteration = true; } } diff --git a/mini_beieli_node.h b/mini_beieli_node.h index 1a59727..8ee447f 100644 --- a/mini_beieli_node.h +++ b/mini_beieli_node.h @@ -56,7 +56,7 @@ enum { | \****************************************************************************/ -static const int32_t fwVersion = 20200605; +static const int32_t fwVersion = 20200606; static const byte INIT_PACKAGE_INTERVAL = 100; // send an init package every 100 packages; static const byte MAX_VALUES_TO_SEND = 8;