Advanced Guide: Hardware Definition & ESP32 Bridge
This section is for those who wish to modify the hardware or optimize the data transmission system for maximum performance.
🛠️ Editing hwdef.dat (Hardware Definition)
The hwdef.dat file is the blueprint that tells THAP which AT32 pins are connected to what. You can find it at:
libraries/AP_HAL_ChibiOS/hwdef/THAP_AT32_ROVER/hwdef.dat
Key Options:
SERIAL_ORDER: Defines the sequence of ports (first port is Console, subsequent are Telemetry/GPS).- Example:
SERIAL_ORDER OTG1 USART1 USART2
- Example:
I2C_ORDER: Defines the sequence of I2C Bus for reading the compass and barometer.ADC: Defines pins for reading Battery Voltage and Current.
📡 ESP32 Bridge Configuration
The Bridge acts as an "intermediary" between radio/WiFi frequencies and the Serial line.
Editing WiFi SSID/Password
In the Tools/esp32_bridge/THAP_Bridge.ino file, you can change the WiFi credentials at:
Optimizing WebSocket Speed
If the dashboard feels slow or laggy, adjust the delay in loop():
void loop() {
processMAVLink();
broadcastData();
ws.cleanupClients();
delay(50); // Change from 100 to 50 for 20Hz (2x smoother)
}
🔗 Wiring Diagram
| Device | Port | Pin (AT32) | Note |
|---|---|---|---|
| ESP32 Bridge | Serial 1 | PA9 (TX), PA10 (RX) | Used for the Dashboard interface |
| GPS Module | Serial 2 | PA2 (TX), PA3 (RX) | Match Baudrate with GPS settings |
| Compass | I2C 1 | PB6 (SCL), PB7 (SDA) | Compatible with GY-87 or HMC5883L |
[!TIP] Tip: To add a 3rd Serial port, add
USART3tohwdef.datand select unused pins (e.g., PB10, PB11).