Move update of space_status_b4 into own function
This commit is contained in:
parent
b14055bcfa
commit
19a1c177c6
1 changed files with 9 additions and 5 deletions
|
@ -39,11 +39,7 @@ void update_space_status() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop(){
|
void update_space_status_b4() {
|
||||||
print_status();
|
|
||||||
|
|
||||||
update_space_status();
|
|
||||||
|
|
||||||
// status check if we can switch the status.
|
// status check if we can switch the status.
|
||||||
// low pass prevents waggling a bit
|
// low pass prevents waggling a bit
|
||||||
if (space_status >= THRESHOLD-3) {
|
if (space_status >= THRESHOLD-3) {
|
||||||
|
@ -53,6 +49,14 @@ void loop(){
|
||||||
// open
|
// open
|
||||||
space_status_b4 = 0;
|
space_status_b4 = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
print_status();
|
||||||
|
|
||||||
|
update_space_status();
|
||||||
|
|
||||||
|
update_space_status_b4();
|
||||||
|
|
||||||
delay(DELAY_TIME);
|
delay(DELAY_TIME);
|
||||||
|
|
||||||
|
|
Reference in a new issue