diff --git a/Platformio/src/battery.h b/Platformio/src/battery.h index e63a08e..446b1af 100644 --- a/Platformio/src/battery.h +++ b/Platformio/src/battery.h @@ -4,6 +4,8 @@ //#define CRG_STAT 21 // battery charger feedback, GPIO21, VSPIHD, EMAC_TX_EN #define ADC_BAT 36 // Battery voltage sense input (1/2 divider), GPIO36, ADC1_CH0, RTC_GPIO0 +extern int battery_percentage; + void init_battery(void); void update_battery_stats(void); diff --git a/Platformio/src/device_keyboard_ble.cpp b/Platformio/src/device_keyboard_ble.cpp index ee66dae..ca09c56 100644 --- a/Platformio/src/device_keyboard_ble.cpp +++ b/Platformio/src/device_keyboard_ble.cpp @@ -2,6 +2,7 @@ #include "commandHandler.h" #include "device_keyboard_ble.h" #include "gui.h" +#include "battery.h" #ifdef ENABLE_KEYBOARD_BLE @@ -38,6 +39,8 @@ bool blinkBluetoothLabelIsOn = false; void update_keyboard_ble_status() { if (bleKeyboard.isConnected()) { lv_label_set_text(BluetoothLabel, LV_SYMBOL_BLUETOOTH); + bleKeyboard.setBatteryLevel(battery_percentage); + } else { if(millis() - blinkBluetoothLabelLastChange >= 1000){ blinkBluetoothLabelIsOn = !blinkBluetoothLabelIsOn;