diff --git a/src/BluetoothStatus.h b/src/BluetoothStatus.h index 526b6f243..f6bb43cc2 100644 --- a/src/BluetoothStatus.h +++ b/src/BluetoothStatus.h @@ -88,10 +88,16 @@ class BluetoothStatus : public Status break; case ConnectionState::CONNECTED: LOG_DEBUG("BluetoothStatus CONNECTED"); +#ifdef BLE_LED + digitalWrite(BLE_LED, HIGH); +#endif break; case ConnectionState::DISCONNECTED: LOG_DEBUG("BluetoothStatus DISCONNECTED"); +#ifdef BLE_LED + digitalWrite(BLE_LED, LOW); +#endif break; } } @@ -102,4 +108,4 @@ class BluetoothStatus : public Status } // namespace meshtastic -extern meshtastic::BluetoothStatus *bluetoothStatus; \ No newline at end of file +extern meshtastic::BluetoothStatus *bluetoothStatus; diff --git a/src/main.cpp b/src/main.cpp index c12707cdb..7ecd634c9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -345,6 +345,16 @@ void setup() digitalWrite(USER_LED, HIGH ^ LED_STATE_ON); #endif +#ifdef WIFI_LED + pinMode(WIFI_LED, OUTPUT); + digitalWrite(WIFI_LED, LOW); +#endif + +#ifdef BLE_LED + pinMode(BLE_LED, OUTPUT); + digitalWrite(BLE_LED, LOW); +#endif + #if defined(T_DECK) // GPIO10 manages all peripheral power supplies // Turn on peripheral power immediately after MUC starts. diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 789f8ac44..945460c28 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -327,9 +327,15 @@ static void WiFiEvent(WiFiEvent_t event) break; case ARDUINO_EVENT_WIFI_STA_CONNECTED: LOG_INFO("Connected to access point"); +#ifdef WIFI_LED + digitalWrite(WIFI_LED, HIGH); +#endif break; case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: LOG_INFO("Disconnected from WiFi access point"); +#ifdef WIFI_LED + digitalWrite(WIFI_LED, LOW); +#endif if (!isReconnecting) { WiFi.disconnect(false, true); syslog.disable(); @@ -378,9 +384,15 @@ static void WiFiEvent(WiFiEvent_t event) break; case ARDUINO_EVENT_WIFI_AP_START: LOG_INFO("WiFi access point started"); +#ifdef WIFI_LED + digitalWrite(WIFI_LED, HIGH); +#endif break; case ARDUINO_EVENT_WIFI_AP_STOP: LOG_INFO("WiFi access point stopped"); +#ifdef WIFI_LED + digitalWrite(WIFI_LED, LOW); +#endif break; case ARDUINO_EVENT_WIFI_AP_STACONNECTED: LOG_INFO("Client connected"); @@ -474,4 +486,4 @@ uint8_t getWifiDisconnectReason() { return wifiDisconnectReason; } -#endif \ No newline at end of file +#endif diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 009439f25..177a07eb4 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -171,6 +171,11 @@ void NimbleBluetooth::deinit() { #ifdef ARCH_ESP32 LOG_INFO("Disable bluetooth until reboot"); + +#ifdef BLE_LED + digitalWrite(BLE_LED, LOW); +#endif + NimBLEDevice::deinit(); #endif } diff --git a/src/sleep.cpp b/src/sleep.cpp index 8ffb08b04..6d1b2f348 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -332,7 +332,7 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false, bool skipSaveN } #endif -#if defined(ARCH_ESP32) && defined(I2C_SDA) +#if !MESHTASTIC_EXCLUDE_I2C && defined(ARCH_ESP32) && defined(I2C_SDA) // Added by https://github.com/meshtastic/firmware/pull/4418 // Possibly to support Heltec Capsule Sensor? Wire.end(); @@ -542,4 +542,4 @@ void enableLoraInterrupt() } #endif } -#endif \ No newline at end of file +#endif diff --git a/variants/heltec_wireless_bridge/platformio.ini b/variants/heltec_wireless_bridge/platformio.ini index 45c3aba74..ab30eb744 100644 --- a/variants/heltec_wireless_bridge/platformio.ini +++ b/variants/heltec_wireless_bridge/platformio.ini @@ -3,4 +3,21 @@ extends = esp32_base board = heltec_wifi_lora_32 build_flags = - ${esp32_base.build_flags} -D HELTEC_WIRELESS_BRIDGE -I variants/heltec_wireless_bridge \ No newline at end of file + ${esp32_base.build_flags} + -I variants/heltec_wireless_bridge + -D HELTEC_WIRELESS_BRIDGE + -D BOARD_HAS_PSRAM + -D RADIOLIB_EXCLUDE_LR11X0=1 + -D RADIOLIB_EXCLUDE_SX128X=1 + -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 + -D MESHTASTIC_EXCLUDE_DETECTIONSENSOR=1 + -D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1 + -D MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR_EXTERNAL=1 + -D MESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION=1 + -D MESHTASTIC_EXCLUDE_GPS=1 + -D MESHTASTIC_EXCLUDE_I2C=1 + -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 + -D MESHTASTIC_EXCLUDE_POWER_FSM=1 + -D MESHTASTIC_EXCLUDE_SERIAL=1 + -D MESHTASTIC_EXCLUDE_SCREEN=1 + -D MESHTASTIC_EXCLUDE_WAYPOINT=1 diff --git a/variants/heltec_wireless_bridge/variant.h b/variants/heltec_wireless_bridge/variant.h index 7c4f41660..5ad16d0e2 100644 --- a/variants/heltec_wireless_bridge/variant.h +++ b/variants/heltec_wireless_bridge/variant.h @@ -1,29 +1,41 @@ -// the default ESP32 Pin of 15 is the Oled SCL, set to 36 and 37 and works fine. -// Tested on Neo6m module. + +// updated variant 20250420 berlincount, tested with HTIT-TB +// +// connections in HTIT-WB +// per https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf +// md5: a0e6ae10ff76611aa61433366b2e4f5c esp32_datasheet_en.pdf +// per https://resource.heltec.cn/download/Wireless_Bridge/Schematic_Diagram_HTIT-WB_V0.2.pdf +// md5: d5c1b0219ece347dd8cee866d7d3ab0a Schematic_Diagram_HTIT-WB_V0.2.pdf + +#define NO_EXT_GPIO 1 +#define NO_GPS 1 + +#define HAS_GPS 0 // GPS is not equipped #undef GPS_RX_PIN #undef GPS_TX_PIN -#define GPS_RX_PIN 36 -#define GPS_TX_PIN 33 -#ifndef USE_JTAG // gpio15 is TDO for JTAG, so no I2C on this board while doing jtag -#define I2C_SDA 4 // I2C pins for this board -#define I2C_SCL 15 -#endif - -#define LED_PIN 25 // If defined we will blink this LED -#define BUTTON_PIN 0 // If defined, this will be used for user button presses +// Green / Lora = PIN 22 / GPIO2, Yellow / Wifi = PIN 23 / GPIO0, Blue / BLE = PIN 25 / GPIO16 +#define LED_PIN 22 +#define WIFI_LED 23 +#define BLE_LED 25 +// ESP32-D0WDQ6 direct pins SX1276 #define USE_RF95 -#define LORA_DIO0 26 // a No connect on the SX1262 module -#ifndef USE_JTAG -#define LORA_RESET 14 -#endif +#define LORA_DIO0 26 #define LORA_DIO1 35 -#define LORA_DIO2 34 // Not really used +#define LORA_DIO2 34 +#define LORA_SCK 05 +#define LORA_MISO 19 +#define LORA_MOSI 27 +#define LORA_CS 18 -// ratio of voltage divider = 3.20 (R1=100k, R2=220k) -#define ADC_MULTIPLIER 3.2 +// several things are not possible with JTAG enabled +#ifndef USE_JTAG +#define LORA_RESET 14 // LoRa Reset shares a pin with MTMS +#define I2C_SDA 4 // SD_DATA1 going to W25Q64, but +#define I2C_SCL 15 // SD_CMD shared a pin with MTD0 +#endif -#define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage -#define ADC_CHANNEL ADC2_GPIO13_CHANNEL -#define BAT_MEASURE_ADC_UNIT 2 \ No newline at end of file +// user button is present on device, but currently untested & unconfigured - couldn't figure out how it's connected + +// battery support is present within device, but currently untested & unconfigured - couldn't find reliable information yet