mirror of
https://github.com/agessaman/MeshCore.git
synced 2026-08-28 09:44:26 +00:00
Three real regressions from the 2026-07-19 upstream merge, all invisible to the two prescribed smoke builds: - heltec_tracker_v2/HeltecTrackerV2Board.cpp: the FEM trio (setLoRaFemLnaEnabled/canControlLoRaFemLna/isLoRaFemLnaEnabled) was duplicated verbatim by auto-merge, and upstream's new powerOff() (35f654ce) used P_LORA_PA_POWER unguarded — a macro defined only for the tracker_v2 envs, while heltec_tracker_v1_1 compiles the same board file. Guarded it the same way LoRaFEMControl.cpp already guards that macro. - SimpleMeshTables.h: the tracker variants pull in TFT_eSPI, whose TFT_eSPI_ESP32_S3.h defines FS_NO_GLOBALS. That suppresses FS.h's own 'using fs::File', so File never reached global scope and every TU routed through it failed with "'File' has not been declared" — here and at simple_repeater/MyMesh.h:158. Restore the using when FS_NO_GLOBALS is set. Explicit fs::File is not an option: File is also the global type on the nRF52/RP2040 paths, which have no fs namespace. - ST7735Display.cpp: upstream's HSPI fix (d30d8ed7) guarded on HELTEC_LORA_V3 || HELTEC_TRACKER_V2. heltec_tracker_v1_1 matches neither and fell through to &SPI1, which is not instantiated on ESP32. Added it to the guard. Also parks LilyGo_TLora_V2_1_1_6_{repeater,room_server}_observer_mqtt with a trailing underscore (the nibble_screen_connect convention fromb8f1fad6), which also excludes them from the workflows' enumeration regex. That board does NOT fit and never did: 2,069,397 / 1,966,080 = 105.3% on flex, with no webconfig and no upstream merge. It has been failing on production all along — the release ships 30 envs, not 32 — hidden because build.sh does not propagate pio's exit code. Dropping webconfig would recover ~46 KB of a ~101 KB deficit, so that is not a fix. Rationale and options in .scratch/tlora-v2-oversize.md.
94 lines
2.7 KiB
C++
94 lines
2.7 KiB
C++
#include "HeltecTrackerV2Board.h"
|
|
|
|
void HeltecTrackerV2Board::begin() {
|
|
ESP32Board::begin();
|
|
|
|
pinMode(PIN_ADC_CTRL, OUTPUT);
|
|
digitalWrite(PIN_ADC_CTRL, LOW); // Initially inactive
|
|
|
|
loRaFEMControl.init();
|
|
|
|
esp_reset_reason_t reason = esp_reset_reason();
|
|
if (reason != ESP_RST_DEEPSLEEP) {
|
|
delay(1); // GC1109 startup time after cold power-on
|
|
}
|
|
|
|
periph_power.begin();
|
|
if (reason == ESP_RST_DEEPSLEEP) {
|
|
long wakeup_source = esp_sleep_get_ext1_wakeup_status();
|
|
if (wakeup_source & (1 << P_LORA_DIO_1)) { // received a LoRa packet (while in deep sleep)
|
|
startup_reason = BD_STARTUP_RX_PACKET;
|
|
}
|
|
|
|
rtc_gpio_hold_dis((gpio_num_t)P_LORA_NSS);
|
|
rtc_gpio_deinit((gpio_num_t)P_LORA_DIO_1);
|
|
}
|
|
}
|
|
|
|
void HeltecTrackerV2Board::onBeforeTransmit(void) {
|
|
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
|
|
loRaFEMControl.setTxModeEnable();
|
|
}
|
|
|
|
void HeltecTrackerV2Board::onAfterTransmit(void) {
|
|
digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
|
|
loRaFEMControl.setRxModeEnable();
|
|
}
|
|
|
|
void HeltecTrackerV2Board::powerOff() {
|
|
// Turn off PA. Guarded because this board file is also compiled for the
|
|
// heltec_tracker_v1_1 envs, which do not define P_LORA_PA_POWER (it is set
|
|
// only in variants/heltec_tracker_v2/platformio.ini). Same guard idiom
|
|
// LoRaFEMControl.cpp already uses for this macro.
|
|
#if defined(P_LORA_PA_POWER)
|
|
digitalWrite(P_LORA_PA_POWER, LOW);
|
|
rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_POWER);
|
|
#endif
|
|
|
|
ESP32Board::powerOff();
|
|
}
|
|
|
|
uint16_t HeltecTrackerV2Board::getBattMilliVolts() {
|
|
analogReadResolution(10);
|
|
digitalWrite(PIN_ADC_CTRL, HIGH);
|
|
delay(10);
|
|
uint32_t raw = 0;
|
|
for (int i = 0; i < 8; i++) {
|
|
raw += analogRead(PIN_VBAT_READ);
|
|
}
|
|
raw = raw / 8;
|
|
|
|
digitalWrite(PIN_ADC_CTRL, LOW);
|
|
|
|
return (5.42 * (3.3 / 1024.0) * raw) * 1000;
|
|
}
|
|
|
|
const char* HeltecTrackerV2Board::getManufacturerName() const {
|
|
// The v1.1 environment reuses this V2 board implementation (same variant
|
|
// dir), so report the correct identity per build flag — this string feeds
|
|
// WebConfig and MQTT status/board metadata.
|
|
#ifdef HELTEC_TRACKER_V1_1
|
|
return "Heltec Tracker V1.1";
|
|
#else
|
|
return "Heltec Tracker V2";
|
|
#endif
|
|
}
|
|
|
|
bool HeltecTrackerV2Board::setLoRaFemLnaEnabled(bool enable) {
|
|
if (!loRaFEMControl.isLnaCanControl()) {
|
|
return false;
|
|
}
|
|
|
|
loRaFEMControl.setLNAEnable(enable);
|
|
loRaFEMControl.setRxModeEnable();
|
|
return true;
|
|
}
|
|
|
|
bool HeltecTrackerV2Board::canControlLoRaFemLna() const {
|
|
return loRaFEMControl.isLnaCanControl();
|
|
}
|
|
|
|
bool HeltecTrackerV2Board::isLoRaFemLnaEnabled() const {
|
|
return loRaFEMControl.isLNAEnabled();
|
|
}
|