7
7
// Toggle the ignore rx setting
8
8
void changeIgnore ()
9
9
{
10
- byte settingIgnoreRX = EEPROM.read (LOCATION_IGNORE_RX);
10
+ settingIgnoreRX = EEPROM.read (LOCATION_IGNORE_RX);
11
11
12
- // Display new settings to the user
13
- SerLCD.clear ();
14
- SerLCD.setCursor (0 , 0 );
12
+ settingIgnoreRX != settingIgnoreRX; // Toggle setting
15
13
16
- SerLCD.print (F (" Ignore RX O" ));
14
+ // Record this new setting
15
+ EEPROM.update (LOCATION_IGNORE_RX, settingIgnoreRX);
17
16
18
- if (settingIgnoreRX == true )
19
- {
20
- settingIgnoreRX = false ;
21
- SerLCD.print (F (" FF" ));
22
- }
23
- else
17
+ if (settingDisplaySystemMessages == true )
24
18
{
25
- settingIgnoreRX = true ;
26
- SerLCD.print (F (" N" ));
19
+ // Display new settings to the user
20
+ SerLCD.clear ();
21
+ SerLCD.setCursor (0 , 0 );
22
+
23
+ SerLCD.print (F (" Ignore RX O" ));
24
+
25
+ if (settingIgnoreRX == true )
26
+ SerLCD.print (F (" FF" ));
27
+ else
28
+ SerLCD.print (F (" N" ));
29
+
30
+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
31
+
32
+ displayFrameBuffer (); // Return the contents of the display
27
33
}
28
- // Record this new setting
29
- EEPROM.update (LOCATION_IGNORE_RX, settingIgnoreRX);
34
+ }
30
35
31
- petSafeDelay (SYSTEM_MESSAGE_DELAY);
36
+ // Toggle the 'displaySystemMessages' setting
37
+ void changeDisplaySystemMessages ()
38
+ {
39
+ settingDisplaySystemMessages = EEPROM.read (LOCATION_DISPLAY_SYSTEM_MESSAGES);
32
40
33
- displayFrameBuffer (); // Return the contents of the display
41
+ settingDisplaySystemMessages != settingDisplaySystemMessages; // Toggle the setting
42
+
43
+ // Record this new setting
44
+ EEPROM.update (LOCATION_DISPLAY_SYSTEM_MESSAGES, settingDisplaySystemMessages);
45
+
46
+ // If user has just enabled messages, then push message to display
47
+ if (settingDisplaySystemMessages == true )
48
+ {
49
+ // Display new setting to the user
50
+ SerLCD.clear ();
51
+ SerLCD.setCursor (0 , 0 );
52
+ SerLCD.print (F (" Messages ON" ));
53
+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
54
+ displayFrameBuffer (); // Return the contents of the display
55
+ }
34
56
}
35
57
36
58
// Display the current firmware version for a set amount of time
@@ -58,16 +80,19 @@ void changeContrast(byte contrast)
58
80
// Go to this new contrast
59
81
analogWrite (LCD_CONTRAST, contrast);
60
82
61
- // Display the new contrast
62
- SerLCD.clear ();
63
- SerLCD.setCursor (0 , 0 ); // First position, 1st row
64
- SerLCD.print (" Contrast Set" );
65
- SerLCD.setCursor (0 , 1 ); // First position, 2nd row
66
- SerLCD.print (contrast);
83
+ if (settingDisplaySystemMessages == true )
84
+ {
85
+ // Display the new contrast
86
+ SerLCD.clear ();
87
+ SerLCD.setCursor (0 , 0 ); // First position, 1st row
88
+ SerLCD.print (" Contrast Set" );
89
+ SerLCD.setCursor (0 , 1 ); // First position, 2nd row
90
+ SerLCD.print (contrast);
67
91
68
- petSafeDelay (SYSTEM_MESSAGE_DELAY);
92
+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
69
93
70
- displayFrameBuffer (); // Display what was there before
94
+ displayFrameBuffer (); // Display what was there before
95
+ }
71
96
}
72
97
73
98
// Change the I2C or TWI address
@@ -78,16 +103,19 @@ void changeTWIAddress(byte newAddress)
78
103
79
104
setupTWI (); // Leverage the regular startup function
80
105
81
- // Display the new TWI address
82
- SerLCD.clear ();
83
- SerLCD.setCursor (0 , 0 ); // First position, 1st row
106
+ if (settingDisplaySystemMessages == true )
107
+ {
108
+ // Display the new TWI address
109
+ SerLCD.clear ();
110
+ SerLCD.setCursor (0 , 0 ); // First position, 1st row
84
111
85
- SerLCD.print (" New TWI: 0x" );
86
- SerLCD.print (newAddress, HEX);
112
+ SerLCD.print (" New TWI: 0x" );
113
+ SerLCD.print (newAddress, HEX);
87
114
88
- petSafeDelay (SYSTEM_MESSAGE_DELAY);
115
+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
89
116
90
- displayFrameBuffer (); // Display what was there before
117
+ displayFrameBuffer (); // Display what was there before
118
+ }
91
119
}
92
120
93
121
// Save the current frame buffer to EEPROM as the splash screen
@@ -97,15 +125,18 @@ void changeSplashContent()
97
125
for (byte x = 0 ; x < settingLCDlines * settingLCDwidth ; x++)
98
126
EEPROM.update (LOCATION_SPLASH_CONTENT + x, currentFrame[x]);
99
127
100
- // Display the backlight setting
101
- SerLCD.clear ();
102
- SerLCD.setCursor (0 , 0 ); // First position, 1st row
128
+ if (settingDisplaySystemMessages == true )
129
+ {
130
+ // Display the backlight setting
131
+ SerLCD.clear ();
132
+ SerLCD.setCursor (0 , 0 ); // First position, 1st row
103
133
104
- SerLCD.print (" Splash Recorded" );
134
+ SerLCD.print (" Splash Recorded" );
105
135
106
- petSafeDelay (SYSTEM_MESSAGE_DELAY);
136
+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
107
137
108
- displayFrameBuffer (); // Display what was there before
138
+ displayFrameBuffer (); // Display what was there before
139
+ }
109
140
}
110
141
111
142
// Changes the brightness of a given pin and updates the EEPROM location with that value
@@ -129,25 +160,28 @@ void changeBLBrightness(byte color, byte brightness)
129
160
SoftPWMSet (BL_B, 255 - brightness); // Controlled by software PWM
130
161
}
131
162
132
- // Display the backlight setting
133
- SerLCD.clear ();
134
- SerLCD.setCursor (0 , 0 ); // First position, 1st row
163
+ if (settingDisplaySystemMessages == true )
164
+ {
165
+ // Display the backlight setting
166
+ SerLCD.clear ();
167
+ SerLCD.setCursor (0 , 0 ); // First position, 1st row
135
168
136
- if (color == RED)
137
- SerLCD.print (F (" Backlight" ));
138
- else if (color == GREEN)
139
- SerLCD.print (F (" Green" ));
140
- else if (color == BLUE)
141
- SerLCD.print (F (" Blue" ));
169
+ if (color == RED)
170
+ SerLCD.print (F (" Backlight" ));
171
+ else if (color == GREEN)
172
+ SerLCD.print (F (" Green" ));
173
+ else if (color == BLUE)
174
+ SerLCD.print (F (" Blue" ));
142
175
143
- SerLCD.print (F (" : " ));
176
+ SerLCD.print (F (" : " ));
144
177
145
- brightness = map (brightness, 0 , 255 , 0 , 100 ); // Covert to percentage
146
- SerLCD.print (brightness);
147
- SerLCD.print (F (" %" ));
148
- petSafeDelay (SYSTEM_MESSAGE_DELAY);
178
+ brightness = map (brightness, 0 , 255 , 0 , 100 ); // Covert to percentage
179
+ SerLCD.print (brightness);
180
+ SerLCD.print (F (" %" ));
181
+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
149
182
150
- displayFrameBuffer (); // Display what was there before
183
+ displayFrameBuffer (); // Display what was there before
184
+ }
151
185
}
152
186
153
187
// Changes the brightness of all three backlight pins and updates the EEPROM locations
@@ -218,45 +252,48 @@ void changeUARTSpeed(byte setting)
218
252
// Record this new buad rate
219
253
EEPROM.update (LOCATION_BAUD, settingUARTSpeed);
220
254
221
- // Display that we are at this new speed
222
- SerLCD.clear ();
223
- SerLCD.setCursor (0 , 0 ); // First position, 1st row
224
- SerLCD.print (F (" Baud now:" ));
225
- SerLCD.print (lookUpBaudRate (settingUARTSpeed));
226
- petSafeDelay (SYSTEM_MESSAGE_DELAY);
227
-
228
255
// Go to this new baud rate
229
256
Serial.begin (lookUpBaudRate (settingUARTSpeed));
230
257
231
- displayFrameBuffer (); // Display what was there before
258
+ if (settingDisplaySystemMessages == true )
259
+ {
260
+ // Display that we are at this new speed
261
+ SerLCD.clear ();
262
+ SerLCD.setCursor (0 , 0 ); // First position, 1st row
263
+ SerLCD.print (F (" Baud now:" ));
264
+ SerLCD.print (lookUpBaudRate (settingUARTSpeed));
265
+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
266
+
267
+ displayFrameBuffer (); // Display what was there before
268
+ }
232
269
}
233
270
234
271
void changeSplashEnable ()
235
272
{
236
- byte settingSplashEnable = EEPROM.read (LOCATION_SPLASH_ONOFF);
273
+ settingSplashEnable = EEPROM.read (LOCATION_SPLASH_ONOFF);
237
274
238
- // Display new settings to the user
239
- SerLCD.clear ();
240
- SerLCD.setCursor (0 , 0 );
275
+ settingSplashEnable != settingSplashEnable; // Toggle setting
241
276
242
- SerLCD.print (F (" Splash O" ));
277
+ // Record this new setting
278
+ EEPROM.update (LOCATION_SPLASH_ONOFF, settingSplashEnable);
243
279
244
- if (settingSplashEnable == true )
280
+ if (settingDisplaySystemMessages == true )
245
281
{
246
- settingSplashEnable = false ;
247
- SerLCD.print (F (" FF" ));
248
- }
249
- else
250
- {
251
- settingSplashEnable = true ;
252
- SerLCD.print (F (" N" ));
253
- }
254
- petSafeDelay (SYSTEM_MESSAGE_DELAY);
282
+ // Display new settings to the user
283
+ SerLCD.clear ();
284
+ SerLCD.setCursor (0 , 0 );
255
285
256
- // Record this new setting
257
- EEPROM.update (LOCATION_SPLASH_ONOFF, settingSplashEnable);
286
+ SerLCD.print (F (" Splash O" ));
258
287
259
- displayFrameBuffer (); // Return the contents of the display
288
+ if (settingSplashEnable == true )
289
+ SerLCD.print (F (" FF" ));
290
+ else
291
+ SerLCD.print (F (" N" ));
292
+
293
+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
294
+
295
+ displayFrameBuffer (); // Return the contents of the display
296
+ }
260
297
}
261
298
262
299
void changeLinesWidths (byte setting)
@@ -290,28 +327,31 @@ void changeLinesWidths(byte setting)
290
327
EEPROM.update (LOCATION_WIDTH, settingLCDwidth);
291
328
EEPROM.update (LOCATION_LINES, settingLCDlines);
292
329
293
- // Display new settings to the user
294
- SerLCD.clear ();
295
- SerLCD.setCursor (0 , 0 );
296
-
297
- SerLCD.print (F (" Lines:" ));
298
- SerLCD.print (settingLCDlines);
299
-
300
- // If we have a single line LCD then clear the message after a second and print more
301
- if (settingLCDlines == 1 )
330
+ if (settingDisplaySystemMessages == true )
302
331
{
303
- petSafeDelay (SYSTEM_MESSAGE_DELAY);
332
+ // Display new settings to the user
304
333
SerLCD.clear ();
305
334
SerLCD.setCursor (0 , 0 );
306
- }
307
- else
308
- {
309
- SerLCD.setCursor (0 , 1 ); // We are assuming at least a two line LCD
310
- }
311
335
312
- SerLCD.print (F (" Width:" ));
313
- SerLCD.print (settingLCDwidth);
314
- petSafeDelay (SYSTEM_MESSAGE_DELAY);
336
+ SerLCD.print (F (" Lines:" ));
337
+ SerLCD.print (settingLCDlines);
338
+
339
+ // If we have a single line LCD then clear the message after a second and print more
340
+ if (settingLCDlines == 1 )
341
+ {
342
+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
343
+ SerLCD.clear ();
344
+ SerLCD.setCursor (0 , 0 );
345
+ }
346
+ else
347
+ {
348
+ SerLCD.setCursor (0 , 1 ); // We are assuming at least a two line LCD
349
+ }
350
+
351
+ SerLCD.print (F (" Width:" ));
352
+ SerLCD.print (settingLCDwidth);
353
+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
315
354
316
- displayFrameBuffer (); // Return the contents of the display
355
+ displayFrameBuffer (); // Return the contents of the display
356
+ }
317
357
}
0 commit comments