mirror of
https://github.com/lora-aprs/LoRa_APRS_iGate.git
synced 2026-01-05 08:09:58 +01:00
add ftp server, config still missing
This commit is contained in:
parent
88ff8f4c53
commit
bc56f8af4a
|
|
@ -15,6 +15,7 @@ lib_deps =
|
|||
sandeepmistry/LoRa @ 0.7.2
|
||||
peterus/APRS-Decoder-Lib @ 0.0.5
|
||||
peterus/APRS-IS-Lib @ 0.0.7
|
||||
https://github.com/peterus/ESP-FTP-Server-Lib
|
||||
peterus/LoRa-APRS-Lib @ 0.0.5
|
||||
check_tool = cppcheck
|
||||
check_flags =
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
#include <WiFiUdp.h>
|
||||
#include <ArduinoOTA.h>
|
||||
#include <APRS-IS.h>
|
||||
#include <SPIFFS.h>
|
||||
#include <ESP-FTP-Server-Lib.h>
|
||||
#include <FTPFilesystem.h>
|
||||
|
||||
#include "LoRa_APRS.h"
|
||||
|
||||
|
|
@ -28,6 +31,7 @@ volatile uint secondsSinceDisplay = 0;
|
|||
WiFiMulti WiFiMulti;
|
||||
WiFiUDP ntpUDP;
|
||||
NTPClient timeClient(ntpUDP, 60*60);
|
||||
FTPServer ftpServer;
|
||||
Configuration Config;
|
||||
APRS_IS * aprs_is = 0;
|
||||
LoRa_APRS lora_aprs;
|
||||
|
|
@ -43,6 +47,7 @@ void setup_lora();
|
|||
void setup_ntp();
|
||||
void setup_aprs_is();
|
||||
void setup_timer();
|
||||
void setup_ftp();
|
||||
|
||||
std::map<uint, std::shared_ptr<APRSMessage>> lastMessages;
|
||||
|
||||
|
|
@ -77,6 +82,7 @@ void setup()
|
|||
setup_wifi();
|
||||
setup_ota();
|
||||
setup_ntp();
|
||||
setup_ftp();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -133,6 +139,19 @@ void loop()
|
|||
beacon_digi = true;
|
||||
}
|
||||
|
||||
ftpServer.handle();
|
||||
static bool configWasOpen = false;
|
||||
if(configWasOpen && ftpServer.countConnections() == 0)
|
||||
{
|
||||
Serial.println("[WARN] Configuration maybe changed via FTP, will restart now...");
|
||||
Serial.println();
|
||||
ESP.restart();
|
||||
}
|
||||
if(ftpServer.countConnections() > 0)
|
||||
{
|
||||
configWasOpen = true;
|
||||
}
|
||||
|
||||
if(Config.wifi.active) ArduinoOTA.handle();
|
||||
if(Config.wifi.active && WiFiMulti.run() != WL_CONNECTED)
|
||||
{
|
||||
|
|
@ -424,6 +443,16 @@ void setup_timer()
|
|||
timerAlarmEnable(timer);
|
||||
}
|
||||
|
||||
void setup_ftp()
|
||||
{
|
||||
#define FTP_USER "ftp"
|
||||
#define FTP_PASSWORD "ftp"
|
||||
ftpServer.addUser(FTP_USER, FTP_PASSWORD);
|
||||
ftpServer.addFilesystem("SPIFFS", &SPIFFS);
|
||||
ftpServer.begin();
|
||||
Serial.println("[INFO] FTP Server init done!");
|
||||
}
|
||||
|
||||
String create_lat_aprs(double lat)
|
||||
{
|
||||
char str[20];
|
||||
|
|
|
|||
Loading…
Reference in a new issue