WIP stubify to get app building without CONFIG_BLUEDROID (BLE disabled)

1.2-legacy
geeksville 2020-07-21 11:16:14 -07:00
rodzic 1e86365167
commit 6aa28f55dd
9 zmienionych plików z 70 dodań i 35 usunięć

Wyświetl plik

@ -12,5 +12,12 @@ you'll automatically get our fixed libraries.
https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/linux-setup.html https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/linux-setup.html
kevinh@kevin-server:~/development/meshtastic/esp32-arduino-lib-builder\$ python /home/kevinh/development/meshtastic/esp32-arduino-lib-builder/esp-idf/components/esptool*py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 /home/kevinh/development/meshtastic/esp32-arduino-lib-builder/build/bootloader/bootloader.bin kevinh@kevin-server:~/development/meshtastic/esp32-arduino-lib-builder\$ python /home/kevinh/development/meshtastic/esp32-arduino-lib-builder/esp-idf/components/esptool*py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 /home/kevinh/development/meshtastic/esp32-arduino-lib-builder/build/bootloader/bootloader.bin
cp -a out/tools/sdk/* components/arduino/tools/sdk cp -a out/tools/sdk/* components/arduino/tools/sdk
cp -ar components/arduino/* ~/.platformio/packages/framework-arduinoespressif32@src-fba9d33740f719f712e9f8b07da6ea13/ cp -ar components/arduino/* ~/.platformio/packages/framework-arduinoespressif32
/// @src-fba9d33740f719f712e9f8b07da6ea13/
or
cp -ar out/tools/sdk/* ~/.platformio/packages/framework-arduinoespressif32/tools/sdk
``` ```

Wyświetl plik

@ -37,13 +37,6 @@ build_flags = -Wno-missing-field-initializers -Isrc -Isrc/mesh -Isrc/gps -Ilib/n
-DAPP_VERSION=${sysenv.APP_VERSION} -DAPP_VERSION=${sysenv.APP_VERSION}
-DHW_VERSION=${sysenv.HW_VERSION} -DHW_VERSION=${sysenv.HW_VERSION}
; not needed included in ttgo-t-beam board file
; also to use PSRAM https://docs.platformio.org/en/latest/platforms/espressif32.html#external-ram-psram
; -DBOARD_HAS_PSRAM
; -mfix-esp32-psram-cache-issue
; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
; leave this commented out to avoid breaking Windows ; leave this commented out to avoid breaking Windows
;upload_port = /dev/ttyUSB0 ;upload_port = /dev/ttyUSB0
;monitor_port = /dev/ttyUSB0 ;monitor_port = /dev/ttyUSB0
@ -92,6 +85,13 @@ lib_ignore = segger_rtt
platform_packages = platform_packages =
framework-arduinoespressif32 @ https://github.com/meshtastic/arduino-esp32.git#b7f106cd11a04573b902228ea97025c8b5814dd9 framework-arduinoespressif32 @ https://github.com/meshtastic/arduino-esp32.git#b7f106cd11a04573b902228ea97025c8b5814dd9
; not needed included in ttgo-t-beam board file
; also to use PSRAM https://docs.platformio.org/en/latest/platforms/espressif32.html#external-ram-psram
; -DBOARD_HAS_PSRAM
; -mfix-esp32-psram-cache-issue
; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
; The 1.0 release of the TBEAM board ; The 1.0 release of the TBEAM board
[env:tbeam] [env:tbeam]
extends = esp32_base extends = esp32_base

Wyświetl plik

@ -1,6 +1,5 @@
#include "BluetoothSoftwareUpdate.h" #include "BluetoothSoftwareUpdate.h"
#include "BluetoothUtil.h" #include "BluetoothUtil.h"
#include "CallbackCharacteristic.h"
#include "RadioLibInterface.h" #include "RadioLibInterface.h"
#include "configuration.h" #include "configuration.h"
#include "../concurrency/LockGuard.h" #include "../concurrency/LockGuard.h"
@ -11,7 +10,9 @@
#include <Update.h> #include <Update.h>
#include <esp_gatt_defs.h> #include <esp_gatt_defs.h>
//using namespace meshtastic; #ifdef CONFIG_BLUEDROID_ENABLED
#include "CallbackCharacteristic.h"
CRC32 crc; CRC32 crc;
uint32_t rebootAtMsec = 0; // If not zero we will reboot at this time (used to reboot shortly after the update completes) uint32_t rebootAtMsec = 0; // If not zero we will reboot at this time (used to reboot shortly after the update completes)
@ -177,3 +178,5 @@ void destroyUpdateService()
resultC = NULL; resultC = NULL;
} }
#endif

Wyświetl plik

@ -5,7 +5,11 @@
#include <BLEServer.h> #include <BLEServer.h>
#include <BLEUtils.h> #include <BLEUtils.h>
#ifdef CONFIG_BLUEDROID_ENABLED
BLEService *createUpdateService(BLEServer *server, std::string hwVendor, std::string swVersion, std::string hwVersion); BLEService *createUpdateService(BLEServer *server, std::string hwVendor, std::string swVersion, std::string hwVersion);
void destroyUpdateService(); void destroyUpdateService();
void bluetoothRebootCheck(); void bluetoothRebootCheck();
#endif

Wyświetl plik

@ -6,6 +6,8 @@
#include <Update.h> #include <Update.h>
#include <esp_gatt_defs.h> #include <esp_gatt_defs.h>
#ifdef CONFIG_BLUEDROID_ENABLED
SimpleAllocator btPool; SimpleAllocator btPool;
bool _BLEClientConnected = false; bool _BLEClientConnected = false;
@ -321,3 +323,12 @@ void loopBLE()
{ {
bluetoothRebootCheck(); bluetoothRebootCheck();
} }
#else
/// Given a level between 0-100, update the BLE attribute
void updateBatteryLevel(uint8_t level) {}
void deinitBLE() {}
void loopBLE() {}
#endif

Wyświetl plik

@ -8,8 +8,7 @@
#include <BLEUtils.h> #include <BLEUtils.h>
#include "SimpleAllocator.h" #include "SimpleAllocator.h"
// Now handled by BluetoothUtil.cpp #ifdef CONFIG_BLUEDROID_ENABLED
// BLEService *createDeviceInfomationService(BLEServer* server, uint8_t sig, uint16_t vid, uint16_t pid, uint16_t version);
// Help routine to add a description to any BLECharacteristic and add it to the service // Help routine to add a description to any BLECharacteristic and add it to the service
void addWithDesc(BLEService *service, BLECharacteristic *c, const char *description); void addWithDesc(BLEService *service, BLECharacteristic *c, const char *description);
@ -23,11 +22,9 @@ uint32_t getValue32(BLECharacteristic *c, uint32_t defaultValue);
using StartBluetoothPinScreenCallback = std::function<void(uint32_t pass_key)>; using StartBluetoothPinScreenCallback = std::function<void(uint32_t pass_key)>;
using StopBluetoothPinScreenCallback = std::function<void(void)>; using StopBluetoothPinScreenCallback = std::function<void(void)>;
void loopBLE();
BLEServer *initBLE( BLEServer *initBLE(
StartBluetoothPinScreenCallback startBtPinScreen, StopBluetoothPinScreenCallback stopBtPinScreen, StartBluetoothPinScreenCallback startBtPinScreen, StopBluetoothPinScreenCallback stopBtPinScreen,
std::string devName, std::string hwVendor, std::string swVersion, std::string hwVersion = ""); std::string devName, std::string hwVendor, std::string swVersion, std::string hwVersion = "");
void deinitBLE();
/// Add a characteristic that we will delete when we restart /// Add a characteristic that we will delete when we restart
BLECharacteristic *addBLECharacteristic(BLECharacteristic *c); BLECharacteristic *addBLECharacteristic(BLECharacteristic *c);
@ -35,8 +32,12 @@ BLECharacteristic *addBLECharacteristic(BLECharacteristic *c);
/// Add a characteristic that we will delete when we restart /// Add a characteristic that we will delete when we restart
BLEDescriptor *addBLEDescriptor(BLEDescriptor *c); BLEDescriptor *addBLEDescriptor(BLEDescriptor *c);
/// Given a level between 0-100, update the BLE attribute
void updateBatteryLevel(uint8_t level);
/// Any bluetooth objects you allocate _must_ come from this pool if you want to be able to call deinitBLE() /// Any bluetooth objects you allocate _must_ come from this pool if you want to be able to call deinitBLE()
extern SimpleAllocator btPool; extern SimpleAllocator btPool;
#endif
/// Given a level between 0-100, update the BLE attribute
void updateBatteryLevel(uint8_t level);
void deinitBLE();
void loopBLE();

Wyświetl plik

@ -1,11 +1,7 @@
#include "MeshBluetoothService.h"
#include "BluetoothUtil.h"
#include <Arduino.h>
#include <BLE2902.h>
#include <assert.h>
#include <esp_gatt_defs.h>
#include "CallbackCharacteristic.h" #include <Arduino.h>
#include <assert.h>
#include "GPS.h" #include "GPS.h"
#include "MeshService.h" #include "MeshService.h"
#include "NodeDB.h" #include "NodeDB.h"
@ -15,6 +11,14 @@
#include "mesh-pb-constants.h" #include "mesh-pb-constants.h"
#include "mesh.pb.h" #include "mesh.pb.h"
#ifdef CONFIG_BLUEDROID_ENABLED
#include <BLE2902.h>
#include <esp_gatt_defs.h>
#include "CallbackCharacteristic.h"
#include "BluetoothUtil.h"
#include "MeshBluetoothService.h"
// This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in // This scratch buffer is used for various bluetooth reads/writes - but it is safe because only one bt operation can be in
// proccess at once // proccess at once
static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)]; static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)];
@ -141,3 +145,10 @@ void destroyMeshBluetoothService()
meshFromNumCharacteristic = NULL; meshFromNumCharacteristic = NULL;
} }
#else
void destroyMeshBluetoothService() {}
void stopMeshBluetoothService() {}
#endif

Wyświetl plik

@ -4,12 +4,11 @@
#include <BLEServer.h> #include <BLEServer.h>
#include <BLEService.h> #include <BLEService.h>
#ifdef CONFIG_BLUEDROID_ENABLED
BLEService *createMeshBluetoothService(BLEServer *server); BLEService *createMeshBluetoothService(BLEServer *server);
#endif
void destroyMeshBluetoothService(); void destroyMeshBluetoothService();
/**
* Tell any bluetooth clients that the number of rx packets has changed
*/
void bluetoothNotifyFromNum(uint32_t newValue);
void stopMeshBluetoothService(); void stopMeshBluetoothService();

Wyświetl plik

@ -17,9 +17,7 @@ void reinitBluetooth()
{ {
DEBUG_MSG("Starting bluetooth\n"); DEBUG_MSG("Starting bluetooth\n");
// FIXME - we are leaking like crazy #ifdef CONFIG_BLUEDROID_ENABLED
// AllocatorScope scope(btPool);
// Note: these callbacks might be coming in from a different thread. // Note: these callbacks might be coming in from a different thread.
BLEServer *serve = initBLE( BLEServer *serve = initBLE(
[](uint32_t pin) { [](uint32_t pin) {
@ -32,6 +30,7 @@ void reinitBluetooth()
// Start advertising - this must be done _after_ creating all services // Start advertising - this must be done _after_ creating all services
serve->getAdvertising()->start(); serve->getAdvertising()->start();
#endif
} }
// Enable/disable bluetooth. // Enable/disable bluetooth.