diff options
author | Tomasz Moń <desowin@gmail.com> | 2021-07-12 14:14:59 +0200 |
---|---|---|
committer | Tomasz Moń <desowin@gmail.com> | 2021-07-12 14:14:59 +0200 |
commit | 321680973b3ea7815195c7f05c5439c7678972da (patch) | |
tree | b377df4f74902b1ab19b951719ac2af347578830 /apps | |
parent | 84362141a0d1e33b29d12162caba7537dd5684b8 (diff) | |
download | rockbox-321680973b3ea7815195c7f05c5439c7678972da.tar.gz rockbox-321680973b3ea7815195c7f05c5439c7678972da.zip |
Sansa Connect: Display battery info in debug menu
Show battery temperature, current, discharge power and available energy
in battery debug menu.
Change-Id: I799af4e5ca7ec168d726e689264e0f092ebc2bf7
Diffstat (limited to 'apps')
-rw-r--r-- | apps/debug_menu.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 9bbbfaec99..02dc19359b 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -112,6 +112,10 @@ | |||
112 | #include "pmu-target.h" | 112 | #include "pmu-target.h" |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | #ifdef SANSA_CONNECT | ||
116 | #include "avr-sansaconnect.h" | ||
117 | #endif | ||
118 | |||
115 | #ifdef HAVE_USBSTACK | 119 | #ifdef HAVE_USBSTACK |
116 | #include "usb_core.h" | 120 | #include "usb_core.h" |
117 | #endif | 121 | #endif |
@@ -1091,6 +1095,17 @@ static bool view_battery(void) | |||
1091 | y = pmu_read(0x2d + (i << 1)) * 100 + 900; | 1095 | y = pmu_read(0x2d + (i << 1)) * 100 + 900; |
1092 | lcd_putsf(0, 10 + i, "LDO%d: %x / %d mV", i + 1, x, y); | 1096 | lcd_putsf(0, 10 + i, "LDO%d: %x / %d mV", i + 1, x, y); |
1093 | } | 1097 | } |
1098 | #elif defined(SANSA_CONNECT) | ||
1099 | lcd_putsf(0, 3, "Charger: %s", | ||
1100 | charger_inserted() ? "present" : "absent"); | ||
1101 | x = (avr_hid_hdq_read_short(HDQ_REG_TEMP) / 4) - 273; | ||
1102 | lcd_putsf(0, 4, "Battery temperature: %d C", x); | ||
1103 | x = (avr_hid_hdq_read_short(HDQ_REG_AI) * 357) / 200; | ||
1104 | lcd_putsf(0, 5, "Battery current: %d.%01d mA", x / 10, x % 10); | ||
1105 | x = (avr_hid_hdq_read_short(HDQ_REG_AP) * 292) / 20; | ||
1106 | lcd_putsf(0, 6, "Discharge power: %d.%01d mW", x / 10, x % 10); | ||
1107 | x = (avr_hid_hdq_read_short(HDQ_REG_SAE) * 292) / 2; | ||
1108 | lcd_putsf(0, 7, "Available energy: %d.%01d mWh", x / 10, x % 10); | ||
1094 | #else | 1109 | #else |
1095 | lcd_putsf(0, 3, "Charger: %s", | 1110 | lcd_putsf(0, 3, "Charger: %s", |
1096 | charger_inserted() ? "present" : "absent"); | 1111 | charger_inserted() ? "present" : "absent"); |