@@ -53,7 +53,7 @@ enum displayMode
53
53
MODE_COMMAND, // Used to indicate if a command byte has been received
54
54
MODE_SETTING, // Used to indicate if a setting byte has been received
55
55
MODE_CONTRAST, // First setting mode, then contrast change mode, then the value to change to
56
- MODE_TWI, // First setting mode, then custom char mode, then record 8 bytes
56
+ MODE_TWI, // First setting mode, then I2C mode, then change I2C address
57
57
MODE_RECORD_CUSTOM_CHAR, // First setting mode, then custom char mode, then record 8 bytes
58
58
MODE_SET_RGB // First setting mode, then RGB mode, then get 3 bytes
59
59
} currentMode = MODE_NORMAL;
@@ -202,22 +202,50 @@ void updateDisplay()
202
202
{
203
203
changeIgnore ();
204
204
}
205
+ // Record custom characters
206
+ else if (incoming >= 27 && incoming <= 34 )
207
+ {
208
+ // User can record up to 8 custom chars
209
+ customCharNumber = incoming - 27 ; // Get the custom char spot to record to
210
+
211
+ currentMode = MODE_RECORD_CUSTOM_CHAR; // Change to this special mode
212
+ }
213
+
214
+ // Display custom characters, 8 characters allowed, 35 to 42 inclusive
215
+ else if (incoming >= 35 && incoming <= 42 )
216
+ {
217
+ SerLCD.write (byte (incoming - 35 )); // You write location zero to display customer char 0
218
+ }
205
219
// Set Backlight RGB in one command to eliminate flicker
206
- else if (incoming == ' +' ) {
220
+ else if (incoming == 43 ) // + character
221
+ {
207
222
currentMode = MODE_SET_RGB; // Go to new mode
208
223
}
209
224
// Display current firmware version
210
- else if (incoming == ' \' ' ) {
225
+ else if (incoming == 44 ) // , character
226
+ {
211
227
displayFirmwareVersion ();
212
228
}
213
229
// Clear screen and buffer
214
- else if (incoming == ' - ' )
230
+ else if (incoming == 45 ) // - character
215
231
{
216
232
SerLCD.clear ();
217
233
SerLCD.setCursor (0 , 0 );
218
234
219
235
clearFrameBuffer (); // Get rid of all characters in our buffer
220
236
}
237
+ // If we get a second special setting character, then write it to the display
238
+ // This allows us to print a pipe by escaping it as a double
239
+ else if (incoming == 124 ) // | character
240
+ {
241
+ SerLCD.write (incoming);
242
+
243
+ currentFrame[characterCount++] = incoming; // Record this character to the display buffer
244
+ if (characterCount == settingLCDwidth * settingLCDlines) characterCount = 0 ; // Wrap condition
245
+ }
246
+
247
+ // The following commands start at integer value 128
248
+
221
249
// Backlight Red or standard white
222
250
else if (incoming >= SPECIAL_RED_MIN && incoming <= (SPECIAL_RED_MIN + 29 ))
223
251
{
@@ -236,28 +264,6 @@ void updateDisplay()
236
264
byte brightness = map (incoming, SPECIAL_BLUE_MIN, SPECIAL_BLUE_MIN + 29 , 0 , 255 ); // Covert 30 digit value to 255 digits
237
265
changeBLBrightness (BLUE, brightness);
238
266
}
239
- // Record custom characters
240
- else if (incoming >= 27 && incoming <= 34 )
241
- {
242
- // User can record up to 8 custom chars
243
- customCharNumber = incoming - 27 ; // Get the custom char spot to record to
244
-
245
- currentMode = MODE_RECORD_CUSTOM_CHAR; // Change to this special mode
246
- }
247
-
248
- // Display custom characters, 8 characters allowed, 35 to 42 inclusive
249
- else if (incoming >= 35 && incoming <= 42 )
250
- {
251
- SerLCD.write (byte (incoming - 35 )); // You write location zero to display customer char 0
252
- }
253
- // If we get a second special setting character, then write it to the display
254
- // This allows us to print a pipe by escaping it as a double
255
- else if (incoming == SPECIAL_SETTING) {
256
- SerLCD.write (incoming);
257
-
258
- currentFrame[characterCount++] = incoming; // Record this character to the display buffer
259
- if (characterCount == settingLCDwidth * settingLCDlines) characterCount = 0 ; // Wrap condition
260
- }
261
267
}
262
268
else if (currentMode == MODE_TWI)
263
269
{
0 commit comments