mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-03 20:13:51 +01:00
esp32 1W LoRa added
This commit is contained in:
parent
250c0a5888
commit
067d1dc67b
|
|
@ -22,7 +22,7 @@ namespace BATTERY_Utils {
|
|||
#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2)
|
||||
sample = analogRead(batteryPin);
|
||||
#endif
|
||||
#ifdef HELTEC_V3
|
||||
#if defined(HELTEC_V3) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
|
||||
sample = 0;
|
||||
#endif
|
||||
sampleSum += sample;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ SX1262 radio = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUS
|
|||
bool transmissionFlag = true;
|
||||
bool enableInterrupt = true;
|
||||
#endif
|
||||
#ifdef ESP32_DIY_1W_LoRa
|
||||
SX1268 radio = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN);
|
||||
bool transmissionFlag = true;
|
||||
bool enableInterrupt = true;
|
||||
#endif
|
||||
|
||||
int rssi, freqError;
|
||||
float snr;
|
||||
|
|
@ -22,7 +27,7 @@ float snr;
|
|||
namespace LoRa_Utils {
|
||||
|
||||
void setFlag(void) {
|
||||
#ifdef HELTEC_V3
|
||||
#if defined(HELTEC_V3) || defined(ESP32_DIY_1W_LoRa)
|
||||
transmissionFlag = true;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -51,12 +56,11 @@ namespace LoRa_Utils {
|
|||
LoRa.setTxPower(Config.loramodule.power);
|
||||
Serial.print("init : LoRa Module ... done!");
|
||||
#endif
|
||||
#ifdef HELTEC_V3
|
||||
#if defined(HELTEC_V3) || defined(ESP32_DIY_1W_LoRa)
|
||||
SPI.begin(RADIO_SCLK_PIN, RADIO_MISO_PIN, RADIO_MOSI_PIN);
|
||||
float freq = (float)Config.loramodule.iGateFreq/1000000;
|
||||
int state = radio.begin(freq);
|
||||
if (state == RADIOLIB_ERR_NONE) {
|
||||
|
||||
Serial.print("Initializing SX126X LoRa Module");
|
||||
} else {
|
||||
Serial.println("Starting LoRa failed!");
|
||||
|
|
@ -66,8 +70,12 @@ namespace LoRa_Utils {
|
|||
radio.setSpreadingFactor(Config.loramodule.spreadingFactor);
|
||||
radio.setBandwidth(Config.loramodule.signalBandwidth);
|
||||
radio.setCodingRate(Config.loramodule.codingRate4);
|
||||
#ifdef HELTEC_V3
|
||||
state = radio.setOutputPower(Config.loramodule.power + 2); // values available: 10, 17, 22 --> if 20 in tracker_conf.json it will be updated to 22.
|
||||
|
||||
#endif
|
||||
#ifdef ESP32_DIY_1W_LoRa_GPS
|
||||
state = radio.setOutputPower(Config.loramodule.power); // max value 20 (when 20dB in setup 30dB in output as 400M30S has Low Noise Amp)
|
||||
#endif
|
||||
if (state == RADIOLIB_ERR_NONE) {
|
||||
Serial.println("init : LoRa Module ... done!");
|
||||
} else {
|
||||
|
|
@ -91,7 +99,7 @@ namespace LoRa_Utils {
|
|||
LoRa.write((const uint8_t *)newPacket.c_str(), newPacket.length());
|
||||
LoRa.endPacket();
|
||||
#endif
|
||||
#ifdef HELTEC_V3
|
||||
#if defined(HELTEC_V3) || defined(ESP32_DIY_1W_LoRa)
|
||||
int state = radio.transmit("\x3c\xff\x01" + newPacket);
|
||||
if (state == RADIOLIB_ERR_NONE) {
|
||||
//Serial.println(F("success!"));
|
||||
|
|
@ -132,7 +140,7 @@ namespace LoRa_Utils {
|
|||
freqError = LoRa.packetFrequencyError();
|
||||
}
|
||||
#endif
|
||||
#ifdef HELTEC_V3
|
||||
#if defined(HELTEC_V3) || defined(ESP32_DIY_1W_LoRa)
|
||||
if (transmissionFlag) {
|
||||
transmissionFlag = false;
|
||||
radio.startReceive();
|
||||
|
|
@ -166,7 +174,7 @@ namespace LoRa_Utils {
|
|||
#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa)
|
||||
LoRa.setFrequency(Config.loramodule.digirepeaterTxFreq);
|
||||
#endif
|
||||
#ifdef HELTEC_V3
|
||||
#if defined(HELTEC_V3) || defined(ESP32_DIY_1W_LoRa)
|
||||
float freq = (float)Config.loramodule.digirepeaterTxFreq/1000000;
|
||||
radio.setFrequency(freq);
|
||||
#endif
|
||||
|
|
@ -177,7 +185,7 @@ namespace LoRa_Utils {
|
|||
#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2) || defined(ESP32_DIY_LoRa)
|
||||
LoRa.setFrequency(Config.loramodule.digirepeaterRxFreq);
|
||||
#endif
|
||||
#ifdef HELTEC_V3
|
||||
#if defined(HELTEC_V3) || defined(ESP32_DIY_1W_LoRa)
|
||||
float freq = (float)Config.loramodule.digirepeaterRxFreq/1000000;
|
||||
radio.setFrequency(freq);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,8 +28,21 @@
|
|||
#define RADIO_BUSY_PIN 13 // SX1262 BUSY
|
||||
#endif
|
||||
|
||||
#ifdef ESP32_DIY_1W_LoRa // Ebyte E22 400M30S
|
||||
#define RADIO_SCLK_PIN 18
|
||||
#define RADIO_MISO_PIN 19
|
||||
#define RADIO_MOSI_PIN 23
|
||||
#define RADIO_CS_PIN 5
|
||||
#define RADIO_RST_PIN 27
|
||||
#define RADIO_DIO1_PIN 12
|
||||
#define RADIO_BUSY_PIN 14
|
||||
#define RADIO_RXEN 32
|
||||
#define RADIO_TXEN 25
|
||||
#endif
|
||||
|
||||
|
||||
// OLED
|
||||
#if defined(TTGO_T_LORA_V2_1) || defined(ESP32_DIY_LoRa)
|
||||
#if defined(TTGO_T_LORA_V2_1) || defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
|
||||
#define OLED_SDA 21
|
||||
#define OLED_SCL 22
|
||||
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
|
||||
|
|
@ -55,7 +68,7 @@
|
|||
#ifdef HELTEC_V3
|
||||
#define internalLedPin 35
|
||||
#endif
|
||||
#ifdef ESP32_DIY_LoRa
|
||||
#if defined(ESP32_DIY_LoRa) || defined(ESP32_DIY_1W_LoRa)
|
||||
#define internalLedPin 2
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ namespace Utils {
|
|||
} else {
|
||||
beaconPacket = iGateBeaconPacket;
|
||||
}
|
||||
#ifndef HELTEC_V3
|
||||
#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2)
|
||||
if (Config.sendBatteryVoltage) {
|
||||
beaconPacket += " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)";
|
||||
}
|
||||
|
|
@ -127,8 +127,8 @@ namespace Utils {
|
|||
fifthLine = "";
|
||||
}
|
||||
sixthLine = "";
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 1000);
|
||||
#ifndef HELTEC_V3
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 1000);
|
||||
#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2)
|
||||
if (Config.sendBatteryVoltage) {
|
||||
sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)";
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ namespace Utils {
|
|||
fifthLine = "";
|
||||
sixthLine = "";
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0);
|
||||
#ifndef HELTEC_V3
|
||||
#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2)
|
||||
if (Config.sendBatteryVoltage) {
|
||||
sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)";
|
||||
}
|
||||
|
|
@ -176,8 +176,8 @@ namespace Utils {
|
|||
if (WiFi.status() == WL_CONNECTED && espClient.connected()) {
|
||||
APRS_IS_Utils::checkStatus();
|
||||
thirdLine = getLocalIP();
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 1000);
|
||||
#ifndef HELTEC_V3
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 1000);
|
||||
#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2)
|
||||
if (Config.sendBatteryVoltage) {
|
||||
sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)";
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ namespace Utils {
|
|||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
|
||||
} else {
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0);
|
||||
#ifndef HELTEC_V3
|
||||
#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2)
|
||||
if (Config.sendBatteryVoltage) {
|
||||
sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)";
|
||||
}
|
||||
|
|
@ -211,7 +211,7 @@ namespace Utils {
|
|||
sixthLine = "";
|
||||
|
||||
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0);
|
||||
#ifndef HELTEC_V3
|
||||
#if defined(TTGO_T_LORA_V2_1) || defined(HELTEC_V2)
|
||||
if (Config.sendBatteryVoltage) {
|
||||
sixthLine = " (Batt=" + String(BATTERY_Utils::checkBattery(),2) + "V)";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue