make display show filtered weight - tare

This commit is contained in:
interfisch 2021-03-16 20:59:29 +01:00
parent c4522476f6
commit 9f87ba3c42
1 changed files with 8 additions and 3 deletions

View File

@ -20,6 +20,8 @@ bool vbatSent=false;
bool weight_updated=false;
unsigned long last_weightchange=10000; //give some headstart if startup takes a bit longer
#include <TM1637Display.h>
#define TM1637_CLK D5
@ -207,6 +209,8 @@ void loop() {
Serial.print("new max="); Serial.println(weight_max,3);
last_display_blink=loopmillis; //blink
}
}else{
last_weightchange=loopmillis;
}
@ -221,7 +225,8 @@ void loop() {
#define STAYONTIME_AFTER_SENT 5000
if (millis() > MAXONTIME || (weight_sent && millis()>weight_sent_time+STAYONTIME_AFTER_SENT)) {
#define STAYONTIME_IDLE 20000 //how long to stay on (ms) after no change in weight detected
if (millis() > MAXONTIME || (weight_sent && millis()>weight_sent_time+STAYONTIME_AFTER_SENT) || millis()>last_weightchange+STAYONTIME_IDLE) {
powerOff();
}
@ -232,11 +237,11 @@ void loop() {
display.setBrightness(displaybrightness,true); //enable display
display.setSegments(display_custom);
}else{ //normale weight display
displayNumber(weight_max-weight_tare);
displayNumber(weight_filtered-weight_tare);
display.setSegments(display_data);
if ((loopmillis >= last_display_blink) && (loopmillis < last_display_blink+display_blink_duration)) {
display.setBrightness(displaybrightness,false);
display.setBrightness(2,true); //dimmed
}else{
display.setBrightness(displaybrightness,true);
}