|
|
@@ -149,8 +149,14 @@ void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, i
|
|
|
|
|
|
void UITask::renderBatteryIndicator(uint16_t batteryMilliVolts) {
|
|
|
// Convert millivolts to percentage
|
|
|
- const int minMilliVolts = 3000; // Minimum voltage (e.g., 3.0V)
|
|
|
- const int maxMilliVolts = 4200; // Maximum voltage (e.g., 4.2V)
|
|
|
+#ifndef BATT_MIN_MILLIVOLTS
|
|
|
+ #define BATT_MIN_MILLIVOLTS 3000
|
|
|
+#endif
|
|
|
+#ifndef BATT_MAX_MILLIVOLTS
|
|
|
+ #define BATT_MAX_MILLIVOLTS 4200
|
|
|
+#endif
|
|
|
+ const int minMilliVolts = BATT_MIN_MILLIVOLTS;
|
|
|
+ const int maxMilliVolts = BATT_MAX_MILLIVOLTS;
|
|
|
int batteryPercentage = ((batteryMilliVolts - minMilliVolts) * 100) / (maxMilliVolts - minMilliVolts);
|
|
|
if (batteryPercentage < 0) batteryPercentage = 0; // Clamp to 0%
|
|
|
if (batteryPercentage > 100) batteryPercentage = 100; // Clamp to 100%
|