mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-28 16:07:16 +02:00
Transmit measures only if queue size is 1 or divisible by 3
This commit is contained in:
@ -76,6 +76,7 @@ CC BY-SA 4.0 Attribution-ShareAlike 4.0 International License
|
||||
#define DISPLAY_DELAY_SHOW_CONTENT_MS 2000 /** ms */
|
||||
#define FIRMWARE_CHECK_FOR_UPDATE_MS (60 * 60 * 1000) /** ms */
|
||||
|
||||
#define MEASUREMENT_TRANSMIT_CYCLE 3
|
||||
#define MAXIMUM_MEASUREMENT_CYCLE_QUEUE 80
|
||||
#define RESERVED_MEASUREMENT_CYCLE_CAPACITY 10
|
||||
|
||||
@ -1364,6 +1365,13 @@ void postUsingCellular() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check queue size if its ready to transmit
|
||||
// It is ready if size is 1 or divisible by 3
|
||||
if (queueSize != 1 && (queueSize % MEASUREMENT_TRANSMIT_CYCLE) > 0) {
|
||||
Serial.printf("Not ready to transmit, queue size are %d\n", queueSize);
|
||||
return;
|
||||
}
|
||||
|
||||
// Build payload include all measurements from queue
|
||||
std::string payload;
|
||||
payload += std::to_string(CELLULAR_MEASUREMENT_INTERVAL / 1000); // Convert to seconds
|
||||
|
Reference in New Issue
Block a user