Skip to content

Commit

Permalink
added base support for Rdaiomaster Bandit Nano
Browse files Browse the repository at this point in the history
  • Loading branch information
uberhalit committed Mar 26, 2024
1 parent d30d6bd commit 8397551
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 5 deletions.
7 changes: 4 additions & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"ms-vscode.cpptools",
"platformio.platformio-ide",
"trunk.io"
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
7 changes: 7 additions & 0 deletions src/mesh/RF95Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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)
Expand Down
19 changes: 18 additions & 1 deletion src/mesh/RadioLibRF95.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,21 @@ uint8_t RadioLibRF95::readReg(uint8_t addr)
{
Module *mod = this->getMod();
return mod->SPIreadRegister(addr);
}
}

int16_t RadioLibRF95::setOutputPower(int8_t power) {
return(RadioLibRF95::setOutputPower(power, false));
}

int16_t RadioLibRF95::setOutputPower(int8_t power, bool useRfo) {

// set mode to standby
int16_t state = SX127x::standby();
Module* mod = this->getMod();

state |= mod->SPIsetRegValue(RADIOLIB_SX127X_REG_PA_CONFIG, RADIOLIB_SX127X_PA_SELECT_BOOST, 7, 7);
state |= mod->SPIsetRegValue(RADIOLIB_SX127X_REG_PA_CONFIG, 140, 6, 0); // 1000mW
state |= mod->SPIsetRegValue(RADIOLIB_SX1278_REG_PA_DAC, RADIOLIB_SX127X_PA_BOOST_ON, 2, 0);

return(state);
}
5 changes: 4 additions & 1 deletion src/mesh/RadioLibRF95.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ class RadioLibRF95 : public SX1278
/// For debugging
uint8_t readReg(uint8_t addr);

int16_t setOutputPower(int8_t power);
int16_t setOutputPower(int8_t power, bool useRfo);

protected:
// since default current limit for SX126x/127x in updated RadioLib is 60mA
// use the previous value
float currentLimit = 100;
float currentLimit = 150;
};
2 changes: 2 additions & 0 deletions src/mesh/generated/meshtastic/mesh.pb.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ typedef enum _meshtastic_HardwareModel {
/* Heltec Wireless Tracker with ESP32-S3 CPU, built-in GPS, and TFT
Older "V1.0" Variant */
meshtastic_HardwareModel_HELTEC_WIRELESS_TRACKER_V1_0 = 58,
/* RadioMaster ExpressLRS "Bandit" TX Module 900MHz with ESP32-D0WDQ6 + SX1276 */
meshtastic_HardwareModel_RADIOMASTER_900_BANDIT_NANO = 59,
/* ------------------------------------------------------------------------------------------------------------------------------------------
Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits.
------------------------------------------------------------------------------------------------------------------------------------------ */
Expand Down
2 changes: 2 additions & 0 deletions src/platform/esp32/architecture.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@
#define HW_VENDOR meshtastic_HardwareModel_NANO_G1_EXPLORER
#elif defined(BETAFPV_900_TX_NANO)
#define HW_VENDOR meshtastic_HardwareModel_BETAFPV_900_NANO_TX
#elif defined(RADIOMASTER_900_BANDIT_NANO)
#define HW_VENDOR meshtastic_HardwareModel_RADIOMASTER_900_BANDIT_NANO
#elif defined(PICOMPUTER_S3)
#define HW_VENDOR meshtastic_HardwareModel_PICOMPUTER_S3
#elif defined(ESP32_S3_PICO)
Expand Down
18 changes: 18 additions & 0 deletions variants/radiomaster_900_bandit_nano/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[env:radiomaster_900_bandit_nano]
extends = esp32_base
board = esp32doit-devkit-v1
board_level = extra
build_flags =
${esp32_base.build_flags}
-D RADIOMASTER_900_BANDIT_NANO
-D VTABLES_IN_FLASH=1
-D CONFIG_DISABLE_HAL_LOCKS=1
-O2
-I variants/radiomaster_900_bandit_nano
board_build.f_cpu = 240000000L
upload_protocol = esptool
;upload_port = /dev/ttyUSB0
upload_speed = 230400
lib_deps =
${esp32_base.lib_deps}
makuna/NeoPixelBus@^2.7.1
45 changes: 45 additions & 0 deletions variants/radiomaster_900_bandit_nano/variant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// https://radiomasterrc.com/products/bandit-nano-expresslrs-rf-module
#include <NeoPixelBus.h>

// 0.96" OLED
#define I2C_SDA 14
#define I2C_SCL 12

// NO GPS - but free solder pads are available
#undef GPS_RX_PIN
#undef GPS_TX_PIN

#define LORA_DIO0 22
#define LORA_DIO1 21
#define LORA_SCK 18
#define LORA_MISO 19
#define LORA_MOSI 23
#define LORA_CS 4 // NSS
#define LORA_RESET 5
#define LORA_TXEN 33
#define RF95_FAN_EN 2

#define LED_PIN 15 // RGB LED

#define BUTTON_PIN 39 // Joystick
#define BUTTON_NEED_PULLUP

#undef EXT_NOTIFY_OUT

// SX1276 900 Mhz LoRa module
#define USE_RF95 // RFM95/SX127x
#define RF95_CS LORA_CS
#define RF95_DIO1 LORA_DIO1
#define RF95_TXEN LORA_TXEN
#define RF95_RESET LORA_RESET
#define RF95_MAX_POWER 20

// This module has PA
#define RF95_PA_EN 26 // power_apc2
#define RF95_PA_DAC_EN
// Mapping of PA_LEVEL to Power output:
// 168 -> 100mW
// 148 -> 250mW
// 128 -> 500mW
// 90 -> 1000mW
#define RF95_PA_LEVEL 90

0 comments on commit 8397551

Please sign in to comment.