* Migrate esp32 families to pioarduino platform * ESP32c6 align text.handler_execute same as C3 * Use pioarduino `develop` The latest fixes and the latest bugs! * preliminary esp32p4.ini * pioarduino: Update LovyanGFX Includes Manuel's recent commit * pioarduino 3.3.6 * pioarduino 3.3.6 *release* chasing the release * pioarduino: Fix OG ESP32 duplicate libs * pioarduino: T-Beam 1W CDC mode * pioarduino: disable network provisioning (wifiprov) * pioarduino: use legacy esptoolpy naming (forward-compatible) * Update lovyangfx from `develop` commit to 1.2.19 * fix esp32p4.ini * check for esp32 w/ wifi * esp32-p4 specific adaptations * Switch to meshtastic/esp32_https_server fork (idf5 branch) * don't ignore esp_lcd * config for MUI * fix/workaround SDMMC * revert a6f6175, update to 3.3.8 * enable esp_hosted for esp32-p4 (experimental) * Pioarduino 55.03.38-1 * NimBLE-Arduino -> Arduino "BLE" (3.3.x) migration (#10164) * NimBLE-Arduino -> Arduino "BLE" (3.3.x) migration * More NimBLE * Fix Device Name in ATT Read Request (0x2A00). Device Name is exposed in two places: - Advertisement data: this is set properly in startAdvertising. - GATT attribute Device Name (0x2A00). This one is handled internally in NimBLE and comes from ble_svc_gap_device_name_set. This is set initially, but then BLEDevice::createServer calls ble_svc_gap_init which resets the device name. This causes the device to apparently "change name after pairing": < ACL Data TX:... flags 0x00 dlen 7 #113 [hci0] 14.241149 ATT: Read Request (0x0a) len 2 Handle: 0x0003 Type: Device Name (0x2a00) > ACL Data RX: Handle 2048 flags 0x02 dlen 11 #115 [hci0] 14.269050 ATT: Read Response (0x0b) len 6 Value[6]: 6e696d626c65 # "nimble" Workaround this by setting the device name once again after BLEDevice::createServer. * Temporarily lower CORE_DEBUG_LEVEL to INFO to avoid triggering an apparent ESP-IDF Bluetooth bug when re-connecting to Pixel 8 Android devices. Initial pairing works, but after ESP32 is rebooted, phone fails to reconnect. Meshtastic app shows it as disconnecting immediately. LightBlue shows a more detailed error "Peripheral Connection - Warning: onConnectionStatusChange: status 61" (0x3D - MIC Failure). Bug report to Espresssif: https://github.com/espressif/esp-idf/issues/18126#issuecomment-4286197744 * Temporarily disable ble_gap_set_data_len, causes crash with Pixel 8 Android reconnect. Crash looks like this: [ 11966][E][BLEAdvertising.cpp:341] setScanResponseData(): ble_gap_adv_rsp_set_data: 22 [ 11975][E][BLEAdvertising.cpp:1554] start(): Host reset, wait for sync. ERROR | ??:??:?? 11 BLE failed to start advertising Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled. Core 0 register dump: PC : 0x420e6190 PS : 0x00060730 A0 : 0x820e158b A1 : 0x3fce50c0 A2 : 0x00000000 A3 : 0x3fcb8600 A4 : 0x3fcb85cc A5 : 0x00000000 A6 : 0x00000000 A7 : 0x00000c03 A8 : 0x00000000 A9 : 0x3fce50b0 A10 : 0x0000000e A11 : 0x00000000 A12 : 0x00000010 A13 : 0x3fce50e0 A14 : 0x00000c03 A15 : 0x00000001 SAR : 0x0000001e EXCCAUSE: 0x0000001c EXCVADDR: 0x00000000 LBEG : 0x400570e8 LEND : 0x400570f3 LCOUNT : 0x00000000 Backtrace: 0x420e618d:0x3fce50c0 0x420e1588:0x3fce5110 0x420dfe87:0x3fce5200 0x420dfefb:0x3fce5220 0x420dff3f:0x3fce5240 0x4219602b:0x3fce5260 0x4037b0e5:0x3fce5280 0x4201edf3:0x3fce52a0 Connection seems fast enough even without this. We'll investigate the reason for the crash and re-enable once it's safe. --------- Co-authored-by: Catalin Patulea <cronos586@gmail.com> * Add extension from pioarduino nag "Jason2866.esp-decoder" * Cleanup after merge * ESP32: Disable classic bluetooth * Cleanup: Fix ADC channels on new variants * InkHUD: Fix type casting for message size in saveToFlash method inkhud compiles again! * update p4 esp_hosted for BT * I thought I fixed this * fix linker error using response file (p4 only) * fix infinite loop * Fix Power.cpp check warning Local variable 'config' shadows outer variable [shadowVariable] * Build ESP32 original with NimBLE ('custom_sdkconfig' approach). (#10235) * Re-enable littlefs json manifest This works locally again :) Not sure what changed * Re-add tool-mklittlefs * sensecap indicator fixes after upgrade arduino-esp & lovyanGFX libs * hackaday fix * robot tbeam cache error fix Co-authored-by: Copilot <copilot@github.com> * trunk fmt * ignore trunk * BLEDevice::deinit() added Co-authored-by: Copilot <copilot@github.com> * platformio-custom: Modify mtjson target dependency to prevent fake-success. (#10291) Co-authored-by: Copilot <copilot@github.com> * Fix ESP32-C6 linker errors. Align .text.handler_execute section to 4 bytes and update watchdog timer core mask configuration Co-authored-by: Copilot <copilot@github.com> * tlora-c6: Disable Screen MESHTASTIC_EXCLUDE_SCREEN=1 on tlora-c6. It doesn't have a screen, and this gets it compiling again (saving flash). * Use mverch's iram_memset hack for all OG-ESP32 * Refactor watchdog timer initialization and handling * use adc_channel_t in variant.h * Fix variant headers * More idiomatic default ethernet that doesn't break the build * Elecrows: Delete problematic variant.cpp Not needed after USE_ETHERNET_DEFAULT --------- Co-authored-by: mverch67 <manuel.verch@gmx.de> Co-authored-by: Manuel <71137295+mverch67@users.noreply.github.com> Co-authored-by: Catalin Patulea <cronos586@gmail.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vidplace7 <1779290+vidplace7@users.noreply.github.com> Co-authored-by: Copilot <copilot@github.com> Co-authored-by: thebentern <9000580+thebentern@users.noreply.github.com> Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
101 lines
4.3 KiB
C
101 lines
4.3 KiB
C
#define VEXT_ENABLE 36 // active low, powers the oled display and the lora antenna boost
|
|
#define BUTTON_PIN 0
|
|
|
|
#define ADC_CTRL 37
|
|
#define ADC_CTRL_ENABLED HIGH
|
|
#define BATTERY_PIN 1 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
|
|
#define ADC_CHANNEL ADC_CHANNEL_0
|
|
#define ADC_ATTENUATION ADC_ATTEN_DB_2_5 // lower dB for high resistance voltage divider
|
|
#define ADC_MULTIPLIER 4.9 * 1.045
|
|
|
|
#define USE_SX1262
|
|
|
|
#define LORA_DIO0 -1 // a No connect on the SX1262 module
|
|
#define LORA_RESET 12
|
|
#define LORA_DIO1 14 // SX1262 IRQ
|
|
#define LORA_DIO2 13 // SX1262 BUSY
|
|
#define LORA_DIO3 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TCXO is enabled
|
|
|
|
#define LORA_SCK 9
|
|
#define LORA_MISO 11
|
|
#define LORA_MOSI 10
|
|
#define LORA_CS 8
|
|
|
|
#define SX126X_CS LORA_CS
|
|
#define SX126X_DIO1 LORA_DIO1
|
|
#define SX126X_BUSY LORA_DIO2
|
|
#define SX126X_RESET LORA_RESET
|
|
|
|
#define SX126X_DIO2_AS_RF_SWITCH
|
|
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
|
|
|
// Enable Traffic Management Module for Heltec V4
|
|
#ifndef HAS_TRAFFIC_MANAGEMENT
|
|
#define HAS_TRAFFIC_MANAGEMENT 1
|
|
#endif
|
|
#ifndef TRAFFIC_MANAGEMENT_CACHE_SIZE
|
|
#define TRAFFIC_MANAGEMENT_CACHE_SIZE 2048
|
|
#endif
|
|
|
|
// ---- GC1109 RF FRONT END CONFIGURATION ----
|
|
// The Heltec V4.2 uses a GC1109 FEM chip with integrated PA and LNA
|
|
// RF path: SX1262 -> Pi attenuator -> GC1109 PA -> Antenna
|
|
// Measured net TX gain (non-linear due to PA compression):
|
|
// +11dB at 0-15dBm input (e.g., 10dBm in -> 21dBm out)
|
|
// +10dB at 16-17dBm input
|
|
// +9dB at 18-19dBm input
|
|
// +7dB at 21dBm input (e.g., 21dBm in -> 28dBm out max)
|
|
// Control logic (from GC1109 datasheet):
|
|
// Shutdown: CSD=0, CTX=X, CPS=X
|
|
// Receive LNA: CSD=1, CTX=0, CPS=X (17dB gain, 2dB NF)
|
|
// Transmit bypass: CSD=1, CTX=1, CPS=0 (~1dB loss, no PA)
|
|
// Transmit PA: CSD=1, CTX=1, CPS=1 (full PA enabled)
|
|
// Pin mapping:
|
|
// CTX (pin 6) -> SX1262 DIO2: TX/RX path select (automatic via SX126X_DIO2_AS_RF_SWITCH)
|
|
// CSD (pin 4) -> GPIO2: Chip enable (HIGH=on, LOW=shutdown)
|
|
// CPS (pin 5) -> GPIO46: PA mode select (HIGH=full PA, LOW=bypass)
|
|
// VCC0/VCC1 -> Vfem via U3 LDO, controlled by GPIO7
|
|
// GC1109 FEM: TX/RX path switching is handled by DIO2 -> CTX pin (via SX126X_DIO2_AS_RF_SWITCH)
|
|
// Do NOT use SX126X_TXEN/RXEN as that would cause double-control of GPIO46
|
|
|
|
#define LORA_PA_POWER 7 // VFEM_Ctrl - GC1109 and KCT8103L LDO power enable
|
|
#define LORA_GC1109_PA_EN 2 // CSD - GC1109 chip enable (HIGH=on)
|
|
#define LORA_GC1109_PA_TX_EN 46 // CPS - GC1109 PA mode (HIGH=full PA, LOW=bypass)
|
|
|
|
// ---- KCT8103L RF FRONT END CONFIGURATION ----
|
|
// The Heltec V4.3 uses a KCT8103L FEM chip with integrated PA and LNA
|
|
// RF path: SX1262 -> Pi attenuator -> KCT8103L PA -> Antenna
|
|
// Control logic (from KCT8103L datasheet):
|
|
// Transmit PA: CSD=1, CTX=1, CPS=1
|
|
// Receive LNA: CSD=1, CTX=0, CPS=X (21dB gain, 1.9dB NF)
|
|
// Receive bypass: CSD=1, CTX=1, CPS=0
|
|
// Shutdown: CSD=0, CTX=X, CPS=X
|
|
// Pin mapping:
|
|
// CPS (pin 5) -> SX1262 DIO2: TX/RX path select (automatic via SX126X_DIO2_AS_RF_SWITCH)
|
|
// CSD (pin 4) -> GPIO2: Chip enable (HIGH=on, LOW=shutdown)
|
|
// CTX (pin 6) -> GPIO5: Switch between Receive LNA Mode and Receive Bypass Mode. (HIGH=RX bypass, LOW=RX LNA)
|
|
// VCC0/VCC1 -> Vfem via U3 LDO, controlled by GPIO7
|
|
// KCT8103L FEM: TX/RX path switching is handled by DIO2 -> CPS pin (via SX126X_DIO2_AS_RF_SWITCH)
|
|
|
|
#define LORA_KCT8103L_PA_CSD 2 // CSD - KCT8103L chip enable (HIGH=on)
|
|
#define LORA_KCT8103L_PA_CTX 5 // CTX - Switch between Receive LNA Mode and Receive Bypass Mode. (HIGH=RX bypass, LOW=RX LNA)
|
|
|
|
#if HAS_TFT
|
|
#define USE_TFTDISPLAY 1
|
|
#endif
|
|
/*
|
|
* GPS pins
|
|
*/
|
|
#define GPS_L76K
|
|
#define PIN_GPS_RESET (42) // An output to reset L76K GPS. As per datasheet, low for > 100ms will reset the L76K
|
|
#define GPS_RESET_MODE LOW
|
|
#define PIN_GPS_EN (34)
|
|
#define GPS_EN_ACTIVE LOW
|
|
#define PERIPHERAL_WARMUP_MS 1000 // Make sure I2C QuickLink has stable power before continuing
|
|
#define PIN_GPS_STANDBY (40) // An output to wake GPS, low means allow sleep, high means force wake
|
|
#define PIN_GPS_PPS (41)
|
|
// Seems to be missing on this new board
|
|
#define GPS_TX_PIN (38) // This is for bits going TOWARDS the CPU
|
|
#define GPS_RX_PIN (39) // This is for bits going TOWARDS the GPS
|
|
#define GPS_THREAD_INTERVAL 50
|