Skip to content

Commit

Permalink
feat(oled): adds option to rotate 180
Browse files Browse the repository at this point in the history
  • Loading branch information
JyeSmith committed Sep 13, 2018
1 parent bc20262 commit 86e1d4c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/rx5808-pro-diversity/settings_eeprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct EepromSettings {
uint8_t selectedHomePage;
uint8_t buttonBeep;
uint8_t invertDisplay;
uint8_t rotateOled;

// Internal settings
uint8_t spectatorFreqScanStep;
Expand Down Expand Up @@ -108,6 +109,7 @@ PROGMEM const struct {
uint8_t selectedHomePage = 0;
uint8_t buttonBeep = true;
uint8_t invertDisplay = false;
uint8_t rotateOled = false;

// Internal settings
uint8_t spectatorFreqScanStep = 5;
Expand Down
2 changes: 1 addition & 1 deletion src/rx5808-pro-diversity/settings_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SOFTWARE.

// This should be incremented after every EEPROM change.
// Version Number format v00.01
#define VERSION_NUMBER 0002
#define VERSION_NUMBER 0001

// === Receiver Modules =========================================================

Expand Down
19 changes: 18 additions & 1 deletion src/rx5808-pro-diversity/state_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
int8_t selectedMenuItem = 0;
bool showChangeMenuOptions = false;

uint8_t menuItems = 12; // Number of items in settingsMenu[]
uint8_t menuItems = 13; // Number of items in settingsMenu[]
char* settingsMenu[]={
"Quadversity",
"Home Page", //defaut, simple, stats
Expand All @@ -27,6 +27,7 @@ char* settingsMenu[]={
"Button Beep",
"Draw Logo",
"Invert Display",
"Rotate OLED",
};

void StateMachine::SettingsStateHandler::onEnter() {
Expand Down Expand Up @@ -213,6 +214,14 @@ void StateMachine::SettingsStateHandler::onUpdateDraw() {
}
break;

case 12: // Rotate OLED
if (EepromSettings.rotateOled) {
Ui::display.print(PSTR2(" Rotated "));
} else {
Ui::display.print(PSTR2(" Normal "));
}
break;

}
}

Expand Down Expand Up @@ -313,6 +322,10 @@ void StateMachine::SettingsStateHandler::onButtonChange(
EepromSettings.invertDisplay = !EepromSettings.invertDisplay;
break;

case (12): // Rotate OLED
EepromSettings.rotateOled = !EepromSettings.rotateOled;
break;

}
}
}
Expand Down Expand Up @@ -388,6 +401,10 @@ void StateMachine::SettingsStateHandler::onButtonChange(
EepromSettings.invertDisplay = !EepromSettings.invertDisplay;
break;

case (12): // Rotate OLED
EepromSettings.rotateOled = !EepromSettings.rotateOled;
break;

}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/rx5808-pro-diversity/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ namespace Ui {
} else {
if (EepromSettings.useOledScreen) {
#ifndef DISABLE_OLED
if (EepromSettings.rotateOled){
display.setRotation(2);
} else {
display.setRotation(0);
}
display.display();
#endif
} else {
Expand Down

0 comments on commit 86e1d4c

Please sign in to comment.