Adds slight debouncing to the scale loop weight logic
Adds slight debouncing to the scale loop to prevent jitter of the weight displayed on the screen.
This commit is contained in:
1 parent
c2a09b21a0
commit
21ec4e0ff3
1 file changed
+5
-1
+5
-1
@@ -74,7 +74,11 @@ void scale_loop(void * parameter) {
|
||||
scaleTareRequest = false;
|
||||
}
|
||||
|
||||
weight = round(scale.get_units());
|
||||
// Only update weight if median changed more than 1
|
||||
int16_t newWeight = round(scale.get_units());
|
||||
if(abs(weight-newWeight) > 1){
|
||||
weight = newWeight;
|
||||
}
|
||||
}
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
|
||||
Reference in new issue
Block a user