new screen 0.1

This commit is contained in:
richonguzman 2023-06-16 19:08:25 -04:00
parent 2300e05b47
commit 3c87e6515a
10 changed files with 159 additions and 54 deletions

View file

@ -1,28 +1,28 @@
{
"callsign": "NOCALL-10",
"stationMode": 1,
"callsign": "CD2RXU-11",
"stationMode": 2,
"iGateComment": "LoRa_APRS_iGate",
"wifi": {
"AP": [
{ "ssid": "WIFI_1",
"password": "password_1",
"latitude": 0.0000000,
"longitude": 0.0000000
{ "ssid": "Richon",
"password": "k4fPnmg5qnyf",
"latitude": -33.0338131,
"longitude": -71.5737237
},
{ "ssid": "WIFI_2",
"password": "password_2",
"latitude": 0.0000000,
"longitude": 0.0000000
{ "ssid": "Jimenita",
"password": "mg6wyMhqRnxk",
"latitude": -33.0312492,
"longitude": -71.5796215
}
]
},
"digi": {
"comment": "LoRa_APRS_Digirepeater",
"latitude": 0.0000000,
"longitude": 0.0000000
"latitude": -33.0338131,
"longitude": -71.5737237
},
"aprs_is": {
"passcode": "VWXYZ",
"passcode": "23201",
"server": "soam.aprs2.net",
"port": 14580,
"reportingDistance": 30
@ -41,12 +41,12 @@
"timeout": 4
},
"syslog": {
"active": false,
"server": "192.168.0.100",
"active": true,
"server": "192.168.20.10",
"port": 514
},
"other": {
"beaconInterval": 15,
"beaconInterval": 5,
"rememberStationTime": 30
}
}

View file

@ -19,7 +19,7 @@ Configuration Config;
WiFiClient espClient;
String versionDate = "2023.06.13";
String versionDate = "2023.06.16";
int myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
@ -34,7 +34,7 @@ uint32_t lastScreenOn = millis();
std::vector<String> lastHeardStation;
std::vector<String> lastHeardStation_temp;
String firstLine, secondLine, thirdLine, fourthLine, iGateBeaconPacket;
String firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, iGateBeaconPacket;
void setup() {
Serial.begin(115200);
@ -55,8 +55,8 @@ void loop() {
if (!espClient.connected()) {
APRS_IS_Utils::connect();
}
secondLine = APRS_IS_Utils::checkStatus();
show_display(firstLine, secondLine, thirdLine, fourthLine, 0);
APRS_IS_Utils::checkStatus();
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
while (espClient.connected()) {
Utils::checkDisplayInterval();
Utils::checkBeaconInterval();

View file

@ -16,6 +16,10 @@ extern String firstLine;
extern String secondLine;
extern String thirdLine;
extern String fourthLine;
extern String fifthLine;
extern String sixthLine;
extern String seventhLine;
extern String eigthLine;
namespace APRS_IS_Utils {
@ -43,7 +47,7 @@ void connect(){
}
}
String checkStatus() {
void checkStatus() {
String wifiState, aprsisState;
if (WiFi.status() == WL_CONNECTED) {
wifiState = "OK";
@ -63,7 +67,7 @@ String checkStatus() {
}
lastScreenOn = millis();
}
return "WiFi: " + wifiState + "/ APRS-IS: " + aprsisState;
secondLine = "WiFi: " + wifiState + "/ APRS-IS: " + aprsisState;
}
String createPacket(String packet) {
@ -110,7 +114,7 @@ void processLoRaPacket(String packet) {
}
LoRa_Utils::sendNewPacket("APRS", QUERY_Utils::process(receivedMessage, Sender, "LoRa"));
lastScreenOn = millis();
show_display(firstLine, secondLine, "Callsign = " + Sender, "TYPE --> QUERY", 0);
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "Callsign = " + Sender, "TYPE --> QUERY", 0);
}
}
}
@ -125,7 +129,7 @@ void processLoRaPacket(String packet) {
Serial.println(" ---> Uploaded to APRS-IS");
STATION_Utils::updateLastHeard(Sender);
Utils::typeOfPacket(aprsPacket);
show_display(firstLine, secondLine, thirdLine, fourthLine, 0);
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
}
}
} else {
@ -167,7 +171,7 @@ void processAPRSISPacket(String packet) {
lastScreenOn = millis();
delay(500);
espClient.write(queryAnswer.c_str());
show_display(firstLine, secondLine, "Callsign = " + Sender, "TYPE --> QUERY", 1000);
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "Callsign = " + Sender, "TYPE --> QUERY", 1000);
}
} else {
Serial.print("Received from APRS-IS : " + packet);
@ -176,7 +180,7 @@ void processAPRSISPacket(String packet) {
display_toggle(true);
lastScreenOn = millis();
Utils::typeOfPacket(packet);
show_display(firstLine, secondLine, Sender + " -> " + Addressee, fourthLine, 0);
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, Sender + " -> " + Addressee, eigthLine, 0);
}
}
}

