77// Toggle the ignore rx setting
88void changeIgnore ()
99{
10- byte settingIgnoreRX = EEPROM.read (LOCATION_IGNORE_RX);
10+ settingIgnoreRX = EEPROM.read (LOCATION_IGNORE_RX);
1111
12- // Display new settings to the user
13- SerLCD.clear ();
14- SerLCD.setCursor (0 , 0 );
12+ settingIgnoreRX != settingIgnoreRX; // Toggle setting
1513
16- SerLCD.print (F (" Ignore RX O" ));
14+ // Record this new setting
15+ EEPROM.update (LOCATION_IGNORE_RX, settingIgnoreRX);
1716
18- if (settingIgnoreRX == true )
19- {
20- settingIgnoreRX = false ;
21- SerLCD.print (F (" FF" ));
22- }
23- else
17+ if (settingDisplaySystemMessages == true )
2418 {
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
2733 }
28- // Record this new setting
29- EEPROM.update (LOCATION_IGNORE_RX, settingIgnoreRX);
34+ }
3035
31- petSafeDelay (SYSTEM_MESSAGE_DELAY);
36+ // Toggle the 'displaySystemMessages' setting
37+ void changeDisplaySystemMessages ()
38+ {
39+ settingDisplaySystemMessages = EEPROM.read (LOCATION_DISPLAY_SYSTEM_MESSAGES);
3240
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+ }
3456}
3557
3658// Display the current firmware version for a set amount of time
@@ -58,16 +80,19 @@ void changeContrast(byte contrast)
5880 // Go to this new contrast
5981 analogWrite (LCD_CONTRAST, contrast);
6082
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);
6791
68- petSafeDelay (SYSTEM_MESSAGE_DELAY);
92+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
6993
70- displayFrameBuffer (); // Display what was there before
94+ displayFrameBuffer (); // Display what was there before
95+ }
7196}
7297
7398// Change the I2C or TWI address
@@ -78,16 +103,19 @@ void changeTWIAddress(byte newAddress)
78103
79104 setupTWI (); // Leverage the regular startup function
80105
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
84111
85- SerLCD.print (" New TWI: 0x" );
86- SerLCD.print (newAddress, HEX);
112+ SerLCD.print (" New TWI: 0x" );
113+ SerLCD.print (newAddress, HEX);
87114
88- petSafeDelay (SYSTEM_MESSAGE_DELAY);
115+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
89116
90- displayFrameBuffer (); // Display what was there before
117+ displayFrameBuffer (); // Display what was there before
118+ }
91119}
92120
93121// Save the current frame buffer to EEPROM as the splash screen
@@ -97,15 +125,18 @@ void changeSplashContent()
97125 for (byte x = 0 ; x < settingLCDlines * settingLCDwidth ; x++)
98126 EEPROM.update (LOCATION_SPLASH_CONTENT + x, currentFrame[x]);
99127
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
103133
104- SerLCD.print (" Splash Recorded" );
134+ SerLCD.print (" Splash Recorded" );
105135
106- petSafeDelay (SYSTEM_MESSAGE_DELAY);
136+ petSafeDelay (SYSTEM_MESSAGE_DELAY);
107137
108- displayFrameBuffer (); // Display what was there before
138+ displayFrameBuffer (); // Display what was there before
139+ }
109140}
110141
111142// 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)
129160 SoftPWMSet (BL_B, 255 - brightness); // Controlled by software PWM
130161 }
131162
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
135168
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" ));
142175
143- SerLCD.print (F (" : " ));
176+ SerLCD.print (F (" : " ));
144177
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);
149182
150- displayFrameBuffer (); // Display what was there before
183+ displayFrameBuffer (); // Display what was there before
184+ }
151185}
152186
153187// Changes the brightness of all three backlight pins and updates the EEPROM locations
@@ -218,45 +252,48 @@ void changeUARTSpeed(byte setting)
218252 // Record this new buad rate
219253 EEPROM.update (LOCATION_BAUD, settingUARTSpeed);
220254
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-
228255 // Go to this new baud rate
229256 Serial.begin (lookUpBaudRate (settingUARTSpeed));
230257
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+ }
232269}
233270
234271void changeSplashEnable ()
235272{
236- byte settingSplashEnable = EEPROM.read (LOCATION_SPLASH_ONOFF);
273+ settingSplashEnable = EEPROM.read (LOCATION_SPLASH_ONOFF);
237274
238- // Display new settings to the user
239- SerLCD.clear ();
240- SerLCD.setCursor (0 , 0 );
275+ settingSplashEnable != settingSplashEnable; // Toggle setting
241276
242- SerLCD.print (F (" Splash O" ));
277+ // Record this new setting
278+ EEPROM.update (LOCATION_SPLASH_ONOFF, settingSplashEnable);
243279
244- if (settingSplashEnable == true )
280+ if (settingDisplaySystemMessages == true )
245281 {
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 );
255285
256- // Record this new setting
257- EEPROM.update (LOCATION_SPLASH_ONOFF, settingSplashEnable);
286+ SerLCD.print (F (" Splash O" ));
258287
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+ }
260297}
261298
262299void changeLinesWidths (byte setting)
@@ -290,28 +327,31 @@ void changeLinesWidths(byte setting)
290327 EEPROM.update (LOCATION_WIDTH, settingLCDwidth);
291328 EEPROM.update (LOCATION_LINES, settingLCDlines);
292329
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 )
302331 {
303- petSafeDelay (SYSTEM_MESSAGE_DELAY);
332+ // Display new settings to the user
304333 SerLCD.clear ();
305334 SerLCD.setCursor (0 , 0 );
306- }
307- else
308- {
309- SerLCD.setCursor (0 , 1 ); // We are assuming at least a two line LCD
310- }
311335
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);
315354
316- displayFrameBuffer (); // Return the contents of the display
355+ displayFrameBuffer (); // Return the contents of the display
356+ }
317357}
0 commit comments