fix bug with last_values

This commit is contained in:
Joerg Lehmann 2020-06-29 20:51:59 +02:00
parent ddec85f57e
commit fecc1bf67b
1 changed files with 5 additions and 1 deletions

View File

@ -688,7 +688,8 @@ void StartNewIteration() {
gCatena.SafePrintf("startSendingUplink(), my_position: %d, iteration: %d, package_counter: %d, big_difference: %d\n", my_position, iteration, package_counter, big_difference);
}
// the first <INIT_PACKETS> packets are "Init-Packets" or each INIT_PACKAGE_INTERVAL ...
startSendingUplink(next_package_is_init_package, big_difference);
// send confirmed if Init-Packet or big_difference in weight
startSendingUplink(next_package_is_init_package, big_difference || next_package_is_init_package);
next_package_is_init_package = ((iteration < INIT_PACKETS) || ((package_counter % INIT_PACKAGE_INTERVAL) == 0));
if (config_data.debug_level > 1) {
@ -730,6 +731,9 @@ void StartNewIteration() {
if (not(next_package_is_init_package)) {
// we make the current sensor reading to the last one...
last_sensor_reading = current_sensor_reading;
} else {
// we only copy the last weight
last_sensor_reading.weight = current_sensor_reading.weight;
}
uint32_t sleep_time_sec;