Make LoRa CRC check configurable from settings

pull/15/head
sh123 2020-12-12 12:21:53 +02:00
rodzic 10edae2b75
commit 3156f9354f
4 zmienionych plików z 10 dodań i 5 usunięć

Wyświetl plik

@ -13,7 +13,7 @@ auto watchdogLedTimer = timer_create_default();
void initializeConfig() { void initializeConfig() {
// client/server mode switch // client/server mode switch
cfg.IsClientMode = false; cfg.IsClientMode = true;
// lora parameters // lora parameters
cfg.LoraFreq = 433.775E6; cfg.LoraFreq = 433.775E6;
@ -22,6 +22,7 @@ void initializeConfig() {
cfg.LoraCodingRate = 7; cfg.LoraCodingRate = 7;
cfg.LoraSync = 0x34; cfg.LoraSync = 0x34;
cfg.LoraPower = 20; cfg.LoraPower = 20;
cfg.LoraEnableCrc = true; // set to false for speech data
// aprs configuration // aprs configuration
cfg.AprsHost = "rotate.aprs2.net"; cfg.AprsHost = "rotate.aprs2.net";

Wyświetl plik

@ -15,6 +15,7 @@ struct Config
byte LoraCodingRate; // lora coding rate, e.g. 7 byte LoraCodingRate; // lora coding rate, e.g. 7
byte LoraSync; // lora sync word/packet id, 0x3f byte LoraSync; // lora sync word/packet id, 0x3f
byte LoraPower; // lora power level in dbm, 20 byte LoraPower; // lora power level in dbm, 20
bool LoraEnableCrc; // lora crc check enabled
int AprsPort; // aprs server port, 14580 int AprsPort; // aprs server port, 14580
String AprsHost; // aprs server hostname, rotate.aprs2.net String AprsHost; // aprs server hostname, rotate.aprs2.net

Wyświetl plik

@ -44,7 +44,8 @@ void Service::setup(const Config &conf)
enableBeacon_ = conf.EnableBeacon; enableBeacon_ = conf.EnableBeacon;
// peripherals // 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()) { if (needsWifi()) {
setupWifi(conf.WifiSsid, conf.WifiKey); setupWifi(conf.WifiSsid, conf.WifiKey);
@ -104,7 +105,7 @@ bool Service::reconnectAprsis()
return true; 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..."); 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.setSignalBandwidth(bw);
LoRa.setCodingRate4(cr); LoRa.setCodingRate4(cr);
LoRa.setTxPower(pwr); LoRa.setTxPower(pwr);
if (enableCrc) {
LoRa.enableCrc(); LoRa.enableCrc();
}
Serial.println("ok"); Serial.println("ok");
} }

Wyświetl plik

@ -22,7 +22,7 @@ public:
private: private:
void setupWifi(const String &wifiName, const String &wifiKey); 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 setupBt(const String &btName);
void reconnectWifi(); void reconnectWifi();