94 if (current < 1)
return 1;
95 if (current < 20)
return 5;
98 if (current <= 1)
return 1;
99 if (current <= 20)
return 5;
110 s_sleep->setLightSleepInterval(
static_cast<uint32_t
>(value) * 60);
123 int8_t tzOffset =
static_cast<int8_t
>(
static_cast<int16_t
>(value) - 12);
124 rtc->setTimezoneOffset(tzOffset);
127 time_t now = time(
nullptr);
128 struct tm* tm = localtime(&now);
131 snprintf(buf,
sizeof(buf),
"%02d:%02d", tm->tm_hour, tm->tm_min);
133 snprintf(buf,
sizeof(buf),
"%02d.%02d.%04d", tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900);
147 time_t now = time(
nullptr);
149 struct tm* current = localtime(&now);
150 if (current) tm = *current;
152 tm.tm_mon = month - 1;
153 tm.tm_year = year - 1900;
155 time_t newTime = mktime(&tm);
156 struct timeval tv = {.tv_sec = newTime, .tv_usec = 0};
157 settimeofday(&tv,
nullptr);
167 time_t now = time(
nullptr);
169 struct tm* current = localtime(&now);
170 if (current) tm = *current;
175 time_t newTime = mktime(&tm);
176 struct timeval tv = {.tv_sec = newTime, .tv_usec = 0};
177 settimeofday(&tv,
nullptr);
206 const char* title =
nullptr;
207 const char* initial =
nullptr;
212 title =
ui::tr(
"core.name");
217 title =
ui::tr(
"core.info");
222 title =
ui::tr(
"core.info2");
275 if (nvs_open(
"display", NVS_READWRITE, &nvs) != ESP_OK)
return;
276 const char* safeValue = value ? value :
"";
277 nvs_set_str(nvs, key, safeValue);
290 if (!key || !out || outSize == 0)
return false;
292 if (nvs_open(
"display", NVS_READONLY, &nvs) != ESP_OK)
return false;
293 size_t len = outSize;
294 esp_err_t err = nvs_get_str(nvs, key, out, &len);
296 return err == ESP_OK && len > 1;
Internationalization with English fallbacks in code and overlay translations loaded at runtime from a...
static constexpr uint8_t MAX_TEXT_LEN
static ViewStack & instance()
Returns singleton view-stack instance.
IRtc * getRtcInstance()
Returns the singleton RTC service instance.
bool loadDisplayField(const char *key, char *out, size_t outSize)
Reads one display text field from NVS into the caller buffer.
static hal::ISleepController * s_sleep
static LockScreenView * s_lockScreen
static constexpr uint8_t BADGE_STEP_INFO
void onPinChangeComplete(bool success)
Handles completion of PIN-change flow.
void saveDisplayField(const char *key, const char *value)
Saves one display text field to NVS.
void onBrightnessChange(uint16_t value)
Applies backlight preview without persisting.
uint16_t brightnessStepCallback(uint16_t current, bool increasing)
Returns adaptive brightness step size.
static void onBadgeNameSave(const char *text)
Handles save callback for badge display name.
static constexpr uint8_t BADGE_STEP_NAME
void onBrightnessSave(uint16_t value)
Persists and applies selected backlight value.
static constexpr uint8_t BADGE_STEP_INFO2
void processPendingBadgeText()
Processes the next pending badge-text wizard step.
void onDateConfirm(uint8_t day, uint8_t month, uint16_t year)
Applies confirmed date to system time.
static void onBadgeInfoSave(const char *text)
Handles save callback for badge info line 1.
void startBadgeTextEdit()
Starts badge-text editing wizard.
void onTimeConfirm(uint8_t hour, uint8_t minute)
Applies confirmed time to system clock.
static hal::IDisplay * s_display
External dependencies injected by AppUi.
void onTimezoneSave(uint16_t value)
Saves timezone offset and refreshes lock-screen clock.
static void onBadgeInfo2Save(const char *text)
Handles save callback for badge info line 2.
static void showBadgeTextStep(uint8_t step)
Forward declarations for internal helper callbacks.
static uint8_t s_badgeTextPendingStep
static constexpr uint8_t BADGE_STEP_NONE
Badge text editing workflow state.
void init(hal::IDisplay *display, hal::ISleepController *sleep, LockScreenView *lockScreen)
Initializes shared dependencies used by the settings handlers.
void onSleepIntervalSave(uint16_t value)
Saves lock-screen sleep interval in minutes.
const char * tr(const char *key)
Look up a translation by string key.
T9InputView * showT9Input(const char *title, const char *initialText, T9InputView::SaveCallback onSave, uint16_t maxLen=128)
Shows a shared T9 input view instance.