Skip to content

Commit

Permalink
Rename and move noTimeRestore flag (/tmp/rtc_available)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aemiii91 committed Dec 23, 2024
1 parent 2cee43a commit 1727779
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/common/system/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ typedef struct settings_s {
int blue_light_rgb;
char blue_light_time[16];
char blue_light_time_off[16];
bool no_time_restore;
bool rtc_available;

char mainui_button_x[JSON_STRING_LEN];
char mainui_button_y[JSON_STRING_LEN];
Expand Down Expand Up @@ -104,7 +104,7 @@ static settings_s __default_settings = (settings_s){
.vibration = 2,
.startup_tab = 0,
.startup_application = 0,
.no_time_restore = false,
.rtc_available = false,
// Menu button actions
.mainui_single_press = 1,
.mainui_long_press = 0,
Expand Down Expand Up @@ -209,7 +209,7 @@ void settings_load(void)
settings.blue_light_schedule = config_flag_get(".blf");
settings.rec_indicator = config_flag_get(".recIndicator");
settings.rec_hotkey = config_flag_get(".recHotkey");
settings.no_time_restore = config_flag_get(".noTimeRestore");
settings.rtc_available = temp_flag_get("rtc_available");

if (config_flag_get(".noLowBatteryAutoSave")) // flag is deprecated, but keep compatibility
settings.low_battery_autosave_at = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/tweaks/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ void menu_themeOverrides(void *_)

void menu_blueLight(void *_)
{
bool schedule_show = (DEVICE_ID == MIYOO354 || settings.no_time_restore || settings.blue_light_schedule);
bool schedule_disable = (!settings.no_time_restore && !network_state.ntp && !settings.blue_light_schedule);
bool schedule_show = (DEVICE_ID == MIYOO354 || settings.rtc_available || settings.blue_light_schedule);
bool schedule_disable = (!settings.rtc_available && !network_state.ntp && !settings.blue_light_schedule);
if (!_menu_user_blue_light._created) {
network_loadState();
_menu_user_blue_light = list_createWithTitle(6, LIST_SMALL, "Blue light filter");
Expand Down
3 changes: 1 addition & 2 deletions static/build/.tmp_update/runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,10 @@ update_time() {

if [ "$current_time" -gt "$rtc_treshold" ]; then
log "RTC available, not restoring time. Current time: $current_time"
touch "$sysdir/config/.noTimeRestore"
touch /tmp/rtc_available
return
else
log "RTC not available, restoring time. Current time: $current_time"
rm -f "$sysdir/config/.noTimeRestore" > /dev/null 2>&1
fi

timepath=/mnt/SDCARD/Saves/CurrentProfile/saves/currentTime.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ You'll find it in Tweaks app: [`Appearance` -› `Blue light filter...`](/docs/a
5. **Time (Off)** - Time Blue light filter will be disabled

:::note
To use Schedule you'll need a Miyoo Mini with RTC and .noTimeRestore set in config or a Miyoo Mini Plus with "[Set time automatically via internet](/docs/apps/tweaks#set-automatically-via-the-internet)" enabled.
To use Schedule you'll need a Miyoo Mini with RTC ~~and .noTimeRestore set in config~~ or a Miyoo Mini Plus with "[Set time automatically via internet](/docs/apps/tweaks#set-automatically-via-the-internet)" enabled.
:::

### Hotkeys

| Button | Function |
| --------------- | ----------------------------------- |
| <kbd>Menu</kbd>+<kbd>B</kbd> <sup>hold 2s</sup> | Force enable/disable Blue light filter |
| Button | Function |
| ----------------------------------------------- | -------------------------------------- |
| <kbd>Menu</kbd>+<kbd>B</kbd> <sup>hold 2s</sup> | Force enable/disable Blue light filter |


0 comments on commit 1727779

Please sign in to comment.