diff --git a/lib/BluetoothOTA/src/BluetoothUtil.cpp b/lib/BluetoothOTA/src/BluetoothUtil.cpp index 306289879..7433827f8 100644 --- a/lib/BluetoothOTA/src/BluetoothUtil.cpp +++ b/lib/BluetoothOTA/src/BluetoothUtil.cpp @@ -13,7 +13,7 @@ static BLECharacteristic HardwareVersionCharacteristic(BLEUUID((uint16_t) ESP_GA /** * Create standard device info service **/ -BLEService *createDeviceInfomationService(BLEServer* server) { +BLEService *createDeviceInfomationService(BLEServer* server, std::string hwVendor, std::string swVersion) { BLEService *deviceInfoService = server->createService(BLEUUID((uint16_t) ESP_GATT_UUID_DEVICE_INFO_SVC)); /* @@ -25,9 +25,9 @@ BLEService *createDeviceInfomationService(BLEServer* server) { uint8_t pnp[] = { sig, (uint8_t) (vid >> 8), (uint8_t) vid, (uint8_t) (pid >> 8), (uint8_t) pid, (uint8_t) (version >> 8), (uint8_t) version }; m_pnpCharacteristic->setValue(pnp, sizeof(pnp)); */ - SWVersionCharacteristic.setValue("0.1"); + SWVersionCharacteristic.setValue(swVersion); deviceInfoService->addCharacteristic(&SWVersionCharacteristic); - ManufacturerCharacteristic.setValue("TTGO"); + ManufacturerCharacteristic.setValue(hwVendor); deviceInfoService->addCharacteristic(&ManufacturerCharacteristic); HardwareVersionCharacteristic.setValue("1.0"); deviceInfoService->addCharacteristic(&HardwareVersionCharacteristic); @@ -122,13 +122,13 @@ uint32_t getValue32(BLECharacteristic *c, uint32_t defaultValue) { } -BLEServer *initBLE(std::string deviceName) { +BLEServer *initBLE(std::string deviceName, std::string hwVendor, std::string swVersion) { BLEDevice::init(deviceName); // Create the BLE Server BLEServer *pServer = BLEDevice::createServer(); pServer->setCallbacks(new MyServerCallbacks()); - BLEService *pDevInfo = createDeviceInfomationService(pServer); + BLEService *pDevInfo = createDeviceInfomationService(pServer, hwVendor, swVersion); // We now let users create the battery service only if they really want (not all devices have a battery) // BLEService *pBattery = createBatteryService(pServer); diff --git a/lib/BluetoothOTA/src/BluetoothUtil.h b/lib/BluetoothOTA/src/BluetoothUtil.h index dd78a544f..65ab327f8 100644 --- a/lib/BluetoothOTA/src/BluetoothUtil.h +++ b/lib/BluetoothOTA/src/BluetoothUtil.h @@ -18,4 +18,4 @@ void dumpCharacteristic(BLECharacteristic *c); uint32_t getValue32(BLECharacteristic *c, uint32_t defaultValue); void loopBLE(); -BLEServer *initBLE(std::string devName); \ No newline at end of file +BLEServer *initBLE(std::string devName, std::string hwVendor, std::string swVersion); \ No newline at end of file diff --git a/src/configuration.h b/src/configuration.h index edd2d91be..f96e8fc59 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -40,6 +40,9 @@ along with this program. If not, see . // #define T_BEAM_V10 // AKA Rev1 (second board released) #define HELTEC_LORA32 +// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled) +#define USE_JTAG + #define DEBUG_PORT Serial // Serial debug port #define SERIAL_BAUD 115200 // Serial debug baud rate #define SLEEP_MSECS (30 * 24 * 60 * 60 * 1000LL) // Sleep for these many millis (or a button press or a lora msg?) @@ -93,12 +96,15 @@ along with this program. If not, see . #define GPS_SERIAL_NUM 1 #define GPS_BAUDRATE 9600 -#define USE_GPS 1 #if defined(T_BEAM_V10) #define GPS_RX_PIN 34 +#ifdef USE_JTAG +#define GPS_TX_PIN -1 // We can't send bytes to the GPS while using JTAG (not a big deal) +#else #define GPS_TX_PIN 12 #endif +#endif // ----------------------------------------------------------------------------- // LoRa SPI @@ -110,6 +116,7 @@ along with this program. If not, see . #define NSS_GPIO 18 #if defined(T_BEAM_V10) +#define HW_VENDOR "TTGO" #define I2C_SDA 21 #define I2C_SCL 22 @@ -123,6 +130,8 @@ along with this program. If not, see . #define PMU_IRQ 35 #elif defined(HELTEC_LORA32) +#define HW_VENDOR "Heltec" + #define I2C_SDA 4 #define I2C_SCL 15 diff --git a/src/main.ino b/src/main.ino index f934da034..7853359e4 100644 --- a/src/main.ino +++ b/src/main.ino @@ -361,7 +361,7 @@ void setup() //} service.init(); - BLEServer *serve = initBLE(getDeviceName()); // FIXME, use a real name based on the macaddr + BLEServer *serve = initBLE(getDeviceName(), HW_VENDOR, APP_VERSION); // FIXME, use a real name based on the macaddr createMeshBluetoothService(serve); }