Compare commits

..

33 Commits

Author SHA1 Message Date
Marcel
5fee5d7eec E22 can now reach 33dBm of output power 2025-04-04 11:37:09 +02:00
Marcel
21e298820f Credits added in HOWTO 2025-03-31 10:55:51 +02:00
Marcel
90969627bc E22 module is now working. 2025-03-30 10:46:25 +02:00
Marcel
6800a4da8e E22 module is now working. 2025-03-30 10:43:36 +02:00
Marcel
3ba0d52ca7 Start implementing support for SX1268, not working yet. 2025-03-10 18:29:35 +01:00
Marcel
cd4ab151e6 Made HOWTO a tiny bit better. 2025-03-04 20:59:09 +01:00
Marcel
4ac7d32bb9 Made HOWTO a tiny bit better. 2025-03-04 20:43:22 +01:00
Marcel
5f3a760bb5 Made HOWTO a tiny bit better. 2025-03-04 20:41:34 +01:00
Marcel
8732ae9f6b Made HOWTO a tiny bit better. 2025-03-04 20:35:24 +01:00
Marcel
9cb1d51311 Made HOWTO a tiny bit better. 2025-03-04 20:32:22 +01:00
Marcel
d3d39b929d Made HOWTO a tiny bit better. 2025-03-04 20:26:23 +01:00
Marcel
ddb4cd12b2 Made HOWTO a tiny bit better. 2025-03-04 20:16:24 +01:00
Marcel
a70e20cd50 Made HOWTO a tiny bit better. 2025-03-04 16:51:10 +01:00
Marcel
0c425e8a04 Made HOWTO a tiny bit better. 2025-03-04 16:40:50 +01:00
Marcel
e0e23a1a19 Made HOWTO a tiny bit better. 2025-03-04 16:16:28 +01:00
Marcel
6e86659c62 Made HOWTO a tiny bit better. 2025-03-04 16:06:29 +01:00
Marcel
7dc3e59be2 Made HOWTO a tiny bit better. 2025-03-04 15:40:26 +01:00
Marcel
27230c0985 Made HOWTO a tiny bit better. 2025-03-04 15:39:28 +01:00
Marcel
113f546a21 Made HOWTO a tiny bit better. 2025-03-04 15:36:46 +01:00
Marcel
289b015296 Made HOWTO a tiny bit better. 2025-03-04 15:31:29 +01:00
Marcel
f12c5a04c6 Made HOWTO a tiny bit better. 2025-03-04 15:23:56 +01:00
Marcel
ac4443a8ee Made HOWTO a tiny bit better. 2025-03-04 15:14:26 +01:00
Marcel
6843b3debf Made HOWTO a tiny bit better. 2025-03-04 15:13:07 +01:00
Marcel
5604c0c71a Firmware works for SX1278 in combination with all ESP32 S3 boards if corrects GPIOs are exposed. 2025-03-03 16:12:49 +01:00
Marcel
089b168a92 Waveshare ESP32 S3 Pico with SX1278 now works. 2025-02-28 15:09:06 +01:00
Marcel
b4526aba3b Waveshare ESP32 S3 Pico with SX1278 now works. 2025-02-28 14:56:41 +01:00
Marcel
cc70ff95bc Waveshare ESP32 S3 Pico with SX1278 now works. 2025-02-28 14:55:09 +01:00
Marcel
e6277be9e6 Release section Makefile cleaned up, HOWTO updated. 2025-02-25 11:29:29 +01:00
Marcel
a8e5ed5067 HOWTO updated 2025-02-24 12:10:14 +01:00
Marcel
08fc86d214 Waveshare ESP32 board compiles and uploads, but does not work with Reticulum yet 2025-02-24 12:06:35 +01:00
Marcel
2daa9e09e5 Added new board, which is a copy of lora32_v21. Can compile and flash it. 2025-02-18 11:26:29 +01:00
Marcel
ee34635afa CHANGELOG.ms added 2025-02-17 21:16:36 +01:00
Marcel
7b21597da8 Changed README.md to explain purpose of this copy of the firmware 2025-02-17 21:10:01 +01:00
13 changed files with 2272 additions and 7 deletions

View File

