change timing/power handling
This commit is contained in:
parent
630c432289
commit
730904e6ba
|
|
@ -536,7 +536,6 @@ void DoDeepSleep(uint32_t sleep_time)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// highest and lowest value will be ignored
|
|
||||||
long my_read_average(byte gain, byte times) {
|
long my_read_average(byte gain, byte times) {
|
||||||
// highest and lowest value will be ignored
|
// highest and lowest value will be ignored
|
||||||
long sum = 0;
|
long sum = 0;
|
||||||
|
|
@ -547,13 +546,14 @@ long my_read_average(byte gain, byte times) {
|
||||||
if (config_data.debug_level > 0) {
|
if (config_data.debug_level > 0) {
|
||||||
gCatena.SafePrintf("%010d - my_read_average, measurements: ", millis());
|
gCatena.SafePrintf("%010d - my_read_average, measurements: ", millis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadCell.set_gain(gain);
|
||||||
|
// we wait 400ms (settling time according HX711 datasheet @ 10 SPS
|
||||||
|
delay(400);
|
||||||
|
|
||||||
for (byte i = 0; i < times; i++) {
|
for (byte i = 0; i < times; i++) {
|
||||||
delay(WAITTIMELOADSAMPLES * 1000);
|
// we wait 400ms (settling time according HX711 datasheet @ 10 SPS)
|
||||||
LoadCell.power_up();
|
|
||||||
LoadCell.set_gain(gain);
|
|
||||||
delay(2); // wait for stabilizing
|
|
||||||
v = LoadCell.read();
|
v = LoadCell.read();
|
||||||
LoadCell.power_down();
|
|
||||||
|
|
||||||
if (L > v) L = v; // find lowest value
|
if (L > v) L = v; // find lowest value
|
||||||
if (H < v) H = v; // find highest value
|
if (H < v) H = v; // find highest value
|
||||||
|
|
@ -562,6 +562,7 @@ long my_read_average(byte gain, byte times) {
|
||||||
gCatena.SafePrintf("%d ", v);
|
gCatena.SafePrintf("%d ", v);
|
||||||
}
|
}
|
||||||
gCatena.poll();
|
gCatena.poll();
|
||||||
|
delay(WAITTIMELOADSAMPLES);
|
||||||
}
|
}
|
||||||
res = (sum - L - H) / (times - 2);
|
res = (sum - L - H) / (times - 2);
|
||||||
if (config_data.debug_level > 0) {
|
if (config_data.debug_level > 0) {
|
||||||
|
|
|
||||||
|
|
@ -55,13 +55,10 @@ enum {
|
||||||
|
|
|
|
||||||
\****************************************************************************/
|
\****************************************************************************/
|
||||||
|
|
||||||
static const int32_t fwVersion = 20200107;
|
static const int32_t fwVersion = 20200109;
|
||||||
|
|
||||||
// wait between samples
|
// wait between samples in milliseconds
|
||||||
// 3 sec is a good delay so that load cell did not warm up
|
const int WAITTIMELOADSAMPLES = 100;
|
||||||
// too much and external random influences like wind has time
|
|
||||||
// to go so that the next sample is more valid
|
|
||||||
const int WAITTIMELOADSAMPLES = 3;
|
|
||||||
|
|
||||||
static const byte INIT_PACKAGE_INTERVAL = 100; // send an init package every 100 packages;
|
static const byte INIT_PACKAGE_INTERVAL = 100; // send an init package every 100 packages;
|
||||||
static const byte MAX_VALUES_TO_SEND = 8;
|
static const byte MAX_VALUES_TO_SEND = 8;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue