Skip to content

Commit bdf6273

Browse files
committed
Adding display firmware version
1 parent 1e7b2a1 commit bdf6273

File tree

4 files changed

+31
-22
lines changed

4 files changed

+31
-22
lines changed

firmware/OpenLCD/OpenLCD.ino

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@
1616
Todo:
1717
Check how splash screen works on 16 vs 20 width displays
1818
Establish and cut down on boot time
19-
20-
Tests:
21-
-Change LCD width to 20, then back to 16 (124/3, then 124/4) then send 18 characters and check for wrap
22-
-Enable/Disable splash screen, send 124 then 9 to toggle, then power cycle
23-
-Change baud rate: 124/12 to go to 4800bps, power cycle, send characters at 4800
2419
*/
2520

2621
//Firmware version. This is sent when requested. Helpful for tech support.
@@ -207,8 +202,16 @@ void updateDisplay()
207202
{
208203
changeIgnore();
209204
}
205+
//Set Backlight RGB in one command to eliminate flicker
206+
else if (incoming == '+') {
207+
currentMode = MODE_SET_RGB; //Go to new mode
208+
}
209+
//Display current firmware version
210+
else if (incoming == '\'') {
211+
displayFirmwareVersion();
212+
}
210213
//Clear screen and buffer
211-
else if (incoming == 45) //'-'
214+
else if (incoming == '-')
212215
{
213216
SerLCD.clear();
214217
SerLCD.setCursor(0, 0);
@@ -255,10 +258,6 @@ void updateDisplay()
255258
currentFrame[characterCount++] = incoming; //Record this character to the display buffer
256259
if (characterCount == settingLCDwidth * settingLCDlines) characterCount = 0; //Wrap condition
257260
}
258-
//Set Backlight RGB in one command to eliminate flicker
259-
else if (incoming == 43) {
260-
currentMode = MODE_SET_RGB; //Go to new mode
261-
}
262261
}
263262
else if (currentMode == MODE_TWI)
264263
{

firmware/OpenLCD/Setting_Control.ino

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,27 @@ void changeIgnore()
2525
settingIgnoreRX = true;
2626
SerLCD.print(F("N"));
2727
}
28-
petSafeDelay(SYSTEM_MESSAGE_DELAY);
29-
3028
//Record this new setting
3129
EEPROM.write(LOCATION_IGNORE_RX, settingIgnoreRX);
3230

31+
petSafeDelay(SYSTEM_MESSAGE_DELAY);
32+
33+
displayFrameBuffer(); //Return the contents of the display
34+
}
35+
36+
//Display the current firmware version for a set amount of time
37+
void displayFirmwareVersion()
38+
{
39+
SerLCD.clear();
40+
SerLCD.setCursor(0, 0);
41+
42+
SerLCD.print(F("Firmware v"));
43+
SerLCD.print(firmwareVersionMajor);
44+
SerLCD.print(F("."));
45+
SerLCD.print(firmwareVersionMinor);
46+
47+
petSafeDelay(SYSTEM_MESSAGE_DELAY);
48+
3349
displayFrameBuffer(); //Return the contents of the display
3450
}
3551

@@ -147,13 +163,8 @@ void changeBacklightRGB(byte red, byte green, byte blue) {
147163
EEPROM.write(LOCATION_BLUE_BRIGHTNESS, blue); //Record new setting
148164
//analogWrite(BL_B, 255 - brightness); //Controlled by PNP so reverse the brightness value
149165
SoftPWMSet(BL_B, 255 - blue); //Controlled by software PWM
150-
151-
petSafeDelay(SYSTEM_MESSAGE_DELAY);
152-
153-
displayFrameBuffer(); //Display what was there before
154166
}
155167

156-
157168
//Changes the baud rate setting
158169
//Assumes caller is passing a number 0 to 12
159170
void changeUARTSpeed(byte setting)

firmware/OpenLCD/System_Functions.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,13 @@ void setupSplash()
236236
//This should work with both 16 and 20 character displays
237237
SerLCD.clear();
238238
SerLCD.setCursor(0, 0); //First position, 1st row
239-
SerLCD.print("SparkFun OpenLCD");
239+
SerLCD.print(F("SparkFun OpenLCD"));
240240
SerLCD.setCursor(0, 1); //First position, 2nd row
241-
SerLCD.print("v");
241+
SerLCD.print(F("v"));
242242
SerLCD.print(firmwareVersionMajor);
243-
SerLCD.print(".");
243+
SerLCD.print(F("."));
244244
SerLCD.print(firmwareVersionMinor);
245-
SerLCD.print(" Baud: ");
245+
SerLCD.print(F(" Baud: "));
246246

247247
//Read what the current UART speed is from EEPROM memory
248248
//Default is 9600

firmware/OpenLCD/settings.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//Hardware pin definitions
22

3-
//v2 Xiamen protos
43
#define LCD_RS A0
54
#define LCD_RW A1
65
#define LCD_EN A2

0 commit comments

Comments
 (0)