kopia lustrzana https://github.com/sh123/esp32_loraprs
Move pinout definitions into config file and add support for TBeam board
rodzic
66749e78cf
commit
6e6e251533
10
config.h
10
config.h
|
@ -1,5 +1,15 @@
|
|||
#define CFG_IS_CLIENT_MODE true
|
||||
|
||||
#ifdef BOARD_T_BEAM
|
||||
#define CFG_LORA_PIN_SS 18
|
||||
#define CFG_LORA_PIN_RST 23
|
||||
#define CFG_LORA_PIN_DIO0 26
|
||||
#else
|
||||
#define CFG_LORA_PIN_SS 5
|
||||
#define CFG_LORA_PIN_RST 26
|
||||
#define CFG_LORA_PIN_DIO0 14
|
||||
#endif
|
||||
|
||||
#define CFG_LORA_FREQ 433.775E6
|
||||
#define CFG_LORA_BW 125e3
|
||||
#define CFG_LORA_SF 12
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
#include "loraprs_service.h"
|
||||
|
||||
#define LED_BUILTIN 2
|
||||
#define LED_TOGGLE_PERIOD 1000
|
||||
#define LED_TOGGLE_PERIOD 1000
|
||||
|
||||
//#define BOARD_T_BEAM
|
||||
|
||||
#if __has_include("/tmp/esp32_loraprs_config.h")
|
||||
#pragma message("Using external config")
|
||||
|
@ -33,6 +35,11 @@ void initializeConfig(LoraPrs::Config &cfg) {
|
|||
cfg.LoraPower = CFG_LORA_PWR;
|
||||
cfg.LoraEnableCrc = CFG_LORA_ENABLE_CRC; // set to false for speech data
|
||||
|
||||
// lora pinouts
|
||||
cfg.LoraPinSs = CFG_LORA_PIN_SS;
|
||||
cfg.LoraPinRst = CFG_LORA_PIN_RST;
|
||||
cfg.LoraPinDio0 = CFG_LORA_PIN_DIO0;
|
||||
|
||||
// aprs configuration
|
||||
cfg.AprsHost = "rotate.aprs2.net";
|
||||
cfg.AprsPort = 14580;
|
||||
|
|
|
@ -17,6 +17,10 @@ struct Config
|
|||
int LoraPower; // lora power level in dbm, 20
|
||||
bool LoraEnableCrc; // lora crc check enabled
|
||||
|
||||
byte LoraPinSs;
|
||||
byte LoraPinRst;
|
||||
byte LoraPinDio0;
|
||||
|
||||
int AprsPort; // aprs server port, 14580
|
||||
String AprsHost; // aprs server hostname, rotate.aprs2.net
|
||||
String AprsLogin; // aprs callsign to use, e.g. N0CALL-1
|
||||
|
|
|
@ -104,7 +104,7 @@ void Service::setupLora(long loraFreq, long bw, int sf, int cr, int pwr, int syn
|
|||
{
|
||||
Serial.print("LoRa init...");
|
||||
|
||||
LoRa.setPins(CfgPinSs, CfgPinRst, CfgPinDio0);
|
||||
LoRa.setPins(config_.LoraPinSs, config_.LoraPinRst, config_.LoraPinDio0);
|
||||
|
||||
while (!LoRa.begin(loraFreq)) {
|
||||
Serial.print(".");
|
||||
|
|
|
@ -59,11 +59,6 @@ protected:
|
|||
private:
|
||||
const String CfgLoraprsVersion = "LoRAPRS 0.1";
|
||||
|
||||
// module pinouts
|
||||
const byte CfgPinSs = 5;
|
||||
const byte CfgPinRst = 26;
|
||||
const byte CfgPinDio0 = 14;
|
||||
|
||||
// processor config
|
||||
const int CfgConnRetryMs = 500;
|
||||
const int CfgPollDelayMs = 5;
|
||||
|
|
Ładowanie…
Reference in New Issue