fix: not detecting end of array(make it circular)
This commit is contained in:
parent
40beda91da
commit
4ece705c29
@ -65,10 +65,16 @@ class LCDScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LCDScreenState get_next_state(){
|
LCDScreenState get_next_state(){
|
||||||
|
if (this->current_state == 2){
|
||||||
|
return this->ordered_states[0];
|
||||||
|
}
|
||||||
return this->ordered_states[this->current_state + 1];
|
return this->ordered_states[this->current_state + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
LCDScreenState get_previous_state(){
|
LCDScreenState get_previous_state(){
|
||||||
|
if (this->current_state == 0){
|
||||||
|
return this->ordered_states[2];
|
||||||
|
}
|
||||||
return this->ordered_states[this->current_state - 1];
|
return this->ordered_states[this->current_state - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user