From e331c2e1ed483616a5a4d7892330330ad823bbe7 Mon Sep 17 00:00:00 2001 From: Brian Alano <10472103+ALittleSlow@users.noreply.github.com> Date: Sun, 17 Mar 2019 00:12:04 -0400 Subject: [PATCH 1/4] 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. --- firmware/OpenLCD/System_Functions.ino | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/firmware/OpenLCD/System_Functions.ino b/firmware/OpenLCD/System_Functions.ino index 58499ee..6a659ff 100644 --- a/firmware/OpenLCD/System_Functions.ino +++ b/firmware/OpenLCD/System_Functions.ino @@ -88,11 +88,6 @@ void setupUART() { //Check to see if we are ignoring the RX reset or not settingIgnoreRX = EEPROM.read(LOCATION_IGNORE_RX); - if (settingIgnoreRX > 1) - { - settingIgnoreRX = false; //Don't ignore - EEPROM.update(LOCATION_IGNORE_RX, settingIgnoreRX); - } if (settingIgnoreRX == false) //If we are NOT ignoring RX, then checkEmergencyReset(); //Look to see if the RX pin is being pulled low @@ -344,7 +339,7 @@ void checkEmergencyReset(void) pinMode(rxPin, INPUT_PULLUP); //Turn the RX pin into an input with pullups if (digitalRead(rxPin) == HIGH) return; //Quick pin check - + SerLCD.print(rxPin); //Wait 2 seconds, blinking backlight while we wait pinMode(BL_RW, OUTPUT); digitalWrite(BL_RW, HIGH); //Set the STAT2 LED @@ -367,7 +362,15 @@ void checkEmergencyReset(void) for (int x = 0 ; x < 200 ; x++) EEPROM.update(x, 0xFF); //Change contrast without notification message - analogWrite(LCD_CONTRAST, 40); //Set contrast to default + analogWrite(LCD_CONTRAST, DEFAULT_CONTRAST_LCD); //Set contrast to default + + //Force ignoreRX to false. + EEPROM.update(LOCATION_IGNORE_RX, false); + + //Change backlight to defaults + changeBLBrightness(RED, DEFAULT_RED); + changeBLBrightness(GREEN, DEFAULT_GREEN); + changeBLBrightness(BLUE, DEFAULT_BLUE); SerLCD.clear(); SerLCD.print("System reset"); From 34a4e9801fe4620d5ed2e701aa0326edbf93d089 Mon Sep 17 00:00:00 2001 From: Brian Alano <10472103+ALittleSlow@users.noreply.github.com> Date: Sun, 17 Mar 2019 00:30:33 -0400 Subject: [PATCH 2/4] Split DEFAULT_BRIGHTNESS into red, green and blue exchange DEFAULT_BRIGHTNESS for DEFAULT_RED, DEFAULT_GREEN and DEFAULT_BLUE --- firmware/OpenLCD/settings.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/firmware/OpenLCD/settings.h b/firmware/OpenLCD/settings.h index 28c067f..c8e2bd5 100644 --- a/firmware/OpenLCD/settings.h +++ b/firmware/OpenLCD/settings.h @@ -34,7 +34,9 @@ const byte DEFAULT_TWI_ADDRESS = 0x72; //0x71 for Serial7Segment. 0x72 for SerLCD. const byte DEFAULT_BAUD = BAUD_9600; //9600 for 8MHz, 2x speed -const byte DEFAULT_BRIGHTNESS = 255; //100%, full brightness +const byte DEFAULT_RED = 255; +const byte DEFAULT_GREEN = 255; +const byte DEFAULT_BLUE = 255; const byte DEFAULT_LINES = 2; const byte DEFAULT_WIDTH = 16; const byte DEFAULT_SPLASH = true; //Default on From dce34833995ec0d14cdc0cc45813aea9a7ce1af6 Mon Sep 17 00:00:00 2001 From: Brian Alano <10472103+ALittleSlow@users.noreply.github.com> Date: Sun, 17 Mar 2019 00:35:25 -0400 Subject: [PATCH 3/4] Fix backward logic displaying settingIgnoreRX --- firmware/OpenLCD/Setting_Control.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/OpenLCD/Setting_Control.ino b/firmware/OpenLCD/Setting_Control.ino index 7cf21e9..2c9911a 100644 --- a/firmware/OpenLCD/Setting_Control.ino +++ b/firmware/OpenLCD/Setting_Control.ino @@ -26,7 +26,7 @@ void changeIgnore() SerLCD.print(F("Ignore RX O")); - if (settingIgnoreRX == true) + if (settingIgnoreRX == false) SerLCD.print(F("FF")); else SerLCD.print(F("N")); From 83d993e176ca22c7171f87113ddf710880d95b7b Mon Sep 17 00:00:00 2001 From: Brian Alano <10472103+ALittleSlow@users.noreply.github.com> Date: Sun, 17 Mar 2019 00:41:38 -0400 Subject: [PATCH 4/4] remove debug line --- firmware/OpenLCD/System_Functions.ino | 1 - 1 file changed, 1 deletion(-) diff --git a/firmware/OpenLCD/System_Functions.ino b/firmware/OpenLCD/System_Functions.ino index 6a659ff..4ddf967 100644 --- a/firmware/OpenLCD/System_Functions.ino +++ b/firmware/OpenLCD/System_Functions.ino @@ -339,7 +339,6 @@ void checkEmergencyReset(void) pinMode(rxPin, INPUT_PULLUP); //Turn the RX pin into an input with pullups if (digitalRead(rxPin) == HIGH) return; //Quick pin check - SerLCD.print(rxPin); //Wait 2 seconds, blinking backlight while we wait pinMode(BL_RW, OUTPUT); digitalWrite(BL_RW, HIGH); //Set the STAT2 LED