Add frontlight off when dark setting
Some checks failed
BTClock CI / build (push) Failing after 1m39s
BTClock CI / merge (map[name:btclock_rev_b version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:btclock_v8 version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 213epd) (push) Has been skipped
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 29epd) (push) Has been skipped
BTClock CI / release (push) Has been skipped

This commit is contained in:
Djuri Baars 2024-12-10 15:13:17 +01:00
parent 3b6f1db3c5
commit 2a116d97ed
4 changed files with 7 additions and 3 deletions

2
data

@ -1 +1 @@
Subproject commit f0fa58b5ea60f695aeaae9ddd7138cbb3686e96a
Subproject commit 25e91b2086936e7c6ef09e917c6efd371293fd7e

View file

@ -45,6 +45,8 @@
#define DEFAULT_FL_EFFECT_DELAY 15
#define DEFAULT_LUX_LIGHT_TOGGLE 128
#define DEFAULT_FL_OFF_WHEN_DARK true
#define DEFAULT_FL_ALWAYS_ON false
#define DEFAULT_FL_FLASH_ON_UPDATE false

View file

@ -546,7 +546,7 @@ void onApiSettingsPatch(AsyncWebServerRequest *request, JsonVariant &json)
"mdnsEnabled", "otaEnabled", "stealFocus",
"mcapBigChar", "useSatsSymbol", "useBlkCountdown",
"suffixPrice", "disableLeds", "ownDataSource",
"mowMode", "suffixShareDot",
"mowMode", "suffixShareDot", "flOffWhenDark",
"flAlwaysOn", "flDisable", "flFlashOnUpd",
"mempoolSecure", "useNostr", "bitaxeEnabled",
"nostrZapNotify", "stagingSource", "httpAuthEnabled"};
@ -726,6 +726,8 @@ void onApiSettingsGet(AsyncWebServerRequest *request)
root["hasLightLevel"] = hasLightLevel();
root["luxLightToggle"] = preferences.getUInt("luxLightToggle", DEFAULT_LUX_LIGHT_TOGGLE);
root["flOffWhenDark"] = preferences.getBool("flOffWhenDark", DEFAULT_FL_OFF_WHEN_DARK);
#else
root["hasFrontlight"] = false;
root["hasLightLevel"] = false;

View file

@ -51,7 +51,7 @@ extern "C" void app_main()
if (hasLightLevel()) {
if (preferences.getUInt("luxLightToggle", DEFAULT_LUX_LIGHT_TOGGLE) != 0)
{
if (hasLightLevel() && getLightLevel() <= 2)
if (hasLightLevel() && getLightLevel() <= 1 && preferences.getBool("flOffWhenDark", DEFAULT_FL_OFF_WHEN_DARK))
{
if (frontlightIsOn()) {
frontlightFadeOutAll();