show max weight
This commit is contained in:
parent
c5f99bd86a
commit
c4522476f6
42
src/main.cpp
42
src/main.cpp
|
@ -191,6 +191,24 @@ void loop() {
|
|||
//Serial.println(weight_current);
|
||||
//Serial.print("spread="); Serial.println(spread,3);
|
||||
|
||||
#define MAXSPREAD 0.2 //in kg
|
||||
|
||||
if (spread<MAXSPREAD) { //if reading is stable
|
||||
if (weight_filtered<weight_tare) { //new min
|
||||
weight_tare=weight_filtered;
|
||||
update_display=true;
|
||||
Serial.print("new tare="); Serial.println(weight_tare,3);
|
||||
last_display_blink=loopmillis; //blink
|
||||
}
|
||||
|
||||
if (weight_filtered>weight_max) { //new max
|
||||
weight_max=weight_filtered;
|
||||
update_display=true;
|
||||
Serial.print("new max="); Serial.println(weight_max,3);
|
||||
last_display_blink=loopmillis; //blink
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
weight_updated=true;
|
||||
|
||||
|
@ -210,11 +228,11 @@ void loop() {
|
|||
if ( (loopmillis > last_displayupdate + DISPLAYUPDATEINTERVAL) | (update_display && (loopmillis > last_displayupdate + DISPLAYUPDATEINTERVAL_MIN) )) {
|
||||
last_displayupdate=loopmillis;
|
||||
update_display=false; //reset flag
|
||||
if ((loopmillis >= last_new_display_custom) && (loopmillis < last_new_display_custom+display_custom_duration)) {
|
||||
if ((loopmillis >= last_new_display_custom) && (loopmillis < last_new_display_custom+display_custom_duration)) { //custom display message
|
||||
display.setBrightness(displaybrightness,true); //enable display
|
||||
display.setSegments(display_custom);
|
||||
}else{
|
||||
displayNumber(weight_filtered);
|
||||
}else{ //normale weight display
|
||||
displayNumber(weight_max-weight_tare);
|
||||
display.setSegments(display_data);
|
||||
|
||||
if ((loopmillis >= last_display_blink) && (loopmillis < last_display_blink+display_blink_duration)) {
|
||||
|
@ -239,23 +257,7 @@ void loopHandler() {
|
|||
|
||||
if (weight_updated) {
|
||||
weight_updated=false;
|
||||
#define MAXSPREAD 0.2 //in kg
|
||||
|
||||
if (spread<MAXSPREAD) { //if reading is stable
|
||||
if (weight_filtered<weight_tare) { //new min
|
||||
weight_tare=weight_filtered;
|
||||
update_display=true;
|
||||
Serial.print("new tare="); Serial.println(weight_tare,3);
|
||||
last_display_blink=loopmillis; //blink
|
||||
}
|
||||
|
||||
if (weight_filtered>weight_max) { //new max
|
||||
weight_max=weight_filtered;
|
||||
update_display=true;
|
||||
Serial.print("new max="); Serial.println(weight_max,3);
|
||||
last_display_blink=loopmillis; //blink
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!weight_sent) {
|
||||
|
|
Loading…
Reference in New Issue