@@ -111,6 +111,7 @@
#define BOARD_HELTEC_T114 0x3C #define BOARD_HELTEC_T114 0x3C
#define MODEL_C6 0xC6 // Heltec Mesh Node T114, 470-510 MHz #define MODEL_C6 0xC6 // Heltec Mesh Node T114, 470-510 MHz
#define MODEL_C7 0xC7 // Heltec Mesh Node T114, 863-928 MHz #define MODEL_C7 0xC7 // Heltec Mesh Node T114, 863-928 MHz
#define MODEL_CB 0xCB // Heltec Mesh Node T114, 863-928 MHz + GPS
#define PRODUCT_TECHO 0x15 // LilyGO T-Echo devices #define PRODUCT_TECHO 0x15 // LilyGO T-Echo devices
#define BOARD_TECHO 0x44 #define BOARD_TECHO 0x44
@@ -125,13 +126,17 @@
#define MODEL_FE 0xFE // Homebrew board, max 17dBm output power #define MODEL_FE 0xFE // Homebrew board, max 17dBm output power
#define MODEL_FF 0xFF // Homebrew board, max 14dBm output power #define MODEL_FF 0xFF // Homebrew board, max 14dBm output power
// Board added by Mees Electronics
#define BOARD_MEES_ESP32_S3 0x61 // Mees Electronics ESP32 S3 board
#define MODEL_F1 0xF1 // SX1278
#define MODEL_F2 0xF2 // SX1268
// Displays // Displays
#define OLED 0x01 #define OLED 0x01
#define EINK_BW 0x02 #define EINK_BW 0x02
#define EINK_3C 0x03 #define EINK_3C 0x03
#define MONO_OLED 0x04 #define MONO_OLED 0x04
#define TFT 0x05 #define TFT 0x05
#define ADAFRUIT_TFT 0x06
#if defined(ESP32) #if defined(ESP32)
#define PLATFORM PLATFORM_ESP32 #define PLATFORM PLATFORM_ESP32
@@ -850,6 +855,7 @@
#elif BOARD_MODEL == BOARD_TDECK #elif BOARD_MODEL == BOARD_TDECK
#define IS_ESP32S3 true #define IS_ESP32S3 true
#define HAS_DISPLAY false #define HAS_DISPLAY false
#define DISPLAY TFT // to be tested...
#define HAS_CONSOLE false #define HAS_CONSOLE false
#define HAS_BLUETOOTH false #define HAS_BLUETOOTH false
#define HAS_BLE true #define HAS_BLE true
@@ -1022,6 +1028,82 @@
-1 // pin_tcxo_enable -1 // pin_tcxo_enable
} }
}; };
// Board definition added by Mees Electronics
#elif BOARD_MODEL == BOARD_MEES_ESP32_S3
#define IS_ESP32S3 true
#define HAS_DISPLAY false
#define HAS_BLUETOOTH false
#define HAS_BLE true
#define HAS_PMU true
#define HAS_CONSOLE true
#define HAS_EEPROM true
#define INTERFACE_COUNT 1
#define HAS_NP true
const int pin_np = 21;// 21 on Waveshare ESP32 S3 Pico, 48 on ESP32-S3-DevKitC-1
#if HAS_NP == false
#if defined(EXTERNAL_LEDS)
const int pin_led_rx = 18;
const int pin_led_tx = 33;
#else
const int pin_led_rx = 21;
const int pin_led_tx = 21;
#endif
#endif
#if BOARD_VARIANT == MODEL_F1
const uint8_t interfaces[INTERFACE_COUNT] = {SX1278};
const bool interface_cfg[INTERFACE_COUNT][3] = {
// SX1278
{
false, // DEFAULT_SPI
false, // HAS_TCXO
false // DIO2_AS_RF_SWITCH
},
};
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX1278
{
10, // pin_ss
12, // pin_sclk
11, // pin_mosi
13, // pin_miso
-1, // pin_busy
15, // pin_dio
14, // pin_reset
-1, // pin_txen
-1, // pin_rxen
-1 // pin_tcxo_enable
}
};
#elif BOARD_VARIANT == MODEL_F2
const uint8_t interfaces[INTERFACE_COUNT] = {SX1262};
const bool interface_cfg[INTERFACE_COUNT][3] = {
// SX1262
{
false, // DEFAULT_SPI
true, // HAS_TCXO
true // DIO2_AS_RF_SWITCH
},
};
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX1262
{
10, // pin_ss
12, // pin_sclk
11, // pin_mosi
13, // pin_miso
16, // pin_busy
15, // pin_dio
14, // pin_reset
-1, // pin_txen
17, // pin_rxen
-1 // pin_tcxo_enable
}
};
#endif
#else #else
#error An unsupported ESP32 board was selected. Cannot compile RNode firmware. #error An unsupported ESP32 board was selected. Cannot compile RNode firmware.
#endif #endif
@@ -1239,7 +1321,6 @@
#define HAS_BUSY true #define HAS_BUSY true
#define HAS_INPUT true #define HAS_INPUT true
#define HAS_SLEEP true #define HAS_SLEEP true
#define DIO2_AS_RF_SWITCH true
#define CONFIG_UART_BUFFER_SIZE 6144 #define CONFIG_UART_BUFFER_SIZE 6144
#define CONFIG_QUEUE_SIZE 6144 #define CONFIG_QUEUE_SIZE 6144
#define CONFIG_QUEUE_MAX_LENGTH 200 #define CONFIG_QUEUE_MAX_LENGTH 200
@@ -1270,7 +1351,7 @@
// pins for ST7789 display on Heltec T114 // pins for ST7789 display on Heltec T114
const int DISPLAY_DC = 12; const int DISPLAY_DC = 12;
const int DISPLAY_CS = 11; const int DISPLAY_CS = 11;
const int DISPLAY_MISO = 11; const int DISPLAY_MISO = 11; // not connected
const int DISPLAY_MOSI = 9; const int DISPLAY_MOSI = 9;
const int DISPLAY_CLK = 8; const int DISPLAY_CLK = 8;
const int DISPLAY_BL_PIN = PIN_T114_TFT_BLGT; const int DISPLAY_BL_PIN = PIN_T114_TFT_BLGT;
@@ -1302,6 +1383,13 @@
-1 // pin_tcxo_enable -1 // pin_tcxo_enable
} }
}; };
#if BOARD_VARIANT == MODEL_CB
#define HAS_GPS true
#define GPS_BAUD_RATE 9600
#define PIN_GPS_RX 37
#define PIN_GPS_TX 39
#endif
#else #else
#error An unsupported nRF board was selected. Cannot compile RNode firmware. #error An unsupported nRF board was selected. Cannot compile RNode firmware.
#endif #endif

1418
Boards.h_old Normal file

File diff suppressed because it is too large Load Diff

105
CHANGELOG.md Normal file
View File

@@ -0,0 +1,105 @@
# Changelog
For the changed made by Mees Electronics.
All notable changes to this project will be documented in this file.
Added : for new features.
Changed : for changes in existing functionality.
Deprecated: for soon-to-be removed features.
Removed : for now removed features.
Fixed : for any bug fixes.
Security : in case of vulnerabilities.
### 2025-04-04
#### Fixed
RXEN switches to low before transmitting, and now the E22 module can output 33 dBm. The maximum power is reached when SX1268 is set to 22 dBm.
### 2025-03-30
#### Fixed
Both SX1278 and SX1268 modules are now working.
#### Changed
Pinout changed to make room for RXEN pin of E22 module.
|pin|GPIO|
|---|----|
|NSS|10|
|MOSI|11|
|SCK|12|
|MISO|13|
|RST|14|
|DIO|15|
|BUSY|16|
|RXEN|17|
|RX LED|18|
|TX LED|33|
### 2025-03-10
#### Changed
Renamed BOARD_WAVESHARE_ESP32_S3_PICO to MEES_ESP32_S3 in source code. Also renamed firmware-waveshare-esp32-s3-pico to firmware-mees-esp32-s3, upload-waveshare-esp32-s3-pico to upload-mees-esp32-s3 and release-waveshare-esp32-s3-pico to release-mees-esp32-s3. This way it is obvious the firmware works for all generic ESP32 S3 boards.
#### Added
Two BOARD_VARIANTs: 0xF1 for SX1278 and 0xF2 for SX1268. Can be chosen during compile time.
### 2025-03-03
Final pinout of LoRa module defined. Should work on most ESP32-S3 development boards.
|pin|GPIO|
|---|----|
|NSS|10|
|MOSI|11|
|SCK|12|
|MISO|13|
|RST|14|
|DIO|15|
|BUSY|16|
|RX LED|17|
|TX LED|18|
### 2025-02-28
Started all over again. This time I succeeded! The Waveshare ESP32 S3 Pico and the Ra-02 SX1278 LoRa transceiver are working as a proper rnode. It took me some time, but now I am happy. See Documentation/HOWTO-change-firmware-and-compile-it_MeesElectronics.md for more information about adding a new board to the code.
Pinout Ra-02:
|pin|GPIO|
|---|----|
|NSS|39|
|MOSI|37|
|MISO|36|
|SCK|38|
|RST|40|
|DIO|35|
But pinout can easily be mapped to other pins.
## 2025-02-24
Added new board (Waveshare ESP32-S3 Pico) to source code.
Pinout Ra-02 LoRa transceiver:
|pin|GPIO|
|---|----|
|NSS|10|
|MOSI|11|
|MISO|13|
|SCK|12|
|RST|14|
|DIO|15|
Can compile the source (with "make firmware-waveshare-esp32-s3-pico") and upload the program to ESP32 (with "make upload-waveshare-esp32-s3-pico"). According to the oscilloscope the SPI bus works. Reticulum still gives errors: "TX power mismatch" and "Radio state mismatch". RGB LED works, so Reticulum seems to communicate with the rnode.
## [1.74] - 2025-02-17
Version from https://github.com/liberatedsystems/RNode_Firmware_CE

