report battery level to BLE device
This commit is contained in:
parent
66c8195a31
commit
fb4dbd71be
2 changed files with 5 additions and 0 deletions
|
@ -4,6 +4,8 @@
|
||||||
//#define CRG_STAT 21 // battery charger feedback, GPIO21, VSPIHD, EMAC_TX_EN
|
//#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
|
#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 init_battery(void);
|
||||||
void update_battery_stats(void);
|
void update_battery_stats(void);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "commandHandler.h"
|
#include "commandHandler.h"
|
||||||
#include "device_keyboard_ble.h"
|
#include "device_keyboard_ble.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
#include "battery.h"
|
||||||
|
|
||||||
#ifdef ENABLE_KEYBOARD_BLE
|
#ifdef ENABLE_KEYBOARD_BLE
|
||||||
|
|
||||||
|
@ -38,6 +39,8 @@ bool blinkBluetoothLabelIsOn = false;
|
||||||
void update_keyboard_ble_status() {
|
void update_keyboard_ble_status() {
|
||||||
if (bleKeyboard.isConnected()) {
|
if (bleKeyboard.isConnected()) {
|
||||||
lv_label_set_text(BluetoothLabel, LV_SYMBOL_BLUETOOTH);
|
lv_label_set_text(BluetoothLabel, LV_SYMBOL_BLUETOOTH);
|
||||||
|
bleKeyboard.setBatteryLevel(battery_percentage);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(millis() - blinkBluetoothLabelLastChange >= 1000){
|
if(millis() - blinkBluetoothLabelLastChange >= 1000){
|
||||||
blinkBluetoothLabelIsOn = !blinkBluetoothLabelIsOn;
|
blinkBluetoothLabelIsOn = !blinkBluetoothLabelIsOn;
|
||||||
|
|
Loading…
Add table
Reference in a new issue