Skip to content

Commit

Permalink
misc. ESP32xx BLE Adv. improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Sep 27, 2023
1 parent 0b52a6e commit c8718bd
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 34 deletions.
12 changes: 12 additions & 0 deletions software/firmware/source/SoftRF/src/driver/Bluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,23 @@ static void ESP32_Bluetooth_setup()

// Start advertising
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
#if 0
pAdvertising->addServiceUUID(BLEUUID(UART_SERVICE_UUID16));
pAdvertising->addServiceUUID(BLEUUID(UUID16_SVC_BATTERY));
#if defined(USE_BLE_MIDI)
pAdvertising->addServiceUUID(BLEUUID(MIDI_SERVICE_UUID));
#endif /* USE_BLE_MIDI */
#else
/* work around https://github.com/espressif/arduino-esp32/issues/6750 */
BLEAdvertisementData BLEAdvData;
BLEAdvData.setFlags(0x06);
BLEAdvData.setCompleteServices(BLEUUID(UART_SERVICE_UUID16));
BLEAdvData.setCompleteServices(BLEUUID(UUID16_SVC_BATTERY));
#if defined(USE_BLE_MIDI)
BLEAdvData.setCompleteServices(BLEUUID(MIDI_SERVICE_UUID));
#endif /* USE_BLE_MIDI */
pAdvertising->setAdvertisementData(BLEAdvData);
#endif
pAdvertising->setScanResponse(true);
pAdvertising->setMinPreferred(0x06); // functions that help with iPhone connections issue
pAdvertising->setMaxPreferred(0x12);
Expand Down
74 changes: 41 additions & 33 deletions software/firmware/source/SoftRF/src/platform/ESP32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,34 +437,33 @@ static void ESP32_setup()
ESP32_Min_AppPart_Size = min_app_size;
}

