mirror of https://github.com/arendst/Tasmota.git
Added define to adjust calibration precision. (#18613)
Co-authored-by: JeroenSt <nospam@nospam.org>
This commit is contained in:
parent
bef49b4617
commit
632176765d
|
@ -991,6 +991,7 @@
|
||||||
// #define TM1638_MAX_LEDS 8 // Add support for 8 leds
|
// #define TM1638_MAX_LEDS 8 // Add support for 8 leds
|
||||||
//#define USE_HX711 // Add support for HX711 load cell (+1k5 code)
|
//#define USE_HX711 // Add support for HX711 load cell (+1k5 code)
|
||||||
// #define USE_HX711_GUI // Add optional web GUI to HX711 as scale (+1k8 code)
|
// #define USE_HX711_GUI // Add optional web GUI to HX711 as scale (+1k8 code)
|
||||||
|
// #define HX711_CAL_PRECISION 1 // When HX711 calibration is to course, raise this value
|
||||||
|
|
||||||
//#define USE_DINGTIAN_RELAY // Add support for the Dingian board using 74'595 et 74'165 shift registers
|
//#define USE_DINGTIAN_RELAY // Add support for the Dingian board using 74'595 et 74'165 shift registers
|
||||||
// #define DINGTIAN_INPUTS_INVERTED // Invert input states (Hi => OFF, Low => ON)
|
// #define DINGTIAN_INPUTS_INVERTED // Invert input states (Hi => OFF, Low => ON)
|
||||||
|
|
|
@ -43,6 +43,10 @@
|
||||||
#ifndef HX_SCALE
|
#ifndef HX_SCALE
|
||||||
#define HX_SCALE 120 // Default result of measured weight / reference weight when scale is 1
|
#define HX_SCALE 120 // Default result of measured weight / reference weight when scale is 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef HX711_CAL_PRECISION
|
||||||
|
#define HX711_CAL_PRECISION 1 // When calibration is to course, raise this value.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define HX_TIMEOUT 120 // A reading at default 10Hz (pin RATE to Gnd on HX711) can take up to 100 milliseconds
|
#define HX_TIMEOUT 120 // A reading at default 10Hz (pin RATE to Gnd on HX711) can take up to 100 milliseconds
|
||||||
#define HX_SAMPLES 10 // Number of samples for average calculation
|
#define HX_SAMPLES 10 // Number of samples for average calculation
|
||||||
|
@ -340,7 +344,7 @@ void HxEvery100mSecond(void) {
|
||||||
for (uint32_t i = 2; i < HX_SAMPLES -2; i++) {
|
for (uint32_t i = 2; i < HX_SAMPLES -2; i++) {
|
||||||
sum_raw += Hx.reads[i];
|
sum_raw += Hx.reads[i];
|
||||||
}
|
}
|
||||||
Hx.raw_absolute = sum_raw / (HX_SAMPLES -4); // Uncalibrated value
|
Hx.raw_absolute = (sum_raw / (HX_SAMPLES -4)) * HX711_CAL_PRECISION; // Uncalibrated value
|
||||||
Hx.raw = Hx.raw_absolute / Hx.scale; // grams
|
Hx.raw = Hx.raw_absolute / Hx.scale; // grams
|
||||||
|
|
||||||
if ((0 == Settings->weight_user_tare) && Hx.tare_flg) { // Reset scale based on current load
|
if ((0 == Settings->weight_user_tare) && Hx.tare_flg) { // Reset scale based on current load
|
||||||
|
|
Loading…
Reference in New Issue