View File

@@ -482,6 +482,10 @@ bool display_init() {
#elif BOARD_MODEL == BOARD_TDECK #elif BOARD_MODEL == BOARD_TDECK
disp_mode = DISP_MODE_PORTRAIT; disp_mode = DISP_MODE_PORTRAIT;
display.setRotation(3); display.setRotation(3);
// Added by Mees Electronics
#elif BOARD_MODEL == BOARD_MEES_ESP32_S3
disp_mode = DISP_MODE_LANDSCAPE;
display.setRotation(0);
#else #else
disp_mode = DISP_MODE_PORTRAIT; disp_mode = DISP_MODE_PORTRAIT;
display.setRotation(3); display.setRotation(3);

View File

@@ -0,0 +1,469 @@
# How to compile the RNode firmware yourself
This document describes my efforts to add a new board to the Reticulum RNode firmware. It is published in the hope that it is useful to other makers who want to make their own RNodes.
## Required knowledge
To follow this manual, some basic programming knowledge like using text editors to edit source code and using basic commands like `make` is required. Plus some basic Linux knowledge. But you don't have to be an expert.
## Dependencies
Make sure *git*, *make*, *python* and *pip* are installed. Most likely these are already available on your system. Otherwise do:
$ sudo apt install git
$ sudo apt install make
$ sudo apt install pip
$ sudo apt install python
Install Reticulum:
$ pip install rns --break-system-packages
Add new directories to path:
$ nano ~/.bashrc
Add `export PATH=~/.local/bin:~/bin:$PATH` to the end of the file. Exit with `CTRL-x` and type `y` to save the changes.
Now reload the shell so the changes to the path will take effect: `exec $SHELL`. You can also logout and login again.
Download arduino-cli:
$ cd
$ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
## Clone git repo
$ cd
$ git clone https://github.com/liberatedsystems/RNode_Firmware_CE.git
## Prepare
Install the required BSP and libraries for the ESP32 system.
$ cd RNode_Firmware_CE/
$ make prep-esp32
Sometimes this command stalls. If this happens, stop the command by hiting `CTRL-c` and restarted it.
## Test
To test if you can compile the firmware try it:
$ make firmware-heltec32_v3
Be patient, this can take up to 15 minutes to complete. Wait for the command prompt to return. You should not see any errors.
## Define a new board
Go to the directory `~/RNode_Firmware_CE`. This is the source code of the RNode firmware. Here you will find all the files needed to compile the firmware. You can edit these files with any text editor you like.
Let's say we want to add support for our homebrew ESP32-S3 with an SX1278 LoRa transceiver. First we have to define a BOARD_MODEL. This is an 8 bit value that is used in the source code to select the right code for the hardware. Let's choose 0x61 as the BOARD_MODEL as this number is not used yet. Optional we can also define a BOARD_VARIANT. This defines the variant of the board. A board could come with different LoRa transceivers, for example. It is also a unique 8 bit number. For now, we ignore this BOARD_VARIANT and only use the BOARD_MODEL.
### Makefile
The source code is compiled using `make` and the file called *Makefile*.
Every target board has a section `firmware-<board_name>`, `upload-<board-name>` and `release-<board-name>`. In the Makefile, three new sections for our new board have to be added. The exact place is not critical. But it is good practice to put them alongside the already present sections for firmware, upload and release.
```
# Added board from Mees Electronics
firmware-mees-esp32-s3:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\""
```
```
# Added board from Mees Electronics
upload-mees-esp32-s3:
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:esp32s3
@sleep 1
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin)
@sleep 3
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) --chip esp32-s3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
```
```
release-mees-esp32-s3:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_mees-esp32-s3.boot_app0
cp build/esp32.esp32.mees-esp32-s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_mees-esp32-s3.bin
cp build/esp32.esp32.mees-esp32-s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_mees-esp32-s3.bootloader
cp build/esp32.esp32.mees-esp32-s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_mees-esp32-s3.partitions
zip --junk-paths ./Release/rnode_firmware_mees-esp32-s3.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_mees-esp32-s3.boot_app0 build/rnode_firmware_mees-esp32-s3.bin build/rnode_firmware_mees-esp32-s3.bootloader build/rnode_firmware_mees-esp32-s3.partitions
rm -r build
```
The `upload-mees-esp32-s3` section assumes the ESP32 S3 is connected to serial port /dev/ttyACM0. On your system, this could be another port. Manual change all the `/dev/ttyACM0` to the port on your system.
### Boards.h
The file `Board.h` is the most important file to edit. This is the place where the supported boards are defined. For our new board, a new section has to be added. This section defines the pinout of the SPI port and if it has certain peripherals such as a screen or BLE.
First, the new board has to be defined at the beginning of the file. Search for the line `#define MODEL_FF 0xFF // Homebrew board, max 14dBm output power` and add the new definition below that line:
// Board added by Mees Electronics
#define BOARD_MEES_ESP32_S3 0x61 // Mees electronics ESP32 S3
Next, search for the line `#if MCU_VARIANT == MCU_ESP32`. This is the part where all the ESP32 variant are defined. This section stops at the line `#elif MCU_VARIANT == MCU_NRF52`. From here the definitions for the NRF52 board begin.
Somewhere between these to lines we have to add our board definition. It is good practice to add it at the end, just before the following code:
#else
#error An unsupported ESP32 board was selected. Cannot compile RNode firmware.
#endif
The new code:
// Board definition added by Mees Electronics
#elif BOARD_MODEL == BOARD_MEES_ESP32_S3
#define IS_ESP32S3 true
#define HAS_DISPLAY false
#define HAS_BLUETOOTH false
#define HAS_BLE true
#define HAS_PMU true
#define HAS_CONSOLE true
#define HAS_EEPROM true
#define INTERFACE_COUNT 1
#define HAS_NP true
const int pin_np = 21;
#if HAS_NP == false
#if defined(EXTERNAL_LEDS)
const int pin_led_rx = 16;
const int pin_led_tx = 17;
#else
const int pin_led_rx = 21;
const int pin_led_tx = 21;
#endif
#endif
const uint8_t interfaces[INTERFACE_COUNT] = {SX1278};
const bool interface_cfg[INTERFACE_COUNT][3] = {
// SX1278
{
false, // DEFAULT_SPI
false, // HAS_TCXO
false // DIO2_AS_RF_SWITCH
},
};
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX1278
{
10, // pin_ss
12, // pin_sclk
11, // pin_mosi
13, // pin_miso
-1, // pin_busy
15, // pin_dio
14, // pin_reset
-1, // pin_txen
-1, // pin_rxen
-1 // pin_tcxo_enable
}
};
A lot of the abilities of the board is defined here. Most of it is self explanatory. The above values should be good enough to get you started.
|Name|What does it do|
|----|-------|
|IS_ESP32S3|Is the board an ESP32 S3|
|HAS_DISPLAY| Has the board a display|
|HAS_BLUETOOTH| Has the board Bluetooth|
|HAS_BLE|Has the board Bluetooth LE|
|HAS_PMU|Unknown yet|
|HAS_CONSOLE|RNode Bootstrap Console|
|HAS_EEPROM|All ESP32 have EEPROM|
|INTERFACE_COUNT|Unknown, set to 1|
|HAS_NP|Has the board a NeoPixel|
|EXTERNAL_LEDS|Has the board external LEDs|
The SPI bus is defined in the structs `interfaces`, `interface_cfg` and `interface_pins`. The comments in the code explain it well enough, I think. When the value of `interface_cfg[0]` is set to *false*, we can define all the IO pins in the struct `interface_pins`. The numbers are the GPIO numbers of the ESP32 S3. So 10 means GPIO10. If the value is set to -1 the pin is not used. For example, the SX1278 transceiver doesn't have a busy pin, so it is set to -1.
### Utilities.h
In this file, the routines for the optional external LEDs are defined. If the new board has a NeoPixel, you don't have to change these. But keep reading, because there are some other functions you have to change even if your board has a NeoPixel!
Search for the line `#if MCU_VARIANT == MCU_ESP32`. Because there are several of these lines, make sure you have the right one: the next line should be `#if HAS_NP == true`. Here you will find a bunch of `#elif BOARD_MODEL ==` lines. Find the last one of this if block, which ends with `#endif`. Add the new section for our board just before the `#endif`:
#elif BOARD_MODEL == BOARD_MEES_ESP32_S3
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); }
void led_id_on() { }
void led_id_off() { }
Search for the code `bool eeprom_model_valid() {`. This code checks if the BOARD_MODEL, which is stored in the EEPROM corresponds with the running firmware version. If these are not the same, the firmware will not boot.
After adding our new board section, the code looks something like this:
```
#if BOARD_MODEL == BOARD_RNODE
if (model == MODEL_A4 || model == MODEL_A9 || model == MODEL_FF || model == MODEL_FE) {
#elif BOARD_MODEL == BOARD_RNODE_NG_20
if (model == MODEL_A3 || model == MODEL_A8) {
#elif BOARD_MODEL == BOARD_RNODE_NG_21
if (model == MODEL_A2 || model == MODEL_A7) {
#elif BOARD_MODEL == BOARD_T3S3
if (model == MODEL_A1 || model == MODEL_A6 || model == MODEL_A5 || model == MODEL_AA || model == MODEL_AC) {
#elif BOARD_MODEL == BOARD_HMBRW
if (model == MODEL_FF || model == MODEL_FE) {
#elif BOARD_MODEL == BOARD_TBEAM
if (model == MODEL_E4 || model == MODEL_E9 || model == MODEL_E3 || model == MODEL_E8) {
#elif BOARD_MODEL == BOARD_TDECK
if (model == MODEL_D4 || model == MODEL_D9) {
#elif BOARD_MODEL == BOARD_TECHO
if (model == MODEL_16 || model == MODEL_17) {
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
if (model == MODEL_DB || model == MODEL_DC) {
#elif BOARD_MODEL == BOARD_LORA32_V1_0
if (model == MODEL_BA || model == MODEL_BB) {
#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) {
#elif BOARD_MODEL == BOARD_HELTEC32_V2
if (model == MODEL_C4 || model == MODEL_C9) {
#elif BOARD_MODEL == BOARD_HELTEC32_V3
if (model == MODEL_C5 || model == MODEL_CA) {
#elif BOARD_MODEL == BOARD_H_W_PAPER
if (model == MODEL_C8) {
#elif BOARD_MODEL == BOARD_HELTEC_T114
if (model == MODEL_C6 || model == MODEL_C7) {
#elif BOARD_MODEL == BOARD_RAK4631
if (model == MODEL_11 || model == MODEL_12 || model == MODEL_13 || model == MODEL_14) {
#elif BOARD_MODEL == BOARD_OPENCOM_XL
if (model == MODEL_21) {
#elif BOARD_MODEL == BOARD_HUZZAH32
if (model == MODEL_FF) {
#elif BOARD_MODEL == BOARD_HMBRW
if (model == MODEL_FF || model == MODEL_FE) {
#elif BOARD_MODEL == BOARD_GENERIC_ESP32
if (model == MODEL_FF || model == MODEL_FE) {
// Added by Mees Electronics
#elif BOARD_MODEL == BOARD_MEES_ESP32_S3
if (model == MODEL_A4) {
#else
```
Last, find the line `void setTXPower(RadioInterface* radio, int txp) {`. This is the code that handles the RF power settings of the LoRa transceiver. Here you have to add the proper code for the LoRa module you use. After adding the code for the SX1278 module we use in this example the code should look something like this:
```
if (model == MODEL_A1) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_A2) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_A3) radio->setTxPower(txp, PA_OUTPUT_RFO_PIN);
if (model == MODEL_A4) radio->setTxPower(txp, PA_OUTPUT_RFO_PIN);
if (model == MODEL_A5) radio->setTxPower(txp, PA_OUTPUT_RFO_PIN);
if (model == MODEL_A6) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_A7) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_A8) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_A9) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_AA) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_AC) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_B3) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_B4) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_B8) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_B9) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_BA) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_BB) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_C4) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_C9) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_C5) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_C6) radio->setTxPower(txp, PA_OUTPUT_RFO_PIN);
if (model == MODEL_C7) radio->setTxPower(txp, PA_OUTPUT_RFO_PIN);
if (model == MODEL_CA) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_D4) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_D9) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_DB) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_DC) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_E4) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_E9) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_E3) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_E8) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_FE) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_FF) radio->setTxPower(txp, PA_OUTPUT_RFO_PIN);
// Added by Mees Electronics
if (model == MODEL_A4) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
```
The `MODEL_A4` is an 8 bit value read from the EEPROM. This is the value we will write to the EEPROM later in this document with the command `rnodeconf /dev/ttyACM0 -r --platform ESP32 --model a4 --product f0 --hwrev 3`. The model number a4 is chosen from a list published in the file [https://git.meezenest.nl/marcel/RNode_Firmware_CE/src/branch/master/Documentation/BUILDING.md](https://git.meezenest.nl/marcel/RNode_Firmware_CE/src/branch/master/Documentation/BUILDING.md). It is shared with another board and it is probably better to choose a unique value. But `rnodeconf` uses this value and choosing a new number breaks Reticulum. Further research is needed. But for now let's use a4, because it works.
### Display.h
The file **display.h** also has a board specific definition section. If the new board has a display, make sure there is a proper entry for it. Our example board doesn't have a display, so we don't have to change this file. If your board has a display, make sure you make the proper changes.
### Power.h
The file **Power.h** must also have a board definition. And also proper definitions in **void measure_battery()** and **bool init_pmu()**. These are more elaborate and not yet fully understood, but only used when the board has a battery installed. Our example board doesn't have a battery, so we don't have to change this file. If your board has a display, make sure you make the proper changes.
### Compiling the code and flashing the board
Make sure you are in the dialout group. If not:
$ sudo usermod -aG dialout <username>
If you are flashing a custom board, you will need to generate a signing key in rnodeconf prior to flashing if you do not already have one by running:
$ rnodeconf -k
Compile the code:
$ make firmware-mees-esp32-s3
Than flash the firmware:
$ make upload-mees-esp32-s3
This first time you flash a new board, this command will end with the error `This device has not been provisioned yet, cannot set firmware hash`. That is because the EEPROM is not programmes yet You will need to provision the EEPROM before use:
$ rnodeconf /dev/ttyACM0 -r --platform ESP32 --model a4 --product f0 --hwrev 3
### Migrating to another system
When the rnode is flashed, it is signed with a key. If you connect the RNode to another system, this key cannot be validated. It is possible to write a new key to the RNode by erasing the eeprom and writing the local key to it.
$ rnodeconf /dev/ttyACM0 --eeprom-wipe
$ rnodeconf /dev/ttyACM0 -r --platform ESP32 --model a4 --product f0 --hwrev 3
## Adding support for SX1268 module
### Boards.h
Change the following section:
````
const uint8_t interfaces[INTERFACE_COUNT] = {SX1278};
const bool interface_cfg[INTERFACE_COUNT][3] = {
// SX1278
{
false, // DEFAULT_SPI
false, // HAS_TCXO
false // DIO2_AS_RF_SWITCH
},
};
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX1278
{
10, // pin_ss
12, // pin_sclk
11, // pin_mosi
13, // pin_miso
-1, // pin_busy
15, // pin_dio
14, // pin_reset
-1, // pin_txen
-1, // pin_rxen
-1 // pin_tcxo_enable
}
};
````
with this:
````
#if BOARD_VARIANT == MODEL_F1
const uint8_t interfaces[INTERFACE_COUNT] = {SX1278};
const bool interface_cfg[INTERFACE_COUNT][3] = {
// SX1278
{
false, // DEFAULT_SPI
false, // HAS_TCXO
false // DIO2_AS_RF_SWITCH
},
};
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX1278
{
10, // pin_ss
12, // pin_sclk
11, // pin_mosi
13, // pin_miso
-1, // pin_busy
15, // pin_dio
14, // pin_reset
-1, // pin_txen
-1, // pin_rxen
-1 // pin_tcxo_enable
}
};
#elif BOARD_VARIANT == MODEL_F2
const uint8_t interfaces[INTERFACE_COUNT] = {SX1262};
const bool interface_cfg[INTERFACE_COUNT][3] = {
// SX1262
{
false, // DEFAULT_SPI
true, // HAS_TCXO
true // DIO2_AS_RF_SWITCH
},
};
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX1262
{
10, // pin_ss
12, // pin_sclk
11, // pin_mosi
13, // pin_miso
16, // pin_busy
15, // pin_dio
14, // pin_reset
-1, // pin_txen
17, // pin_rxen
-1 // pin_tcxo_enable
}
};
#endif
````
### Radio.cpp
Add the following statement to the function **sx126x::enableTCXO()**:
// Board added by Mees Electronics
#elif BOARD_MODEL == BOARD_MEES_ESP32_S3
uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};
Add the following statement to the function **int sx126x::endPacket()** just after `setPacketParams(_preambleLength, _implicitHeaderMode, _payloadLength, _crcMode);`:
// Added by Mees Electronics: RXEN on E22 module back to low
#if BOARD_MODEL == BOARD_MEES_ESP32_S3 && BOARD_VARIANT == MODEL_F2
if (_rxen != -1) {
digitalWrite(_rxen, LOW);
}
#endif
The E22 module has an RXEN and a TXEN input. Both must be used and both cannot be logic 1 at the same time. RXEN must be controlled by the firmware while TXEN can be controlled by either the firmware or the DIO2 pin, by using the DIO2_AS_RF_SWITCH function in the firmware. My current solution is to control TXEN by the DIO2 pin. If you forget to control the TXEN line, the maximum output will be 22 dBm instead of 33 dBm. It would be better to alter the code to make it more universal (like with the *sx128x* code), but for now it works.
### Makefile
Change the following section:
````
# Added board from Mees Electronics
firmware-mees-esp32-s3:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\""
````
with this:
````
# Added board from Mees Electronics
firmware-mees-esp32-s3:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\" \"-DBOARD_VARIANT=0xF2\""
````
If you want to compile the board for the SX1278 just change **BOARD_VARIANT** to *0xF1*.
# License
(C) 2025 M.T. Konstapel https://meezenest.nl/mees
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Many thanks to Tom ON3DHC for proofreading this document.