if (psramFound()) {

uint32_t flash_id = ESP32_getFlashId();

/*
* Board | Module | Flash memory IC
* ----------------+---------------+--------------------
* DoIt ESP32 | WROOM | GIGADEVICE_GD25Q32
* TTGO T3 V2.0 | PICO-D4 IC | GIGADEVICE_GD25Q32
* TTGO T3 V2.1.6 | PICO-D4 IC | GIGADEVICE_GD25Q32
* TTGO T22 V06 | | WINBOND_NEX_W25Q32_V
* TTGO T22 V08 | | WINBOND_NEX_W25Q32_V
* TTGO T22 V11 | | BOYA_BY25Q32AL
* TTGO T8 V1.8 | WROVER | GIGADEVICE_GD25LQ32
* TTGO T8 S2 V1.1 | | WINBOND_NEX_W25Q32_V
* TTGO T5S V1.9 | | WINBOND_NEX_W25Q32_V
* TTGO T5S V2.8 | | BOYA_BY25Q32AL
* TTGO T5 4.7 | WROVER-E | XMC_XM25QH128C
* TTGO T-Watch | | WINBOND_NEX_W25Q128_V
* Ai-T NodeMCU-S3 | ESP-S3-12K | GIGADEVICE_GD25Q64C
* TTGO T-Dongle | | BOYA_BY25Q32AL
* TTGO S3 Core | | GIGADEVICE_GD25Q64C
* TTGO T-01C3 | | BOYA_BY25Q32AL
* | ESP-C3-12F | XMC_XM25QH32B
* LilyGO T-TWR | WROOM-1-N16R8 | GIGADEVICE_GD25Q128
* Heltec Tracker | | GIGADEVICE_GD25Q64
*/
uint32_t flash_id = ESP32_getFlashId();

/*
* Board | Module | Flash memory IC
* ----------------+---------------+--------------------
* DoIt ESP32 | WROOM | GIGADEVICE_GD25Q32
* TTGO T3 V2.0 | PICO-D4 IC | GIGADEVICE_GD25Q32
* TTGO T3 V2.1.6 | PICO-D4 IC | GIGADEVICE_GD25Q32
* TTGO T22 V06 | | WINBOND_NEX_W25Q32_V
* TTGO T22 V08 | | WINBOND_NEX_W25Q32_V
* TTGO T22 V11 | | BOYA_BY25Q32AL
* TTGO T8 V1.8 | WROVER | GIGADEVICE_GD25LQ32
* TTGO T8 S2 V1.1 | | WINBOND_NEX_W25Q32_V
* TTGO T5S V1.9 | | WINBOND_NEX_W25Q32_V
* TTGO T5S V2.8 | | BOYA_BY25Q32AL
* TTGO T5 4.7 | WROVER-E | XMC_XM25QH128C
* TTGO T-Watch | | WINBOND_NEX_W25Q128_V
* Ai-T NodeMCU-S3 | ESP-S3-12K | GIGADEVICE_GD25Q64C
* TTGO T-Dongle | | BOYA_BY25Q32AL
* TTGO S3 Core | | GIGADEVICE_GD25Q64C
* TTGO T-01C3 | | BOYA_BY25Q32AL
* | ESP-C3-12F | XMC_XM25QH32B
* LilyGO T-TWR | WROOM-1-N16R8 | GIGADEVICE_GD25Q128
* Heltec Tracker | | GIGADEVICE_GD25Q64
*/

if (psramFound()) {
switch(flash_id)
{
case MakeFlashId(GIGADEVICE_ID, GIGADEVICE_GD25LQ32):
Expand All @@ -483,9 +482,7 @@ static void ESP32_setup()
default:
esp32_board = ESP32_S2_T8_V1_1;
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
case MakeFlashId(GIGADEVICE_ID, GIGADEVICE_GD25Q128):
hw_info.model = SOFTRF_MODEL_HAM;
break;
/* Both Ai-Thinker ESP-S3-12K and LilyGO S3 Core have QSPI PSRAM onboard */
case MakeFlashId(GIGADEVICE_ID, GIGADEVICE_GD25Q64):
default:
hw_info.model = SOFTRF_MODEL_PRIME_MK3;
Expand All @@ -510,13 +507,24 @@ static void ESP32_setup()
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
esp32_board = ESP32_S2_T8_V1_1;
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
if (ESP32_getFlashId() == MakeFlashId(GIGADEVICE_ID, GIGADEVICE_GD25Q128)) {
switch(flash_id)
{
case MakeFlashId(GIGADEVICE_ID, GIGADEVICE_GD25Q128):
/*
* LilyGO T-TWR has OPI PSRAM in the WROVER module.
* ESP32 Arduino Core 2.0.x is unable to detect OPI PSRAM
* unless we do a psram_type=opi custom build.
*/
hw_info.model = SOFTRF_MODEL_HAM; /* allow psramFound() to fail */
} else if (ESP32_getFlashId() == MakeFlashId(GIGADEVICE_ID, GIGADEVICE_GD25Q64)) {
break;
case MakeFlashId(GIGADEVICE_ID, GIGADEVICE_GD25Q64):
/* Heltec Tracker has no PSRAM onboard */
esp32_board = ESP32_HELTEC_TRACKER;
hw_info.model = SOFTRF_MODEL_MIDI;
} else {
break;
default:
esp32_board = ESP32_S3_DEVKIT;
break;
}
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
esp32_board = ESP32_C3_DEVKIT;
Expand Down
4 changes: 3 additions & 1 deletion software/firmware/source/libraries/SA818/library.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name=SA818
version=1.0.0
author=Gibbon Zen
maintainer=Gibbon Zen
sentence=AT+Commands library for SA818/SA868 module
category=Serial Arduino-SA818 communications
paragraph=Serial Arduino-SA818 communications
category=Communication
url=https://github.com/gibbonzen/SA818
keywords=serial, SA818, SA868
frameworks=arduino
Expand Down

0 comments on commit c8718bd

Please sign in to comment.