From 65ee7289390d9ae1e7196abd751d3eb0f835a705 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Sun, 8 Dec 2019 01:26:26 +0200 Subject: [PATCH] nyx: Enable fan when temps are high --- nyx/nyx_gui/frontend/gui.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nyx/nyx_gui/frontend/gui.c b/nyx/nyx_gui/frontend/gui.c index 52bc791..6cfaed2 100644 --- a/nyx/nyx_gui/frontend/gui.c +++ b/nyx/nyx_gui/frontend/gui.c @@ -782,10 +782,19 @@ static void _update_status_bar(void *params) max17050_get_property(MAX17050_VCELL, &batt_volt); max17050_get_property(MAX17050_Current, &batt_curr); + u32 soc_temp_dec = (soc_temp >> 8); + // Enable fan if more than 44 oC. + if (soc_temp_dec > 50) + set_fan_duty(100); + else if (soc_temp_dec > 44) + set_fan_duty(53); + else + 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 >> 8, (soc_temp & 0xFF) / 10); + time.hour, time.min, soc_temp_dec, (soc_temp & 0xFF) / 10); lv_label_set_array_text(status_bar.time_temp, label, 64);