View File

@@ -106,6 +106,11 @@
#define ERROR_MEMORY_LOW 0x05 #define ERROR_MEMORY_LOW 0x05
#define ERROR_MODEM_TIMEOUT 0x06 #define ERROR_MODEM_TIMEOUT 0x06
#define CMD_GPS 0xA0
#define GPS_CMD_LAT 0x00
#define GPS_CMD_LNG 0x01
// Serial logging // Serial logging
#define LOG_MSG 0x2F #define LOG_MSG 0x2F

View File

@@ -54,6 +54,7 @@ prep-nrf:
arduino-cli lib install "Crypto" arduino-cli lib install "Crypto"
arduino-cli lib install "Adafruit GFX Library" arduino-cli lib install "Adafruit GFX Library"
arduino-cli lib install "GxEPD2" arduino-cli lib install "GxEPD2"
arduino-cli lib install "TinyGPSPlus"
arduino-cli config set library.enable_unsafe_install true arduino-cli config set library.enable_unsafe_install true
arduino-cli lib install --git-url https://github.com/liamcottle/esp8266-oled-ssd1306#e16cee124fe26490cb14880c679321ad8ac89c95 arduino-cli lib install --git-url https://github.com/liamcottle/esp8266-oled-ssd1306#e16cee124fe26490cb14880c679321ad8ac89c95
pip install pyserial rns --upgrade --user --break-system-packages # This looks scary, but it's actually just telling pip to install packages as a user instead of trying to install them systemwide, which bypasses the "externally managed environment" error. pip install pyserial rns --upgrade --user --break-system-packages # This looks scary, but it's actually just telling pip to install packages as a user instead of trying to install them systemwide, which bypasses the "externally managed environment" error.
@@ -151,6 +152,14 @@ firmware-opencom-xl:
firmware-heltec_t114: firmware-heltec_t114:
arduino-cli compile --log --fqbn Heltec_nRF52:Heltec_nRF52:HT-n5262 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3C\"" arduino-cli compile --log --fqbn Heltec_nRF52:Heltec_nRF52:HT-n5262 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3C\""
firmware-heltec_t114_gps:
arduino-cli compile --log --fqbn Heltec_nRF52:Heltec_nRF52:HT-n5262 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3C\" \"-DBOARD_VARIANT=0xCB\""
# Added board from Mees Electronics
firmware-mees-esp32-s3:
#arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\""
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\" \"-DBOARD_VARIANT=0xF2\""
upload-tbeam: upload-tbeam:
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:t-beam arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:t-beam
@sleep 1 @sleep 1
@@ -264,6 +273,20 @@ upload-techo:
@sleep 6 @sleep 6
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes from_device /dev/ttyACM0) rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes from_device /dev/ttyACM0)
# Added board from Mees Electronics
upload-mees-esp32-s3:
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:esp32s3
@sleep 1
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) --chip esp32-s3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
@sleep 3
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin)
#arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:ttgo-lora32
#@sleep 1
#rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
#@sleep 3
#python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) $(COMMON_ESP_UPLOAD_FLAGS) ./Release/console_image.bin
release: console-site spiffs-image $(shell grep ^release- Makefile | cut -d: -f1) release: console-site spiffs-image $(shell grep ^release- Makefile | cut -d: -f1)
release-hashes: release-hashes:
@@ -504,3 +527,13 @@ release-heltec_t114:
cp build/Heltec_nRF52.Heltec_nRF52.HT-n5262/RNode_Firmware_CE.ino.hex build/rnode_firmware_heltec_t114.hex cp build/Heltec_nRF52.Heltec_nRF52.HT-n5262/RNode_Firmware_CE.ino.hex build/rnode_firmware_heltec_t114.hex
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_heltec_t114.hex Release/rnode_firmware_heltec_t114.zip adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_heltec_t114.hex Release/rnode_firmware_heltec_t114.zip
rm -r build rm -r build
# Added by Mees Electronics
release-mees-esp32-s3:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\" \"-DBOARD_VARIANT=0x31\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_mees-esp32-s3.boot_app0
cp build/esp32.esp32.mees-esp32-s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_mees-esp32-s3.bin
cp build/esp32.esp32.mees-esp32-s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_mees-esp32-s3.bootloader
cp build/esp32.esp32.mees-esp32-s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_mees-esp32-s3.partitions
zip --junk-paths ./Release/rnode_firmware_mees-esp32-s3.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx126xrnode_firmware_mees-esp32-s3.boot_app0 build/rnode_firmware_mees-esp32-s3.bin build/rnode_firmware_mees-esp32-s3.bootloader build/rnode_firmware_mees-esp32-s3.partitions
rm -r build

