From 0067edc5b237c817ef896455527c34b43bfcce67 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Thu, 8 Aug 2019 02:57:17 -0500 Subject: When user doesn't change any date/time, make sure that when an elemnt of date/time wasn't changed. Gotta be a better way to do this. --- main.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/main.c b/main.c index a30fd28..a3ac98e 100755 --- a/main.c +++ b/main.c @@ -396,7 +396,6 @@ void edit_Date_Time(void) { Lcd_Set_Cursor(1, 1); display_Digit(hour); } - updateRTC |= (hour_org == hour); break; @@ -424,8 +423,7 @@ void edit_Date_Time(void) { Lcd_Set_Cursor(1, 4); display_Digit(min); } - updateRTC |= (min_org == min); - + break; case 3: //Seconds @@ -458,8 +456,7 @@ void edit_Date_Time(void) { updateRTC = 1; } } - updateRTC |= (sec_org == sec); - + break; case 6: //Date @@ -492,8 +489,7 @@ void edit_Date_Time(void) { Lcd_Set_Cursor(2, 6); display_Digit(date); } - updateRTC |= (date_org == date); - + break; case 5: //Month @@ -520,8 +516,7 @@ void edit_Date_Time(void) { Lcd_Set_Cursor(2, 9); display_Digit(month); } - updateRTC |= (month_org == month); - + break; case 4: //Year @@ -548,8 +543,7 @@ void edit_Date_Time(void) { Lcd_Set_Cursor(2, 14); display_Digit(year); } - updateRTC |= (year_org == year); - + break; //TODO Maybe add a case to edit century on display @@ -576,7 +570,12 @@ void edit_Date_Time(void) { Lcd_Write_String(" "); edit_datetime = 0; - if(updateRTC) { + /* + * If any date/time field was changed, clear updateRTC field and + * update RTC. + */ + if(hour_org != hour || min_org != min || sec_org != sec + || year_org != year || month_org != month || date_org != date) { updateRTC = 0; Set_Time(); Set_DayOfWeek(Get_DayOfWeek(year, month, date)); -- cgit v1.2.3-54-g00ecf