Add support for RadioMaster Bandit Nano (#4005)

* Add support for RadioMaster Bandit Nano

* Add fan to init and sleep
This commit is contained in:
Ben Meadors
2024-05-31 10:56:04 -05:00
committed by GitHub
parent 953aa4d091
commit 17142f8778
6 changed files with 136 additions and 5 deletions

View File

@@ -292,6 +292,9 @@ void NodeDB::installDefaultConfig()
meshtastic_Config_PositionConfig_PositionFlags_SPEED | meshtastic_Config_PositionConfig_PositionFlags_HEADING |
meshtastic_Config_PositionConfig_PositionFlags_DOP | meshtastic_Config_PositionConfig_PositionFlags_SATINVIEW);
#ifdef RADIOMASTER_900_BANDIT_NANO
config.display.flip_screen = true;
#endif
#ifdef T_WATCH_S3
config.display.screen_on_secs = 30;
config.display.wake_on_tap_or_motion = true;

View File

@@ -8,7 +8,10 @@
#include "PortduinoGlue.h"
#endif
#define MAX_POWER 20
#ifndef RF95_MAX_POWER
#define RF95_MAX_POWER 20
#endif
// if we use 20 we are limited to 1% duty cycle or hw might overheat. For continuous operation set a limit of 17
// In theory up to 27 dBm is possible, but the modules installed in most radios can cope with a max of 20. So BIG WARNING
// if you set power to something higher than 17 or 20 you might fry your board.
@@ -49,8 +52,8 @@ bool RF95Interface::init()
{
RadioLibInterface::init();
if (power > MAX_POWER) // This chip has lower power limits than some
power = MAX_POWER;
if (power > RF95_MAX_POWER) // This chip has lower power limits than some
power = RF95_MAX_POWER;
limitPower();
@@ -61,6 +64,13 @@ bool RF95Interface::init()
digitalWrite(RF95_TCXO, 1);
#endif
// enable PA
#ifdef RF95_PA_EN
#if defined(RF95_PA_DAC_EN)
dacWrite(RF95_PA_EN, RF95_PA_LEVEL);
#endif
#endif
/*
#define RF95_TXEN (22) // If defined, this pin should be set high prior to transmit (controls an external analog switch)
#define RF95_RXEN (23) // If defined, this pin should be set high prior to receive (controls an external analog switch)
@@ -71,6 +81,11 @@ bool RF95Interface::init()
digitalWrite(RF95_TXEN, 0);
#endif
#ifdef RF95_FAN_EN
pinMode(RF95_FAN_EN, OUTPUT);
digitalWrite(RF95_FAN_EN, 1);
#endif
#ifdef RF95_RXEN
pinMode(RF95_RXEN, OUTPUT);
digitalWrite(RF95_RXEN, 1);
@@ -146,10 +161,14 @@ bool RF95Interface::reconfigure()
if (err != RADIOLIB_ERR_NONE)
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
if (power > MAX_POWER) // This chip has lower power limits than some
power = MAX_POWER;
if (power > RF95_MAX_POWER) // This chip has lower power limits than some
power = RF95_MAX_POWER;
#ifdef USE_RF95_RFO
err = lora->setOutputPower(power, true);
#else
err = lora->setOutputPower(power);
#endif
if (err != RADIOLIB_ERR_NONE)
RECORD_CRITICALERROR(meshtastic_CriticalErrorCode_INVALID_RADIO_SETTING);
@@ -235,5 +254,9 @@ bool RF95Interface::sleep()
setStandby(); // First cancel any active receiving/sending
lora->sleep();
#ifdef RF95_FAN_EN
digitalWrite(RF95_FAN_EN, 0);
#endif
return true;
}

View File

@@ -42,7 +42,11 @@ int16_t RadioLibRF95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_
state = setCodingRate(cr);
RADIOLIB_ASSERT(state);
#ifdef USE_RF95_RFO
state = setOutputPower(power, true);
#else
state = setOutputPower(power);
#endif
RADIOLIB_ASSERT(state);
state = setGain(gain);