diff options
author | William Harrington <kb0iic@berzerkula.org> | 2019-08-01 03:37:39 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2019-08-01 03:37:39 -0500 |
commit | d866095fb395e468be7facfc636f2ee501398498 (patch) | |
tree | 2ee920768d0183093daef6bfda9a00d5ff2bbf62 | |
parent | c6fc933f95a0ce1acc0730e25a031f2d14ebfcdc (diff) |
Remove New_Second method as the interrupt ends up doing too much. Just set a flag that states an update is needed.
-rwxr-xr-x | main.c | 60 | ||||
-rwxr-xr-x | main.h | 9 |
2 files changed, 16 insertions, 53 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 @@ -7,9 +7,8 @@ unsigned int ldr = 0; #define brtlvl ldr/256
unsigned int brtlvl_chg = 0;
-// Initialize for timerr interrupt value
-unsigned int counter = 0;
-unsigned int interrupts = 0;
+// Update to 1 if RB0 interrupt occurs, otherwise 0
+unsigned int update = 0;
// Initialize variables for date time and alarms
unsigned int sec = 0;
@@ -69,6 +68,4 @@ void getWeekDay(unsigned int); // Determine Alarm status from control registers
void Get_Alarm_Status(void);
-void update_Display(void);
-
-void New_Second(void);
\ No newline at end of file +void update_Display(void);
\ No newline at end of file |