nyx: remove negative decimal external handling

This commit is contained in:
CTCaer
2022-05-08 05:32:21 +03:00
parent c2869703af
commit ae394d9f37
3 changed files with 24 additions and 20 deletions

View File

@@ -1321,10 +1321,7 @@ static void _update_status_bar(void *params)
lv_obj_realign(status_bar.battery);
// Set battery current draw and voltage.
if (batt_curr >= 0)
s_printf(label, "#96FF00 +%d", batt_curr / 1000);
else
s_printf(label, "#FF3C28 -%d", (~batt_curr + 1) / 1000);
s_printf(label, "#%s%d", batt_curr >= 0 ? "96FF00 +" : "FF3C28 ", batt_curr / 1000);
bool voltage_empty = batt_volt < 3200;
s_printf(label + strlen(label), " mA# (%s%d mV%s)",

View File

@@ -2162,16 +2162,10 @@ static lv_res_t _create_window_battery_status(lv_obj_t *btn)
s_printf(txt_buf + strlen(txt_buf), "%d mAh\n", value);
max17050_get_property(MAX17050_Current, &value);
if (value >= 0)
s_printf(txt_buf + strlen(txt_buf), "%d mA\n", value / 1000);
else
s_printf(txt_buf + strlen(txt_buf), "-%d mA\n", (~value + 1) / 1000);
s_printf(txt_buf + strlen(txt_buf), "%d mA\n", value / 1000);
max17050_get_property(MAX17050_AvgCurrent, &value);
if (value >= 0)
s_printf(txt_buf + strlen(txt_buf), "%d mA\n", value / 1000);
else
s_printf(txt_buf + strlen(txt_buf), "-%d mA\n", (~value + 1) / 1000);
s_printf(txt_buf + strlen(txt_buf), "%d mA\n", value / 1000);
max17050_get_property(MAX17050_VCELL, &value);
bool voltage_empty = value < 3200;
@@ -2191,10 +2185,7 @@ static lv_res_t _create_window_battery_status(lv_obj_t *btn)
s_printf(txt_buf + strlen(txt_buf), "%d mV\n", value);
max17050_get_property(MAX17050_TEMP, &value);
if (value >= 0)
s_printf(txt_buf + strlen(txt_buf), "%d.%d oC\n\n\n", value / 10, value % 10);
else
s_printf(txt_buf + strlen(txt_buf), "-%d.%d oC\n\n\n", (~value + 1) / 10, (~value + 1) % 10);
s_printf(txt_buf + strlen(txt_buf), "%d.%d oC\n\n\n", value / 10, (value >= 0 ? value : (~value + 1)) % 10);
value = i2c_recv_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_CID4);
u32 main_pmic_version = i2c_recv_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_CID3) & 0xF;