diff --git a/common/menu.c b/common/menu.c index f0bb84e..218c9b2 100644 --- a/common/menu.c +++ b/common/menu.c @@ -15,6 +15,8 @@ uint8_t *folder_icon_large, *folder_icon_small; uint8_t *invalid_icon_large, *invalid_icon_small; uint8_t *theme_icon_large, *theme_icon_small; +int imperialtemperatureFlag=0; + void computeFrontGradient(color_t baseColor, int height); void menuLoadFileassoc(void); @@ -473,6 +475,8 @@ void menuStartup(void) { menuScan(rootPath); menuStartupCommon(); + + imperialtemperatureFlag = GetTempSettingFromConfig(); } void themeMenuStartup(void) { @@ -574,6 +578,7 @@ void drawNetwork(int tmpX, AssetId id) { u32 drawStatus() { bool netstatusFlag=0; bool temperatureFlag=0; + s32 temperatureF=0; s32 temperature=0; AssetId id; @@ -599,7 +604,12 @@ u32 drawStatus() { if (statusGet(&netstatusFlag, &id, &temperatureFlag, &temperature)) { if (netstatusFlag) drawNetwork(tmpX, id); if (temperatureFlag) { + if (imperialtemperatureFlag == 1) { + temperatureF = (temperature * 9 / 5) + 32; + snprintf(tmpstr, sizeof(tmpstr)-1, "%d°F (%d°C)", temperatureF, temperature); + } else { snprintf(tmpstr, sizeof(tmpstr)-1, "%d°C", temperature); + } DrawTextFromLayout(ThemeLayoutId_Temperature, themeCurrent.textColor, tmpstr); } } diff --git a/common/theme.c b/common/theme.c index c61edd1..303c2e7 100644 --- a/common/theme.c +++ b/common/theme.c @@ -309,26 +309,26 @@ void themeStartup(ThemePreset preset) { [ThemeLayoutId_NetworkIcon] = { .visible = true, .posType = true, - .posStart = {0, 0 + 47 + 10 + 3}, + .posStart = {-20, 0 + 47 + 10 + 3}, }, [ThemeLayoutId_BatteryCharge] = { .visible = true, .posType = false, - .posStart = {1180 - 10 - 24 - 8, 0 + 47 + 10 + 21 + 4}, + .posStart = {1160 - 10 - 24 - 8, 0 + 47 + 10 + 21 + 4}, .font = interuiregular14, }, [ThemeLayoutId_BatteryIcon] = { .visible = true, .posType = false, - .posStart = {1180 - 8 - 24 - 8, 0 + 47 + 10 + 6}, + .posStart = {1160 - 8 - 24 - 8, 0 + 47 + 10 + 6}, }, [ThemeLayoutId_ChargingIcon] = { .visible = true, .posType = false, - .posStart = {1180 - 20, 0 + 47 + 10 + 6}, + .posStart = {1160 - 20, 0 + 47 + 10 + 6}, }, [ThemeLayoutId_Status] = { @@ -341,7 +341,7 @@ void themeStartup(ThemePreset preset) { [ThemeLayoutId_Temperature] = { .visible = true, .posType = false, - .posStart = {1180 + 4, 0 + 47 + 10 + 21 + 4}, + .posStart = {1160 + 4, 0 + 47 + 10 + 21 + 4}, .font = interuiregular14, }, @@ -724,3 +724,22 @@ void SetThemePathToConfig(const char* themePath) { config_destroy(&cfg); } + +int GetTempSettingFromConfig() { + int imperialtemperatureFlag=0; + config_t cfg = {0}; + config_setting_t *settings = NULL; + char tmp_path[PATH_MAX+1] = {0}; + snprintf(tmp_path, sizeof(tmp_path)-1, "%s/config/nx-hbmenu/settings.cfg", menuGetRootBasePath()); + bool good_cfg = config_read_file(&cfg, tmp_path); + if(good_cfg) { + settings = config_lookup(&cfg, "settings"); + if(settings != NULL) { + if(config_setting_lookup_int(settings, "tempinF", &imperialtemperatureFlag)) { + } + + } + } + config_destroy(&cfg); + return imperialtemperatureFlag; +} diff --git a/common/theme.h b/common/theme.h index 0eec46d..a3528c9 100644 --- a/common/theme.h +++ b/common/theme.h @@ -56,6 +56,7 @@ bool colorFromSetting(config_setting_t *rgba, color_t *col); void themeStartup(ThemePreset preset); void GetThemePathFromConfig(char* themePath, size_t size); void SetThemePathToConfig(const char* themePath); +int GetTempSettingFromConfig(); extern theme_t themeCurrent;