/* * Bed time with the alarm turned off */ static void reset_with_alarm_off() { if (get_config_data()->smart) { get_config_data()->smart = false; trigger_config_save(); set_smart_status(); } reset_sleep_period(); }
/* * Drop values back into the rest of the system */ static void return_values() { get_config_data()->smart = true; get_config_data()->fromhr = hour_from_fields(values[F_FROM_HOUR],values[F_FROM_AMPM]); get_config_data()->frommin = values[F_FROM_MINUTE]; get_config_data()->tohr = hour_from_fields(values[F_TO_HOUR],values[F_TO_AMPM]); get_config_data()->tomin = values[F_TO_MINUTE]; get_config_data()->from = to_mins(get_config_data()->fromhr, get_config_data()->frommin); get_config_data()->to = to_mins(get_config_data()->tohr, get_config_data()->tomin); resend_all_data(true); // Force resend - we've fiddled with the times trigger_config_save(); set_smart_status(); }
/* * Do menu action after shutting the menu and allowing time for the animations to complete */ static void do_menu_action(void *data) { get_config_data()->fromhr = preset_data.fromhr[selected_row]; get_config_data()->frommin = preset_data.frommin[selected_row]; get_config_data()->tohr = preset_data.tohr[selected_row]; get_config_data()->tomin = preset_data.tomin[selected_row]; get_config_data()->from = preset_data.from[selected_row]; get_config_data()->to = preset_data.to[selected_row]; get_config_data()->smart = true; resend_all_data(true); // Force resend - we've fiddled with the times trigger_config_save(); set_smart_status(); }
/* * Do menu action after shutting the menu and allowing time for the animations to complete */ static void do_menu_action(void *data) { uint8_t no = menu_def[selected_row].no; if (menu_def[selected_row].set) { preset_data.fromhr[no] = get_config_data()->fromhr; preset_data.frommin[no] = get_config_data()->frommin; preset_data.tohr[no] = get_config_data()->tohr; preset_data.tomin[no] = get_config_data()->tomin; preset_data.from[no] = get_config_data()->from; preset_data.to[no] = get_config_data()->to; save_preset_data(); } else { get_config_data()->fromhr = preset_data.fromhr[no]; get_config_data()->frommin = preset_data.frommin[no]; get_config_data()->tohr = preset_data.tohr[no]; get_config_data()->tomin = preset_data.tomin[no]; get_config_data()->from = preset_data.from[no]; get_config_data()->to = preset_data.to[no]; get_config_data()->smart = true; resend_all_data(true); // Force resend - we've fiddled with the times trigger_config_save(); set_smart_status(); } }
/* * Analogue option */ static void menu_analogue() { get_config_data()->analogue = !get_config_data()->analogue; trigger_config_save(); analogue_visible(get_config_data()->analogue, false); }
/* * Toggle the smart alarm */ static void toggle_alarm() { get_config_data()->smart = !get_config_data()->smart; resend_all_data(true); // Force resend - we've fiddled with the times trigger_config_save(); set_smart_status(); }