try to make measurements more stable...
This commit is contained in:
parent
f846c0d82a
commit
3028836e2f
|
|
@ -20,9 +20,9 @@ Das sind die verwendeten Libraries [1]:
|
|||
| --- | ----- | ----------- |
|
||||
| https://github.com/mcci-catena/Adafruit_BME280_Library.git | 3dafbe1 | Wed, 13 Dec 2017 13:56:30 -0500 |
|
||||
| https://github.com/mcci-catena/Adafruit_Sensor.git | f2af6f4 | Tue, 1 Sep 2015 15:57:59 +0200 |
|
||||
| https://github.com/mcci-catena/arduino-lmic.git | 6fe04ec | Tue, 12 May 2020 09:16:47 -0400 |
|
||||
| https://github.com/mcci-catena/arduino-lmic.git | 1964dcf | Mon, 22 Jun 2020 10:54:56 -0400 |
|
||||
| https://github.com/mcci-catena/arduino-lorawan.git | 4bc0d48 | Sat, 9 May 2020 12:38:28 -0400 |
|
||||
| https://github.com/mcci-catena/Catena-Arduino-Platform.git | cdbb111 | Thu, 11 Jun 2020 14:56:40 +0530 |
|
||||
| https://github.com/mcci-catena/Catena-Arduino-Platform.git | 478ad23 | Fri, 26 Jun 2020 18:39:01 -0400 |
|
||||
| https://github.com/mcci-catena/Catena-mcciadk.git | a428006 | Sat, 21 Dec 2019 20:45:26 -0500 |
|
||||
| https://github.com/mcci-catena/MCCI_FRAM_I2C.git | f0a5ea5 | Sat, 21 Dec 2019 16:17:01 -0500 |
|
||||
| https://github.com/tatobari/Q2-HX711-Arduino-Library.git | ccda8d8 | Wed, 13 Mar 2019 12:41:44 -0300 |
|
||||
|
|
|
|||
|
|
@ -679,13 +679,14 @@ 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) || ((my_position > 1) && (abs(last_sensor_reading.weight - current_sensor_reading.weight) > SEND_DIFF_THRESHOLD_5GRAMS)) || ((millis() - timer_pos0) > 3600000)) {
|
||||
bool big_difference = (abs(last_sensor_reading.weight - current_sensor_reading.weight) > SEND_DIFF_THRESHOLD_5GRAMS);
|
||||
if ( (next_package_is_init_package) || (my_position >= MAX_VALUES_TO_SEND) || ((my_position > 1) && big_difference) || ((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);
|
||||
}
|
||||
// the first <INIT_PACKETS> packets are "Init-Packets" or each INIT_PACKAGE_INTERVAL ...
|
||||
startSendingUplink(next_package_is_init_package);
|
||||
startSendingUplink(next_package_is_init_package, big_difference);
|
||||
next_package_is_init_package = ((iteration < INIT_PACKETS) || ((package_counter % INIT_PACKAGE_INTERVAL) == 0));
|
||||
|
||||
if (config_data.debug_level > 1) {
|
||||
|
|
@ -791,7 +792,7 @@ void StartNewIteration() {
|
|||
}
|
||||
}
|
||||
|
||||
void startSendingUplink(bool firstTime)
|
||||
void startSendingUplink(bool firstTime, bool confirmed)
|
||||
{
|
||||
send_in_progress = true;
|
||||
|
||||
|
|
@ -815,6 +816,11 @@ void startSendingUplink(bool firstTime)
|
|||
fConfirmed = true;
|
||||
}
|
||||
|
||||
// we can overwrite fConfirmed
|
||||
if (confirmed) {
|
||||
fConfirmed = true;
|
||||
}
|
||||
|
||||
if (firstTime) {
|
||||
if (config_data.debug_level > 0) {
|
||||
gCatena.SafePrintf("SendBuffer firstTime\n");
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ enum {
|
|||
|
|
||||
\****************************************************************************/
|
||||
|
||||
static const int32_t fwVersion = 20200611;
|
||||
static const int32_t fwVersion = 20200629;
|
||||
|
||||
static const byte INIT_PACKAGE_INTERVAL = 100; // send an init package every 100 packages;
|
||||
static const byte MAX_VALUES_TO_SEND = 8;
|
||||
|
|
|
|||
|
|
@ -102,12 +102,14 @@ long ReadScale(char channel)
|
|||
if ((millis() - mytimer) > 10000) {
|
||||
// Timeout reading scale...
|
||||
Wire.endTransmission(true);
|
||||
delay(50);
|
||||
InitializeScales();
|
||||
if (debug_level > 0) {
|
||||
gCatena.SafePrintf("Timeout while reading scale...\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
delay(1);
|
||||
delay(50);
|
||||
}
|
||||
long reading;
|
||||
if (myScale.available()) {
|
||||
|
|
@ -117,7 +119,7 @@ long ReadScale(char channel)
|
|||
if (debug_level > 0) {
|
||||
gCatena.SafePrintf("Reading: %d\n", reading);
|
||||
}
|
||||
delay(10);
|
||||
delay(50);
|
||||
}
|
||||
|
||||
long duration = millis() - startTime;
|
||||
|
|
|
|||
Loading…
Reference in New Issue