16
Power.h
View File

@@ -164,6 +164,22 @@
bool bat_voltage_dropping = false; bool bat_voltage_dropping = false;
float bat_delay_v = 0; float bat_delay_v = 0;
float bat_state_change_v = 0; float bat_state_change_v = 0;
#elif BOARD_MODEL == BOARD_MEES_ESP32_S3
#define BAT_V_MIN 3.15
#define BAT_V_MAX 4.3
#define BAT_V_CHG 4.48
#define BAT_V_FLOAT 4.33
#define BAT_SAMPLES 5
const uint8_t pin_vbat = 35;
float bat_p_samples[BAT_SAMPLES];
float bat_v_samples[BAT_SAMPLES];
uint8_t bat_samples_count = 0;
int bat_discharging_samples = 0;
int bat_charging_samples = 0;
int bat_charged_samples = 0;
bool bat_voltage_dropping = false;
float bat_delay_v = 0;
float bat_state_change_v = 0;
#endif #endif
uint32_t last_pmu_update = 0; uint32_t last_pmu_update = 0;

View File

@@ -1,6 +1,31 @@
# RNode Firmware - Community Edition # RNode Firmware - Mees Electronics Edition
This is the community maintained fork of the open firmware which powers RNode devices. It has been created to continue to expand development and support for more hardware devices, as the upstream repository is no longer accepting PRs for new hardware support. The original repository by Mark Qvist can be found [here](https://github.com/markqvist/RNode_Firmware). This version of the RNode firmware is made to add support for the E22-400M33S LoRa module. With an output power of 33 dBm this module is suitable for ham radio applications.
This is a copy of the community maintained fork of the open firmware which powers RNode devices found on [https://github.com/liberatedsystems/RNode_Firmware_CE](https://github.com/liberatedsystems/RNode_Firmware_CE). The copy has been created to add support for hardware designed by [Mees Electronics](https://meezenest.nl/mees). The original repository by Mark Qvist can be found [here](https://github.com/markqvist/RNode_Firmware).
Support is added for **ESP32 S3** boards with either an **SX1278** or an **SX1268** LoRa module. It is tested with a **Waveshare ESP32 S3 Pico** and a **LilyGO T7-S3 ESP32-S3 Development Board**. But it is expected to work with all ESP32 S3 boards which expose the proper GPIO pins. LoRa modules that are tested are the **Ra-02 SX1278** transceiver and the **E22-400M33S SX1268** transceiver. See [./Documentation/HOWTO-change-firmware-and-compile-it_MeesElectronics.md](https://git.meezenest.nl/marcel/RNode_Firmware_CE/src/branch/master/Documentation/HOWTO-change-firmware-and-compile-it_MeesElectronics.md) for more information about adding a new board to the code.
More information about this project can be found on: [https://www.meezenest.nl/mees-elektronica/projects/reticulum_design_my_own_rnode/index.html](https://www.meezenest.nl/mees-elektronica/projects/reticulum_design_my_own_rnode/index.html)
Pinout between ESP and LoRa module:
|LoRa|ESP32 GPIO|
|---|----|
|NSS|10|
|MOSI|11|
|SCK|12|
|MISO|13|
|RST|14|
|DIO|15|
|BUSY|16|
|RXEN|17|
|RX LED|18|
|TX LED|33|
Note: **BUSY** and **RXEN** are only necessary when using the SX1268 module.
# What it is
An RNode is an open, free and unrestricted digital radio transceiver. It enables anyone to send and receive any kind of data over both short and very long distances. RNodes can be used with many different kinds of programs and systems, but they are especially well suited for use with [Reticulum](https://reticulum.network). An RNode is an open, free and unrestricted digital radio transceiver. It enables anyone to send and receive any kind of data over both short and very long distances. RNodes can be used with many different kinds of programs and systems, but they are especially well suited for use with [Reticulum](https://reticulum.network).

View File

@@ -46,7 +46,7 @@
SPIClass interface_spi[1] = { SPIClass interface_spi[1] = {
// SX1262 // SX1262
SPIClass( SPIClass(
NRF_SPIM3, NRF_SPIM1,
interface_pins[0][3], interface_pins[0][3],
interface_pins[0][1], interface_pins[0][1],
interface_pins[0][2] interface_pins[0][2]
@@ -132,8 +132,14 @@ void setup() {
pinMode(PIN_LED_GREEN, OUTPUT); pinMode(PIN_LED_GREEN, OUTPUT);
pinMode(PIN_LED_BLUE, OUTPUT); pinMode(PIN_LED_BLUE, OUTPUT);
delay(200); delay(200);
#elif BOARD_MODEL == BOARD_HELTEC_T114
delay(200);
pinMode(PIN_VEXT_EN, OUTPUT);
digitalWrite(PIN_VEXT_EN, HIGH);
delay(100);
#endif #endif
if (!eeprom_begin()) { Serial.write("EEPROM initialisation failed.\r\n"); } if (!eeprom_begin()) { Serial.write("EEPROM initialisation failed.\r\n"); }
#endif #endif
@@ -208,6 +214,11 @@ void setup() {
fifo_init(&packet_rdy_interfaces, packet_rdy_interfaces_buf, MAX_INTERFACES); fifo_init(&packet_rdy_interfaces, packet_rdy_interfaces_buf, MAX_INTERFACES);
#if HAS_GPS
// init GPS
gps_s.begin(GPS_BAUD_RATE);
#endif
// add call to init_channel_stats here? \todo // add call to init_channel_stats here? \todo
// Create and configure interface objects // Create and configure interface objects
@@ -398,6 +409,7 @@ void setup() {
// Validate board health, EEPROM and config // Validate board health, EEPROM and config
validate_status(); validate_status();
} }
void lora_receive(RadioInterface* radio) { void lora_receive(RadioInterface* radio) {
@@ -1545,7 +1557,7 @@ void loop() {
process_serial(); process_serial();
#if HAS_DISPLAY #if HAS_DISPLAY
#if DISPLAY == OLED #if DISPLAY == OLED || DISPLAY == TFT || DISPLAY == ADAFRUIT_TFT
if (disp_ready) update_display(); if (disp_ready) update_display();
#elif DISPLAY == EINK_BW || DISPLAY == EINK_3C #elif DISPLAY == EINK_BW || DISPLAY == EINK_3C
// Display refreshes take so long on e-paper displays that they can disrupt // Display refreshes take so long on e-paper displays that they can disrupt
@@ -1577,6 +1589,20 @@ void loop() {
input_read(); input_read();
#endif #endif
#if HAS_GPS
while (gps_s.available() > 0) {
if (gps.encode(gps_s.read()) && millis() - last_gps >= GPS_INTERVAL) {
kiss_indicate_location();
last_gps = millis();
}
}
if (millis() > 5000 && gps.charsProcessed() < 10) {
while (true) {
Serial.println(F("No GPS detected: check wiring."));
}
}
#endif
if (memory_low) { if (memory_low) {
#if PLATFORM == PLATFORM_ESP32 #if PLATFORM == PLATFORM_ESP32
if (esp_get_free_heap_size() < 8192) { if (esp_get_free_heap_size() < 8192) {

View File

@@ -439,6 +439,13 @@ int sx126x::endPacket()
{ {
setPacketParams(_preambleLength, _implicitHeaderMode, _payloadLength, _crcMode); setPacketParams(_preambleLength, _implicitHeaderMode, _payloadLength, _crcMode);
// Added by Mees Electronics: RXEN on E22 module back to low
#if BOARD_MODEL == BOARD_MEES_ESP32_S3 && BOARD_VARIANT == MODEL_F2
if (_rxen != -1) {
digitalWrite(_rxen, LOW);
}
#endif
// put in single TX mode // put in single TX mode
uint8_t timeout[3] = {0}; uint8_t timeout[3] = {0};
executeOpcode(OP_TX_6X, timeout, 3); executeOpcode(OP_TX_6X, timeout, 3);
@@ -711,6 +718,9 @@ void sx126x::enableTCXO() {
uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF}; uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};
#elif BOARD_MODEL == BOARD_HELTEC_T114 #elif BOARD_MODEL == BOARD_HELTEC_T114
uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF}; uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};
// Board added by Mees Electronics
#elif BOARD_MODEL == BOARD_MEES_ESP32_S3
uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF};
#else #else
uint8_t buf[4] = {0}; uint8_t buf[4] = {0};
#endif #endif
@@ -742,6 +752,11 @@ void sx126x::setTxPower(int level, int outputPin) {
_txp = level; _txp = level;
// Added by Mees Electronics: E22 transceiver can go to +33dBm, but only needs 9dBm drive. Set any higher and it might blow the finals!
//#if BOARD_MODEL == BOARD_MEES_ESP32_S3 && BOARD_VARIANT == MODEL_F2
//if (level > 9) { level = 9; }
//#endif
writeRegister(REG_OCP_6X, OCP_TUNED); // 160mA limit, overcurrent protection writeRegister(REG_OCP_6X, OCP_TUNED); // 160mA limit, overcurrent protection
uint8_t tx_buf[2]; uint8_t tx_buf[2];

View File

@@ -61,6 +61,10 @@ uint8_t eeprom_read(uint32_t mapped_addr);
#include "Input.h" #include "Input.h"
#endif #endif
#if HAS_GPS
#include "src/misc/gps.h"
#endif
#if MCU_VARIANT == MCU_ESP32 || MCU_VARIANT == MCU_NRF52 #if MCU_VARIANT == MCU_ESP32 || MCU_VARIANT == MCU_NRF52
#include "Device.h" #include "Device.h"
#endif #endif
@@ -289,6 +293,13 @@ uint8_t boot_vector = 0x00;
void led_tx_off() { digitalWrite(pin_led_tx, LOW); } void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
void led_id_on() { } void led_id_on() { }
void led_id_off() { } void led_id_off() { }
#elif BOARD_MODEL == BOARD_MEES_ESP32_S3
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); }
void led_id_on() { }
void led_id_off() { }
#endif #endif
#elif MCU_VARIANT == MCU_NRF52 #elif MCU_VARIANT == MCU_NRF52
#if HAS_NP == true #if HAS_NP == true
@@ -1246,6 +1257,16 @@ void setTXPower(RadioInterface* radio, int txp) {
if (model == MODEL_FE) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN); if (model == MODEL_FE) radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
if (model == MODEL_FF) radio->setTxPower(txp, PA_OUTPUT_RFO_PIN); if (model == MODEL_FF) radio->setTxPower(txp, PA_OUTPUT_RFO_PIN);
// Added by Mees Electronics
if (model == MODEL_A4) {
if (interfaces[radio->getIndex()] == SX1278) {
radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
} else {
radio->setTxPower(txp, PA_OUTPUT_PA_BOOST_PIN);
}
}
} }
uint8_t getRandom(RadioInterface* radio) { uint8_t getRandom(RadioInterface* radio) {
@@ -1528,6 +1549,9 @@ bool eeprom_model_valid() {
if (model == MODEL_FF || model == MODEL_FE) { if (model == MODEL_FF || model == MODEL_FE) {
#elif BOARD_MODEL == BOARD_GENERIC_ESP32 #elif BOARD_MODEL == BOARD_GENERIC_ESP32
if (model == MODEL_FF || model == MODEL_FE) { if (model == MODEL_FF || model == MODEL_FE) {
// Added by Mees Electronics
#elif BOARD_MODEL == BOARD_MEES_ESP32_S3
if (model == MODEL_A4) {
#else #else
if (false) { if (false) {
#endif #endif
@@ -1712,6 +1736,35 @@ void unlock_rom() {
eeprom_erase(); eeprom_erase();
} }
void kiss_indicate_location() {
#if HAS_GPS
char location[10];
int len;
int32_t val;
if (gps.location.isValid()) {
serial_write(FEND);
serial_write(CMD_GPS);
serial_write(GPS_CMD_LAT);
val = gps.location.lat() * 1000000;
escaped_serial_write(val>>24);
escaped_serial_write(val>>16);
escaped_serial_write(val>>8);
escaped_serial_write(val);
serial_write(FEND);
serial_write(FEND);
serial_write(CMD_GPS);
serial_write(GPS_CMD_LNG);
val = gps.location.lng() * 1000000;
escaped_serial_write(val>>24);
escaped_serial_write(val>>16);
escaped_serial_write(val>>8);
escaped_serial_write(val);
serial_write(FEND);
}
#endif
}
void log_debug(const char* msg) { void log_debug(const char* msg) {
serial_write(FEND); serial_write(FEND);
serial_write(LOG_MSG); serial_write(LOG_MSG);

8
src/misc/gps.h Normal file
View File

@@ -0,0 +1,8 @@
#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
#define GPS_INTERVAL 5000 // ms
unsigned long last_gps = 0;
TinyGPSPlus gps;
SoftwareSerial gps_s(PIN_GPS_RX, PIN_GPS_TX);