View file

@ -6,7 +6,7 @@
namespace APRS_IS_Utils {
void connect();
String checkStatus();
void checkStatus();
String createPacket(String unprocessedPacket);
void processLoRaPacket(String packet);
void processAPRSISPacket(String packet);

View file

@ -67,7 +67,7 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
void Configuration::validateConfigFile(String currentBeaconCallsign) {
if (currentBeaconCallsign == "NOCALL-10") {
Serial.println("Change Callsign in /data/igate_conf.json");
show_display("ERROR", "Change your settings", "'igate_conf.json'", "--> File System image", 0);
show_display("------- ERROR -------", "Change your settings", "on 'igate_conf.json'", "--> File System image", 0);
while (true) {
delay(1000);
}

View file

@ -90,4 +90,96 @@ void show_display(String line1, String line2, String line3, String line4, int wa
display.ssd1306_command(1);
display.display();
delay(wait);
}
void show_display(String line1, String line2, String line3, String line4, String line5, int wait) {
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.println(line1);
display.setCursor(0, 8);
display.println(line2);
display.setCursor(0, 16);
display.println(line3);
display.setCursor(0, 24);
display.println(line4);
display.setCursor(0, 32);
display.println(line5);
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1);
display.display();
delay(wait);
}
void show_display(String line1, String line2, String line3, String line4, String line5, String line6, int wait) {
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.println(line1);
display.setCursor(0, 8);
display.println(line2);
display.setCursor(0, 16);
display.println(line3);
display.setCursor(0, 24);
display.println(line4);
display.setCursor(0, 32);
display.println(line5);
display.setCursor(0, 40);
display.println(line6);
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1);
display.display();
delay(wait);
}
void show_display(String line1, String line2, String line3, String line4, String line5, String line6, String line7, int wait) {
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.println(line1);
display.setCursor(0, 8);
display.println(line2);
display.setCursor(0, 16);
display.println(line3);
display.setCursor(0, 24);
display.println(line4);
display.setCursor(0, 32);
display.println(line5);
display.setCursor(0, 40);
display.println(line6);
display.setCursor(0, 48);
display.println(line7);
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1);
display.display();
delay(wait);
}
void show_display(String line1, String line2, String line3, String line4, String line5, String line6, String line7, String line8, int wait) {
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.println(line1);
display.setCursor(0, 8);
display.println(line2);
display.setCursor(0, 16);
display.println(line3);
display.setCursor(0, 24);
display.println(line4);
display.setCursor(0, 32);
display.println(line5);
display.setCursor(0, 40);
display.println(line6);
display.setCursor(0, 48);
display.println(line7);
display.setCursor(0, 56);
display.println(line8);
display.ssd1306_command(SSD1306_SETCONTRAST);
display.ssd1306_command(1);
display.display();
delay(wait);
}

View file

@ -4,7 +4,7 @@
#include <Arduino.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
@ -15,5 +15,9 @@ void show_display(String line1, int wait = 0);
void show_display(String line1, String line2, int wait = 0);
void show_display(String line1, String line2, String line3, int wait = 0);
void show_display(String line1, String line2, String line3, String line4, int wait = 0);
void show_display(String line1, String line2, String line3, String line4, String line5, int wait = 0);
void show_display(String line1, String line2, String line3, String line4, String line5, String line6, int wait = 0);
void show_display(String line1, String line2, String line3, String line4, String line5, String line6, String line7, int wait = 0);
void show_display(String line1, String line2, String line3, String line4, String line5, String line6, String line7, String line8, int wait = 0);
#endif

View file

