From 1727779afd9bc23e358952263df5bdaeedd0ef03 Mon Sep 17 00:00:00 2001
From: Aemiii91 <44569252+Aemiii91@users.noreply.github.com>
Date: Mon, 23 Dec 2024 22:39:23 +0100
Subject: [PATCH] Rename and move noTimeRestore flag (/tmp/rtc_available)
---
src/common/system/settings.h | 6 +++---
src/tweaks/menus.h | 4 ++--
static/build/.tmp_update/runtime.sh | 3 +--
.../07-apps/01-included-in-onion/blue-light-filter.md | 8 ++++----
4 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/common/system/settings.h b/src/common/system/settings.h
index 4afce304f0..5da8742793 100644
--- a/src/common/system/settings.h
+++ b/src/common/system/settings.h
@@ -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];
@@ -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,
@@ -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;
diff --git a/src/tweaks/menus.h b/src/tweaks/menus.h
index 8490b42488..bbf8cd33e4 100644
--- a/src/tweaks/menus.h
+++ b/src/tweaks/menus.h
@@ -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");
diff --git a/static/build/.tmp_update/runtime.sh b/static/build/.tmp_update/runtime.sh
index fe1a63a386..19d82e0726 100644
--- a/static/build/.tmp_update/runtime.sh
+++ b/static/build/.tmp_update/runtime.sh
@@ -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
diff --git a/website/docs/07-apps/01-included-in-onion/blue-light-filter.md b/website/docs/07-apps/01-included-in-onion/blue-light-filter.md
index daedc8e5f0..95522053f4 100644
--- a/website/docs/07-apps/01-included-in-onion/blue-light-filter.md
+++ b/website/docs/07-apps/01-included-in-onion/blue-light-filter.md
@@ -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 |
-| --------------- | ----------------------------------- |
-| Menu+B hold 2s | Force enable/disable Blue light filter |
+| Button | Function |
+| ----------------------------------------------- | -------------------------------------- |
+| Menu+B hold 2s | Force enable/disable Blue light filter |