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:
@@ -232,8 +232,3 @@ void ble_keyboard_release(void) {
|
||||
input_kbd->setValue(report, sizeof(report));
|
||||
input_kbd->notify();
|
||||
}
|
||||
|
||||
bool ble_is_connected(void) {
|
||||
return state == BLE_STATE_CONNECTED;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,5 +23,3 @@ void ble_request_refresh(void);
|
||||
// BLE HID keyboard
|
||||
void ble_keyboard_press(uint8_t key, uint8_t modifier);
|
||||
void ble_keyboard_release(void);
|
||||
bool ble_is_connected(void);
|
||||
|
||||
|
||||
@@ -74,8 +74,3 @@ void imu_tick(void) {
|
||||
uint8_t imu_get_rotation(void) {
|
||||
return current_rotation;
|
||||
}
|
||||
|
||||
void imu_set_rotation(uint8_t r) {
|
||||
current_rotation = r % 4;
|
||||
Serial.printf("Rotation: %d (manual)\n", current_rotation);
|
||||
}
|
||||
|
||||
+4
-29
@@ -4,15 +4,13 @@
|
||||
|
||||
// Poll intervals
|
||||
#define BATTERY_POLL_MS 2000
|
||||
#define VBUS_POLL_MS 500
|
||||
#define CHARGING_POLL_MS 500
|
||||
|
||||
static int cached_pct = -1;
|
||||
static bool cached_charging = false;
|
||||
static bool cached_usb = false;
|
||||
static bool usb_changed_flag = false;
|
||||
static bool pwr_pressed_flag = false;
|
||||
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;
|
||||
#define PWR_POLL_MS 50
|
||||
|
||||
@@ -23,9 +21,7 @@ void power_init(void) {
|
||||
}
|
||||
Serial.println("AXP2101 init OK");
|
||||
|
||||
// Enable battery and VBUS ADC measurements
|
||||
pmu.enableBattDetection();
|
||||
pmu.enableVbusVoltageMeasure();
|
||||
pmu.enableBattVoltageMeasure();
|
||||
|
||||
// Enable PWR button short-press IRQ (mid button for cycling screens)
|
||||
@@ -33,8 +29,6 @@ void power_init(void) {
|
||||
pmu.clearIrqStatus();
|
||||
pmu.enableIRQ(XPOWERS_AXP2101_PKEY_SHORT_IRQ);
|
||||
|
||||
// Read initial state
|
||||
cached_usb = pmu.isVbusIn();
|
||||
cached_charging = pmu.isCharging();
|
||||
cached_pct = pmu.getBatteryPercent();
|
||||
}
|
||||
@@ -42,18 +36,11 @@ void power_init(void) {
|
||||
void power_tick(void) {
|
||||
uint32_t now = millis();
|
||||
|
||||
// Poll VBUS status
|
||||
if (now - last_vbus_ms >= VBUS_POLL_MS) {
|
||||
last_vbus_ms = now;
|
||||
bool usb_now = pmu.isVbusIn();
|
||||
if (usb_now != cached_usb) {
|
||||
cached_usb = usb_now;
|
||||
usb_changed_flag = true;
|
||||
}
|
||||
if (now - last_charging_ms >= CHARGING_POLL_MS) {
|
||||
last_charging_ms = now;
|
||||
cached_charging = pmu.isCharging();
|
||||
}
|
||||
|
||||
// Poll battery level
|
||||
if (now - last_battery_ms >= BATTERY_POLL_MS) {
|
||||
last_battery_ms = now;
|
||||
cached_pct = pmu.getBatteryPercent();
|
||||
@@ -78,18 +65,6 @@ bool power_is_charging(void) {
|
||||
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) {
|
||||
if (pwr_pressed_flag) {
|
||||
pwr_pressed_flag = false;
|
||||
|
||||
@@ -4,6 +4,4 @@ void power_init(void);
|
||||
void power_tick(void);
|
||||
int power_battery_pct(void); // 0-100, or -1 if no battery
|
||||
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
|
||||
|
||||
@@ -166,19 +166,6 @@ void splash_next(void) {
|
||||
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) {
|
||||
if (SPLASH_ANIM_COUNT == 0) return;
|
||||
int g = usage_rate_group();
|
||||
@@ -214,10 +201,3 @@ void splash_hide(void) {
|
||||
lv_obj_t* splash_get_root(void) {
|
||||
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; }
|
||||
|
||||
@@ -12,12 +12,6 @@ void splash_tick(void);
|
||||
// Cycle to the next animation in the catalog.
|
||||
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.
|
||||
void splash_show(void);
|
||||
void splash_hide(void);
|
||||
@@ -32,8 +26,3 @@ bool splash_is_active(void);
|
||||
|
||||
// Root container (so ui.cpp can attach a click event).
|
||||
lv_obj_t* splash_get_root(void);
|
||||
|
||||
// Current animation name (for debug/UI).
|
||||
const char *splash_current_name(void);
|
||||
|
||||
uint16_t splash_count(void);
|
||||
|
||||
@@ -33,7 +33,7 @@ static inline uint8_t oldest_idx(void) {
|
||||
return (head + RING_SIZE - count) % RING_SIZE;
|
||||
}
|
||||
|
||||
void usage_rate_reset(void) {
|
||||
static void usage_rate_reset(void) {
|
||||
count = 0;
|
||||
head = 0;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,3 @@ void usage_rate_sample(float session_pct);
|
||||
// 0 = idle, 1 = normal, 2 = active, 3 = heavy.
|
||||
// Defaults to 0 when the buffer doesn't have enough samples yet.
|
||||
int usage_rate_group(void);
|
||||
|
||||
// Clear the buffer (e.g. when the 5-hour session window resets).
|
||||
void usage_rate_reset(void);
|
||||
|
||||
Reference in New Issue
Block a user