This commit is contained in:
richonguzman 2023-06-09 20:20:39 -04:00
parent 0faef78a8d
commit d392483bea
7 changed files with 28 additions and 22 deletions

View File

@ -21,7 +21,7 @@ Configuration Config;
WiFiClient espClient;
//AsyncWebServer server(80);
String versionDate = "2023.06.08";
String versionDate = "2023.06.09";
int myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
@ -40,6 +40,7 @@ String firstLine, secondLine, thirdLine, fourthLine, iGateBeaconPacket;
void setup() {
Serial.begin(115200);
pinMode(greenLed, OUTPUT);
delay(1000);
utils::setupDiplay();
WIFI_Utils::setup();
@ -51,7 +52,7 @@ void setup() {
});
AsyncElegantOTA.begin(&server); // Start ElegantOTA
server.begin();
Serial.println("HTTP server started");*/
Serial.println("HTTP server started");*/
}
void loop() {

View File

@ -171,16 +171,12 @@ void processAPRSISPacket(String packet) {
}
} else {
Serial.print("Received from APRS-IS : " + packet);
if (stationMode == 1) {
Serial.println(" ---> Cant Tx without Ham Lincence");
} else if (stationMode > 1) {
if (STATION_Utils::wasHeard(Addressee)) {
LoRa_Utils::sendNewPacket("APRS", LoRa_Utils::generatePacket(packet));
display_toggle(true);
lastScreenOn = millis();
receivedMessage = AddresseeAndMessage.substring(AddresseeAndMessage.indexOf(":")+1);
show_display(firstLine, secondLine, Sender + " -> " + Addressee, receivedMessage, 0);
}
if (stationMode == 2 && STATION_Utils::wasHeard(Addressee)) {
LoRa_Utils::sendNewPacket("APRS", LoRa_Utils::generatePacket(packet));
display_toggle(true);
lastScreenOn = millis();
utils::typeOfPacket(packet);
show_display(firstLine, secondLine, Sender + " -> " + Addressee, fourthLine, 0);
}
}
}

View File

@ -11,25 +11,22 @@ extern uint32_t lastScreenOn;
namespace DIGI_Utils {
void processPacket(String packet) {
String firstPart, lastPart, loraPacket;
String loraPacket;
if (packet != "") {
Serial.print("Received Lora Packet : " + String(packet));
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1)) {
Serial.println(" ---> APRS LoRa Packet");
if ((stationMode==3) && (packet.indexOf("WIDE1-1") > 10)) {
utils::typeOfPacket(packet);
firstPart = packet.substring(3,packet.indexOf(",")+1);
lastPart = packet.substring(packet.indexOf(":"));
loraPacket = firstPart + Config.callsign + "*" + lastPart;
loraPacket = packet.substring(3);
loraPacket.replace("WIDE1-1", Config.callsign + "*");
delay(500);
LoRa_Utils::sendNewPacket("APRS", loraPacket);
display_toggle(true);
lastScreenOn = millis();
} else {
} else if (stationMode ==4){
utils::typeOfPacket(packet);
firstPart = packet.substring(3,packet.indexOf(",")+1);
lastPart = packet.substring(packet.indexOf(",")+1);
loraPacket = firstPart + Config.callsign + lastPart; // se agrega "*"" ???
loraPacket = packet.substring(3,packet.indexOf(",")+1) + Config.callsign + "*" + packet.substring(packet.indexOf(",")+1);
delay(500);
if (stationMode == 4) {
LoRa_Utils::changeFreqTx();

View File

@ -1,5 +1,6 @@
#include <LoRa.h>
#include "configuration.h"
#include "pins_config.h"
#include "display.h"
extern Configuration Config;
@ -32,6 +33,7 @@ void setup() {
}
void sendNewPacket(const String &typeOfMessage, const String &newPacket) {
digitalWrite(greenLed,HIGH);
LoRa.beginPacket();
LoRa.write('<');
if (typeOfMessage == "APRS") {
@ -42,6 +44,7 @@ void sendNewPacket(const String &typeOfMessage, const String &newPacket) {
LoRa.write(0x01);
LoRa.write((const uint8_t *)newPacket.c_str(), newPacket.length());
LoRa.endPacket();
digitalWrite(greenLed,LOW);
Serial.print("---> LoRa Packet Tx : ");
Serial.println(newPacket);
}

View File

@ -10,8 +10,10 @@
#define LORA_RST 23 // GPIO14 - SX1276 RST
#define LORA_IRQ 26 // GPIO26 - SX1276 IRQ ---->DIO0
#define OLED_SDA 21
#define OLED_SCL 22
#define OLED_SDA 21
#define OLED_SCL 22
#define greenLed 25 // Green Led
/* (Same pins for LILYGO LoRa32 and ESP32 Wroom Dev )
SX1278-------------------> ESP32 ttgo-lora32-v21 and ESP32 WROOM Dev

View File

@ -1,5 +1,6 @@
#include <WiFi.h>
#include "configuration.h"
#include "pins_config.h"
#include "wifi_utils.h"
#include "lora_utils.h"
#include "display.h"
@ -43,8 +44,10 @@ void processStatus() {
void setupDiplay() {
setup_display();
digitalWrite(greenLed,HIGH);
Serial.println("\nStarting iGate: " + Config.callsign + " Version: " + versionDate);
show_display(" LoRa APRS iGate", " Richonguzman", " -- CD2RXU --", " " + versionDate, 4000);
digitalWrite(greenLed,LOW);
firstLine = "LoRa iGate: " + Config.callsign;
if (stationMode==3 || stationMode==4) {
secondLine = "<DigiRepeater Active>";

View File

@ -1,5 +1,6 @@
#include <WiFi.h>
#include "configuration.h"
#include "pins_config.h"
#include "wifi_utils.h"
#include "display.h"
@ -32,8 +33,10 @@ void startWiFi() {
Serial.print("\nConnecting to '"); Serial.print(currentWiFi->ssid); Serial.println("' WiFi ...");
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
while (WiFi.status() != WL_CONNECTED) {
digitalWrite(greenLed,HIGH);
Serial.print('.');
delay(1000);
digitalWrite(greenLed,LOW);
if ((millis() - start) > 15000){
if(myWiFiAPIndex >= (myWiFiAPSize-1)) {
myWiFiAPIndex = 0;
@ -47,6 +50,7 @@ void startWiFi() {
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
}
}
digitalWrite(greenLed,LOW);
Serial.print("Connected as ");
Serial.println(WiFi.localIP());
}