mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge 848cc75bd3 into dee3e26ac0
This commit is contained in:
commit
01d3d09ea7
11 changed files with 61 additions and 13 deletions
|
|
@ -229,4 +229,7 @@ void loop() {
|
||||||
ui_task.loop();
|
ui_task.loop();
|
||||||
#endif
|
#endif
|
||||||
rtc_clock.tick();
|
rtc_clock.tick();
|
||||||
}
|
#ifdef P_FAN_CTRL
|
||||||
|
update_fan_control();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
@ -887,7 +887,9 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
|
||||||
_prefs.flood_advert_interval = 12; // 12 hours
|
_prefs.flood_advert_interval = 12; // 12 hours
|
||||||
_prefs.flood_max = 64;
|
_prefs.flood_max = 64;
|
||||||
_prefs.interference_threshold = 0; // disabled
|
_prefs.interference_threshold = 0; // disabled
|
||||||
|
#ifdef DEFAULT_AGC_RESET_INTERVAL
|
||||||
|
_prefs.agc_reset_interval = DEFAULT_AGC_RESET_INTERVAL;
|
||||||
|
#endif
|
||||||
// bridge defaults
|
// bridge defaults
|
||||||
_prefs.bridge_enabled = 1; // enabled
|
_prefs.bridge_enabled = 1; // enabled
|
||||||
_prefs.bridge_delay = 500; // milliseconds
|
_prefs.bridge_delay = 500; // milliseconds
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,9 @@ void loop() {
|
||||||
ui_task.loop();
|
ui_task.loop();
|
||||||
#endif
|
#endif
|
||||||
rtc_clock.tick();
|
rtc_clock.tick();
|
||||||
|
#ifdef P_FAN_CTRL
|
||||||
|
update_fan_control();
|
||||||
|
#endif
|
||||||
if (the_mesh.getNodePrefs()->powersaving_enabled && !the_mesh.hasPendingWork()) {
|
if (the_mesh.getNodePrefs()->powersaving_enabled && !the_mesh.hasPendingWork()) {
|
||||||
#if defined(NRF52_PLATFORM)
|
#if defined(NRF52_PLATFORM)
|
||||||
board.sleep(1800); // nrf ignores seconds param, sleeps whenever possible
|
board.sleep(1800); // nrf ignores seconds param, sleeps whenever possible
|
||||||
|
|
|
||||||
|
|
@ -644,6 +644,9 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
|
||||||
_prefs.flood_advert_interval = 12; // 12 hours
|
_prefs.flood_advert_interval = 12; // 12 hours
|
||||||
_prefs.flood_max = 64;
|
_prefs.flood_max = 64;
|
||||||
_prefs.interference_threshold = 0; // disabled
|
_prefs.interference_threshold = 0; // disabled
|
||||||
|
#ifdef DEFAULT_AGC_RESET_INTERVAL
|
||||||
|
_prefs.agc_reset_interval = DEFAULT_AGC_RESET_INTERVAL;
|
||||||
|
#endif
|
||||||
#ifdef ROOM_PASSWORD
|
#ifdef ROOM_PASSWORD
|
||||||
StrHelper::strncpy(_prefs.guest_password, ROOM_PASSWORD, sizeof(_prefs.guest_password));
|
StrHelper::strncpy(_prefs.guest_password, ROOM_PASSWORD, sizeof(_prefs.guest_password));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -113,4 +113,7 @@ void loop() {
|
||||||
ui_task.loop();
|
ui_task.loop();
|
||||||
#endif
|
#endif
|
||||||
rtc_clock.tick();
|
rtc_clock.tick();
|
||||||
|
#ifdef P_FAN_CTRL
|
||||||
|
update_fan_control();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,30 +3,49 @@
|
||||||
void TBeam1WBoard::begin() {
|
void TBeam1WBoard::begin() {
|
||||||
ESP32Board::begin();
|
ESP32Board::begin();
|
||||||
|
|
||||||
// Power on radio module (must be done before radio init)
|
// Power on radio module (must be done before radio init).
|
||||||
|
// Drive LOW first to ensure a clean SX1262 reset — on soft reboot the ESP32
|
||||||
|
// GPIO glitch may be too brief to drain module capacitors, leaving the SX1262
|
||||||
|
// in a stuck state. Holding LOW for 50ms guarantees a full power cycle.
|
||||||
pinMode(SX126X_POWER_EN, OUTPUT);
|
pinMode(SX126X_POWER_EN, OUTPUT);
|
||||||
|
digitalWrite(SX126X_POWER_EN, LOW);
|
||||||
|
delay(50);
|
||||||
digitalWrite(SX126X_POWER_EN, HIGH);
|
digitalWrite(SX126X_POWER_EN, HIGH);
|
||||||
radio_powered = true;
|
radio_powered = true;
|
||||||
delay(10); // Allow radio to power up
|
delay(10); // Allow radio to power up
|
||||||
|
|
||||||
// RF switch RXEN pin handled by RadioLib via setRfSwitchPins()
|
// Explicitly drive RXEN HIGH (LNA on) from boot, before RadioLib takes over.
|
||||||
|
// Without this the pin floats until the first startReceive() call.
|
||||||
|
pinMode(SX126X_RXEN, OUTPUT);
|
||||||
|
digitalWrite(SX126X_RXEN, HIGH);
|
||||||
|
|
||||||
// Initialize LED
|
// Initialize LED
|
||||||
pinMode(LED_PIN, OUTPUT);
|
pinMode(LED_PIN, OUTPUT);
|
||||||
digitalWrite(LED_PIN, LOW);
|
digitalWrite(LED_PIN, LOW);
|
||||||
|
|
||||||
// Initialize fan control (on by default - 1W PA can overheat)
|
// Fan starts off; onAfterTransmit() enables it with a 30s cooldown timer
|
||||||
pinMode(FAN_CTRL_PIN, OUTPUT);
|
pinMode(FAN_CTRL_PIN, OUTPUT);
|
||||||
digitalWrite(FAN_CTRL_PIN, HIGH);
|
digitalWrite(FAN_CTRL_PIN, LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TBeam1WBoard::onBeforeTransmit() {
|
void TBeam1WBoard::onBeforeTransmit() {
|
||||||
// RF switching handled by RadioLib via SX126X_DIO2_AS_RF_SWITCH and setRfSwitchPins()
|
digitalWrite(SX126X_RXEN, LOW); // disconnect LNA before PA ramps up
|
||||||
digitalWrite(LED_PIN, HIGH); // TX LED on
|
digitalWrite(LED_PIN, HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TBeam1WBoard::onAfterTransmit() {
|
void TBeam1WBoard::onAfterTransmit() {
|
||||||
digitalWrite(LED_PIN, LOW); // TX LED off
|
digitalWrite(SX126X_RXEN, HIGH); // re-enable LNA immediately after TX
|
||||||
|
digitalWrite(LED_PIN, LOW);
|
||||||
|
// Keep fan running for 10s after TX
|
||||||
|
setFanEnabled(true);
|
||||||
|
_fan_off_millis = millis() + 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TBeam1WBoard::updateFan() {
|
||||||
|
if (_fan_off_millis > 0 && millis() >= _fan_off_millis) {
|
||||||
|
setFanEnabled(false);
|
||||||
|
_fan_off_millis = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t TBeam1WBoard::getBattMilliVolts() {
|
uint16_t TBeam1WBoard::getBattMilliVolts() {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
class TBeam1WBoard : public ESP32Board {
|
class TBeam1WBoard : public ESP32Board {
|
||||||
private:
|
private:
|
||||||
bool radio_powered = false;
|
bool radio_powered = false;
|
||||||
|
unsigned long _fan_off_millis = 0; // 0 = no pending fan-off
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void begin();
|
void begin();
|
||||||
|
|
@ -39,7 +40,9 @@ public:
|
||||||
const char* getManufacturerName() const override;
|
const char* getManufacturerName() const override;
|
||||||
void powerOff() override;
|
void powerOff() override;
|
||||||
|
|
||||||
// Fan control methods
|
// Called each main loop iteration to manage fan cooldown after TX
|
||||||
|
void updateFan();
|
||||||
|
|
||||||
void setFanEnabled(bool enabled);
|
void setFanEnabled(bool enabled);
|
||||||
bool isFanEnabled() const;
|
bool isFanEnabled() const;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
[LilyGo_TBeam_1W]
|
[LilyGo_TBeam_1W]
|
||||||
extends = esp32_base
|
extends = esp32_base
|
||||||
board = t_beam_1w
|
board = t_beam_1w
|
||||||
|
board_build.partitions = default_16MB.csv
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32_base.build_flags}
|
${esp32_base.build_flags}
|
||||||
-I variants/lilygo_tbeam_1w
|
-I variants/lilygo_tbeam_1w
|
||||||
|
|
@ -27,13 +28,20 @@ build_flags =
|
||||||
-D SX126X_DIO3_TCXO_VOLTAGE=3.0
|
-D SX126X_DIO3_TCXO_VOLTAGE=3.0
|
||||||
-D SX126X_CURRENT_LIMIT=140
|
-D SX126X_CURRENT_LIMIT=140
|
||||||
-D SX126X_RX_BOOSTED_GAIN=1
|
-D SX126X_RX_BOOSTED_GAIN=1
|
||||||
|
-D SX126X_REGISTER_PATCH=1 ; Patch register 0x8B5 for improved RX with external PA+LNA FEM
|
||||||
|
|
||||||
; TX power: 22dBm to SX1262, PA module adds ~10dB for 32dBm total
|
; TX power: 22dBm to SX1262, PA module adds ~10dB for 32dBm total
|
||||||
-D LORA_TX_POWER=22
|
-D LORA_TX_POWER=22
|
||||||
|
|
||||||
|
; AGC reset interval default: 60 seconds (value * 4000ms).
|
||||||
|
; Periodically recalibrates the SX1262 frontend to prevent progressive
|
||||||
|
; deafness caused by the receiver getting stuck in a high-attenuation state
|
||||||
|
; after repeated TX/RX transitions with the external PA+LNA module.
|
||||||
|
-D DEFAULT_AGC_RESET_INTERVAL=15
|
||||||
|
|
||||||
; Battery - 2S 7.4V LiPo (6.0V min, 8.4V max)
|
; Battery - 2S 7.4V LiPo (6.0V min, 8.4V max)
|
||||||
-D BATT_MIN_MILLIVOLTS=6000
|
-D BATT_MIN_MILLIVOLTS=6000
|
||||||
-D BATT_MAX_MILLIVOLTS=8400
|
-D BATT_MAX_MILLIVOLTS=7900
|
||||||
|
|
||||||
; Display - SH1106 OLED at 0x3C
|
; Display - SH1106 OLED at 0x3C
|
||||||
-D DISPLAY_CLASS=SH1106Display
|
-D DISPLAY_CLASS=SH1106Display
|
||||||
|
|
@ -154,7 +162,6 @@ build_flags =
|
||||||
-I examples/companion_radio/ui-new
|
-I examples/companion_radio/ui-new
|
||||||
-D MAX_CONTACTS=350
|
-D MAX_CONTACTS=350
|
||||||
-D MAX_GROUP_CHANNELS=40
|
-D MAX_GROUP_CHANNELS=40
|
||||||
-D OFFLINE_QUEUE_SIZE=256
|
|
||||||
-D WIFI_DEBUG_LOGGING=1
|
-D WIFI_DEBUG_LOGGING=1
|
||||||
-D WIFI_SSID='"myssid"'
|
-D WIFI_SSID='"myssid"'
|
||||||
-D WIFI_PWD='"mypwd"'
|
-D WIFI_PWD='"mypwd"'
|
||||||
|
|
|
||||||
|
|
@ -63,3 +63,7 @@ mesh::LocalIdentity radio_new_identity() {
|
||||||
return mesh::LocalIdentity(&rng);
|
return mesh::LocalIdentity(&rng);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void update_fan_control() {
|
||||||
|
board.updateFan();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,5 @@ uint32_t radio_get_rng_seed();
|
||||||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
|
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
|
||||||
void radio_set_tx_power(int8_t dbm);
|
void radio_set_tx_power(int8_t dbm);
|
||||||
mesh::LocalIdentity radio_new_identity();
|
mesh::LocalIdentity radio_new_identity();
|
||||||
|
void update_fan_control();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@
|
||||||
|
|
||||||
// Fan control
|
// Fan control
|
||||||
#define FAN_CTRL_PIN 41
|
#define FAN_CTRL_PIN 41
|
||||||
|
#define P_FAN_CTRL FAN_CTRL_PIN // enables update_fan_control() in main loop
|
||||||
|
|
||||||
// PA Ramp Time - T-Beam 1W requires >800us stabilization (default is 200us)
|
// PA Ramp Time - T-Beam 1W requires >800us stabilization (default is 200us)
|
||||||
// Value 0x05 = RADIOLIB_SX126X_PA_RAMP_800U
|
// Value 0x05 = RADIOLIB_SX126X_PA_RAMP_800U
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue