mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-01 10:19:59 +00:00
turn off battery service for now
This commit is contained in:
parent
255463f6b8
commit
ef4e7911f5
1
TODO.md
1
TODO.md
@ -40,6 +40,7 @@ until the phone pulls those packets. Ever so often power on bluetooth just so w
|
|||||||
|
|
||||||
# Low priority
|
# Low priority
|
||||||
|
|
||||||
|
* reneable the bluetooth battely level service on the T-BEAM, because we can read battery level there
|
||||||
* report esp32 device code bugs back to the mothership via android
|
* report esp32 device code bugs back to the mothership via android
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
|
@ -78,10 +78,24 @@ BLEService *createBatteryService(BLEServer* server) {
|
|||||||
addWithDesc(pBattery, &BatteryLevelCharacteristic, "Percentage 0 - 100");
|
addWithDesc(pBattery, &BatteryLevelCharacteristic, "Percentage 0 - 100");
|
||||||
BatteryLevelCharacteristic.addDescriptor(new BLE2902()); // Needed so clients can request notification
|
BatteryLevelCharacteristic.addDescriptor(new BLE2902()); // Needed so clients can request notification
|
||||||
|
|
||||||
|
// I don't think we need to advertise this
|
||||||
|
// server->getAdvertising()->addServiceUUID(pBattery->getUUID());
|
||||||
|
pBattery->start();
|
||||||
|
|
||||||
return pBattery;
|
return pBattery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the battery level we are currently telling clients.
|
||||||
|
* level should be a pct between 0 and 100
|
||||||
|
*/
|
||||||
|
void updateBatteryLevel(uint8_t level) {
|
||||||
|
// Pretend to update battery levels - fixme do elsewhere
|
||||||
|
BatteryLevelCharacteristic.setValue(&level, 1);
|
||||||
|
BatteryLevelCharacteristic.notify();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void dumpCharacteristic(BLECharacteristic *c) {
|
void dumpCharacteristic(BLECharacteristic *c) {
|
||||||
std::string value = c->getValue();
|
std::string value = c->getValue();
|
||||||
@ -115,15 +129,14 @@ BLEServer *initBLE(std::string deviceName) {
|
|||||||
|
|
||||||
BLEService *pDevInfo = createDeviceInfomationService(pServer);
|
BLEService *pDevInfo = createDeviceInfomationService(pServer);
|
||||||
|
|
||||||
BLEService *pBattery = createBatteryService(pServer);
|
// We now let users create the battery service only if they really want (not all devices have a battery)
|
||||||
pServer->getAdvertising()->addServiceUUID(pBattery->getUUID());
|
// BLEService *pBattery = createBatteryService(pServer);
|
||||||
|
|
||||||
BLEService *pUpdate = createUpdateService(pServer); // We need to advertise this so our android ble scan operation can see it
|
BLEService *pUpdate = createUpdateService(pServer); // We need to advertise this so our android ble scan operation can see it
|
||||||
pServer->getAdvertising()->addServiceUUID(pUpdate->getUUID());
|
pServer->getAdvertising()->addServiceUUID(pUpdate->getUUID());
|
||||||
|
|
||||||
// start all our services (do this after creating all of them)
|
// start all our services (do this after creating all of them)
|
||||||
pDevInfo->start();
|
pDevInfo->start();
|
||||||
pBattery->start();
|
|
||||||
pUpdate->start();
|
pUpdate->start();
|
||||||
|
|
||||||
// Start advertising
|
// Start advertising
|
||||||
@ -134,14 +147,5 @@ BLEServer *initBLE(std::string deviceName) {
|
|||||||
|
|
||||||
// Called from loop
|
// Called from loop
|
||||||
void loopBLE() {
|
void loopBLE() {
|
||||||
static uint8_t level = 31;
|
|
||||||
|
|
||||||
// Pretend to update battery levels - fixme do elsewhere
|
|
||||||
BatteryLevelCharacteristic.setValue(&level, 1);
|
|
||||||
BatteryLevelCharacteristic.notify();
|
|
||||||
delay(5000);
|
|
||||||
|
|
||||||
level = (level + 1) % 100;
|
|
||||||
|
|
||||||
bluetoothRebootCheck();
|
bluetoothRebootCheck();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user