Skip to content

Commit e331c2e

Browse files
authored
Fix bug which disables emergency reset by default
Initialize settingIgnoreRX to false. In emergency reset, use default value for contrast instead of literal, and set brightnesses to defaults.
1 parent 83fb750 commit e331c2e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

firmware/OpenLCD/System_Functions.ino

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@ void setupUART()
8888
{
8989
//Check to see if we are ignoring the RX reset or not
9090
settingIgnoreRX = EEPROM.read(LOCATION_IGNORE_RX);
91-
if (settingIgnoreRX > 1)
92-
{
93-
settingIgnoreRX = false; //Don't ignore
94-
EEPROM.update(LOCATION_IGNORE_RX, settingIgnoreRX);
95-
}
9691

9792
if (settingIgnoreRX == false) //If we are NOT ignoring RX, then
9893
checkEmergencyReset(); //Look to see if the RX pin is being pulled low
@@ -344,7 +339,7 @@ void checkEmergencyReset(void)
344339
pinMode(rxPin, INPUT_PULLUP); //Turn the RX pin into an input with pullups
345340

346341
if (digitalRead(rxPin) == HIGH) return; //Quick pin check
347-
342+
SerLCD.print(rxPin);
348343
//Wait 2 seconds, blinking backlight while we wait
349344
pinMode(BL_RW, OUTPUT);
350345
digitalWrite(BL_RW, HIGH); //Set the STAT2 LED
@@ -367,7 +362,15 @@ void checkEmergencyReset(void)
367362
for (int x = 0 ; x < 200 ; x++) EEPROM.update(x, 0xFF);
368363

369364
//Change contrast without notification message
370-
analogWrite(LCD_CONTRAST, 40); //Set contrast to default
365+
analogWrite(LCD_CONTRAST, DEFAULT_CONTRAST_LCD); //Set contrast to default
366+
367+
//Force ignoreRX to false.
368+
EEPROM.update(LOCATION_IGNORE_RX, false);
369+
370+
//Change backlight to defaults
371+
changeBLBrightness(RED, DEFAULT_RED);
372+
changeBLBrightness(GREEN, DEFAULT_GREEN);
373+
changeBLBrightness(BLUE, DEFAULT_BLUE);
371374

372375
SerLCD.clear();
373376
SerLCD.print("System reset");

0 commit comments

Comments
 (0)