mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2024-07-02 14:34:13 +02:00
Added support for LoRa32 v2.1 boards
This commit is contained in:
parent
01babb84f1
commit
044cb33948
9
Config.h
9
Config.h
@ -4,7 +4,7 @@
|
|||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
#define MAJ_VERS 0x01
|
#define MAJ_VERS 0x01
|
||||||
#define MIN_VERS 0x18
|
#define MIN_VERS 0x19
|
||||||
|
|
||||||
#define PLATFORM_AVR 0x90
|
#define PLATFORM_AVR 0x90
|
||||||
#define PLATFORM_ESP32 0x80
|
#define PLATFORM_ESP32 0x80
|
||||||
@ -109,8 +109,13 @@
|
|||||||
const int pin_cs = 18;
|
const int pin_cs = 18;
|
||||||
const int pin_reset = 23;
|
const int pin_reset = 23;
|
||||||
const int pin_dio = 26;
|
const int pin_dio = 26;
|
||||||
const int pin_led_rx = 2;
|
#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_led_tx = 25;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#error An unsupported board was selected. Cannot compile RNode firmware.
|
#error An unsupported board was selected. Cannot compile RNode firmware.
|
||||||
#endif
|
#endif
|
||||||
|
5
Makefile
5
Makefile
@ -24,6 +24,9 @@ firmware-lora32_v20:
|
|||||||
firmware-lora32_v21:
|
firmware-lora32_v21:
|
||||||
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\""
|
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\""
|
||||||
|
|
||||||
|
firmware-lora32_v21_extled:
|
||||||
|
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DEXTERNAL_LEDS=true\""
|
||||||
|
|
||||||
firmware-featheresp32:
|
firmware-featheresp32:
|
||||||
arduino-cli compile --fqbn esp32:esp32:featheresp32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\""
|
arduino-cli compile --fqbn esp32:esp32:featheresp32 --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\""
|
||||||
|
|
||||||
@ -53,6 +56,8 @@ upload-featheresp32:
|
|||||||
upload-mega2560:
|
upload-mega2560:
|
||||||
arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:mega
|
arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:mega
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
release-all: release-rnode release-tbeam release-lora32_v21 release-featheresp32 release-genericesp32
|
release-all: release-rnode release-tbeam release-lora32_v21 release-featheresp32 release-genericesp32
|
||||||
|
|
||||||
release-rnode:
|
release-rnode:
|
||||||
|
@ -250,6 +250,7 @@ bool startRadio() {
|
|||||||
|
|
||||||
// Flash an info pattern to indicate
|
// Flash an info pattern to indicate
|
||||||
// that the radio is now on
|
// that the radio is now on
|
||||||
|
kiss_indicate_radiostate();
|
||||||
led_indicate_info(3);
|
led_indicate_info(3);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -258,12 +259,15 @@ bool startRadio() {
|
|||||||
// Flash a warning pattern to indicate
|
// Flash a warning pattern to indicate
|
||||||
// that the radio was locked, and thus
|
// that the radio was locked, and thus
|
||||||
// not started
|
// not started
|
||||||
|
radio_online = false;
|
||||||
|
kiss_indicate_radiostate();
|
||||||
led_indicate_warning(3);
|
led_indicate_warning(3);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If radio is already on, we silently
|
// If radio is already on, we silently
|
||||||
// ignore the request.
|
// ignore the request.
|
||||||
|
kiss_indicate_radiostate();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
ROM.h
6
ROM.h
@ -6,8 +6,14 @@
|
|||||||
#define PRODUCT_RNODE 0x03
|
#define PRODUCT_RNODE 0x03
|
||||||
#define PRODUCT_HMBRW 0xF0
|
#define PRODUCT_HMBRW 0xF0
|
||||||
#define PRODUCT_TBEAM 0xE0
|
#define PRODUCT_TBEAM 0xE0
|
||||||
|
#define PRODUCT_T32_20 0xB0
|
||||||
|
#define PRODUCT_T32_21 0xB1
|
||||||
#define MODEL_A4 0xA4
|
#define MODEL_A4 0xA4
|
||||||
#define MODEL_A9 0xA9
|
#define MODEL_A9 0xA9
|
||||||
|
#define MODEL_B3 0xB3
|
||||||
|
#define MODEL_B8 0xB8
|
||||||
|
#define MODEL_B4 0xB4
|
||||||
|
#define MODEL_B9 0xB9
|
||||||
#define MODEL_E4 0xE4
|
#define MODEL_E4 0xE4
|
||||||
#define MODEL_E9 0xE9
|
#define MODEL_E9 0xE9
|
||||||
#define MODEL_FF 0xFF
|
#define MODEL_FF 0xFF
|
||||||
|
48
Utilities.h
48
Utilities.h
@ -49,8 +49,8 @@ uint8_t boot_vector = 0x00;
|
|||||||
#elif BOARD_MODEL == BOARD_LORA32_V2_1
|
#elif BOARD_MODEL == BOARD_LORA32_V2_1
|
||||||
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
|
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
|
||||||
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
|
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
|
||||||
void led_tx_on() { digitalWrite(pin_led_tx, LOW); }
|
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
|
||||||
void led_tx_off() { digitalWrite(pin_led_tx, HIGH); }
|
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
|
||||||
#elif BOARD_MODEL == BOARD_HUZZAH32
|
#elif BOARD_MODEL == BOARD_HUZZAH32
|
||||||
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
|
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
|
||||||
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
|
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
|
||||||
@ -130,6 +130,20 @@ void led_indicate_warning(int cycles) {
|
|||||||
led_rx_off();
|
led_rx_off();
|
||||||
}
|
}
|
||||||
#elif MCU_VARIANT == MCU_ESP32
|
#elif MCU_VARIANT == MCU_ESP32
|
||||||
|
#if BOARD_MODEL == BOARD_LORA32_V2_1
|
||||||
|
void led_indicate_info(int cycles) {
|
||||||
|
bool forever = (cycles == 0) ? true : false;
|
||||||
|
cycles = forever ? 1 : cycles;
|
||||||
|
while(cycles > 0) {
|
||||||
|
led_rx_off();
|
||||||
|
delay(100);
|
||||||
|
led_rx_on();
|
||||||
|
delay(100);
|
||||||
|
if (!forever) cycles--;
|
||||||
|
}
|
||||||
|
led_rx_off();
|
||||||
|
}
|
||||||
|
#else
|
||||||
void led_indicate_info(int cycles) {
|
void led_indicate_info(int cycles) {
|
||||||
bool forever = (cycles == 0) ? true : false;
|
bool forever = (cycles == 0) ? true : false;
|
||||||
cycles = forever ? 1 : cycles;
|
cycles = forever ? 1 : cycles;
|
||||||
@ -142,6 +156,7 @@ void led_indicate_warning(int cycles) {
|
|||||||
}
|
}
|
||||||
led_tx_off();
|
led_tx_off();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -195,7 +210,13 @@ int8_t led_standby_direction = 0;
|
|||||||
} else {
|
} else {
|
||||||
led_tx_off();
|
led_tx_off();
|
||||||
}
|
}
|
||||||
|
#if BOARD_MODEL == BOARD_LORA32_V2_1
|
||||||
|
#if defined(EXTERNAL_LEDS)
|
||||||
led_rx_off();
|
led_rx_off();
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
led_rx_off();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -564,7 +585,14 @@ bool eeprom_lock_set() {
|
|||||||
|
|
||||||
bool eeprom_product_valid() {
|
bool eeprom_product_valid() {
|
||||||
uint8_t rval = EEPROM.read(eeprom_addr(ADDR_PRODUCT));
|
uint8_t rval = EEPROM.read(eeprom_addr(ADDR_PRODUCT));
|
||||||
if (rval == PRODUCT_RNODE || rval == PRODUCT_HMBRW || rval == PRODUCT_TBEAM) {
|
|
||||||
|
#if PLATFORM == PLATFORM_AVR
|
||||||
|
if (rval == PRODUCT_RNODE || rval == PRODUCT_HMBRW) {
|
||||||
|
#elif PLATFORM == PLATFORM_ESP32
|
||||||
|
if (rval == PRODUCT_RNODE || rval == PRODUCT_HMBRW || rval == PRODUCT_TBEAM || rval == PRODUCT_T32_20 || rval == PRODUCT_T32_21) {
|
||||||
|
#else
|
||||||
|
if (false) {
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -573,7 +601,19 @@ bool eeprom_product_valid() {
|
|||||||
|
|
||||||
bool eeprom_model_valid() {
|
bool eeprom_model_valid() {
|
||||||
model = EEPROM.read(eeprom_addr(ADDR_MODEL));
|
model = EEPROM.read(eeprom_addr(ADDR_MODEL));
|
||||||
if (model == MODEL_A4 || model == MODEL_A9 || model == MODEL_FF || model == MODEL_E4 || model == MODEL_E9) {
|
#if BOARD_MODEL == BOARD_RNODE
|
||||||
|
if (model == MODEL_A4 || model == MODEL_A9) {
|
||||||
|
#elif BOARD_MODEL == BOARD_HMBRW
|
||||||
|
if (model == MODEL_FF) {
|
||||||
|
#elif BOARD_MODEL == BOARD_TBEAM
|
||||||
|
if (model == MODEL_E4 || model == MODEL_E9) {
|
||||||
|
#elif BOARD_MODEL == BOARD_LORA32_V2_0
|
||||||
|
if (model == MODEL_B3 || model == MODEL_B8) {
|
||||||
|
#elif BOARD_MODEL == BOARD_LORA32_V2_1
|
||||||
|
if (model == MODEL_B4 || model == MODEL_B9) {
|
||||||
|
#else
|
||||||
|
if (false) {
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user