static s8 sync(struct client *c,struct msg *m) { if(m->req_dws<3){ PERR("client(%d):fatal:display::sync request misses callback_id\n",c->so); return LWL_ERR; } LOG_WIRE("client(%d):display::sync callback_id=%u\n",c->so,m->req[2]); return display_sync(c,m->req[2]); }
// ************************************************************************************************* // @fn mx_time // @brief Clock set routine. // @param u8 line LINE1, LINE2 // @return none // ************************************************************************************************* void mx_time(u8 line) { u8 select; s32 timeformat; s16 timeformat1; s32 hours; s32 minutes; s32 seconds; u8 * str; // Clear display clear_display_all(); #ifdef CONFIG_USE_SYNC_TOSET_TIME if (sys.flag.low_battery) return; display_sync(LINE2, DISPLAY_LINE_UPDATE_FULL); start_simpliciti_sync(); #else // Convert global time to local variables // Global time keeps on ticking in background until it is overwritten if (sys.flag.am_pm_time) { timeformat = TIMEFORMAT_12H; } else { timeformat = TIMEFORMAT_24H; } timeformat1 = timeformat; hours = sTime.hour; minutes = sTime.minute; seconds = sTime.second; // Init value index select = 0; // Loop values until all are set or user breaks set while(1) { // Idle timeout: exit without saving if (sys.flag.idle_timeout) { // Roll back time format if (timeformat1 == TIMEFORMAT_12H) sys.flag.am_pm_time = 1; else sys.flag.am_pm_time = 0; display_symbol(LCD_SYMB_AM, SEG_OFF); break; } // Button STAR (short): save, then exit if (button.flag.star) { // Stop clock timer Timer0_Stop(); // Store local variables in global clock time sTime.hour = hours; sTime.minute = minutes; sTime.second = seconds; // Start clock timer Timer0_Start(); // Full display update is done when returning from function display_symbol(LCD_SYMB_AM, SEG_OFF); #ifdef CONFIG_SIDEREAL if(sSidereal_time.sync>0) sync_sidereal(); #endif break; } switch (select) { #if (OPTION_TIME_DISPLAY == CLOCK_DISPLAY_SELECT) case 0: // Clear LINE1 and LINE2 and AM icon - required when coming back from set_value(seconds) clear_display(); display_symbol(LCD_SYMB_AM, SEG_OFF); // Set 24H / 12H time format set_value(&timeformat, 1, 0, 0, 1, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_SELECTION + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_1, display_selection_Timeformat1); // Modify global time format variable immediately to update AM/PM icon correctly if (timeformat == TIMEFORMAT_12H) sys.flag.am_pm_time = 1; else sys.flag.am_pm_time = 0; select = 1; break; #else case 0: #endif case 1: // Display HH:MM (LINE1) and .SS (LINE2) str = itoa(hours, 2, 0); display_chars(LCD_SEG_L1_3_2, str, SEG_ON); display_symbol(LCD_SEG_L1_COL, SEG_ON); str = itoa(minutes, 2, 0); display_chars(LCD_SEG_L1_1_0, str, SEG_ON); str = itoa(seconds, 2, 0); display_chars(LCD_SEG_L2_1_0, str, SEG_ON); display_symbol(LCD_SEG_L2_DP, SEG_ON); // Set hours set_value(&hours, 2, 0, 0, 23, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_3_2, display_hours_12_or_24); select = 2; break; case 2: // Set minutes set_value(&minutes, 2, 0, 0, 59, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L1_1_0, display_value1); select = 3; break; case 3: // Set seconds set_value(&seconds, 2, 0, 0, 59, SETVALUE_ROLLOVER_VALUE + SETVALUE_DISPLAY_VALUE + SETVALUE_NEXT_VALUE, LCD_SEG_L2_1_0, display_value1); select = 0; break; } } // Clear button flags button.all_flags = 0; #endif }
/* If you want to pause on showpage, then don't return immediately */ static int display_page(void *handle, void *device, int copies, int flush) { return display_sync(handle, device); }