mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-10 04:21:45 +00:00
nyx: Add time offset
The epoch is based on HOS format. An automatic time set will be implemented in a later version.
This commit is contained in:
parent
6d75f96ed5
commit
c072041039
4 changed files with 12 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -45,6 +45,7 @@ typedef struct _hekate_config
|
|||
typedef struct _nyx_config
|
||||
{
|
||||
u32 themecolor;
|
||||
s32 timeoff;
|
||||
u32 home_screen;
|
||||
u32 verification;
|
||||
} nyx_config;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue