diff options
Diffstat (limited to 'main.c')
-rwxr-xr-x | main.c | 60 |
1 files changed, 13 insertions, 47 deletions
@@ -89,53 +89,17 @@ void main(void) { #ifdef VFD
Vfd_Set_Brightness(3); //Max brightness 3 - minimum
#endif
-
- while(1){
-
- }
-}
-void New_Second() {
- // Set time and date variables from DS3231
- //#ifdef DEBUG
- // UART_send_string("Updating current date time from DS3231\r\n");
- //#endif
- Update_Current_Date_Time();
-
- // Read temp
- //#ifdef DEBUG
- // UART_send_string("Reading Alarms and Temperature");
- //#endif
- Read_Alarms_Temp();
-
- // Get Alarm Status
- Get_Alarm_Status();
-
- // Separate the int timedate variables into chars
- //#ifdef DEBUG
- // UART_send_string("Formatting chars");
- //#endif
- format_DateTimeChars();
-
- // Format temperature
- //#ifdef DEBUG
- // UART_send_string("Formating temperature");
- //#endif
- format_Temperature();
-
- // Determine day of the week from Calendar Date
- //#ifdef DEBUG
- // UART_send_string("Determining day of week");
- //#endif
- getWeekDay(Get_DayOfWeek(year, month, date));
-
- // Enter loop and update display if sec changes from DS3231
- if (sec_chg != sec) {
-
- update_Display();
-
- // Set temp_sec to current sec from DS3231
- sec_chg = sec;
+ while (1) {
+ Update_Current_Date_Time();
+ Read_Alarms_Temp();
+ Get_Alarm_Status();
+ format_DateTimeChars();
+ format_Temperature();
+ getWeekDay(Get_DayOfWeek(year, month, date));
+ if (update) {
+ update_Display();
+ }
}
#ifdef ADC
@@ -349,6 +313,8 @@ void update_Display() { void __interrupt() isr(void) {
if (INTF == 1) {
INTF = 0;
- New_Second();
+ update = 1;
+ } else {
+ update = 0;
}
}
\ No newline at end of file |