Skip to content

Commit

Permalink
feat(tvout): option to invert colours
Browse files Browse the repository at this point in the history
  • Loading branch information
JyeSmith committed Sep 13, 2018
1 parent 61d7cd1 commit c52c954
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/rx5808-pro-diversity/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ SOFTWARE.
//
// =============================================================================

//#define FENIX_QUADVERSITY
#define REALACC_RX5808_PRO_PLUS_OSD
#define FENIX_QUADVERSITY
//#define REALACC_RX5808_PRO_PLUS_OSD

// === EEPROM ==================================================================
//
// Select ROM used. Option included for testing.
//
// =============================================================================

#define EEPROM_AT24C02 // WORKING
//#define EEPROM_AT24C02 // WORKING
//#define EEPROM_AT24C16 // WORKING
//#define EEPROM_AT24C32 // NOT TESTED
//#define EEPROM_AT24C64 // WORKING
#define EEPROM_AT24C64 // WORKING

// === Display Module ==========================================================
//
Expand Down
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 @@ -47,6 +47,7 @@ struct EepromSettings {
uint8_t useFastBoot;
uint8_t selectedHomePage;
uint8_t buttonBeep;
uint8_t invertDisplay;

// Internal settings
uint8_t spectatorFreqScanStep;
Expand Down Expand Up @@ -106,6 +107,7 @@ PROGMEM const struct {
uint8_t useFastBoot = false;
uint8_t selectedHomePage = 0;
uint8_t buttonBeep = true;
uint8_t invertDisplay = 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 0001
#define VERSION_NUMBER 0002

// === 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 = 11; // Number of items in settingsMenu[]
uint8_t menuItems = 12; // Number of items in settingsMenu[]
char* settingsMenu[]={
"Quadversity",
"Home Page", //defaut, simple, stats
Expand All @@ -26,6 +26,7 @@ char* settingsMenu[]={
"Advanced Settings",
"Button Beep",
"Draw Logo",
"Invert Display",
};

void StateMachine::SettingsStateHandler::onEnter() {
Expand Down Expand Up @@ -204,6 +205,14 @@ void StateMachine::SettingsStateHandler::onUpdateDraw() {
#endif
break;

case 11: // Invert Display
if (EepromSettings.invertDisplay) {
Ui::display.print(PSTR2(" On "));
} else {
Ui::display.print(PSTR2(" Off "));
}
break;

}
}

Expand Down Expand Up @@ -300,6 +309,10 @@ void StateMachine::SettingsStateHandler::onButtonChange(
EepromSettings.buttonBeep = !EepromSettings.buttonBeep;
break;

case (11): // Invert Display
EepromSettings.invertDisplay = !EepromSettings.invertDisplay;
break;

}
}
}
Expand Down Expand Up @@ -371,6 +384,10 @@ void StateMachine::SettingsStateHandler::onButtonChange(
EepromSettings.buttonBeep = !EepromSettings.buttonBeep;
break;

case (11): // Invert Display
EepromSettings.invertDisplay = !EepromSettings.invertDisplay;
break;

}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/rx5808-pro-diversity/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ namespace Ui {
void sdToTtvout() {
for(int y=0; y<64; y++) {
for(int x=0; x<128; x++) {
bool colour = display.getPixel(x,y);
bool colour;
if (EepromSettings.invertDisplay) {
colour = !display.getPixel(x,y);
} else {
colour = display.getPixel(x,y);
}

#if F_CPU == 120000000L
TV.draw_rect(16+x, 22+y, 1, 1, colour, colour); // 120 MHz
Expand Down

0 comments on commit c52c954

Please sign in to comment.