Restore normal T-Beam 1W RXEN startup

This commit is contained in:
mikecarper committed 2026-08-14 20:11:36 -07:00
1 parent 94a0ea2d7a
commit 8decf0ba85
2 files changed
+15 -12

No files matched your search

+6 -8
View File
@@ -173,12 +173,6 @@ class CustomSX1262 : public SX1262 {
static const uint32_t pins[Module::RFSWITCH_MAX_PINS] = {
SX126X_RXEN, tx_en, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC,
};
static const Module::RfSwitchMode_t lna_enabled_table[] = {
{ Module::MODE_IDLE, { LOW, LOW } },
{ Module::MODE_RX, { HIGH, LOW } },
{ Module::MODE_TX, { LOW, HIGH } },
END_OF_MODE_TABLE,
};
static const Module::RfSwitchMode_t lna_disabled_table[] = {
{ Module::MODE_IDLE, { LOW, LOW } },
{ Module::MODE_RX, { LOW, LOW } },
@@ -186,8 +180,12 @@ class CustomSX1262 : public SX1262 {
END_OF_MODE_TABLE,
};
this->mod->setRfSwitchTable(
pins, enabled ? lna_enabled_table : lna_disabled_table);
if (enabled) {
// Restore RadioLib's standard RXEN/TXEN behavior exactly.
setRfSwitchPins(SX126X_RXEN, tx_en);
} else {
this->mod->setRfSwitchTable(pins, lna_disabled_table);
}
return true;
#else
(void)enabled;
+9 -4
View File
@@ -10,10 +10,8 @@ void TBeam1WBoard::begin() {
radio_powered = true;
delay(10); // Allow radio to power up
// Keep the external LNA off until RadioLib deliberately enters RX. GPIO21
// is subsequently controlled by RadioLib's target-specific RF switch table.
pinMode(SX126X_RXEN, OUTPUT);
digitalWrite(SX126X_RXEN, LOW);
// GPIO21/CTRL is initialized by RadioLib with the normal RXEN mode table.
// Do not drive it independently during board startup.
// Initialize LED
pinMode(LED_PIN, OUTPUT);
@@ -71,6 +69,13 @@ void TBeam1WBoard::attachRadioDriver(CustomSX1262Wrapper* driver) {
}
bool TBeam1WBoard::setLoRaFemLnaEnabled(bool enable) {
// The normal/default ON state is already installed by radio.std_init().
// Avoid touching GPIO21 or reconfiguring the radio during boot unless the
// saved setting actually requests a different state.
if (lna_enabled == enable) {
return radio_driver != nullptr;
}
if (radio_driver == nullptr || !radio_driver->setExternalRxLnaEnabled(enable)) {
return false;
}