Allow to specify preamble length and select modem type from platformio ini

master 1.0.11
sh123 2023-03-15 08:26:07 +02:00
rodzic c203b98d51
commit 3540ef3006
5 zmienionych plików z 25 dodań i 8 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
#define CONFIG_H
// Uncomment for SX126X module usage
#define USE_SX126X
// #define USE_SX126X
// Check your module name at https://github.com/jgromes/RadioLib/wiki/Modules
#ifdef USE_SX126X
@ -69,6 +69,7 @@
#define CFG_LORA_EXPLICIT true // header mode, true - explicit, false - implicit
#define CFG_LORA_SYNC 0x12 // sync word (0x12 - private used by other trackers, 0x34 - public used by LoRaWAN)
#define CFG_LORA_PWR 20 // output power in dBm
#define CFG_LORA_PREAMBLE 8 // preamble length from 6 to 65535
// WiFi client and AP options
#define CFG_WIFI_ENABLE_AP false // run as wifi access point (for CFG_KISS_TCP_IP mode)

Wyświetl plik

@ -21,6 +21,7 @@ struct Config
int LoraSync; // lora sync word/packet id, 0x34
int LoraCrc; // lora crc mode, 0 - disabled, 1 - 1 byte, 2 - 2 bytes
bool LoraExplicit; // lora header mode, true - explicit, false - implicit
int LoraPreamble; // lora preamble length from 6 to 65535
// lora hardware pinouts and isr
byte LoraPinSs; // lora ss pin

Wyświetl plik

@ -1,6 +1,6 @@
[platformio]
description = ESP32 LoRA APRS modem
default_envs = esp32dev
default_envs = esp32dev_sx126x_modem
[env]
platform = espressif32 @ 5.2.0
@ -19,18 +19,31 @@ check_flags =
cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK
check_skip_packages = yes
[env:esp32dev]
[env:esp32dev_sx126x_modem]
board = esp32dev
build_flags =
'-D CFG_IS_CLIENT_MODE=true'
-D CFG_IS_CLIENT_MODE=true
-D USE_SX126X
[env:esp32dev_igate]
[env:esp32dev_sx126x_igate]
board = esp32dev
board_build.f_cpu = 240000000L
build_flags =
'-D CFG_IS_CLIENT_MODE=false'
-D CFG_IS_CLIENT_MODE=false
-D USE_SX126X
[env:ttgo-lora32-v1]
[env:esp32dev_sx127x_modem]
board = esp32dev
build_flags =
-D CFG_IS_CLIENT_MODE=true
[env:esp32dev_sx127x_igate]
board = esp32dev
board_build.f_cpu = 240000000L
build_flags =
-D CFG_IS_CLIENT_MODE=false
[env:ttgo-lora32-v1_modem]
board = ttgo-lora32-v1
build_flags =
'-D CFG_IS_CLIENT_MODE=true'
-D CFG_IS_CLIENT_MODE=true

Wyświetl plik

@ -239,6 +239,7 @@ void Service::setupRig(long loraFreq, long bw, int sf, int cr, int pwr, int sync
LOG_ERROR("Radio start error:", state);
}
rig_->setCRC(crcBytes);
rig_->setPreambleLength(config_.LoraPreamble);
#ifdef USE_SX126X
#pragma message("Using SX126X")
LOG_INFO("Using SX126X module");

Wyświetl plik

@ -41,6 +41,7 @@ void initializeConfig(LoraPrs::Config &cfg) {
cfg.LoraCrc = CFG_LORA_CRC; // set to 0 to disable
cfg.LoraExplicit = CFG_LORA_EXPLICIT;
cfg.LoraPower = CFG_LORA_PWR;
cfg.LoraPreamble = CFG_LORA_PREAMBLE;
// lora pinouts
cfg.LoraPinSs = CFG_LORA_PIN_SS;