mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 10:51:57 +00:00
Fix T-Beam 1W fan races and remove PWM controls
This commit is contained in:
@@ -32,39 +32,34 @@
|
||||
class TBeam1WBoard : public ESP32Board {
|
||||
public:
|
||||
enum FanMode { FAN_ON, FAN_OFF, FAN_AUTO };
|
||||
enum FanDrive { FAN_DRIVE_PWM, FAN_DRIVE_ONOFF };
|
||||
|
||||
private:
|
||||
bool radio_powered = false;
|
||||
bool _stopped = false;
|
||||
bool _pwm_attached = false;
|
||||
KeyValueStore* _prefs = nullptr;
|
||||
FanMode _mode = FAN_AUTO;
|
||||
FanDrive _drive = FAN_DRIVE_ONOFF;
|
||||
int _lo_c = FAN_DEFAULT_LO_C;
|
||||
int _hi_c = FAN_DEFAULT_HI_C;
|
||||
int _manual_duty = -1; // -1 = follow mode; 0..100 = CLI override
|
||||
bool _thermal_on = false; // onoff hysteresis; TX boost must not latch this
|
||||
volatile float _temp_c = NAN;
|
||||
volatile int _duty_pct = 100;
|
||||
volatile bool _tx_active = false;
|
||||
volatile bool _tx_cooldown_active = false;
|
||||
volatile uint32_t _tx_until_ms = 0;
|
||||
bool _fan_on = true;
|
||||
float _temp_c = NAN;
|
||||
bool _tx_active = false;
|
||||
bool _tx_cooldown_active = false;
|
||||
uint32_t _tx_until_ms = 0;
|
||||
TaskHandle_t _fan_task = nullptr;
|
||||
mutable portMUX_TYPE _fan_mux = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
void startFanTask();
|
||||
void updateFan();
|
||||
void applyDuty(int pct);
|
||||
void setFanOutputLocked(bool enabled);
|
||||
float readNtcTempC();
|
||||
int rampDuty(float temp_c) const;
|
||||
int cooldownSecs();
|
||||
bool isTxCooling(uint32_t now);
|
||||
int cooldownSecsLocked();
|
||||
bool isTxCoolingLocked(uint32_t now);
|
||||
bool ntcImplausible(float temp_c) const;
|
||||
bool persistKey(const char* key, const char* value);
|
||||
static bool parseIntArg(const char* text, int& value);
|
||||
void loadFanPrefs();
|
||||
const char* modeName() const;
|
||||
const char* driveName() const;
|
||||
const char* modeNameLocked() const;
|
||||
static void fanTaskThunk(void* arg);
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user