Initial commit: Simple Sensor firmware for Heltec T114 with BME280
Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
- MeshCore-based Simple Sensor firmware - Heltec T114 without display - BME280 sensor support (temp/humidity/pressure) - Radio: 868.856018 MHz, SF7, BW62.5 kHz, CR4/7 - 2-byte path hash - PlatformIO project
This commit is contained in:
51
variants/xiao_c6/XiaoC6Board.cpp
Normal file
51
variants/xiao_c6/XiaoC6Board.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
|
||||
XiaoC6Board board;
|
||||
|
||||
#if defined(P_LORA_SCLK)
|
||||
static SPIClass spi(0);
|
||||
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);
|
||||
|
||||
ESP32RTCClock fallback_clock;
|
||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
SensorManager sensors;
|
||||
|
||||
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);
|
||||
return radio.std_init(&spi);
|
||||
#else
|
||||
return radio.std_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
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(int8_t dbm) {
|
||||
radio.setOutputPower(dbm);
|
||||
}
|
||||
|
||||
mesh::LocalIdentity radio_new_identity() {
|
||||
RadioNoiseListener rng(radio);
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
|
||||
|
||||
28
variants/xiao_c6/XiaoC6Board.h
Normal file
28
variants/xiao_c6/XiaoC6Board.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <helpers/ESP32Board.h>
|
||||
|
||||
class XiaoC6Board : public ESP32Board {
|
||||
public:
|
||||
void begin() {
|
||||
ESP32Board::begin();
|
||||
|
||||
#ifdef USE_XIAO_ESP32C6_EXTERNAL_ANTENNA
|
||||
// Connect an external antenna to your XIAO ESP32C6 otherwise, it may be damaged!
|
||||
pinMode(3, OUTPUT);
|
||||
digitalWrite(3, LOW); // Activate RF switch control
|
||||
|
||||
delay(100);
|
||||
|
||||
pinMode(14, OUTPUT);
|
||||
digitalWrite(14, HIGH); // Use external antenna
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* getManufacturerName() const override {
|
||||
return "Xiao C6";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
186
variants/xiao_c6/platformio.ini
Normal file
186
variants/xiao_c6/platformio.ini
Normal file
@@ -0,0 +1,186 @@
|
||||
[Xiao_C6]
|
||||
extends = esp32c6_base
|
||||
board = esp32-c6-devkitm-1
|
||||
board_build.partitions = min_spiffs.csv ; get around 4mb flash limit
|
||||
build_flags =
|
||||
${esp32c6_base.build_flags}
|
||||
-I variants/xiao_c6
|
||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||
-D ARDUINO_USB_MODE=1
|
||||
-D P_LORA_TX_LED=15
|
||||
-D P_LORA_SCLK=19
|
||||
-D P_LORA_MISO=20
|
||||
-D P_LORA_MOSI=18
|
||||
-D P_LORA_NSS=22
|
||||
-D P_LORA_DIO_1=1
|
||||
-D P_LORA_BUSY=21
|
||||
-D P_LORA_RESET=2
|
||||
-D PIN_BOARD_SDA=16
|
||||
-D PIN_BOARD_SCL=17
|
||||
-D SX126X_RXEN=23
|
||||
-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 USE_SX1262
|
||||
-D RADIO_CLASS=CustomSX1262
|
||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||
-D LORA_TX_POWER=22
|
||||
-D DISABLE_WIFI_OTA=1
|
||||
build_src_filter = ${esp32c6_base.build_src_filter}
|
||||
+<../variants/xiao_c6>
|
||||
+<XiaoC6Board.cpp>
|
||||
|
||||
[env:Xiao_C6_repeater_]
|
||||
extends = Xiao_C6
|
||||
build_src_filter = ${Xiao_C6.build_src_filter}
|
||||
+<../examples/simple_repeater/*.cpp>
|
||||
build_flags =
|
||||
${Xiao_C6.build_flags}
|
||||
-D ADVERT_NAME='"Xiao C6 Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
lib_deps =
|
||||
${Xiao_C6.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:Xiao_C6_companion_radio_ble_]
|
||||
extends = Xiao_C6
|
||||
build_flags = ${Xiao_C6.build_flags}
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-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 = ${Xiao_C6.build_src_filter}
|
||||
+<helpers/esp32/*.cpp>
|
||||
-<helpers/esp32/ESPNOWRadio.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
lib_deps =
|
||||
${Xiao_C6.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
; Meshimi variant
|
||||
[Meshimi]
|
||||
extends = Xiao_C6
|
||||
board_build.partitions = max_app_4MB.csv
|
||||
build_flags =
|
||||
${Xiao_C6.build_flags}
|
||||
-D P_LORA_TX_LED=15
|
||||
-D P_LORA_SCLK=19
|
||||
-D P_LORA_MISO=20
|
||||
-D P_LORA_MOSI=18
|
||||
-D P_LORA_NSS=21
|
||||
-D P_LORA_DIO_1=7
|
||||
-D P_LORA_BUSY=6
|
||||
-D P_LORA_RESET=2
|
||||
-D PIN_BOARD_SDA=22
|
||||
-D PIN_BOARD_SCL=23
|
||||
-D SX126X_RXEN=4
|
||||
-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 USE_XIAO_ESP32C6_EXTERNAL_ANTENNA=1
|
||||
|
||||
[env:Meshimi_repeater_]
|
||||
extends = Meshimi
|
||||
build_src_filter = ${Meshimi.build_src_filter}
|
||||
+<../examples/simple_repeater/*.cpp>
|
||||
build_flags =
|
||||
${Meshimi.build_flags}
|
||||
-D ADVERT_NAME='"Meshimi Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
lib_deps =
|
||||
${Meshimi.lib_deps}
|
||||
|
||||
[env:Meshimi_companion_radio_ble_]
|
||||
extends = Meshimi
|
||||
build_flags = ${Meshimi.build_flags}
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-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
|
||||
build_src_filter = ${Meshimi.build_src_filter}
|
||||
+<helpers/esp32/*.cpp>
|
||||
-<helpers/esp32/ESPNOWRadio.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
lib_deps =
|
||||
${Meshimi.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
|
||||
; WHY2025 badge variant
|
||||
; requires soldering 2 pins between the esp32-C6 and the lora chip as shown here: https://wiki.why2025.org/Project:Meshtastic_on_the_WHY2025_badge
|
||||
; also requires wiping the esp32-P4
|
||||
[WHY2025_badge]
|
||||
extends = Xiao_C6
|
||||
board_build.partitions = default_8MB.csv
|
||||
board_upload.flash_size = 8MB
|
||||
board_upload.maximum_size = 8388608
|
||||
build_flags =
|
||||
${Xiao_C6.build_flags}
|
||||
-D P_LORA_SCLK=6
|
||||
-D P_LORA_MISO=2
|
||||
-D P_LORA_MOSI=7
|
||||
-D P_LORA_NSS=4
|
||||
-D P_LORA_DIO_1=5
|
||||
-D P_LORA_BUSY=11
|
||||
-D P_LORA_RESET=1
|
||||
-D SX126X_TXEN=3
|
||||
-UPIN_BOARD_SDA
|
||||
-UPIN_BOARD_SCL
|
||||
-UP_LORA_TX_LED
|
||||
-USX126X_RXEN
|
||||
-USX126X_DIO2_AS_RF_SWITCH
|
||||
-USX126X_DIO3_TCXO_VOLTAGE
|
||||
|
||||
[env:WHY2025_badge_repeater_]
|
||||
extends = WHY2025_badge
|
||||
build_src_filter = ${WHY2025_badge.build_src_filter}
|
||||
+<../examples/simple_repeater/*.cpp>
|
||||
build_flags =
|
||||
${WHY2025_badge.build_flags}
|
||||
-D ADVERT_NAME='"WHY2025 Badge Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D MAX_NEIGHBOURS=50
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
lib_deps =
|
||||
${WHY2025_badge.lib_deps}
|
||||
${esp32_ota.lib_deps}
|
||||
|
||||
[env:WHY2025_badge_companion_radio_ble_]
|
||||
extends = WHY2025_badge
|
||||
build_flags = ${WHY2025_badge.build_flags}
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-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 = ${WHY2025_badge.build_src_filter}
|
||||
+<helpers/esp32/*.cpp>
|
||||
-<helpers/esp32/ESPNOWRadio.cpp>
|
||||
+<../examples/companion_radio/*.cpp>
|
||||
lib_deps =
|
||||
${WHY2025_badge.lib_deps}
|
||||
densaugeo/base64 @ ~1.4.0
|
||||
22
variants/xiao_c6/target.h
Normal file
22
variants/xiao_c6/target.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#define RADIOLIB_STATIC_ONLY 1
|
||||
#include <RadioLib.h>
|
||||
#include <XiaoC6Board.h>
|
||||
#include <helpers/radiolib/RadioLibWrappers.h>
|
||||
#include <helpers/ESP32Board.h>
|
||||
#include <helpers/radiolib/CustomSX1262Wrapper.h>
|
||||
#include <helpers/AutoDiscoverRTCClock.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
|
||||
extern XiaoC6Board 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(int8_t dbm);
|
||||
mesh::LocalIdentity radio_new_identity();
|
||||
|
||||
Reference in New Issue
Block a user