Skip to content

Commit

Permalink
regard rotary counts in setup menu and select menu's as well
Browse files Browse the repository at this point in the history
  • Loading branch information
iltis42 committed Mar 26, 2024
1 parent a3cc1d5 commit c7685ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 7 additions & 4 deletions main/SetupMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,11 @@ void SetupMenu::down(int count){
ucg->setColor(COLOR_BLACK);
ucg->drawFrame( 1,(highlight+1)*25+3,238,25 );
ucg->setColor(COLOR_WHITE);
if( highlight > -1 ){
while( (highlight > -1) && count ){
highlight --;
count--;
}
else
if( highlight < -1 )
highlight = (int)(_childs.size() -1 );
ucg->drawFrame( 1,(highlight+1)*25+3,238,25 );
xSemaphoreGive(spiMutex );
Expand Down Expand Up @@ -617,11 +618,13 @@ void SetupMenu::up(int count){
ucg->setColor(COLOR_BLACK);
ucg->drawFrame( 1,(highlight+1)*25+3,238,25 );
ucg->setColor(COLOR_WHITE);
if( highlight < (int)(_childs.size()-1) ){
while( highlight < (int)(_childs.size()-1) && count ){
highlight ++;
count--;
}
else
if( highlight > (int)(_childs.size()-1) ){
highlight = -1;
}
ucg->drawFrame( 1,(highlight+1)*25+3,238,25 );
pressed = true;
xSemaphoreGive(spiMutex );
Expand Down
8 changes: 6 additions & 2 deletions main/SetupMenuSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ void SetupMenuSelect::down(int count){
ucg->setColor(COLOR_BLACK);
ucg->drawFrame( 1,(_select+1)*25+3,238,25 ); // blank old frame
ucg->setColor(COLOR_WHITE);
if( (_select) > 0 )
while( (_select) > 0 && count){
(_select)--;
count--;
}
ESP_LOGI(FNAME,"val down %d", _select );
ucg->drawFrame( 1,(_select+1)*25+3,238,25 ); // draw new frame
xSemaphoreGive(spiMutex );
Expand All @@ -215,8 +217,10 @@ void SetupMenuSelect::up(int count){
ucg->setColor(COLOR_BLACK);
ucg->drawFrame( 1,(_select+1)*25+3,238,25 ); // blank old frame
ucg->setColor(COLOR_WHITE);
if ( (_select) < _numval-1 )
while ( (_select) < _numval-1 && count ){
(_select)++;
count--;
}
ESP_LOGI(FNAME,"val up %d", _select );
ucg->drawFrame( 1,(_select+1)*25+3,238,25 ); // draw new frame
xSemaphoreGive(spiMutex );
Expand Down

0 comments on commit c7685ff

Please sign in to comment.