mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge branch 'dev' into seeed_xiao_c6
This commit is contained in:
commit
c5167d0fd9
80 changed files with 3739 additions and 1928 deletions
|
|
@ -56,13 +56,11 @@ build_flags =
|
|||
${Generic_ESPNOW.build_flags}
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
; NOTE: DO NOT ENABLE --> -D ESPNOW_DEBUG_LOGGING=1
|
||||
build_src_filter = ${Generic_ESPNOW.build_src_filter}
|
||||
+<../examples/companion_radio/main.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${Generic_ESPNOW.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
|
|
|||
33
variants/heltec_ct62/HT-CT62Board.h
Normal file
33
variants/heltec_ct62/HT-CT62Board.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
#include <MeshCore.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#if defined(ESP_PLATFORM)
|
||||
|
||||
#include <helpers/ESP32Board.h>
|
||||
|
||||
class Heltec_CT62_Board : public ESP32Board {
|
||||
public:
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
#ifdef PIN_VBAT_READ
|
||||
analogReadResolution(12); // ESP32-C3 ADC is 12-bit - 3.3/4096 (ref voltage/max counts)
|
||||
uint32_t raw = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
raw += analogRead(PIN_VBAT_READ);
|
||||
}
|
||||
raw = raw / 8;
|
||||
|
||||
return ((6.52 * raw) / 1024.0) * 1000;
|
||||
#else
|
||||
return 0; // not supported
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* getManufacturerName() const override {
|
||||
return "Heltec CT62";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
88
variants/heltec_ct62/platformio.ini
Normal file
88
variants/heltec_ct62/platformio.ini
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
[Heltec_ct62]
|
||||
extends = esp32_base
|
||||
board = esp32-c3-devkitm-1
|
||||
build_flags =
|
||||
${esp32_base.build_flags}
|
||||
-I variants/heltec_ct62
|
||||
-D HELTEC_HT_CT62=1
|
||||
-D RADIO_CLASS=CustomSX1262
|
||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||
-D ESP32_CPU_FREQ=80
|
||||
-D LORA_TX_POWER=22
|
||||
-D P_LORA_TX_LED=18
|
||||
-D PIN_BOARD_SDA=0
|
||||
-D PIN_BOARD_SCL=1
|
||||
;-D PIN_USER_BTN=9
|
||||
-D PIN_VBAT_READ=2
|
||||
-D P_LORA_DIO_1=3
|
||||
-D P_LORA_NSS=8
|
||||
-D P_LORA_RESET=5
|
||||
-D P_LORA_DIO_0=RADIOLIB_NC
|
||||
-D P_LORA_DIO_2=RADIOLIB_NC
|
||||
-D P_LORA_BUSY=4
|
||||
-D P_LORA_SCLK=10
|
||||
-D P_LORA_MISO=6
|
||||
-D P_LORA_MOSI=7
|
||||
-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
|
||||
build_src_filter = ${esp32_base.build_src_filter}
|
||||
+<../variants/heltec_ct62>
|
||||
|
||||
[env:Heltec_ct62_repeater]
|
||||
extends = Heltec_ct62
|
||||
build_flags =
|
||||
${Heltec_ct62.build_flags}
|
||||
;-D ARDUINO_USB_MODE=1
|
||||
;-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D ADVERT_NAME='"HT-CT62 Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=8
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_ct62.build_src_filter}
|
||||
+<../examples/simple_repeater>
|
||||
lib_deps =
|
||||
${Heltec_ct62.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:Heltec_ct62_companion_radio_usb]
|
||||
extends = Heltec_ct62
|
||||
build_flags =
|
||||
${Heltec_ct62.build_flags}
|
||||
; -D ARDUINO_USB_MODE=1
|
||||
; -D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_ct62.build_src_filter}
|
||||
+<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${Heltec_ct62.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:Heltec_ct62_companion_radio_ble]
|
||||
extends = Heltec_ct62
|
||||
build_flags =
|
||||
${Heltec_ct62.build_flags}
|
||||
; -D ARDUINO_USB_MODE=1
|
||||
; -D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D BLE_PIN_CODE=123456
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_ct62.build_src_filter}
|
||||
+<../examples/companion_radio>
|
||||
+<helpers/esp32/SerialBLEInterface.cpp>
|
||||
lib_deps =
|
||||
${Heltec_ct62.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
70
variants/heltec_ct62/target.cpp
Normal file
70
variants/heltec_ct62/target.cpp
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
|
||||
Heltec_CT62_Board board;
|
||||
|
||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY);
|
||||
WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
ESP32RTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
SensorManager sensors;
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
fallback_clock.begin();
|
||||
rtc_clock.begin(Wire);
|
||||
|
||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||
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() {
|
||||
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
|
||||
}
|
||||
20
variants/heltec_ct62/target.h
Normal file
20
variants/heltec_ct62/target.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#define RADIOLIB_STATIC_ONLY 1
|
||||
#include <RadioLib.h>
|
||||
#include <helpers/RadioLibWrappers.h>
|
||||
#include "HT-CT62Board.h"
|
||||
#include <helpers/CustomSX1262Wrapper.h>
|
||||
#include <helpers/AutoDiscoverRTCClock.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
|
||||
extern Heltec_CT62_Board board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern AutoDiscoverRTCClock rtc_clock;
|
||||
extern SensorManager sensors;
|
||||
|
||||
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();
|
||||
|
|
@ -39,7 +39,7 @@ extends = Heltec_tracker_base
|
|||
build_flags =
|
||||
${Heltec_tracker_base.build_flags}
|
||||
-I src/helpers/ui
|
||||
; -D ARDUINO_USB_CDC_ON_BOOT=1 ; need for debugging
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1 ; need for Serial
|
||||
-D DISPLAY_ROTATION=1
|
||||
-D DISPLAY_CLASS=ST7735Display
|
||||
-D MAX_CONTACTS=100
|
||||
|
|
@ -47,8 +47,6 @@ build_flags =
|
|||
-D BLE_PIN_CODE=123456 ; HWT will use display for pin
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_tracker_base.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -99,8 +99,6 @@ build_flags =
|
|||
-D BLE_PIN_CODE=0
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_lora32_v2.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -91,8 +91,6 @@ build_flags =
|
|||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||
|
|
@ -112,8 +110,6 @@ build_flags =
|
|||
-D BLE_PIN_CODE=0 ; dynamic, random PIN
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||
|
|
@ -134,8 +130,6 @@ build_flags =
|
|||
-D WIFI_DEBUG_LOGGING=1
|
||||
-D WIFI_SSID='"myssid"'
|
||||
-D WIFI_PWD='"mypwd"'
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||
|
|
@ -189,8 +183,6 @@ build_flags =
|
|||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_lora32_v3.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -20,43 +20,16 @@ EnvironmentSensorManager sensors;
|
|||
DISPLAY_CLASS display;
|
||||
#endif
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
fallback_clock.begin();
|
||||
rtc_clock.begin(Wire);
|
||||
|
||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||
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);
|
||||
return radio.std_init(&spi);
|
||||
#else
|
||||
return radio.std_init();
|
||||
#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() {
|
||||
|
|
|
|||
|
|
@ -92,8 +92,6 @@ build_flags =
|
|||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_T3S3_sx1262.build_src_filter}
|
||||
|
|
@ -113,8 +111,6 @@ build_flags =
|
|||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_T3S3_sx1262.build_src_filter}
|
||||
|
|
|
|||
119
variants/lilygo_t3s3_sx1276/platformio.ini
Normal file
119
variants/lilygo_t3s3_sx1276/platformio.ini
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
[LilyGo_T3S3_sx1276]
|
||||
extends = esp32_base
|
||||
board = t3_s3_v1_x
|
||||
build_flags =
|
||||
${esp32_base.build_flags}
|
||||
-I variants/lilygo_t3s3_sx1276
|
||||
-D LILYGO_T3S3
|
||||
-D P_LORA_DIO_0=9
|
||||
-D P_LORA_DIO_1=33
|
||||
-D P_LORA_NSS=7
|
||||
-D P_LORA_RESET=8
|
||||
-D P_LORA_SCLK=5
|
||||
-D P_LORA_MISO=3
|
||||
-D P_LORA_MOSI=6
|
||||
-D P_LORA_TX_LED=37
|
||||
-D PIN_VBAT_READ=1
|
||||
-D PIN_USER_BTN=0
|
||||
-D PIN_BOARD_SDA=18
|
||||
-D PIN_BOARD_SCL=17
|
||||
-D PIN_OLED_RESET=21
|
||||
-D RADIO_CLASS=CustomSX1276
|
||||
-D WRAPPER_CLASS=CustomSX1276Wrapper
|
||||
-D SX127X_CURRENT_LIMIT=120
|
||||
-D LORA_TX_POWER=20
|
||||
build_src_filter = ${esp32_base.build_src_filter}
|
||||
+<../variants/lilygo_t3s3_sx1276>
|
||||
lib_deps =
|
||||
${esp32_base.lib_deps}
|
||||
adafruit/Adafruit SSD1306 @ ^2.5.13
|
||||
|
||||
; === LilyGo T3S3 with SX1276 environments ===
|
||||
[env:LilyGo_T3S3_sx1276_Repeater]
|
||||
extends = LilyGo_T3S3_sx1276
|
||||
build_flags =
|
||||
${LilyGo_T3S3_sx1276.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D ADVERT_NAME='"T3S3-1276 Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=8
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_T3S3_sx1276.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
lib_deps =
|
||||
${LilyGo_T3S3_sx1276.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:LilyGo_T3S3_sx1276_terminal_chat]
|
||||
extends = LilyGo_T3S3_sx1276
|
||||
build_flags =
|
||||
${LilyGo_T3S3_sx1276.build_flags}
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_T3S3_sx1276.build_src_filter}
|
||||
+<../examples/simple_secure_chat/main.cpp>
|
||||
lib_deps =
|
||||
${LilyGo_T3S3_sx1276.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:LilyGo_T3S3_sx1276_room_server]
|
||||
extends = LilyGo_T3S3_sx1276
|
||||
build_flags =
|
||||
${LilyGo_T3S3_sx1276.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D ADVERT_NAME='"T3S3-1276 Room"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ROOM_PASSWORD='"hello"'
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_T3S3_sx1276.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/simple_room_server>
|
||||
lib_deps =
|
||||
${LilyGo_T3S3_sx1276.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:LilyGo_T3S3_sx1276_companion_radio_usb]
|
||||
extends = LilyGo_T3S3_sx1276
|
||||
upload_speed = 115200
|
||||
build_flags =
|
||||
${LilyGo_T3S3_sx1276.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
-D MESH_PACKET_LOGGING=1
|
||||
-D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_T3S3_sx1276.build_src_filter}
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${LilyGo_T3S3_sx1276.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:LilyGo_T3S3_sx1276_companion_radio_ble]
|
||||
extends = LilyGo_T3S3_sx1276
|
||||
build_flags =
|
||||
${LilyGo_T3S3_sx1276.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_T3S3_sx1276.build_src_filter}
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${LilyGo_T3S3_sx1276.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
70
variants/lilygo_t3s3_sx1276/target.cpp
Normal file
70
variants/lilygo_t3s3_sx1276/target.cpp
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
|
||||
ESP32Board board;
|
||||
|
||||
#if defined(P_LORA_SCLK)
|
||||
static SPIClass spi;
|
||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi);
|
||||
#else
|
||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1);
|
||||
#endif
|
||||
|
||||
WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
ESP32RTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
SensorManager sensors;
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
DISPLAY_CLASS display;
|
||||
#endif
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
fallback_clock.begin();
|
||||
rtc_clock.begin(Wire);
|
||||
|
||||
#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);
|
||||
if (status != RADIOLIB_ERR_NONE) {
|
||||
Serial.print("ERROR: radio init failed: ");
|
||||
Serial.println(status);
|
||||
return false; // fail
|
||||
}
|
||||
|
||||
#ifdef SX127X_CURRENT_LIMIT
|
||||
radio.setCurrentLimit(SX127X_CURRENT_LIMIT);
|
||||
#endif
|
||||
|
||||
radio.setCRC(1);
|
||||
|
||||
radio.setRfSwitchPins(21, 10);
|
||||
|
||||
return true; // success
|
||||
}
|
||||
|
||||
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/lilygo_t3s3_sx1276/target.h
Normal file
27
variants/lilygo_t3s3_sx1276/target.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#define RADIOLIB_STATIC_ONLY 1
|
||||
#include <RadioLib.h>
|
||||
#include <helpers/RadioLibWrappers.h>
|
||||
#include <helpers/ESP32Board.h>
|
||||
#include <helpers/CustomSX1276Wrapper.h>
|
||||
#include <helpers/AutoDiscoverRTCClock.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include <helpers/ui/SSD1306Display.h>
|
||||
#endif
|
||||
|
||||
extern ESP32Board 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();
|
||||
|
|
@ -33,8 +33,6 @@ build_flags =
|
|||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D RADIOLIB_DEBUG_BASIC=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_TBeam.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,6 @@ build_flags =
|
|||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
; -D RADIOLIB_DEBUG_BASIC=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_TBeam_SX1262.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,6 @@ build_flags =
|
|||
-D BLE_PIN_CODE=123456
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=8
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${T_Beam_S3_Supreme_SX1262.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ build_flags =
|
|||
build_src_filter = ${esp32c6_base.build_src_filter}
|
||||
+<../variants/lilygo_tlora_c6>
|
||||
|
||||
[env:LilyGo_Tlora_c6_Repeater]
|
||||
[env:LilyGo_Tlora_C6_repeater]
|
||||
extends = tlora_c6
|
||||
build_src_filter = ${tlora_c6.build_src_filter}
|
||||
+<../examples/simple_repeater/main.cpp>
|
||||
|
|
@ -47,7 +47,24 @@ lib_deps =
|
|||
${tlora_c6.lib_deps}
|
||||
; ${esp32_ota.lib_deps}
|
||||
|
||||
[env:LilyGo_Tlora_c6_companion_radio_ble]
|
||||
[env:LilyGo_Tlora_C6_room_server]
|
||||
extends = tlora_c6
|
||||
build_src_filter = ${tlora_c6.build_src_filter}
|
||||
+<../examples/simple_room_server>
|
||||
build_flags =
|
||||
${tlora_c6.build_flags}
|
||||
-D ADVERT_NAME='"Tlora C6 Room"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ROOM_PASSWORD='"hello"'
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
lib_deps =
|
||||
${tlora_c6.lib_deps}
|
||||
; ${esp32_ota.lib_deps}
|
||||
|
||||
[env:LilyGo_Tlora_C6_companion_radio_ble]
|
||||
extends = tlora_c6
|
||||
build_flags = ${tlora_c6.build_flags}
|
||||
-D MAX_CONTACTS=100
|
||||
|
|
@ -55,8 +72,8 @@ build_flags = ${tlora_c6.build_flags}
|
|||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
-D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
-D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${tlora_c6.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ build_flags =
|
|||
${LilyGo_TLora_V2_1_1_6.build_flags}
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter}
|
||||
|
|
@ -92,8 +90,6 @@ build_flags =
|
|||
-D BLE_PIN_CODE=123456
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ build_flags =
|
|||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=SH1106Display
|
||||
-D PIN_BUZZER=4
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Nano_G2_Ultra.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ build_flags = ${rp2040_base.build_flags}
|
|||
-D LORA_TX_POWER=22
|
||||
-D SX126X_RX_BOOSTED_GAIN=1
|
||||
build_src_filter = ${rp2040_base.build_src_filter}
|
||||
+<helpers/rp2040/*.cpp>
|
||||
+<helpers/rp2040/PicoWBoard.cpp>
|
||||
+<../variants/picow>
|
||||
lib_deps = ${rp2040_base.lib_deps}
|
||||
|
||||
|
|
@ -49,8 +49,6 @@ extends = picow
|
|||
build_flags = ${picow.build_flags}
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
build_src_filter = ${picow.build_src_filter}
|
||||
|
|
@ -65,8 +63,6 @@ lib_deps = ${picow.lib_deps}
|
|||
; -D MAX_GROUP_CHANNELS=8
|
||||
; -D BLE_PIN_CODE=123456
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
; ; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; ; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; ; -D MESH_PACKET_LOGGING=1
|
||||
; ; -D MESH_DEBUG=1
|
||||
; build_src_filter = ${picow.build_src_filter}
|
||||
|
|
@ -82,8 +78,6 @@ lib_deps = ${picow.lib_deps}
|
|||
; -D WIFI_DEBUG_LOGGING=1
|
||||
; -D WIFI_SSID='"myssid"'
|
||||
; -D WIFI_PWD='"mypwd"'
|
||||
; ; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; ; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; ; -D MESH_PACKET_LOGGING=1
|
||||
; ; -D MESH_DEBUG=1
|
||||
; build_src_filter = ${picow.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -103,8 +103,6 @@ build_flags = ${Faketec.build_flags}
|
|||
-D MAX_GROUP_CHANNELS=8
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
-D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
|
|
@ -186,7 +184,7 @@ build_flags = ${ProMicroLLCC68.build_flags}
|
|||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
build_src_filter = ${ProMicroLLCC68.build_src_filter}
|
||||
+<../examples/companion_radio/main.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps = ${ProMicroLLCC68.lib_deps}
|
||||
adafruit/RTClib @ ^2.1.3
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
|
@ -198,14 +196,12 @@ build_flags = ${ProMicroLLCC68.build_flags}
|
|||
-D MAX_GROUP_CHANNELS=8
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
-D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${ProMicroLLCC68.build_src_filter}
|
||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||
+<../examples/companion_radio/main.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps = ${ProMicroLLCC68.lib_deps}
|
||||
adafruit/RTClib @ ^2.1.3
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ build_flags =
|
|||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
|
|
@ -85,8 +83,6 @@ build_flags =
|
|||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
|
|
@ -108,8 +104,6 @@ build_flags =
|
|||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D ENV_INCLUDE_GPS=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${rak4631.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -9,18 +9,23 @@ build_flags =
|
|||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||
-D LORA_TX_POWER=7
|
||||
; -D P_LORA_TX_LED=35
|
||||
; -D PIN_BOARD_SDA=5
|
||||
; -D PIN_BOARD_SCL=6
|
||||
-D PIN_USER_BTN=0
|
||||
-D PIN_BOARD_SDA=5
|
||||
-D PIN_BOARD_SCL=6
|
||||
-D PIN_USER_BTN=38
|
||||
-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 - DO NOT ENABLE THIS!
|
||||
-I src/helpers/ui
|
||||
-D DISPLAY_CLASS=SH1106Display
|
||||
; https://wiki.uniteng.com/en/meshtastic/station-g2#impact-of-lora-node-dense-areashigh-noise-environments-on-rf-performance
|
||||
build_src_filter = ${esp32_base.build_src_filter}
|
||||
+<../variants/station_g2>
|
||||
+<helpers/ui/SH1106Display.cpp>
|
||||
lib_deps =
|
||||
${esp32_base.lib_deps}
|
||||
adafruit/Adafruit SH110X @ ~2.1.13
|
||||
adafruit/Adafruit GFX Library @ ^1.12.1
|
||||
|
||||
[env:Station_G2_repeater]
|
||||
extends = Station_G2
|
||||
|
|
@ -55,3 +60,39 @@ build_flags =
|
|||
lib_deps =
|
||||
${Station_G2.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:Station_G2_companion_radio_usb]
|
||||
extends = Station_G2
|
||||
build_flags =
|
||||
${Station_G2.build_flags}
|
||||
-D DISPLAY_CLASS=SH1106Display
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
build_src_filter = ${Station_G2.build_src_filter}
|
||||
+<helpers/ui/SH1106Display.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${Station_G2.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:Station_G2_companion_radio_ble]
|
||||
extends = Station_G2
|
||||
build_flags =
|
||||
${Station_G2.build_flags}
|
||||
-D DISPLAY_CLASS=SH1106Display
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Station_G2.build_src_filter}
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<helpers/ui/SH1106Display.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${Station_G2.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ ESP32RTCClock fallback_clock;
|
|||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
SensorManager sensors;
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
DISPLAY_CLASS display;
|
||||
#endif
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -8,11 +8,19 @@
|
|||
#include <helpers/AutoDiscoverRTCClock.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include <helpers/ui/SH1106Display.h>
|
||||
#endif
|
||||
|
||||
extern StationG2Board 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);
|
||||
|
|
|
|||
119
variants/t1000-e/t1000e_sensors.cpp
Normal file
119
variants/t1000-e/t1000e_sensors.cpp
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#include <Arduino.h>
|
||||
#include "t1000e_sensors.h"
|
||||
|
||||
#define HEATER_NTC_BX 4250 // thermistor coefficient B
|
||||
#define HEATER_NTC_RP 8250 // ohm, series resistance to thermistor
|
||||
#define HEATER_NTC_KA 273.15 // 25 Celsius at Kelvin
|
||||
#define NTC_REF_VCC 3000 // mV, output voltage of LDO
|
||||
#define LIGHT_REF_VCC 2400 //
|
||||
|
||||
static unsigned int ntc_res2[136]={
|
||||
113347,107565,102116,96978,92132,87559,83242,79166,75316,71677,
|
||||
68237,64991,61919,59011,56258,53650,51178,48835,46613,44506,
|
||||
42506,40600,38791,37073,35442,33892,32420,31020,29689,28423,
|
||||
27219,26076,24988,23951,22963,22021,21123,20267,19450,18670,
|
||||
17926,17214,16534,15886,15266,14674,14108,13566,13049,12554,
|
||||
12081,11628,11195,10780,10382,10000,9634,9284,8947,8624,
|
||||
8315,8018,7734,7461,7199,6948,6707,6475,6253,6039,
|
||||
5834,5636,5445,5262,5086,4917,4754,4597,4446,4301,
|
||||
4161,4026,3896,3771,3651,3535,3423,3315,3211,3111,
|
||||
3014,2922,2834,2748,2666,2586,2509,2435,2364,2294,
|
||||
2228,2163,2100,2040,1981,1925,1870,1817,1766,1716,
|
||||
1669,1622,1578,1535,1493,1452,1413,1375,1338,1303,
|
||||
1268,1234,1202,1170,1139,1110,1081,1053,1026,999,
|
||||
974,949,925,902,880,858,
|
||||
};
|
||||
|
||||
static char ntc_temp2[136]=
|
||||
{
|
||||
-30,-29,-28,-27,-26,-25,-24,-23,-22,-21,
|
||||
-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,
|
||||
-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,
|
||||
0,1,2,3,4,5,6,7,8,9,
|
||||
10,11,12,13,14,15,16,17,18,19,
|
||||
20,21,22,23,24,25,26,27,28,29,
|
||||
30,31,32,33,34,35,36,37,38,39,
|
||||
40,41,42,43,44,45,46,47,48,49,
|
||||
50,51,52,53,54,55,56,57,58,59,
|
||||
60,61,62,63,64,65,66,67,68,69,
|
||||
70,71,72,73,74,75,76,77,78,79,
|
||||
80,81,82,83,84,85,86,87,88,89,
|
||||
90,91,92,93,94,95,96,97,98,99,
|
||||
100,101,102,103,104,105,
|
||||
};
|
||||
|
||||
static float get_heater_temperature( unsigned int vcc_volt, unsigned int ntc_volt )
|
||||
{
|
||||
int i = 0;
|
||||
float Vout = 0, Rt = 0, temp = 0;
|
||||
Vout = ntc_volt;
|
||||
|
||||
Rt = ( HEATER_NTC_RP * vcc_volt ) / Vout - HEATER_NTC_RP;
|
||||
|
||||
for( i = 0; i < 136; i++ )
|
||||
{
|
||||
if( Rt >= ntc_res2[i] )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
temp = ntc_temp2[i - 1] + 1 * ( ntc_res2[i - 1] - Rt ) / ( float )( ntc_res2[i - 1] - ntc_res2[i] );
|
||||
|
||||
temp = ( temp * 100 + 5 ) / 100;
|
||||
return temp;
|
||||
}
|
||||
|
||||
static int get_light_lv( unsigned int light_volt )
|
||||
{
|
||||
float Vout = 0, Vin = 0, Rt = 0, temp = 0;
|
||||
unsigned int light_level = 0;
|
||||
|
||||
if( light_volt <= 80 )
|
||||
{
|
||||
light_level = 0;
|
||||
return light_level;
|
||||
}
|
||||
else if( light_volt >= 2480 )
|
||||
{
|
||||
light_level = 100;
|
||||
return light_level;
|
||||
}
|
||||
Vout = light_volt;
|
||||
light_level = 100 * ( Vout - 80 ) / LIGHT_REF_VCC;
|
||||
|
||||
return light_level;
|
||||
}
|
||||
|
||||
float t1000e_get_temperature( void )
|
||||
{
|
||||
unsigned int ntc_v, vcc_v;
|
||||
|
||||
digitalWrite(PIN_3V3_EN, HIGH);
|
||||
digitalWrite(SENSOR_EN, HIGH);
|
||||
analogReference(AR_INTERNAL_3_0);
|
||||
analogReadResolution(12);
|
||||
delay(10);
|
||||
vcc_v = (1000.0*(analogRead(BATTERY_PIN) * ADC_MULTIPLIER * AREF_VOLTAGE)) / 4096;
|
||||
ntc_v = (1000.0 * AREF_VOLTAGE * analogRead(TEMP_SENSOR)) / 4096;
|
||||
digitalWrite(PIN_3V3_EN, LOW);
|
||||
digitalWrite(SENSOR_EN, LOW);
|
||||
|
||||
return get_heater_temperature (vcc_v, ntc_v);
|
||||
}
|
||||
|
||||
uint32_t t1000e_get_light( void )
|
||||
{
|
||||
int lux = 0;
|
||||
unsigned int lux_v = 0;
|
||||
|
||||
digitalWrite(SENSOR_EN, HIGH);
|
||||
analogReference(AR_INTERNAL_3_0);
|
||||
analogReadResolution(12);
|
||||
delay(10);
|
||||
lux_v = 1000 * analogRead(LUX_SENSOR) * AREF_VOLTAGE / 4096;
|
||||
lux = get_light_lv( lux_v );
|
||||
digitalWrite(SENSOR_EN, LOW);
|
||||
|
||||
return lux;
|
||||
}
|
||||
8
variants/t1000-e/t1000e_sensors.h
Normal file
8
variants/t1000-e/t1000e_sensors.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
// Light and temperature sensors are on ADC ports
|
||||
// functions adapted from Seeed examples to get values
|
||||
// see : https://github.com/Seeed-Studio/Seeed-Tracker-T1000-E-for-LoRaWAN-dev-board
|
||||
|
||||
extern uint32_t t1000e_get_light();
|
||||
extern float t1000e_get_temperature();
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#include <Arduino.h>
|
||||
#include "t1000e_sensors.h"
|
||||
#include "target.h"
|
||||
#include <helpers/sensors/MicroNMEALocationProvider.h>
|
||||
|
||||
|
|
@ -160,6 +161,10 @@ bool T1000SensorManager::querySensors(uint8_t requester_permissions, CayenneLPP&
|
|||
if (requester_permissions & TELEM_PERM_LOCATION) { // does requester have permission?
|
||||
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, node_altitude);
|
||||
}
|
||||
if (requester_permissions & TELEM_PERM_ENVIRONMENT) {
|
||||
telemetry.addLuminosity(TELEM_CHANNEL_SELF, t1000e_get_light());
|
||||
telemetry.addTemperature(TELEM_CHANNEL_SELF, t1000e_get_temperature());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +174,7 @@ void T1000SensorManager::loop() {
|
|||
_nmea->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_nmea->isValid()) {
|
||||
if (gps_active && _nmea->isValid()) {
|
||||
node_lat = ((double)_nmea->getLatitude())/1000000.;
|
||||
node_lon = ((double)_nmea->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_nmea->getAltitude()) / 1000.0;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ board = heltec_t114
|
|||
board_build.ldscript = boards/nrf52840_s140_v6.ld
|
||||
build_flags = ${nrf52840_t114.build_flags}
|
||||
-I variants/t114
|
||||
-I src/helpers/ui
|
||||
-DHELTEC_T114
|
||||
-D P_LORA_TX_LED=35
|
||||
-D RADIO_CLASS=CustomSX1262
|
||||
|
|
@ -22,20 +23,27 @@ build_flags = ${nrf52840_t114.build_flags}
|
|||
-D LORA_TX_POWER=22
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
-D SX126X_RX_BOOSTED_GAIN=1
|
||||
-D ST7789
|
||||
-D DISPLAY_CLASS=ST7789Display
|
||||
build_src_filter = ${nrf52840_t114.build_src_filter}
|
||||
+<helpers/*.cpp>
|
||||
+<helpers/nrf52/T114Board.cpp>
|
||||
+<../variants/t114>
|
||||
+<helpers/ui/ST7789Display.cpp>
|
||||
+<helpers/ui/OLEDDisplay.cpp>
|
||||
+<helpers/ui/OLEDDisplayFonts.cpp>
|
||||
lib_deps =
|
||||
${nrf52840_t114.lib_deps}
|
||||
stevemarple/MicroNMEA @ ^2.0.6
|
||||
adafruit/Adafruit GFX Library @ ^1.12.1
|
||||
debug_tool = jlink
|
||||
upload_protocol = nrfutil
|
||||
|
||||
[env:Heltec_t114_repeater]
|
||||
extends = Heltec_t114
|
||||
build_src_filter = ${Heltec_t114.build_src_filter}
|
||||
+<../examples/simple_repeater/main.cpp>
|
||||
+<../examples/simple_repeater>
|
||||
|
||||
build_flags =
|
||||
${Heltec_t114.build_flags}
|
||||
-D ADVERT_NAME='"Heltec_T114 Repeater"'
|
||||
|
|
@ -64,27 +72,17 @@ build_flags =
|
|||
extends = Heltec_t114
|
||||
build_flags =
|
||||
${Heltec_t114.build_flags}
|
||||
-I src/helpers/ui
|
||||
-D ST7789
|
||||
-D DISPLAY_CLASS=ST7789Display
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_t114.build_src_filter}
|
||||
+<helpers/nrf52/T114Board.cpp>
|
||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||
+<../examples/companion_radio>
|
||||
+<helpers/ui/ST7789Display.cpp>
|
||||
+<helpers/ui/OLEDDisplay.cpp>
|
||||
+<helpers/ui/OLEDDisplayFonts.cpp>
|
||||
lib_deps =
|
||||
adafruit/Adafruit GFX Library @ ^1.12.1
|
||||
${Heltec_t114.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
|
|
@ -96,13 +94,11 @@ build_flags =
|
|||
-D MAX_GROUP_CHANNELS=8
|
||||
; -D BLE_PIN_CODE=123456
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Heltec_t114.build_src_filter}
|
||||
+<helpers/nrf52/*.cpp>
|
||||
+<../examples/companion_radio/main.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${Heltec_t114.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
|
@ -18,41 +18,10 @@ T114SensorManager sensors = T114SensorManager(nmea);
|
|||
DISPLAY_CLASS display;
|
||||
#endif
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
rtc_clock.begin(Wire);
|
||||
|
||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
||||
#else
|
||||
float tcxo = 1.6f;
|
||||
#endif
|
||||
|
||||
SPI.setPins(P_LORA_MISO, P_LORA_SCLK, P_LORA_MOSI);
|
||||
SPI.begin();
|
||||
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
|
||||
return radio.std_init(&SPI);
|
||||
}
|
||||
|
||||
uint32_t radio_get_rng_seed() {
|
||||
|
|
|
|||
|
|
@ -67,8 +67,6 @@ build_flags =
|
|||
-D BLE_DEBUG_LOGGING=1
|
||||
-D DISPLAY_CLASS=GxEPDDisplay
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${LilyGo_Techo.build_src_filter}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ build_flags = ${nrf52840_thinknode_m1.build_flags}
|
|||
-D RADIO_CLASS=CustomSX1262
|
||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||
-D LORA_TX_POWER=22
|
||||
-D P_LORA_TX_LED=13
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
-D SX126X_RX_BOOSTED_GAIN=1
|
||||
build_src_filter = ${nrf52840_thinknode_m1.build_src_filter}
|
||||
|
|
@ -75,8 +76,6 @@ build_flags =
|
|||
-D DISPLAY_CLASS=GxEPDDisplay
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D PIN_BUZZER=6
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${ThinkNode_M1.build_src_filter}
|
||||
|
|
|
|||
107
variants/waveshare_rp2040_lora/platformio.ini
Normal file
107
variants/waveshare_rp2040_lora/platformio.ini
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
; Waveshare RP2040-LoRa-HF/LF
|
||||
; https://files.waveshare.com/wiki/RP2040-LoRa/Rp2040-lora-sch.pdf
|
||||
|
||||
[waveshare_rp2040_lora]
|
||||
extends = rp2040_base
|
||||
|
||||
board = pico
|
||||
board_build.filesystem_size = 0.5m
|
||||
|
||||
build_flags = ${rp2040_base.build_flags}
|
||||
-I variants/waveshare_rp2040_lora
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
-D RADIO_CLASS=CustomSX1262
|
||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||
-D LORA_TX_POWER=22
|
||||
-D SX126X_RX_BOOSTED_GAIN=1
|
||||
; Debug options
|
||||
; -D DEBUG_RP2040_WIRE=1
|
||||
; -D DEBUG_RP2040_SPI=1
|
||||
; -D DEBUG_RP2040_CORE=1
|
||||
; -D RADIOLIB_DEBUG_SPI=1
|
||||
; -D DEBUG_RP2040_PORT=Serial
|
||||
|
||||
build_src_filter = ${rp2040_base.build_src_filter}
|
||||
+<helpers/rp2040/WaveshareBoard.cpp>
|
||||
+<../variants/waveshare_rp2040_lora>
|
||||
|
||||
lib_deps = ${rp2040_base.lib_deps}
|
||||
|
||||
[env:waveshare_rp2040_lora_Repeater]
|
||||
extends = waveshare_rp2040_lora
|
||||
build_flags = ${waveshare_rp2040_lora.build_flags}
|
||||
-D ADVERT_NAME='"RP2040-LoRa Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=8
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${waveshare_rp2040_lora.build_src_filter}
|
||||
+<../examples/simple_repeater>
|
||||
|
||||
[env:waveshare_rp2040_lora_room_server]
|
||||
extends = waveshare_rp2040_lora
|
||||
build_flags = ${waveshare_rp2040_lora.build_flags}
|
||||
-D ADVERT_NAME='"RP2040-LoRa Room"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D ROOM_PASSWORD='"hello"'
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${waveshare_rp2040_lora.build_src_filter}
|
||||
+<../examples/simple_room_server>
|
||||
|
||||
[env:waveshare_rp2040_lora_companion_radio_usb]
|
||||
extends = waveshare_rp2040_lora
|
||||
build_flags = ${waveshare_rp2040_lora.build_flags}
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
build_src_filter = ${waveshare_rp2040_lora.build_src_filter}
|
||||
+<../examples/companion_radio>
|
||||
lib_deps = ${waveshare_rp2040_lora.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
; [env:waveshare_rp2040_lora_companion_radio_ble]
|
||||
; extends = waveshare_rp2040_lora
|
||||
; build_flags = ${waveshare_rp2040_lora.build_flags}
|
||||
; -D MAX_CONTACTS=100
|
||||
; -D MAX_GROUP_CHANNELS=8
|
||||
; -D BLE_PIN_CODE=123456
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
; ; -D MESH_PACKET_LOGGING=1
|
||||
; ; -D MESH_DEBUG=1
|
||||
; build_src_filter = ${waveshare_rp2040_lora.build_src_filter}
|
||||
; +<../examples/companion_radio>
|
||||
; lib_deps = ${waveshare_rp2040_lora.lib_deps}
|
||||
; densaugeo/base64 @ ~1.4.0
|
||||
|
||||
; [env:waveshare_rp2040_lora_companion_radio_wifi]
|
||||
; extends = waveshare_rp2040_lora
|
||||
; build_flags = ${waveshare_rp2040_lora.build_flags}
|
||||
; -D MAX_CONTACTS=100
|
||||
; -D MAX_GROUP_CHANNELS=8
|
||||
; -D WIFI_DEBUG_LOGGING=1
|
||||
; -D WIFI_SSID='"myssid"'
|
||||
; -D WIFI_PWD='"mypwd"'
|
||||
; ; -D MESH_PACKET_LOGGING=1
|
||||
; ; -D MESH_DEBUG=1
|
||||
; build_src_filter = ${waveshare_rp2040_lora.build_src_filter}
|
||||
; +<../examples/companion_radio>
|
||||
; lib_deps = ${waveshare_rp2040_lora.lib_deps}
|
||||
; densaugeo/base64 @ ~1.4.0
|
||||
|
||||
[env:waveshare_rp2040_lora_terminal_chat]
|
||||
extends = waveshare_rp2040_lora
|
||||
build_flags = ${waveshare_rp2040_lora.build_flags}
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${waveshare_rp2040_lora.build_src_filter}
|
||||
+<../examples/simple_secure_chat/main.cpp>
|
||||
lib_deps = ${waveshare_rp2040_lora.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
81
variants/waveshare_rp2040_lora/target.cpp
Normal file
81
variants/waveshare_rp2040_lora/target.cpp
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
#include "target.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
|
||||
WaveshareBoard board;
|
||||
|
||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI1);
|
||||
WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
SensorManager sensors;
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
rtc_clock.begin(Wire);
|
||||
|
||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
||||
#else
|
||||
float tcxo = 1.6f;
|
||||
#endif
|
||||
|
||||
SPI1.setSCK(P_LORA_SCLK);
|
||||
SPI1.setTX(P_LORA_MOSI);
|
||||
SPI1.setRX(P_LORA_MISO);
|
||||
|
||||
pinMode(P_LORA_NSS, OUTPUT);
|
||||
digitalWrite(P_LORA_NSS, HIGH);
|
||||
|
||||
SPI1.begin(false);
|
||||
|
||||
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() {
|
||||
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
|
||||
}
|
||||
21
variants/waveshare_rp2040_lora/target.h
Normal file
21
variants/waveshare_rp2040_lora/target.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#define RADIOLIB_STATIC_ONLY 1
|
||||
|
||||
#include <RadioLib.h>
|
||||
#include <helpers/AutoDiscoverRTCClock.h>
|
||||
#include <helpers/CustomSX1262Wrapper.h>
|
||||
#include <helpers/RadioLibWrappers.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
#include <helpers/rp2040/WaveshareBoard.h>
|
||||
|
||||
extern WaveshareBoard board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern AutoDiscoverRTCClock rtc_clock;
|
||||
extern SensorManager sensors;
|
||||
|
||||
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();
|
||||
|
|
@ -4,6 +4,7 @@ board = seeed_xiao_esp32c3
|
|||
build_flags =
|
||||
${esp32_base.build_flags}
|
||||
-I variants/xiao_c3
|
||||
-D ESP32_CPU_FREQ=80
|
||||
-D LORA_TX_BOOST_PIN=D3
|
||||
-D P_LORA_TX_LED=D5
|
||||
-D PIN_VBAT_READ=D0
|
||||
|
|
|
|||
|
|
@ -16,43 +16,16 @@ ESP32RTCClock fallback_clock;
|
|||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
SensorManager sensors;
|
||||
|
||||
#ifndef LORA_CR
|
||||
#define LORA_CR 5
|
||||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
fallback_clock.begin();
|
||||
rtc_clock.begin(Wire);
|
||||
|
||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||
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);
|
||||
return radio.std_init(&spi);
|
||||
#else
|
||||
return radio.std_init();
|
||||
#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() {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ build_flags = ${nrf52840_xiao.build_flags}
|
|||
-D P_LORA_RESET=D2
|
||||
-D P_LORA_BUSY=D3
|
||||
-D P_LORA_NSS=D4
|
||||
-D SX126X_RXEN=D5
|
||||
-D SX126X_TXEN=RADIOLIB_NC
|
||||
-D SX126X_DIO2_AS_RF_SWITCH=1
|
||||
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
|
|
@ -63,12 +65,11 @@ build_flags =
|
|||
-D BLE_PIN_CODE=123456
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Xiao_nrf52.build_src_filter}
|
||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||
+<../examples/companion_radio/main.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${Xiao_nrf52.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
|
@ -79,12 +80,11 @@ build_flags =
|
|||
${Xiao_nrf52.build_flags}
|
||||
-D MAX_CONTACTS=100
|
||||
-D MAX_GROUP_CHANNELS=8
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Xiao_nrf52.build_src_filter}
|
||||
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||
+<../examples/companion_radio/main.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${Xiao_nrf52.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BU
|
|||
|
||||
WRAPPER_CLASS radio_driver(radio, board);
|
||||
|
||||
VolatileRTCClock rtc_clock;
|
||||
VolatileRTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
EnvironmentSensorManager sensors;
|
||||
|
||||
#ifndef LORA_CR
|
||||
|
|
@ -16,7 +17,7 @@ EnvironmentSensorManager sensors;
|
|||
#endif
|
||||
|
||||
bool radio_init() {
|
||||
// rtc_clock.begin(Wire);
|
||||
rtc_clock.begin(Wire);
|
||||
|
||||
#ifdef SX126X_DIO3_TCXO_VOLTAGE
|
||||
float tcxo = SX126X_DIO3_TCXO_VOLTAGE;
|
||||
|
|
@ -35,6 +36,10 @@ bool radio_init() {
|
|||
|
||||
radio.setCRC(1);
|
||||
|
||||
#if defined(SX126X_RXEN) && defined(SX126X_TXEN)
|
||||
radio.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN);
|
||||
#endif
|
||||
|
||||
#ifdef SX126X_CURRENT_LIMIT
|
||||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@
|
|||
#include <helpers/RadioLibWrappers.h>
|
||||
#include <helpers/nrf52/XiaoNrf52Board.h>
|
||||
#include <helpers/CustomSX1262Wrapper.h>
|
||||
#include <helpers/AutoDiscoverRTCClock.h>
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/sensors/EnvironmentSensorManager.h>
|
||||
|
||||
extern XiaoNrf52Board board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern VolatileRTCClock rtc_clock;
|
||||
extern AutoDiscoverRTCClock rtc_clock;
|
||||
extern EnvironmentSensorManager sensors;
|
||||
|
||||
bool radio_init();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ build_flags = ${esp32_base.build_flags}
|
|||
-D P_LORA_MOSI=9
|
||||
-D PIN_USER_BTN=21
|
||||
-D PIN_STATUS_LED=48
|
||||
-D SX126X_RXEN=38
|
||||
-D SX126X_TXEN=RADIOLIB_NC
|
||||
-D SX126X_DIO2_AS_RF_SWITCH=true
|
||||
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
|
|
@ -83,8 +85,6 @@ build_flags =
|
|||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
; -D BLE_DEBUG_LOGGING=1
|
||||
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Xiao_S3_WIO.build_src_filter}
|
||||
|
|
@ -108,7 +108,7 @@ build_flags =
|
|||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${Xiao_S3_WIO.build_src_filter}
|
||||
+<helpers/esp32/*.cpp>
|
||||
+<../examples/companion_radio/main.cpp>
|
||||
+<../examples/companion_radio>
|
||||
lib_deps =
|
||||
${Xiao_S3_WIO.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@ bool radio_init() {
|
|||
}
|
||||
|
||||
radio.setCRC(1);
|
||||
|
||||
|
||||
#if defined(SX126X_RXEN) && defined(SX126X_TXEN)
|
||||
radio.setRfSwitchPins(SX126X_RXEN, SX126X_TXEN);
|
||||
#endif
|
||||
|
||||
#ifdef SX126X_CURRENT_LIMIT
|
||||
radio.setCurrentLimit(SX126X_CURRENT_LIMIT);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue