kopia lustrzana https://github.com/sh123/esp32_loraprs
Allow to specify preamble length and select modem type from platformio ini
rodzic
c203b98d51
commit
3540ef3006
|
@ -2,7 +2,7 @@
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
// Uncomment for SX126X module usage
|
// Uncomment for SX126X module usage
|
||||||
#define USE_SX126X
|
// #define USE_SX126X
|
||||||
|
|
||||||
// Check your module name at https://github.com/jgromes/RadioLib/wiki/Modules
|
// Check your module name at https://github.com/jgromes/RadioLib/wiki/Modules
|
||||||
#ifdef USE_SX126X
|
#ifdef USE_SX126X
|
||||||
|
@ -69,6 +69,7 @@
|
||||||
#define CFG_LORA_EXPLICIT true // header mode, true - explicit, false - implicit
|
#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_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_PWR 20 // output power in dBm
|
||||||
|
#define CFG_LORA_PREAMBLE 8 // preamble length from 6 to 65535
|
||||||
|
|
||||||
// WiFi client and AP options
|
// WiFi client and AP options
|
||||||
#define CFG_WIFI_ENABLE_AP false // run as wifi access point (for CFG_KISS_TCP_IP mode)
|
#define CFG_WIFI_ENABLE_AP false // run as wifi access point (for CFG_KISS_TCP_IP mode)
|
||||||
|
|
|
@ -21,6 +21,7 @@ struct Config
|
||||||
int LoraSync; // lora sync word/packet id, 0x34
|
int LoraSync; // lora sync word/packet id, 0x34
|
||||||
int LoraCrc; // lora crc mode, 0 - disabled, 1 - 1 byte, 2 - 2 bytes
|
int LoraCrc; // lora crc mode, 0 - disabled, 1 - 1 byte, 2 - 2 bytes
|
||||||
bool LoraExplicit; // lora header mode, true - explicit, false - implicit
|
bool LoraExplicit; // lora header mode, true - explicit, false - implicit
|
||||||
|
int LoraPreamble; // lora preamble length from 6 to 65535
|
||||||
|
|
||||||
// lora hardware pinouts and isr
|
// lora hardware pinouts and isr
|
||||||
byte LoraPinSs; // lora ss pin
|
byte LoraPinSs; // lora ss pin
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[platformio]
|
[platformio]
|
||||||
description = ESP32 LoRA APRS modem
|
description = ESP32 LoRA APRS modem
|
||||||
default_envs = esp32dev
|
default_envs = esp32dev_sx126x_modem
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
platform = espressif32 @ 5.2.0
|
platform = espressif32 @ 5.2.0
|
||||||
|
@ -19,18 +19,31 @@ check_flags =
|
||||||
cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK
|
cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK
|
||||||
check_skip_packages = yes
|
check_skip_packages = yes
|
||||||
|
|
||||||
[env:esp32dev]
|
[env:esp32dev_sx126x_modem]
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
build_flags =
|
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 = esp32dev
|
||||||
board_build.f_cpu = 240000000L
|
board_build.f_cpu = 240000000L
|
||||||
build_flags =
|
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
|
board = ttgo-lora32-v1
|
||||||
build_flags =
|
build_flags =
|
||||||
'-D CFG_IS_CLIENT_MODE=true'
|
-D CFG_IS_CLIENT_MODE=true
|
||||||
|
|
|
@ -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);
|
LOG_ERROR("Radio start error:", state);
|
||||||
}
|
}
|
||||||
rig_->setCRC(crcBytes);
|
rig_->setCRC(crcBytes);
|
||||||
|
rig_->setPreambleLength(config_.LoraPreamble);
|
||||||
#ifdef USE_SX126X
|
#ifdef USE_SX126X
|
||||||
#pragma message("Using SX126X")
|
#pragma message("Using SX126X")
|
||||||
LOG_INFO("Using SX126X module");
|
LOG_INFO("Using SX126X module");
|
||||||
|
|
|
@ -41,6 +41,7 @@ void initializeConfig(LoraPrs::Config &cfg) {
|
||||||
cfg.LoraCrc = CFG_LORA_CRC; // set to 0 to disable
|
cfg.LoraCrc = CFG_LORA_CRC; // set to 0 to disable
|
||||||
cfg.LoraExplicit = CFG_LORA_EXPLICIT;
|
cfg.LoraExplicit = CFG_LORA_EXPLICIT;
|
||||||
cfg.LoraPower = CFG_LORA_PWR;
|
cfg.LoraPower = CFG_LORA_PWR;
|
||||||
|
cfg.LoraPreamble = CFG_LORA_PREAMBLE;
|
||||||
|
|
||||||
// lora pinouts
|
// lora pinouts
|
||||||
cfg.LoraPinSs = CFG_LORA_PIN_SS;
|
cfg.LoraPinSs = CFG_LORA_PIN_SS;
|
||||||
|
|
Ładowanie…
Reference in New Issue