#define CONFIG_H
#define MAJ_VERS 0x01
- #define MIN_VERS 0x34
+ #define MIN_VERS 0x35
#define PLATFORM_AVR 0x90
#define PLATFORM_ESP32 0x80
#define HAS_DISPLAY false
#define HAS_BLUETOOTH false
#define HAS_PMU false
+ #define HAS_NP false
#if MCU_VARIANT == MCU_1284P
const int pin_cs = 4;
#define HAS_DISPLAY true
#define HAS_BLUETOOTH true
#elif BOARD_MODEL == BOARD_RNODE_NG_20
+ #define HAS_DISPLAY true
+ #define HAS_BLUETOOTH true
+ #define HAS_NP true
const int pin_cs = 18;
const int pin_reset = 12;
const int pin_dio = 26;
- #if defined(EXTERNAL_LEDS)
- const int pin_led_rx = 2;
- const int pin_led_tx = 0;
- #else
- const int pin_led_rx = 22;
- const int pin_led_tx = 22;
+ const int pin_np = 4;
+ #if HAS_NP == false
+ #if defined(EXTERNAL_LEDS)
+ const int pin_led_rx = 2;
+ const int pin_led_tx = 0;
+ #else
+ const int pin_led_rx = 22;
+ const int pin_led_tx = 22;
+ #endif
#endif
+ #elif BOARD_MODEL == BOARD_RNODE_NG_21
#define HAS_DISPLAY true
#define HAS_BLUETOOTH true
- #elif BOARD_MODEL == BOARD_RNODE_NG_21
+ #define HAS_PMU true
+ #define HAS_NP true
const int pin_cs = 18;
const int pin_reset = 23;
const int pin_dio = 26;
- #if defined(EXTERNAL_LEDS)
- const int pin_led_rx = 15;
- const int pin_led_tx = 4;
- #else
- const int pin_led_rx = 25;
- const int pin_led_tx = 25;
+ const int pin_np = 15;
+ #if HAS_NP == false
+ #if defined(EXTERNAL_LEDS)
+ const int pin_led_rx = 15;
+ const int pin_led_tx = 4;
+ #else
+ const int pin_led_rx = 25;
+ const int pin_led_tx = 25;
+ #endif
#endif
- #define HAS_DISPLAY true
- #define HAS_BLUETOOTH true
- #define HAS_PMU true
#else
#error An unsupported board was selected. Cannot compile RNode firmware.
#endif
// TODO: Get ESP32 boot flags
#endif
-#if BOARD_MODEL == BOARD_RNODE_NG_20 || BOARD_RNODE_NG_21
+#if HAS_NP == true
#include <Adafruit_NeoPixel.h>
- #define NP_PIN 4
#define NUMPIXELS 1
#define NP_M 0.15
- Adafruit_NeoPixel pixels(NUMPIXELS, NP_PIN, NEO_GRB + NEO_KHZ800);
+ Adafruit_NeoPixel pixels(NUMPIXELS, pin_np, NEO_GRB + NEO_KHZ800);
uint8_t npr = 0;
uint8_t npg = 0;
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
#elif MCU_VARIANT == MCU_ESP32
- #if BOARD_MODEL == BOARD_TBEAM
+ #if HAS_NP == true
+ void led_rx_on() { npset(0, 0, 0xFF); }
+ void led_rx_off() { npset(0, 0, 0); }
+ void led_tx_on() { npset(0xFF, 0x50, 0x00); }
+ void led_tx_off() { npset(0, 0, 0); }
+ #elif BOARD_MODEL == BOARD_RNODE_NG_20
+ void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
+ void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
+ void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
+ void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
+ #elif BOARD_MODEL == BOARD_RNODE_NG_21
+ void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
+ void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
+ void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
+ void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
+ #elif BOARD_MODEL == BOARD_TBEAM
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
- #elif BOARD_MODEL == BOARD_RNODE_NG_20
- void led_rx_on() { npset(0, 0, 0xFF); }
- void led_rx_off() { npset(0, 0, 0); }
- void led_tx_on() { npset(0xFF, 0x50, 0x00); }
- void led_tx_off() { npset(0, 0, 0); }
- #elif BOARD_MODEL == BOARD_RNODE_NG_21
- void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
- void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
- void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
- void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
#elif BOARD_MODEL == BOARD_HUZZAH32
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
// LED Indication: Error
void led_indicate_error(int cycles) {
- #if BOARD_MODEL == BOARD_RNODE_NG_20
+ #if HAS_NP == true
bool forever = (cycles == 0) ? true : false;
cycles = forever ? 1 : cycles;
while(cycles > 0) {
// LED Indication: Boot Error
void led_indicate_boot_error() {
- #if BOARD_MODEL == BOARD_RNODE_NG_20
+ #if HAS_NP == true
while(true) {
npset(0xFF, 0xFF, 0xFF);
}
// LED Indication: Warning
void led_indicate_warning(int cycles) {
- #if BOARD_MODEL == BOARD_RNODE_NG_20
+ #if HAS_NP == true
bool forever = (cycles == 0) ? true : false;
cycles = forever ? 1 : cycles;
while(cycles > 0) {
led_rx_off();
}
#elif MCU_VARIANT == MCU_ESP32
- #if BOARD_MODEL == BOARD_RNODE_NG_20
+ #if HAS_NP == true
void led_indicate_info(int cycles) {
bool forever = (cycles == 0) ? true : false;
cycles = forever ? 1 : cycles;
}
#elif MCU_VARIANT == MCU_ESP32
- #if BOARD_MODEL == BOARD_RNODE_NG_20
+ #if HAS_NP == true
void led_indicate_standby() {
led_standby_ticks++;
}
}
#elif MCU_VARIANT == MCU_ESP32
- #if BOARD_MODEL == BOARD_RNODE_NG_20 || BOARD_MODEL == BOARD_RNODE_NG_21
+ #if HAS_NP == true
void led_indicate_not_ready() {
led_standby_ticks++;
void setTXPower() {
if (radio_online) {
- if (model == MODEL_A2) LoRa.setTxPower(lora_txp, PA_OUTPUT_RFO_PIN);
+ if (model == MODEL_A2) LoRa.setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_A3) LoRa.setTxPower(lora_txp, PA_OUTPUT_RFO_PIN);
if (model == MODEL_A4) LoRa.setTxPower(lora_txp, PA_OUTPUT_RFO_PIN);
if (model == MODEL_A7) LoRa.setTxPower(lora_txp, PA_OUTPUT_PA_BOOST_PIN);