summaryrefslogtreecommitdiffstats
path: root/firmware/export/config
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2021-07-07 08:22:50 +0200
committerTomasz Moń <desowin@gmail.com>2021-07-07 08:24:01 +0200
commit841e704fc3b5bde96ca8de4794c85198e2f12a65 (patch)
tree796859262b7398b6300d01c09782971f5ee65226 /firmware/export/config
parentb87e75f768eba3ccdf422a5082c91097a0b72b5b (diff)
downloadrockbox-841e704fc3b5bde96ca8de4794c85198e2f12a65.tar.gz
rockbox-841e704fc3b5bde96ca8de4794c85198e2f12a65.zip
Sansa Connect: Read HDQ battery data
Make it possible for target to provide voltage, percentage and time to empty values. The voltage measurement is nice to have in debug menu even if the actions are taken only based on percentage. Perform battery level estimation based on voltage only if percentage is not available. Use time to empty based on actual power consumption. This makes the estimated runtime displayed in Rockbox Info to react to backlight setting. The bq27000 updates time to empty estimate every 5.12 seconds so it is possible to see the estimate with backlight off on the screen if user enters Rockbox Info, activates hold switch, waits 11 seconds and releases the hold switch. Change-Id: Iafe3fa0fb334e3428e3a0ad05b2c020d208dc934
Diffstat (limited to 'firmware/export/config')
-rw-r--r--firmware/export/config/sansaconnect.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/firmware/export/config/sansaconnect.h b/firmware/export/config/sansaconnect.h
index 5668d579fc..fa929f3c10 100644
--- a/firmware/export/config/sansaconnect.h
+++ b/firmware/export/config/sansaconnect.h
@@ -152,7 +152,15 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
-#define CONFIG_BATTERY_MEASURE PERCENTAGE_MEASURE
+/* bq27000 provides voltage, percentage and time measure.
+ * Voltage reading is available every 2.56 seconds and does not need filtering.
+ * Read the measured voltage every 3 seconds so we are guaranteed to not read
+ * the same value twice (do not try to read every 2.56 seconds as clocks are
+ * not synchronized).
+ */
+#define CONFIG_BATTERY_MEASURE (VOLTAGE_MEASURE|PERCENTAGE_MEASURE|TIME_MEASURE)
+#define BATT_AVE_SAMPLES 1
+#define POWER_THREAD_STEP_TICKS (3*HZ)
/* define current usage levels */
#if 0