Fix compilation errors and warnings

Fixing issues when only ENABLE_GBX was enabled or when compiling for a serial-only firmware.
This commit is contained in:
Ancyker 2024-06-02 11:15:50 -04:00
parent ad69abdf57
commit 740c2698bc
No known key found for this signature in database
GPG Key ID: 841A6B28CD25A744

View File

@ -876,10 +876,14 @@ boolean checkCartSelection(FsFile& database, void (*readData)(FsFile&, void*), v
return false; return false;
} }
#if (defined(ENABLE_ODY2) || defined(ENABLE_ARC) || defined(ENABLE_FAIRCHILD) || defined(ENABLE_MSX) || defined(ENABLE_POKE) || defined(ENABLE_2600) || defined(ENABLE_5200) || defined(ENABLE_7800) || defined(ENABLE_C64) || defined(ENABLE_VECTREX) || defined(ENABLE_NES)) # if ( \
#if (defined(ENABLE_OLED) || defined(ENABLE_LCD)) || defined(ENABLE_GBX) defined(ENABLE_ODY2) || defined(ENABLE_ARC) || defined(ENABLE_FAIRCHILD) || defined(ENABLE_MSX) || \
defined(ENABLE_POKE) || defined(ENABLE_2600) || defined(ENABLE_5200) || defined(ENABLE_7800) || \
defined(ENABLE_C64) || defined(ENABLE_VECTREX) || defined(ENABLE_NES) || defined(ENABLE_GBX) \
)
void printInstructions() { void printInstructions() {
println_Msg(FS(FSTRING_EMPTY)); println_Msg(FS(FSTRING_EMPTY));
# if defined(ENABLE_OLED) # if defined(ENABLE_OLED)
print_STR(press_to_change_STR, 1); print_STR(press_to_change_STR, 1);
print_STR(right_to_select_STR, 1); print_STR(right_to_select_STR, 1);
@ -889,19 +893,22 @@ void printInstructions() {
# elif defined(SERIAL_MONITOR) # elif defined(SERIAL_MONITOR)
println_Msg(F("U/D to Change")); println_Msg(F("U/D to Change"));
println_Msg(F("Space to Select")); println_Msg(F("Space to Select"));
#endif # endif /* ENABLE_OLED | ENABLE_LCD | SERIAL_MONITOR */
display_Update(); display_Update();
} }
# if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
int navigateMenu(int min, int max, void (*printSelection)(int)) { int navigateMenu(int min, int max, void (*printSelection)(int)) {
uint8_t b = 0; uint8_t b = 0;
int i = min; int i = min;
// Check Button Status // Check Button Status
# if defined(ENABLE_OLED) # if defined(ENABLE_OLED)
buttonVal1 = (PIND & (1 << 7)); // PD7 buttonVal1 = (PIND & (1 << 7)); // PD7
# elif defined(ENABLE_LCD) # elif defined(ENABLE_LCD)
boolean buttonVal1 = (PING & (1 << 2)); //PG2 boolean buttonVal1 = (PING & (1 << 2)); //PG2
#endif # endif /* ENABLE_OLED | ENABLE_LCD */
if (buttonVal1 == LOW) { // Button Pressed if (buttonVal1 == LOW) { // Button Pressed
while (1) { // Scroll Mapper List while (1) { // Scroll Mapper List
@ -909,7 +916,8 @@ int navigateMenu(int min, int max, void (*printSelection)(int)) {
buttonVal1 = (PIND & (1 << 7)); // PD7 buttonVal1 = (PIND & (1 << 7)); // PD7
# elif defined(ENABLE_LCD) # elif defined(ENABLE_LCD)
buttonVal1 = (PING & (1 << 2)); // PG2 buttonVal1 = (PING & (1 << 2)); // PG2
#endif # endif /* ENABLE_OLED | ENABLE_LCD */
if (buttonVal1 == HIGH) { // Button Released if (buttonVal1 == HIGH) { // Button Released
// Correct Overshoot // Correct Overshoot
if (i == min) if (i == min)
@ -959,9 +967,10 @@ int navigateMenu(int min, int max, void (*printSelection)(int)) {
} }
} }
} }
#endif # endif /* (ENABLE_OLED | ENABLE_LCD) */
#endif # endif /* ENABLE_<CORES> */
# if (defined(ENABLE_OLED) || defined(ENABLE_LCD))
void starting_letter__subDraw(byte selection, byte line) { void starting_letter__subDraw(byte selection, byte line) {
display.setDrawColor(0); display.setDrawColor(0);
for (uint8_t i = 0; i < 4; i++) display.drawLine(0, 10 + i * 16, 128, 10 + i * 16); for (uint8_t i = 0; i < 4; i++) display.drawLine(0, 10 + i * 16, 128, 10 + i * 16);
@ -969,6 +978,7 @@ void starting_letter__subDraw(byte selection, byte line) {
display.drawLine(4 + selection * 16, 10 + line * 16, 9 + selection * 16, 10 + line * 16); display.drawLine(4 + selection * 16, 10 + line * 16, 9 + selection * 16, 10 + line * 16);
display_Update(); display_Update();
} }
# endif /* (ENABLE_OLED | ENABLE_LCD) */
byte starting_letter() { byte starting_letter() {
#ifdef ENABLE_GLOBAL_LOG #ifdef ENABLE_GLOBAL_LOG
@ -2023,7 +2033,7 @@ void setup() {
* Set LED Pin PD7 to Output * Set LED Pin PD7 to Output
**/ **/
DDRD |= (1 << 7); DDRD |= (1 << 7);
# else /* !defined(HW5) && !defined(HW5) */ # else /* !defined(HW5) && !defined(ENABLE_VSELECT) */
/** /**
* HW1-3 have button connected to PD7 * HW1-3 have button connected to PD7
* Set pin PD7 to input for button * Set pin PD7 to input for button
@ -2715,7 +2725,7 @@ unsigned char question_box(const __FlashStringHelper* question, char answers[7][
#if defined(ENABLE_SERIAL) #if defined(ENABLE_SERIAL)
// Serial Monitor // Serial Monitor
byte questionBox_Serial(const __FlashStringHelper* question, char answers[7][20], uint8_t num_answers, uint8_t default_choice) { byte questionBox_Serial(const __FlashStringHelper* question __attribute__((unused)), char answers[7][20], uint8_t num_answers, uint8_t default_choice __attribute__((unused))) {
// Print menu to serial monitor // Print menu to serial monitor
Serial.println(FS(FSTRING_EMPTY)); Serial.println(FS(FSTRING_EMPTY));
for (byte i = 0; i < num_answers; i++) { for (byte i = 0; i < num_answers; i++) {