diff --git a/nyx/nyx_gui/config/config.c b/nyx/nyx_gui/config/config.c index e90b13f..afed9d6 100644 --- a/nyx/nyx_gui/config/config.c +++ b/nyx/nyx_gui/config/config.c @@ -57,6 +57,7 @@ void set_default_configuration() void set_nyx_default_configuration() { n_cfg.themecolor = 167; + n_cfg.timeoff = 0; n_cfg.home_screen = 0; n_cfg.verification = 1; } @@ -192,6 +193,9 @@ int create_nyx_config_entry() f_puts("[config]\nthemecolor=", &fp); itoa(n_cfg.themecolor, lbuf, 10); f_puts(lbuf, &fp); + f_puts("\ntimeoff=", &fp); + itoa(n_cfg.timeoff, lbuf, 10); + f_puts(lbuf, &fp); f_puts("\nhomescreen=", &fp); itoa(n_cfg.home_screen, lbuf, 10); f_puts(lbuf, &fp); diff --git a/nyx/nyx_gui/config/config.h b/nyx/nyx_gui/config/config.h index a5d3bd9..3a6bea4 100644 --- a/nyx/nyx_gui/config/config.h +++ b/nyx/nyx_gui/config/config.h @@ -45,6 +45,7 @@ typedef struct _hekate_config typedef struct _nyx_config { u32 themecolor; + s32 timeoff; u32 home_screen; u32 verification; } nyx_config; diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index a7cd875..46271ac 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -1139,6 +1139,11 @@ static void _update_status_bar(void *params) // Get sensor data. max77620_rtc_get_time(&time); + if (n_cfg.timeoff) + { + u32 epoch = (u32)((s32)max77620_rtc_date_to_epoch(&time, true) + (s32)n_cfg.timeoff); + max77620_rtc_epoch_to_date(epoch, &time); + } soc_temp = tmp451_get_soc_temp(false); bq24193_get_property(BQ24193_ChargeStatus, &charge_status); max17050_get_property(MAX17050_RepSOC, (int *)&batt_percent); @@ -1154,7 +1159,6 @@ static void _update_status_bar(void *params) else if (soc_temp_dec < 40) set_fan_duty(0); - //! TODO: Parse time and use offset. // Set time and SoC temperature. s_printf(label, "%02d:%02d "SYMBOL_DOT" "SYMBOL_TEMPERATURE" %02d.%d", time.hour, time.min, soc_temp_dec, (soc_temp & 0xFF) / 10); diff --git a/nyx/nyx_gui/nyx.c b/nyx/nyx_gui/nyx.c index 57dd6a3..f5e453f 100644 --- a/nyx/nyx_gui/nyx.c +++ b/nyx/nyx_gui/nyx.c @@ -264,6 +264,8 @@ void load_saved_configuration() { if (!strcmp("themecolor", kv->key)) n_cfg.themecolor = atoi(kv->val); + else if (!strcmp("timeoff", kv->key)) + n_cfg.timeoff = strtol(kv->val, NULL, 16); else if (!strcmp("homescreen", kv->key)) n_cfg.home_screen = atoi(kv->val); else if (!strcmp("verification", kv->key))