From d2e4b8141636cba44b8880181b2ea0722931f2d0 Mon Sep 17 00:00:00 2001 From: Joerg Lehmann Date: Wed, 27 May 2020 10:20:45 +0200 Subject: [PATCH] remove unused variable --- mini-beieli-node.ino | 5 ++--- mini_beieli_node.h | 4 ++-- mini_beieli_node_nau7802.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mini-beieli-node.ino b/mini-beieli-node.ino index 80d2d9e..02e4521 100644 --- a/mini-beieli-node.ino +++ b/mini-beieli-node.ino @@ -677,7 +677,7 @@ void StartNewIteration() { // we send data the first time the system is started, when the array is full // or when the weight has fallen more than threshold or the first measurement is // more than one hour old (which should not happen :-) ) - if ( (next_package_is_init_package) || (my_position >= MAX_VALUES_TO_SEND) || ((last_sensor_reading.weight - current_sensor_reading.weight) > SEND_DIFF_THRESHOLD_5GRAMS) || ((millis() - timer_pos0) > 3600000)) { + if ( (next_package_is_init_package) || (my_position >= MAX_VALUES_TO_SEND) || (abs(last_sensor_reading.weight - current_sensor_reading.weight) > SEND_DIFF_THRESHOLD_5GRAMS) || ((millis() - timer_pos0) > 3600000)) { lora_data.offset_last_reading = (uint8_t)((millis() - timer_pos0) / 1000 / 60); if (config_data.debug_level > 0) { gCatena.SafePrintf("startSendingUplink(), my_position: %d, iteration: %d, package_counter: %d\n", my_position, iteration, package_counter); @@ -1023,6 +1023,7 @@ void doDeepSleep(osjob_t *pJob) void deepSleepPrepare(void) { Serial.end(); + Wire.endTransmission(true); Wire.end(); SPI.end(); if (fFlash) @@ -1112,8 +1113,6 @@ static void receiveMessage(void *pContext, uint8_t port, const uint8_t *pMessage float fval; } u; - SENSOR_data temp_sensor_data; - if (config_data.debug_level > 0) { gCatena.SafePrintf("receiveMessage was called!!!\n"); } diff --git a/mini_beieli_node.h b/mini_beieli_node.h index a07ad88..47f6d9c 100644 --- a/mini_beieli_node.h +++ b/mini_beieli_node.h @@ -56,7 +56,7 @@ enum { | \****************************************************************************/ -static const int32_t fwVersion = 20200525; +static const int32_t fwVersion = 20200527; static const byte INIT_PACKAGE_INTERVAL = 100; // send an init package every 100 packages; static const byte MAX_VALUES_TO_SEND = 8; @@ -64,7 +64,7 @@ static const byte MAX_VALUES_TO_SEND = 8; static const uint8_t LORA_DATA_VERSION = 1; static const uint8_t LORA_DATA_VERSION_FIRST_PACKAGE = 128; static const uint32_t PRESSURE_OFFSET = 825; -static const uint16_t SEND_DIFF_THRESHOLD_5GRAMS = 10; // when weight value drops by 50g, then send data +static const uint16_t SEND_DIFF_THRESHOLD_5GRAMS = 20; // when weight changes by 100g, then send data static const long NOT_ATTACHED = -2147483648; static const byte INIT_PACKETS = 5; diff --git a/mini_beieli_node_nau7802.h b/mini_beieli_node_nau7802.h index 981d120..1087bf8 100644 --- a/mini_beieli_node_nau7802.h +++ b/mini_beieli_node_nau7802.h @@ -24,7 +24,7 @@ void SetScalesDebugLevel(byte dbg_level) bool InitializeScales() { bool result; - result &= myScale.reset(); //Reset all registers + result = myScale.reset(); //Reset all registers result &= myScale.powerUp(); //Power on analog and digital sections of the scale result &= myScale.setIntPolarityHigh();