@ -22,6 +22,10 @@ extern String firstLine;
extern String secondLine;
extern String thirdLine;
extern String fourthLine;
extern String fifthLine;
extern String sixthLine;
extern String seventhLine;
extern String eigthLine;
extern uint32_t lastBeaconTx;
extern uint32_t lastScreenOn;
extern bool beacon_update;
@ -51,24 +55,24 @@ void processStatus() {
statusAfterBoot = false;
}
String getLocalIP() {
return "IP : " + String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(WiFi.localIP()[3]);
}
void setupDiplay() {
setup_display();
digitalWrite(greenLed,HIGH);
Serial.println("\nStarting iGate: " + Config.callsign + " Version: " + versionDate);
show_display(" LoRa APRS iGate", " Richonguzman", " -- CD2RXU --", " " + versionDate, 4000);
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>";
} else {
secondLine = "";
}
thirdLine = "";
fourthLine = " listening...";
}
String getLocalIP() {
return "IP : " + String(WiFi.localIP()[0]) + "." + String(WiFi.localIP()[1]) + "." + String(WiFi.localIP()[2]) + "." + String(WiFi.localIP()[3]);
}
seventhLine = "";
eigthLine = " listening...";
}
void checkBeaconInterval() {
@ -78,17 +82,18 @@ void checkBeaconInterval() {
}
if (beacon_update) {
display_toggle(true);
//thirdLine = getLocalIP();
Serial.println("---- Sending iGate Beacon ----");
if (stationMode==1 || stationMode==2) {
show_display(firstLine, secondLine, thirdLine, "SENDING iGate BEACON", 1000);
thirdLine = getLocalIP();
fourthLine = " listening...";
seventhLine = "";
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, "SENDING iGate BEACON", 1000);
eigthLine = " listening...";
espClient.write((iGateBeaconPacket + "\n").c_str());
show_display(firstLine, secondLine, thirdLine, fourthLine, 0);
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, eigthLine, 0);
} else if (stationMode==3 || stationMode==4) {
show_display(firstLine, secondLine, thirdLine, "SENDING iGate BEACON", 0);
fourthLine = " listening...";
seventhLine = "";
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, "SENDING iGate BEACON", 0);
eigthLine = " listening...";
if (stationMode == 4) {
LoRa_Utils::changeFreqTx();
}
@ -127,18 +132,18 @@ void validateDigiFreqs() {
void typeOfPacket(String packet) {
if (stationMode==1 || stationMode==2) {
thirdLine = "Callsign = " + packet.substring(0,packet.indexOf(">"));
seventhLine = "Callsign = " + packet.substring(0,packet.indexOf(">"));
} else {
thirdLine = "Callsign = " + packet.substring(3,packet.indexOf(">"));
seventhLine = "Callsign = " + packet.substring(3,packet.indexOf(">"));
}
if (packet.indexOf("::") >= 10) {
fourthLine = "TYPE ----> MESSAGE";
eigthLine = "TYPE ----> MESSAGE";
} else if (packet.indexOf(":>") >= 10) {
fourthLine = "TYPE ----> NEW STATUS";
eigthLine = "TYPE ----> NEW STATUS";
} else if (packet.indexOf(":!") >= 10 || packet.indexOf(":=") >= 10) {
fourthLine = "TYPE ----> GPS BEACON";
eigthLine = "TYPE ----> GPS BEACON";
} else {
fourthLine = "TYPE ----> ??????????";
eigthLine = "TYPE ----> ??????????";
}
}

View file

@ -6,8 +6,8 @@
namespace Utils {
void processStatus();
void setupDiplay();
String getLocalIP();
void setupDiplay();
void checkBeaconInterval();
void checkDisplayInterval();
void validateDigiFreqs();

View file

@ -29,7 +29,7 @@ void startWiFi() {
WiFi.disconnect();
delay(500);
unsigned long start = millis();
show_display("", "Connecting to Wifi:", currentWiFi->ssid + " ...", 0);
show_display("", "", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
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) {
@ -48,7 +48,7 @@ void startWiFi() {
currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
start = millis();
Serial.print("\nConnecting to WiFi '"); Serial.print(currentWiFi->ssid); Serial.println("' ...");
show_display("", "Connecting to Wifi:", currentWiFi->ssid + " ...", 0);
show_display("", "", "Connecting to Wifi:", "", currentWiFi->ssid + " ...", 0);
WiFi.disconnect();
WiFi.begin(currentWiFi->ssid.c_str(), currentWiFi->password.c_str());
}
@ -56,7 +56,7 @@ void startWiFi() {
digitalWrite(greenLed,LOW);
Serial.print("Connected as ");
Serial.println(WiFi.localIP());
show_display("", " Connected!", " ( " + currentWiFi->ssid + " )", 1000);
show_display("", "", " Connected!!", 1000);
}
void setup() {
@ -78,7 +78,7 @@ void setup() {
btStop();
} else {
Serial.println("stationMode ---> NOT VALID, check '/data/igate_conf.json'");
show_display("stationMode Not Valid", "change it on : /data/", "igate_conf.json", 0);
show_display("------- ERROR -------", "stationMode Not Valid", "change it on : /data/", "igate_conf.json", 0);
while (1);
}
}