// ************************************************************************************************* // @fn display_alarm // @brief Display alarm time. 24H / 12H time format. // @param u8 line LINE1, LINE2 // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_CLEAR // @return none // ************************************************************************************************* void display_alarm(u8 line, u8 update) { #ifndef CONFIG_METRIC_ONLY u8 hour12; #endif if (update == DISPLAY_LINE_UPDATE_FULL) { #ifdef CONFIG_METRIC_ONLY display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sAlarm.hour, 2, 0), SEG_ON); #else if (sys.flag.use_metric_units) { // Display 24H alarm time "HH:MM" display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sAlarm.hour, 2, 0), SEG_ON); } else { // Display 12H alarm time "HH:MM" + AM/PM hour12 = convert_hour_to_12H_format(sAlarm.hour); display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(hour12, 2, 0), SEG_ON); // Display AM/PM symbol display_am_pm_symbol(sAlarm.hour); } #endif display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), itoa(sAlarm.minute, 2, 0), SEG_ON); display_symbol(switch_seg(line, LCD_SEG_L1_COL, LCD_SEG_L2_COL0), SEG_ON); // Show blinking alarm icon display_symbol(LCD_ICON_ALARM, SEG_ON_BLINK_ON); // // If alarm is enabled, show icon // if (sAlarm.state == ALARM_ENABLED) // { // display_symbol(LCD_ICON_ALARM, SEG_ON_BLINK_OFF); // } // // When alarm is disabled, blink icon to indicate that this is not current time! // else if (sAlarm.state == ALARM_DISABLED) // { // } } else if (update == DISPLAY_LINE_CLEAR) { // Clean up function-specific segments before leaving function display_symbol(LCD_SYMB_AM, SEG_OFF); // Clear / set alarm icon if (sAlarm.state == ALARM_DISABLED) { display_symbol(LCD_ICON_ALARM, SEG_OFF_BLINK_OFF); } else { display_symbol(LCD_ICON_ALARM, SEG_ON_BLINK_OFF); } } }
// ************************************************************************************************* // @fn display_alarm // @brief Display alarm time. 24H / 12H time format. // @param u8 line LINE1, LINE2 // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_CLEAR // @return none // ************************************************************************************************* void display_alarm(u8 line, u8 update) { u8 hour12; if (update == DISPLAY_LINE_UPDATE_FULL) { if (sys.flag.use_metric_units) { // Display 24H alarm time "HH:MM" display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), int_to_array(sAlarm.hour, 2, 0), SEG_ON); } else { // Display 12H alarm time "HH:MM" + AM/PM hour12 = convert_hour_to_12H_format(sAlarm.hour); display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), int_to_array(hour12, 2, 0), SEG_ON); // Display AM/PM symbol display_am_pm_symbol(sAlarm.hour); } display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), int_to_array(sAlarm.minute, 2, 0), SEG_ON); display_symbol(switch_seg(line, LCD_SEG_L1_COL, LCD_SEG_L2_COL0), SEG_ON); // Show blinking alarm icon display_symbol(LCD_ICON_ALARM, SEG_ON_BLINK_ON); } else if (update == DISPLAY_LINE_CLEAR) { // Clean up function-specific segments before leaving function display_symbol(LCD_SYMB_AM, SEG_OFF); // Clear / set alarm icon if (sAlarm.state == ALARM_DISABLED) { display_symbol(LCD_ICON_ALARM, SEG_OFF_BLINK_OFF); } else { display_symbol(LCD_ICON_ALARM, SEG_ON_BLINK_OFF); } } }
// ************************************************************************************************* // @fn display_time // @brief Clock display routine. Supports 24H and 12H time format. // @param u8 line LINE1 // u8 update DISPLAY_LINE_UPDATE_FULL, // DISPLAY_LINE_UPDATE_PARTIAL // @return none // ************************************************************************************************* void display_time(u8 update) { u8 hour12; float sidereal; s32 sideint; // Partial update display_symbol(LCD_ICON_RECORD, SEG_OFF); if (update == DISPLAY_LINE_UPDATE_PARTIAL) { if (sTime.drawFlag != 0) { if (sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW) { switch (sTime.drawFlag) { case 3: if (sys.flag.use_metric_units) { // Display 24H time "HH" display_chars(LCD_SEG_L1_3_2, int_to_array(sTime.hour, 2, 0), SEG_ON); } else { // Display 12H time "HH" + AM/PM hour12 = convert_hour_to_12H_format(sTime.hour); display_chars(LCD_SEG_L1_3_2, int_to_array(hour12, 2, 0), SEG_ON); display_am_pm_symbol(sTime.hour); } case 2: display_chars(LCD_SEG_L1_1_0, int_to_array(sTime.minute, 2, 0), SEG_ON); } } else { display_time(DISPLAY_LINE_UPDATE_FULL); } } } else if (update == DISPLAY_LINE_UPDATE_FULL) { // Full update if (sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW) { // Display 24H/12H time hour12 = sTime.hour; if (!sys.flag.use_metric_units) { // Display 12H time "HH" + AM/PM information hour12 = convert_hour_to_12H_format(hour12); display_am_pm_symbol(sTime.hour); } display_chars(LCD_SEG_L1_3_2, int_to_array(hour12, 2, 0), SEG_ON); // Display minute display_chars(LCD_SEG_L1_1_0, int_to_array(sTime.minute, 2, 0), SEG_ON); } else { // Display sidereal display_symbol(LCD_ICON_RECORD, SEG_ON); sidereal = (sTime.second + 60.0F * ((sTime.minute - sminute) + 60.0F * ((sTime.hour - shour) + 24.0F * sday))) * 1.0027378956F; sideint = (s32)sidereal / 60;//sidereal minutes display_chars(LCD_SEG_L1_1_0, int_to_array(sideint % 60, 2, 0), SEG_ON); sideint /= 60;//sidereal hours display_chars(LCD_SEG_L1_3_2, int_to_array(sideint % 24, 2, 0), SEG_ON); if(sday > 180) display_chars(LCD_SEG_L1_3_0, (u8 *) "SYNC", SEG_ON);//out of range } display_symbol(LCD_SEG_L1_COL, SEG_ON_BLINK_ON); } else if (update == DISPLAY_LINE_CLEAR) { display_symbol(LCD_SEG_L1_COL, SEG_OFF_BLINK_OFF); // Change display style to default (HH:MM) sTime.line1ViewStyle = DISPLAY_DEFAULT_VIEW; // Clean up AM/PM icon display_symbol(LCD_SYMB_AM, SEG_OFF); } }
// ************************************************************************************************* // @fn display_time // @brief Clock display routine. Supports 24H and 12H time format. // @param u8 line LINE1 // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_UPDATE_PARTIAL // @return none // ************************************************************************************************* void display_time(u8 line, u8 update) { u8 hour12; // Partial update if (update == DISPLAY_LINE_UPDATE_PARTIAL) { if(sTime.drawFlag != 0) { if (sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW) { switch(sTime.drawFlag) { case 3: if (sys.flag.use_metric_units) { // Display 24H time "HH" display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sTime.hour, 2, 0), SEG_ON); } else { // Display 12H time "HH" + AM/PM hour12 = convert_hour_to_12H_format(sTime.hour); display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(hour12, 2, 0), SEG_ON); display_am_pm_symbol(sTime.hour); } case 2: display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), itoa(sTime.minute, 2, 0), SEG_ON); } } else { // Seconds are always updated display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), itoa(sTime.second, 2, 0), SEG_ON); } } } else if (update == DISPLAY_LINE_UPDATE_FULL) { // Full update if (sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW) { // Display 24H/12H time if (sys.flag.use_metric_units) { // Display 24H time "HH" display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(sTime.hour, 2, 0), SEG_ON); } else { // Display 12H time "HH" + AM/PM information hour12 = convert_hour_to_12H_format(sTime.hour); display_chars(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), itoa(hour12, 2, 0), SEG_ON); // Display AM/PM information if (line == LINE1) { display_am_pm_symbol(sTime.hour); } } // Display minute display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), itoa(sTime.minute, 2, 0), SEG_ON); display_symbol(switch_seg(line, LCD_SEG_L1_COL, LCD_SEG_L2_COL0), SEG_ON_BLINK_ON); } else { // Display seconds display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), itoa(sTime.second, 2, 0), SEG_ON); display_symbol(switch_seg(line, LCD_SEG_L1_DP1, LCD_SEG_L2_DP), SEG_ON); } } else if (update == DISPLAY_LINE_CLEAR) { display_symbol(switch_seg(line, LCD_SEG_L1_COL, LCD_SEG_L2_COL0), SEG_OFF_BLINK_OFF); // Change display style to default (HH:MM) sTime.line1ViewStyle = DISPLAY_DEFAULT_VIEW; // Clean up AM/PM icon display_symbol(LCD_SYMB_AM, SEG_OFF); } }