Merge branch 'dev' into minewsemi-me25ls01
This commit is contained in:
@@ -613,10 +613,10 @@ void MyMesh::begin(bool has_display) {
|
|||||||
_prefs.cr = constrain(_prefs.cr, 5, 8);
|
_prefs.cr = constrain(_prefs.cr, 5, 8);
|
||||||
_prefs.tx_power_dbm = constrain(_prefs.tx_power_dbm, 1, MAX_LORA_TX_POWER);
|
_prefs.tx_power_dbm = constrain(_prefs.tx_power_dbm, 1, MAX_LORA_TX_POWER);
|
||||||
|
|
||||||
#ifdef BLE_PIN_CODE
|
#ifdef BLE_PIN_CODE // 123456 by default
|
||||||
if (_prefs.ble_pin == 0) {
|
if (_prefs.ble_pin == 0) {
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
if (has_display) {
|
if (has_display && BLE_PIN_CODE == 123456) {
|
||||||
StdRNG rng;
|
StdRNG rng;
|
||||||
_active_ble_pin = rng.nextInt(100000, 999999); // random pin each session
|
_active_ble_pin = rng.nextInt(100000, 999999); // random pin each session
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
#define FIRMWARE_VER_CODE 6
|
#define FIRMWARE_VER_CODE 6
|
||||||
|
|
||||||
#ifndef FIRMWARE_BUILD_DATE
|
#ifndef FIRMWARE_BUILD_DATE
|
||||||
#define FIRMWARE_BUILD_DATE "29 Jun 2025"
|
#define FIRMWARE_BUILD_DATE "2 Jul 2025"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FIRMWARE_VERSION
|
#ifndef FIRMWARE_VERSION
|
||||||
#define FIRMWARE_VERSION "v1.7.1"
|
#define FIRMWARE_VERSION "v1.7.2"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
/* ------------------------------ Config -------------------------------- */
|
/* ------------------------------ Config -------------------------------- */
|
||||||
|
|
||||||
#ifndef FIRMWARE_BUILD_DATE
|
#ifndef FIRMWARE_BUILD_DATE
|
||||||
#define FIRMWARE_BUILD_DATE "29 Jun 2025"
|
#define FIRMWARE_BUILD_DATE "2 Jul 2025"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FIRMWARE_VERSION
|
#ifndef FIRMWARE_VERSION
|
||||||
#define FIRMWARE_VERSION "v1.7.1"
|
#define FIRMWARE_VERSION "v1.7.2"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LORA_FREQ
|
#ifndef LORA_FREQ
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
/* ------------------------------ Config -------------------------------- */
|
/* ------------------------------ Config -------------------------------- */
|
||||||
|
|
||||||
#ifndef FIRMWARE_BUILD_DATE
|
#ifndef FIRMWARE_BUILD_DATE
|
||||||
#define FIRMWARE_BUILD_DATE "29 Jun 2025"
|
#define FIRMWARE_BUILD_DATE "2 Jul 2025"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FIRMWARE_VERSION
|
#ifndef FIRMWARE_VERSION
|
||||||
#define FIRMWARE_VERSION "v1.7.1"
|
#define FIRMWARE_VERSION "v1.7.2"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LORA_FREQ
|
#ifndef LORA_FREQ
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <helpers/RefCountedDigitalPin.h>
|
#include <helpers/RefCountedDigitalPin.h>
|
||||||
|
|
||||||
// LoRa radio module pins for Heltec V3
|
// LoRa radio module pins for Heltec V3
|
||||||
// Also for Heltec Wireless Tracker
|
// Also for Heltec Wireless Tracker/Paper
|
||||||
#define P_LORA_DIO_1 14
|
#define P_LORA_DIO_1 14
|
||||||
#define P_LORA_NSS 8
|
#define P_LORA_NSS 8
|
||||||
#define P_LORA_RESET RADIOLIB_NC
|
#define P_LORA_RESET RADIOLIB_NC
|
||||||
@@ -14,7 +14,9 @@
|
|||||||
#define P_LORA_MOSI 10
|
#define P_LORA_MOSI 10
|
||||||
|
|
||||||
// built-ins
|
// built-ins
|
||||||
#define PIN_VBAT_READ 1
|
#ifndef PIN_VBAT_READ // set in platformio.ini for boards like Heltec Wireless Paper (20)
|
||||||
|
#define PIN_VBAT_READ 1
|
||||||
|
#endif
|
||||||
#ifndef PIN_ADC_CTRL // set in platformio.ini for Heltec Wireless Tracker (2)
|
#ifndef PIN_ADC_CTRL // set in platformio.ini for Heltec Wireless Tracker (2)
|
||||||
#define PIN_ADC_CTRL 37
|
#define PIN_ADC_CTRL 37
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
116
src/helpers/ui/E213Display.cpp
Normal file
116
src/helpers/ui/E213Display.cpp
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
#include "E213Display.h"
|
||||||
|
|
||||||
|
#include "../../MeshCore.h"
|
||||||
|
|
||||||
|
bool E213Display::begin() {
|
||||||
|
if (_init) return true;
|
||||||
|
|
||||||
|
powerOn();
|
||||||
|
display.begin();
|
||||||
|
|
||||||
|
// Set to landscape mode rotated 180 degrees
|
||||||
|
display.setRotation(3);
|
||||||
|
|
||||||
|
_init = true;
|
||||||
|
_isOn = true;
|
||||||
|
|
||||||
|
clear();
|
||||||
|
display.fastmodeOn(); // Enable fast mode for quicker (partial) updates
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::powerOn() {
|
||||||
|
#ifdef PIN_VEXT_EN
|
||||||
|
pinMode(PIN_VEXT_EN, OUTPUT);
|
||||||
|
digitalWrite(PIN_VEXT_EN, LOW); // Active low
|
||||||
|
delay(50); // Allow power to stabilize
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::powerOff() {
|
||||||
|
#ifdef PIN_VEXT_EN
|
||||||
|
digitalWrite(PIN_VEXT_EN, HIGH); // Turn off power
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::turnOn() {
|
||||||
|
if (!_init) begin();
|
||||||
|
powerOn();
|
||||||
|
_isOn = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::turnOff() {
|
||||||
|
powerOff();
|
||||||
|
_isOn = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::clear() {
|
||||||
|
display.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::startFrame(Color bkg) {
|
||||||
|
// Fill screen with white first to ensure clean background
|
||||||
|
display.fillRect(0, 0, width(), height(), WHITE);
|
||||||
|
if (bkg == LIGHT) {
|
||||||
|
// Fill with black if light background requested (inverted for e-ink)
|
||||||
|
display.fillRect(0, 0, width(), height(), BLACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::setTextSize(int sz) {
|
||||||
|
// The library handles text size internally
|
||||||
|
display.setTextSize(sz);
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::setColor(Color c) {
|
||||||
|
// implemented in individual display methods
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::setCursor(int x, int y) {
|
||||||
|
display.setCursor(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::print(const char *str) {
|
||||||
|
display.print(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::fillRect(int x, int y, int w, int h) {
|
||||||
|
display.fillRect(x, y, w, h, BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::drawRect(int x, int y, int w, int h) {
|
||||||
|
display.drawRect(x, y, w, h, BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::drawXbm(int x, int y, const uint8_t *bits, int w, int h) {
|
||||||
|
// Width in bytes for bitmap processing
|
||||||
|
uint16_t widthInBytes = (w + 7) / 8;
|
||||||
|
|
||||||
|
// Process the bitmap row by row
|
||||||
|
for (int by = 0; by < h; by++) {
|
||||||
|
// Scan across the row bit by bit
|
||||||
|
for (int bx = 0; bx < w; bx++) {
|
||||||
|
// Get the current bit using MSB ordering (like GxEPDDisplay)
|
||||||
|
uint16_t byteOffset = (by * widthInBytes) + (bx / 8);
|
||||||
|
uint8_t bitMask = 0x80 >> (bx & 7);
|
||||||
|
bool bitSet = bits[byteOffset] & bitMask;
|
||||||
|
|
||||||
|
// If the bit is set, draw the pixel
|
||||||
|
if (bitSet) {
|
||||||
|
display.drawPixel(x + bx, y + by, BLACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t E213Display::getTextWidth(const char *str) {
|
||||||
|
int16_t x1, y1;
|
||||||
|
uint16_t w, h;
|
||||||
|
display.getTextBounds(str, 0, 0, &x1, &y1, &w, &h);
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
void E213Display::endFrame() {
|
||||||
|
display.update();
|
||||||
|
}
|
||||||
37
src/helpers/ui/E213Display.h
Normal file
37
src/helpers/ui/E213Display.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "DisplayDriver.h"
|
||||||
|
|
||||||
|
#include <SPI.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
#include <heltec-eink-modules.h>
|
||||||
|
|
||||||
|
// Display driver for E213 e-ink display
|
||||||
|
class E213Display : public DisplayDriver {
|
||||||
|
EInkDisplay_VisionMasterE213 display;
|
||||||
|
bool _init = false;
|
||||||
|
bool _isOn = false;
|
||||||
|
|
||||||
|
public:
|
||||||
|
E213Display() : DisplayDriver(250, 122) {}
|
||||||
|
|
||||||
|
bool begin();
|
||||||
|
bool isOn() override { return _isOn; }
|
||||||
|
void turnOn() override;
|
||||||
|
void turnOff() override;
|
||||||
|
void clear() override;
|
||||||
|
void startFrame(Color bkg = DARK) override;
|
||||||
|
void setTextSize(int sz) override;
|
||||||
|
void setColor(Color c) override;
|
||||||
|
void setCursor(int x, int y) override;
|
||||||
|
void print(const char *str) override;
|
||||||
|
void fillRect(int x, int y, int w, int h) override;
|
||||||
|
void drawRect(int x, int y, int w, int h) override;
|
||||||
|
void drawXbm(int x, int y, const uint8_t *bits, int w, int h) override;
|
||||||
|
uint16_t getTextWidth(const char *str) override;
|
||||||
|
void endFrame() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void powerOn();
|
||||||
|
void powerOff();
|
||||||
|
};
|
||||||
@@ -96,7 +96,7 @@ build_flags =
|
|||||||
-D DISPLAY_CLASS=SSD1306Display
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=8
|
-D MAX_GROUP_CHANNELS=8
|
||||||
-D BLE_PIN_CODE=0
|
-D BLE_PIN_CODE=123456
|
||||||
-D BLE_DEBUG_LOGGING=1
|
-D BLE_DEBUG_LOGGING=1
|
||||||
-D OFFLINE_QUEUE_SIZE=256
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ build_flags =
|
|||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=8
|
-D MAX_GROUP_CHANNELS=8
|
||||||
-D DISPLAY_CLASS=SSD1306Display
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
-D BLE_PIN_CODE=0 ; dynamic, random PIN
|
-D BLE_PIN_CODE=123456 ; dynamic, random PIN
|
||||||
-D BLE_DEBUG_LOGGING=1
|
-D BLE_DEBUG_LOGGING=1
|
||||||
-D OFFLINE_QUEUE_SIZE=256
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
|
|||||||
84
variants/heltec_wireless_paper/platformio.ini
Normal file
84
variants/heltec_wireless_paper/platformio.ini
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
[Heltec_Wireless_Paper_base]
|
||||||
|
extends = esp32_base
|
||||||
|
board = esp32-s3-devkitc-1
|
||||||
|
build_flags =
|
||||||
|
${esp32_base.build_flags}
|
||||||
|
-I variants/heltec_wireless_paper
|
||||||
|
-D HELTEC_WIRELESS_PAPER
|
||||||
|
-D RADIO_CLASS=CustomSX1262
|
||||||
|
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||||
|
-D LORA_TX_POWER=22
|
||||||
|
-D P_LORA_TX_LED=18
|
||||||
|
; -D PIN_BOARD_SDA=17
|
||||||
|
; -D PIN_BOARD_SCL=18
|
||||||
|
-D PIN_USER_BTN=0
|
||||||
|
-D PIN_VEXT_EN=45
|
||||||
|
-D PIN_VBAT_READ=20
|
||||||
|
-D PIN_ADC_CTRL=19
|
||||||
|
-D SX126X_DIO2_AS_RF_SWITCH=true
|
||||||
|
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
||||||
|
-D SX126X_CURRENT_LIMIT=140
|
||||||
|
-D SX126X_RX_BOOSTED_GAIN=1
|
||||||
|
-D DISP_CS=4
|
||||||
|
-D DISP_BUSY=7
|
||||||
|
-D DISP_DC=5
|
||||||
|
-D DISP_RST=6
|
||||||
|
-D DISP_SCLK=3
|
||||||
|
-D DISP_MOSI=2
|
||||||
|
-D ARDUINO_heltec_wifi_lora_32_V3
|
||||||
|
-D WIRELESS_PAPER
|
||||||
|
build_src_filter = ${esp32_base.build_src_filter}
|
||||||
|
+<../variants/heltec_wireless_paper>
|
||||||
|
lib_deps =
|
||||||
|
${esp32_base.lib_deps}
|
||||||
|
todd-herbert/heltec-eink-modules @ 4.5.0
|
||||||
|
|
||||||
|
[env:Heltec_Wireless_Paper_companion_radio_ble]
|
||||||
|
extends = Heltec_Wireless_Paper_base
|
||||||
|
build_flags =
|
||||||
|
${Heltec_Wireless_Paper_base.build_flags}
|
||||||
|
-D MAX_CONTACTS=100
|
||||||
|
-D MAX_GROUP_CHANNELS=8
|
||||||
|
-D DISPLAY_CLASS=E213Display
|
||||||
|
-D BLE_PIN_CODE=0 ; dynamic, random PIN
|
||||||
|
-D BLE_DEBUG_LOGGING=1
|
||||||
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
|
build_src_filter = ${Heltec_Wireless_Paper_base.build_src_filter}
|
||||||
|
+<helpers/ui/E213Display.cpp>
|
||||||
|
+<helpers/esp32/*.cpp>
|
||||||
|
+<../examples/companion_radio>
|
||||||
|
lib_deps =
|
||||||
|
${Heltec_Wireless_Paper_base.lib_deps}
|
||||||
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
|
[env:Heltec_Wireless_Paper_repeater]
|
||||||
|
extends = Heltec_Wireless_Paper_base
|
||||||
|
build_flags =
|
||||||
|
${Heltec_Wireless_Paper_base.build_flags}
|
||||||
|
-D DISPLAY_CLASS=E213Display
|
||||||
|
-D ADVERT_NAME='"Heltec WP Repeater"'
|
||||||
|
-D ADVERT_LAT=0.0
|
||||||
|
-D ADVERT_LON=0.0
|
||||||
|
build_src_filter = ${Heltec_Wireless_Paper_base.build_src_filter}
|
||||||
|
+<helpers/ui/E213Display.cpp>
|
||||||
|
+<../examples/simple_repeater>
|
||||||
|
lib_deps =
|
||||||
|
${Heltec_Wireless_Paper_base.lib_deps}
|
||||||
|
${esp32_ota.lib_deps}
|
||||||
|
|
||||||
|
[env:Heltec_Wireless_Paper_room_server]
|
||||||
|
extends = Heltec_Wireless_Paper_base
|
||||||
|
build_flags =
|
||||||
|
${Heltec_Wireless_Paper_base.build_flags}
|
||||||
|
-D DISPLAY_CLASS=E213Display
|
||||||
|
-D ADVERT_NAME='"Heltec WP Room"'
|
||||||
|
-D ADVERT_LAT=0.0
|
||||||
|
-D ADVERT_LON=0.0
|
||||||
|
-D ADMIN_PASSWORD='"password"'
|
||||||
|
-D ROOM_PASSWORD='"hello"'
|
||||||
|
build_src_filter = ${Heltec_Wireless_Paper_base.build_src_filter}
|
||||||
|
+<helpers/ui/E213Display.cpp>
|
||||||
|
+<../examples/simple_room_server>
|
||||||
|
lib_deps =
|
||||||
|
${Heltec_Wireless_Paper_base.lib_deps}
|
||||||
|
${esp32_ota.lib_deps}
|
||||||
45
variants/heltec_wireless_paper/target.cpp
Normal file
45
variants/heltec_wireless_paper/target.cpp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#include "target.h"
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
HeltecV3Board board;
|
||||||
|
|
||||||
|
static SPIClass spi;
|
||||||
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);
|
||||||
|
|
||||||
|
WRAPPER_CLASS radio_driver(radio, board);
|
||||||
|
|
||||||
|
ESP32RTCClock fallback_clock;
|
||||||
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
|
|
||||||
|
SensorManager sensors;
|
||||||
|
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
DISPLAY_CLASS display;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool radio_init() {
|
||||||
|
fallback_clock.begin();
|
||||||
|
rtc_clock.begin(Wire);
|
||||||
|
return radio.std_init(&spi);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t radio_get_rng_seed() {
|
||||||
|
return radio.random(0x7FFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) {
|
||||||
|
radio.setFrequency(freq);
|
||||||
|
radio.setSpreadingFactor(sf);
|
||||||
|
radio.setBandwidth(bw);
|
||||||
|
radio.setCodingRate(cr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void radio_set_tx_power(uint8_t dbm) {
|
||||||
|
radio.setOutputPower(dbm);
|
||||||
|
}
|
||||||
|
|
||||||
|
mesh::LocalIdentity radio_new_identity() {
|
||||||
|
RadioNoiseListener rng(radio);
|
||||||
|
return mesh::LocalIdentity(&rng); // create new random identity
|
||||||
|
}
|
||||||
27
variants/heltec_wireless_paper/target.h
Normal file
27
variants/heltec_wireless_paper/target.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define RADIOLIB_STATIC_ONLY 1
|
||||||
|
#include <RadioLib.h>
|
||||||
|
#include <helpers/AutoDiscoverRTCClock.h>
|
||||||
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
|
#include <helpers/HeltecV3Board.h>
|
||||||
|
#include <helpers/RadioLibWrappers.h>
|
||||||
|
#include <helpers/SensorManager.h>
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
#include <helpers/ui/E213Display.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern HeltecV3Board board;
|
||||||
|
extern WRAPPER_CLASS radio_driver;
|
||||||
|
extern AutoDiscoverRTCClock rtc_clock;
|
||||||
|
extern SensorManager sensors;
|
||||||
|
|
||||||
|
#ifdef DISPLAY_CLASS
|
||||||
|
extern DISPLAY_CLASS display;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool radio_init();
|
||||||
|
uint32_t radio_get_rng_seed();
|
||||||
|
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr);
|
||||||
|
void radio_set_tx_power(uint8_t dbm);
|
||||||
|
mesh::LocalIdentity radio_new_identity();
|
||||||
@@ -3,13 +3,8 @@
|
|||||||
|
|
||||||
ESP32Board board;
|
ESP32Board board;
|
||||||
|
|
||||||
#if defined(P_LORA_SCLK)
|
static SPIClass spi;
|
||||||
static SPIClass spi;
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, spi);
|
|
||||||
#else
|
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WRAPPER_CLASS radio_driver(radio, board);
|
WRAPPER_CLASS radio_driver(radio, board);
|
||||||
|
|
||||||
ESP32RTCClock fallback_clock;
|
ESP32RTCClock fallback_clock;
|
||||||
@@ -28,35 +23,7 @@ bool radio_init() {
|
|||||||
fallback_clock.begin();
|
fallback_clock.begin();
|
||||||
rtc_clock.begin(Wire);
|
rtc_clock.begin(Wire);
|
||||||
|
|
||||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
return radio.std_init(&spi);
|
||||||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
|
||||||
#else
|
|
||||||
float tcxo = 1.6f;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(P_LORA_SCLK)
|
|
||||||
spi.begin(P_LORA_SCLK, P_LORA_MISO, P_LORA_MOSI);
|
|
||||||
#endif
|
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
|
|
||||||
if (status != RADIOLIB_ERR_NONE) {
|
|
||||||
Serial.print("ERROR: radio init failed: ");
|
|
||||||
Serial.println(status);
|
|
||||||
return false; // fail
|
|
||||||
}
|
|
||||||
|
|
||||||
radio.setCRC(1);
|
|
||||||
|
|
||||||
#ifdef SX126X_CURRENT_LIMIT
|
|
||||||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
|
||||||
#endif
|
|
||||||
#ifdef SX126X_DIO2_AS_RF_SWITCH
|
|
||||||
radio.setDio2AsRfSwitch(SX126X_DIO2_AS_RF_SWITCH);
|
|
||||||
#endif
|
|
||||||
#ifdef SX126X_RX_BOOSTED_GAIN
|
|
||||||
radio.setRxBoostedGainMode(SX126X_RX_BOOSTED_GAIN);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true; // success
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t radio_get_rng_seed() {
|
uint32_t radio_get_rng_seed() {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ build_flags =
|
|||||||
-I src/helpers/ui
|
-I src/helpers/ui
|
||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=8
|
-D MAX_GROUP_CHANNELS=8
|
||||||
-D BLE_PIN_CODE=0
|
-D BLE_PIN_CODE=123456
|
||||||
-D BLE_DEBUG_LOGGING=1
|
-D BLE_DEBUG_LOGGING=1
|
||||||
-D OFFLINE_QUEUE_SIZE=256
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
-D DISPLAY_CLASS=SH1106Display
|
-D DISPLAY_CLASS=SH1106Display
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ bool radio_init() {
|
|||||||
|
|
||||||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo);
|
int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_LR11X0_LORA_SYNC_WORD_PRIVATE, LORA_TX_POWER, 16, tcxo);
|
||||||
if (status != RADIOLIB_ERR_NONE) {
|
if (status != RADIOLIB_ERR_NONE) {
|
||||||
Serial.print("ERROR: radio init failed: ");
|
Serial.print("ERROR: radio init failed: ");
|
||||||
Serial.println(status);
|
Serial.println(status);
|
||||||
|
|||||||
Reference in New Issue
Block a user