Remove dead functions and unused Montserrat font flags

Six public API functions had no callers anywhere in the firmware:
splash_prev, splash_set_active, splash_current_name, splash_count,
ble_is_connected, imu_set_rotation, power_is_usb_connected,
power_usb_changed. Trimming them lets power.cpp drop the VBUS state
machine (cached_usb, usb_changed_flag, last_vbus_ms,
enableVbusVoltageMeasure). usage_rate_reset becomes file-static since
the only caller is in usage_rate.cpp itself. Montserrat font flags in
platformio.ini were enabled but never referenced.
This commit is contained in:
Hermann Björgvin Haraldsson
2026-05-11 02:19:45 +00:00
parent 7ed4710d28
commit f1feacb3dc
10 changed files with 5 additions and 84 deletions
-6
View File
@@ -21,12 +21,6 @@ build_flags =
-DLV_CONF_SKIP -DLV_CONF_SKIP
-DLV_COLOR_DEPTH=16 -DLV_COLOR_DEPTH=16
-DLV_USE_LOG=0 -DLV_USE_LOG=0
-DLV_FONT_MONTSERRAT_12=1
-DLV_FONT_MONTSERRAT_14=1
-DLV_FONT_MONTSERRAT_16=1
-DLV_FONT_MONTSERRAT_20=1
-DLV_FONT_MONTSERRAT_24=1
-DLV_FONT_MONTSERRAT_28=1
-DLV_USE_BAR=1 -DLV_USE_BAR=1
-DLV_USE_LABEL=1 -DLV_USE_LABEL=1
-DLV_USE_ARC=1 -DLV_USE_ARC=1
-5
View File
@@ -232,8 +232,3 @@ void ble_keyboard_release(void) {
input_kbd->setValue(report, sizeof(report)); input_kbd->setValue(report, sizeof(report));
input_kbd->notify(); input_kbd->notify();
} }
bool ble_is_connected(void) {
return state == BLE_STATE_CONNECTED;
}
-2
View File
@@ -23,5 +23,3 @@ void ble_request_refresh(void);
// BLE HID keyboard // BLE HID keyboard
void ble_keyboard_press(uint8_t key, uint8_t modifier); void ble_keyboard_press(uint8_t key, uint8_t modifier);
void ble_keyboard_release(void); void ble_keyboard_release(void);
bool ble_is_connected(void);
-5
View File
@@ -74,8 +74,3 @@ void imu_tick(void) {
uint8_t imu_get_rotation(void) { uint8_t imu_get_rotation(void) {
return current_rotation; return current_rotation;
} }
void imu_set_rotation(uint8_t r) {
current_rotation = r % 4;
Serial.printf("Rotation: %d (manual)\n", current_rotation);
}
+4 -29
View File
@@ -4,15 +4,13 @@
// Poll intervals // Poll intervals
#define BATTERY_POLL_MS 2000 #define BATTERY_POLL_MS 2000
#define VBUS_POLL_MS 500 #define CHARGING_POLL_MS 500
static int cached_pct = -1; static int cached_pct = -1;
static bool cached_charging = false; static bool cached_charging = false;
static bool cached_usb = false;
static bool usb_changed_flag = false;
static bool pwr_pressed_flag = false; static bool pwr_pressed_flag = false;
static uint32_t last_battery_ms = 0; static uint32_t last_battery_ms = 0;
static uint32_t last_vbus_ms = 0; static uint32_t last_charging_ms = 0;
static uint32_t last_pwr_ms = 0; static uint32_t last_pwr_ms = 0;
#define PWR_POLL_MS 50 #define PWR_POLL_MS 50
@@ -23,9 +21,7 @@ void power_init(void) {
} }
Serial.println("AXP2101 init OK"); Serial.println("AXP2101 init OK");
// Enable battery and VBUS ADC measurements
pmu.enableBattDetection(); pmu.enableBattDetection();
pmu.enableVbusVoltageMeasure();
pmu.enableBattVoltageMeasure(); pmu.enableBattVoltageMeasure();
// Enable PWR button short-press IRQ (mid button for cycling screens) // Enable PWR button short-press IRQ (mid button for cycling screens)
@@ -33,8 +29,6 @@ void power_init(void) {
pmu.clearIrqStatus(); pmu.clearIrqStatus();
pmu.enableIRQ(XPOWERS_AXP2101_PKEY_SHORT_IRQ); pmu.enableIRQ(XPOWERS_AXP2101_PKEY_SHORT_IRQ);
// Read initial state
cached_usb = pmu.isVbusIn();
cached_charging = pmu.isCharging(); cached_charging = pmu.isCharging();
cached_pct = pmu.getBatteryPercent(); cached_pct = pmu.getBatteryPercent();
} }
@@ -42,18 +36,11 @@ void power_init(void) {
void power_tick(void) { void power_tick(void) {
uint32_t now = millis(); uint32_t now = millis();
// Poll VBUS status if (now - last_charging_ms >= CHARGING_POLL_MS) {
if (now - last_vbus_ms >= VBUS_POLL_MS) { last_charging_ms = now;
last_vbus_ms = now;
bool usb_now = pmu.isVbusIn();
if (usb_now != cached_usb) {
cached_usb = usb_now;
usb_changed_flag = true;
}
cached_charging = pmu.isCharging(); cached_charging = pmu.isCharging();
} }
// Poll battery level
if (now - last_battery_ms >= BATTERY_POLL_MS) { if (now - last_battery_ms >= BATTERY_POLL_MS) {
last_battery_ms = now; last_battery_ms = now;
cached_pct = pmu.getBatteryPercent(); cached_pct = pmu.getBatteryPercent();
@@ -78,18 +65,6 @@ bool power_is_charging(void) {
return cached_charging; return cached_charging;
} }
bool power_is_usb_connected(void) {
return cached_usb;
}
bool power_usb_changed(void) {
if (usb_changed_flag) {
usb_changed_flag = false;
return true;
}
return false;
}
bool power_pwr_pressed(void) { bool power_pwr_pressed(void) {
if (pwr_pressed_flag) { if (pwr_pressed_flag) {
pwr_pressed_flag = false; pwr_pressed_flag = false;
-2
View File
@@ -4,6 +4,4 @@ void power_init(void);
void power_tick(void); void power_tick(void);
int power_battery_pct(void); // 0-100, or -1 if no battery int power_battery_pct(void); // 0-100, or -1 if no battery
bool power_is_charging(void); bool power_is_charging(void);
bool power_is_usb_connected(void);
bool power_usb_changed(void); // true once per VBUS state transition
bool power_pwr_pressed(void); // true once per AXP2101 PWR button short-press bool power_pwr_pressed(void); // true once per AXP2101 PWR button short-press
-20
View File
@@ -166,19 +166,6 @@ void splash_next(void) {
Serial.printf("splash: -> %s\n", a->name); Serial.printf("splash: -> %s\n", a->name);
} }
void splash_prev(void) {
if (SPLASH_ANIM_COUNT == 0) return;
cur_anim = (cur_anim + SPLASH_ANIM_COUNT - 1) % SPLASH_ANIM_COUNT;
cur_frame = 0;
frame_started_ms = millis();
last_pick_ms = frame_started_ms;
const splash_anim_def_t *a = &splash_anims[cur_anim];
render_frame(a->frames[0], a->palette);
Serial.printf("splash: <- %s\n", a->name);
}
void splash_set_active(bool a) { active = a; }
void splash_pick_for_current_rate(void) { void splash_pick_for_current_rate(void) {
if (SPLASH_ANIM_COUNT == 0) return; if (SPLASH_ANIM_COUNT == 0) return;
int g = usage_rate_group(); int g = usage_rate_group();
@@ -214,10 +201,3 @@ void splash_hide(void) {
lv_obj_t* splash_get_root(void) { lv_obj_t* splash_get_root(void) {
return splash_container; return splash_container;
} }
const char *splash_current_name(void) {
if (SPLASH_ANIM_COUNT == 0) return "(none)";
return splash_anims[cur_anim].name;
}
uint16_t splash_count(void) { return SPLASH_ANIM_COUNT; }
-11
View File
@@ -12,12 +12,6 @@ void splash_tick(void);
// Cycle to the next animation in the catalog. // Cycle to the next animation in the catalog.
void splash_next(void); void splash_next(void);
// Cycle to the previous animation in the catalog.
void splash_prev(void);
// Pause/resume rendering (e.g. when a different screen is active).
void splash_set_active(bool active);
// Show/hide the splash container. // Show/hide the splash container.
void splash_show(void); void splash_show(void);
void splash_hide(void); void splash_hide(void);
@@ -32,8 +26,3 @@ bool splash_is_active(void);
// Root container (so ui.cpp can attach a click event). // Root container (so ui.cpp can attach a click event).
lv_obj_t* splash_get_root(void); lv_obj_t* splash_get_root(void);
// Current animation name (for debug/UI).
const char *splash_current_name(void);
uint16_t splash_count(void);
+1 -1
View File
@@ -33,7 +33,7 @@ static inline uint8_t oldest_idx(void) {
return (head + RING_SIZE - count) % RING_SIZE; return (head + RING_SIZE - count) % RING_SIZE;
} }
void usage_rate_reset(void) { static void usage_rate_reset(void) {
count = 0; count = 0;
head = 0; head = 0;
} }
-3
View File
@@ -10,6 +10,3 @@ void usage_rate_sample(float session_pct);
// 0 = idle, 1 = normal, 2 = active, 3 = heavy. // 0 = idle, 1 = normal, 2 = active, 3 = heavy.
// Defaults to 0 when the buffer doesn't have enough samples yet. // Defaults to 0 when the buffer doesn't have enough samples yet.
int usage_rate_group(void); int usage_rate_group(void);
// Clear the buffer (e.g. when the 5-hour session window resets).
void usage_rate_reset(void);