kopia lustrzana https://github.com/sh123/esp32_loraprs
Make LoRa CRC check configurable from settings
rodzic
10edae2b75
commit
3156f9354f
|
@ -13,7 +13,7 @@ auto watchdogLedTimer = timer_create_default();
|
|||
void initializeConfig() {
|
||||
|
||||
// client/server mode switch
|
||||
cfg.IsClientMode = false;
|
||||
cfg.IsClientMode = true;
|
||||
|
||||
// lora parameters
|
||||
cfg.LoraFreq = 433.775E6;
|
||||
|
@ -22,6 +22,7 @@ void initializeConfig() {
|
|||
cfg.LoraCodingRate = 7;
|
||||
cfg.LoraSync = 0x34;
|
||||
cfg.LoraPower = 20;
|
||||
cfg.LoraEnableCrc = true; // set to false for speech data
|
||||
|
||||
// aprs configuration
|
||||
cfg.AprsHost = "rotate.aprs2.net";
|
||||
|
|
|
@ -15,6 +15,7 @@ struct Config
|
|||
byte LoraCodingRate; // lora coding rate, e.g. 7
|
||||
byte LoraSync; // lora sync word/packet id, 0x3f
|
||||
byte LoraPower; // lora power level in dbm, 20
|
||||
bool LoraEnableCrc; // lora crc check enabled
|
||||
|
||||
int AprsPort; // aprs server port, 14580
|
||||
String AprsHost; // aprs server hostname, rotate.aprs2.net
|
||||
|
|
|
@ -44,7 +44,8 @@ void Service::setup(const Config &conf)
|
|||
enableBeacon_ = conf.EnableBeacon;
|
||||
|
||||
// peripherals
|
||||
setupLora(conf.LoraFreq, conf.LoraBw, conf.LoraSf, conf.LoraCodingRate, conf.LoraPower, conf.LoraSync);
|
||||
setupLora(conf.LoraFreq, conf.LoraBw, conf.LoraSf,
|
||||
conf.LoraCodingRate, conf.LoraPower, conf.LoraSync, conf.LoraEnableCrc);
|
||||
|
||||
if (needsWifi()) {
|
||||
setupWifi(conf.WifiSsid, conf.WifiKey);
|
||||
|
@ -104,7 +105,7 @@ bool Service::reconnectAprsis()
|
|||
return true;
|
||||
}
|
||||
|
||||
void Service::setupLora(int loraFreq, int bw, byte sf, byte cr, byte pwr, byte sync)
|
||||
void Service::setupLora(int loraFreq, int bw, byte sf, byte cr, byte pwr, byte sync, bool enableCrc)
|
||||
{
|
||||
Serial.print("LoRa init...");
|
||||
|
||||
|
@ -119,7 +120,9 @@ void Service::setupLora(int loraFreq, int bw, byte sf, byte cr, byte pwr, byte s
|
|||
LoRa.setSignalBandwidth(bw);
|
||||
LoRa.setCodingRate4(cr);
|
||||
LoRa.setTxPower(pwr);
|
||||
LoRa.enableCrc();
|
||||
if (enableCrc) {
|
||||
LoRa.enableCrc();
|
||||
}
|
||||
|
||||
Serial.println("ok");
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
private:
|
||||
void setupWifi(const String &wifiName, const String &wifiKey);
|
||||
void setupLora(int loraFreq, int bw, byte sf, byte cr, byte pwr, byte sync);
|
||||
void setupLora(int loraFreq, int bw, byte sf, byte cr, byte pwr, byte sync, bool enableCrc);
|
||||
void setupBt(const String &btName);
|
||||
|
||||
void reconnectWifi();
|
||||
|
|
Ładowanie…
Reference in New Issue