// ************************************************************************************************* // @fn display_time // @brief Clock display routine. Supports 24H and 12H time format, // through the helper display_hours_with_12_24. // @param u8 line LINE1 // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_UPDATE_PARTIAL // @return none // ************************************************************************************************* void display_time(u8 line, u8 update) { // Partial and full update if (update == DISPLAY_LINE_UPDATE_PARTIAL || update == DISPLAY_LINE_UPDATE_FULL) { if ( ( line == LINE1 && sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW ) || ( line == LINE2 && sTime.line2ViewStyle == DISPLAY_DEFAULT_VIEW ) ) { // Display hours #ifndef LZH display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sTime.hour, 2, 1, SEG_ON); #else display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sTime.hour, 2, 0, SEG_ON); #endif // 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); } }
// ************************************************************************************************* // @fn display_sidereal // @brief Sidereal Clock display routine. Supports 24H and 12H time format, // through the helper display_hours_with_12_24. // @param u8 line LINE1 // u8 update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_UPDATE_PARTIAL // @return none // ************************************************************************************************* void display_sidereal(u8 line, u8 update) { // Partial update if (update == DISPLAY_LINE_UPDATE_PARTIAL) { if(sSidereal_time.drawFlag != 0) { if (sSidereal_time.line1ViewStyle == DISPLAY_DEFAULT_VIEW) { switch(sSidereal_time.drawFlag) { case 3: display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sSidereal_time.hour, 2, 1, SEG_ON); case 2: display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), _itoa(sSidereal_time.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(sSidereal_time.second, 2, 0), SEG_ON); } } } else if (update == DISPLAY_LINE_UPDATE_FULL) { if (line == LINE1) { // display "i" (like in sIdereal) to distinguish sidereal time clock from normal clock display_symbol(LCD_UNIT_L1_I, SEG_ON); } // Full update if ( ( line == LINE1 && sSidereal_time.line1ViewStyle == DISPLAY_DEFAULT_VIEW ) || ( line == LINE2 && sSidereal_time.line2ViewStyle == DISPLAY_DEFAULT_VIEW ) ) { // Display hours display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sSidereal_time.hour, 2, 1, SEG_ON); // Display minute display_chars(switch_seg(line, LCD_SEG_L1_1_0, LCD_SEG_L2_1_0), _itoa(sSidereal_time.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(sSidereal_time.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) // sSidereal_time.line1ViewStyle = DISPLAY_DEFAULT_VIEW; // Clean up AM/PM icon display_symbol(LCD_SYMB_AM, SEG_OFF); // cleanup "i" icon display_symbol(LCD_UNIT_L1_I, SEG_OFF); } }
// ************************************************************************************************* // @fn display_time // @brief Clock display routine. Supports 24H and 12H time format, // through the helper display_hours_with_12_24. // @param uint8_t line LINE1 // uint8_t update DISPLAY_LINE_UPDATE_FULL, DISPLAY_LINE_UPDATE_PARTIAL // @return none // ************************************************************************************************* void display_time(uint8_t line, uint8_t update) { // Partial update if (update == DISPLAY_LINE_UPDATE_PARTIAL) { if(sTime.drawFlag != 0) { if (sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW) { switch(sTime.drawFlag) { case 3: display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sTime.hour, 2, 1, SEG_ON); 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 ( ( line == LINE1 && sTime.line1ViewStyle == DISPLAY_DEFAULT_VIEW ) || ( line == LINE2 && sTime.line2ViewStyle == DISPLAY_DEFAULT_VIEW ) ) { // Display hours display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sTime.hour, 2, 1, SEG_ON); // 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); } }
// ************************************************************************************************* // @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) { if (update == DISPLAY_LINE_UPDATE_FULL) { display_hours_12_or_24(switch_seg(line, LCD_SEG_L1_3_2, LCD_SEG_L2_3_2), sAlarm.hour, 2, 1, SEG_ON); 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); } 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); } } }