This commit is contained in:
richonguzman 2023-08-28 23:21:20 -04:00
parent 1b28beb3f4
commit 0870ae39d8
6 changed files with 45 additions and 15 deletions

View file

@ -1,13 +1,13 @@
{
"callsign": "CD2RXU-11",
"stationMode": 2,
"callsign": "NOCALL-10",
"stationMode": 1,
"iGateComment": "LoRa_APRS_iGate",
"wifi": {
"AP": [
{ "ssid": "Richon",
"password": "k4fPnmg5qnyf",
"latitude": -32.8805195,
"longitude": -71.4282433
{ "ssid": "Wifi_1",
"password": "wifi_1_password",
"latitude": 0.0000000,
"longitude": 0.0000000
},
{ "ssid": "Wifi_2",
"password": "wifi_2_password",
@ -22,8 +22,8 @@
"longitude": 0.0000000
},
"aprs_is": {
"passcode": "23201",
"server": "soam.aprs2.net",
"passcode": "VWXYZ",
"server": "euro.aprs2.net",
"port": 14580,
"reportingDistance": 30
},
@ -50,8 +50,8 @@
"active": false
},
"ota": {
"username":"richon",
"password": "totoro"
"username":"",
"password": ""
},
"other": {
"beaconInterval": 15,

16
data/script.js Normal file
View file

@ -0,0 +1,16 @@
// Retrieve JSON data from the JSON file in SPIFFS
fetch('igate_conf.json')
.then(response => response.json())
.then(data => {
// Process the JSON data
displayJSONData(data);
})
.catch(error => {
console.error('Error fetching JSON:', error);
});
// Display JSON data in the HTML
function displayJSONData(data) {
const jsonContainer = document.getElementById('json-container');
jsonContainer.innerHTML = JSON.stringify(data, null, 2);
}

10
data/testx.html Normal file
View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>JSON Data Example</title>
</head>
<body>
<div id="json-container"></div>
<script src="script.js"></script>
</body>
</html>

View file

@ -20,7 +20,7 @@
Configuration Config;
WiFiClient espClient;
String versionDate = "2023.08.27";
String versionDate = "2023.08.29";
int myWiFiAPIndex = 0;
int myWiFiAPSize = Config.wifiAPs.size();
WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex];
@ -53,7 +53,7 @@ void setup() {
LoRa_Utils::setup();
Utils::validateDigiFreqs();
iGateBeaconPacket = GPS_Utils::generateBeacon();
Utils::startOTAServer();
Utils::startServer();
SYSLOG_Utils::setup();
BME_Utils::setup();
}
@ -77,7 +77,7 @@ void loop() {
if (lastStationModeState == 1) {
iGateBeaconPacket = GPS_Utils::generateBeacon();
lastStationModeState = 0;
Utils::startOTAServer();
Utils::startServer();
}
APRS_IS_Utils::loop();
} else { // DigiRepeater Mode

View file

@ -262,7 +262,7 @@ void typeOfPacket(String packet, String packetType) {
}
}
void startOTAServer() {
void startServer() {
if (stationMode==1 || stationMode==2 || (stationMode==5 && WiFi.status() == WL_CONNECTED)) {
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send(200, "text/plain", "Hi " + Config.callsign + ", \n\nthis is your (Richonguzman/CD2RXU) LoRa iGate , version " + versionDate + ".\n\nTo update your firmware or filesystem go to: http://" + getLocalIP().substring(getLocalIP().indexOf(":")+3) + "/update\n\n\n73!");
@ -276,6 +276,10 @@ void startOTAServer() {
request->send(LittleFS, "/index2.html", "text/html");
});
server.on("/testx", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send(LittleFS, "/testx.html", "text/html");//"application/json");
});
if (Config.ota.username != "" && Config.ota.password != "") {
AsyncElegantOTA.begin(&server, Config.ota.username.c_str(), Config.ota.password.c_str());
} else {

View file

@ -14,7 +14,7 @@ void checkDisplayInterval();
void checkWiFiInterval();
void validateDigiFreqs();
void typeOfPacket(String packet, String packetType);
void startOTAServer();
void startServer();
}