fix: not detecting end of array(make it circular)

This commit is contained in:
rafa 2025-05-24 00:42:16 +01:00
parent 40beda91da
commit 4ece705c29

View File

@ -65,10 +65,16 @@ class LCDScreen {
}
LCDScreenState get_next_state(){
if (this->current_state == 2){
return this->ordered_states[0];
}
return this->ordered_states[this->current_state + 1];
}
LCDScreenState get_previous_state(){
if (this->current_state == 0){
return this->ordered_states[2];
}
return this->ordered_states[this->current_state - 1];
}