mirror of
https://github.com/lora-aprs/LoRa_APRS_iGate.git
synced 2025-12-06 07:42:00 +01:00
add TaskQueue and many other stuff :)
This commit is contained in:
parent
d29982a0c9
commit
33e766a5ac
|
|
@ -66,15 +66,10 @@ bool APRS_IS::sendMessage(const std::shared_ptr<APRSMessage> message)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
_client.println(message->encode());
|
||||
_client.println(message->encode() + "\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
void APRS_IS::action(std::shared_ptr<APRSMessage> elem, int rssi, float snr)
|
||||
{
|
||||
sendMessage(elem);
|
||||
}
|
||||
|
||||
int APRS_IS::available()
|
||||
{
|
||||
return _client.available();
|
||||
|
|
@ -108,6 +103,5 @@ std::shared_ptr<APRSMessage> APRS_IS::getAPRSMessage()
|
|||
}
|
||||
std::shared_ptr<APRSMessage> msg = std::shared_ptr<APRSMessage>(new APRSMessage());
|
||||
msg->decode(line);
|
||||
emit(msg);
|
||||
return msg;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@
|
|||
#ifndef APRS_IS_Lib_h_
|
||||
#define APRS_IS_Lib_h_
|
||||
|
||||
#include <SignalSlot.h>
|
||||
#include <WiFi.h>
|
||||
#include <APRS-Decoder.h>
|
||||
|
||||
class APRS_IS : public Signal1<const std::shared_ptr<APRSMessage>>, public Slot3<std::shared_ptr<APRSMessage>, int, float>
|
||||
class APRS_IS
|
||||
{
|
||||
public:
|
||||
APRS_IS(const String & user, const String & passcode, const String & tool_name, const String & version);
|
||||
|
|
@ -18,7 +17,6 @@ public:
|
|||
|
||||
bool sendMessage(const String & message);
|
||||
bool sendMessage(const std::shared_ptr<APRSMessage> message);
|
||||
void action(std::shared_ptr<APRSMessage> msg, int rssi, float snr) override;
|
||||
|
||||
int available();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ bool LoRa_APRS::checkMessage()
|
|||
}
|
||||
_LastReceivedMsg = std::shared_ptr<APRSMessage>(new APRSMessage());
|
||||
_LastReceivedMsg->decode(str);
|
||||
emit(_LastReceivedMsg, packetRssi(), packetSnr());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -80,8 +79,3 @@ long LoRa_APRS::getTxFrequency() const
|
|||
{
|
||||
return _TxFrequency;
|
||||
}
|
||||
|
||||
void LoRa_APRS::action(const std::shared_ptr<APRSMessage> elem)
|
||||
{
|
||||
sendMessage(elem);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include <Arduino.h>
|
||||
#include <LoRa.h>
|
||||
#include <APRS-Decoder.h>
|
||||
#include <SignalSlot.h>
|
||||
|
||||
#define LORA_RX_FREQUENCY (433775000)
|
||||
#define LORA_TX_FREQUENCY (433900000)
|
||||
|
|
@ -13,7 +12,7 @@
|
|||
#define LORA_SIGNAL_BANDWIDTH (125E3)
|
||||
#define LORA_CODING_RATE4 (5)
|
||||
|
||||
class LoRa_APRS : public LoRaClass, public Slot1<const std::shared_ptr<APRSMessage>>, public Signal3<std::shared_ptr<APRSMessage>, int, float>
|
||||
class LoRa_APRS : public LoRaClass
|
||||
{
|
||||
public:
|
||||
explicit LoRa_APRS(std::shared_ptr<BoardConfig> boardConfig);
|
||||
|
|
@ -29,8 +28,6 @@ public:
|
|||
void setTxFrequency(long frequency);
|
||||
long getTxFrequency() const;
|
||||
|
||||
void action(const std::shared_ptr<APRSMessage> elem) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<APRSMessage> _LastReceivedMsg;
|
||||
long _RxFrequency;
|
||||
|
|
|
|||
|
|
@ -1,116 +0,0 @@
|
|||
#ifndef SIGNAL_SLOT_H_
|
||||
#define SIGNAL_SLOT_H_
|
||||
|
||||
#include <list>
|
||||
|
||||
class Slot0
|
||||
{
|
||||
public:
|
||||
virtual void action() = 0;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class Slot1
|
||||
{
|
||||
public:
|
||||
virtual void action(T elem1) = 0;
|
||||
};
|
||||
|
||||
template <typename T, typename H>
|
||||
class Slot2
|
||||
{
|
||||
public:
|
||||
virtual void action(T elem1, H elem2) = 0;
|
||||
};
|
||||
|
||||
template <typename T, typename H, typename K>
|
||||
class Slot3
|
||||
{
|
||||
public:
|
||||
virtual void action(T elem1, H elem2, K elem3) = 0;
|
||||
};
|
||||
|
||||
class Signal0
|
||||
{
|
||||
public:
|
||||
void emit()
|
||||
{
|
||||
for(Slot0 * slot: _slots)
|
||||
{
|
||||
slot->action();
|
||||
}
|
||||
}
|
||||
|
||||
void connectSlot(Slot0 * slot)
|
||||
{
|
||||
_slots.push_back(slot);
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<Slot0 *> _slots;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class Signal1
|
||||
{
|
||||
public:
|
||||
void emit(T elem1)
|
||||
{
|
||||
for(Slot1<T> * slot: _slots)
|
||||
{
|
||||
slot->action(elem1);
|
||||
}
|
||||
}
|
||||
|
||||
void connectSlot(Slot1<T> * slot)
|
||||
{
|
||||
_slots.push_back(slot);
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<Slot1<T> *> _slots;
|
||||
};
|
||||
|
||||
template <typename T, typename H>
|
||||
class Signal2
|
||||
{
|
||||
public:
|
||||
void emit(T elem1, H elem2)
|
||||
{
|
||||
for(Slot2<T, H> * slot: _slots)
|
||||
{
|
||||
slot->action(elem1, elem2);
|
||||
}
|
||||
}
|
||||
|
||||
void connectSlot(Slot2<T, H> * slot)
|
||||
{
|
||||
_slots.push_back(slot);
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<Slot2<T, H> *> _slots;
|
||||
};
|
||||
|
||||
template <typename T, typename H, typename K>
|
||||
class Signal3
|
||||
{
|
||||
public:
|
||||
void emit(T elem1, H elem2, K elem3)
|
||||
{
|
||||
for(Slot3<T, H, K> * slot: _slots)
|
||||
{
|
||||
slot->action(elem1, elem2, elem3);
|
||||
}
|
||||
}
|
||||
|
||||
void connectSlot(Slot3<T, H, K> * slot)
|
||||
{
|
||||
_slots.push_back(slot);
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<Slot3<T, H, K> *> _slots;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -10,7 +10,7 @@ void TaskManager::addTask(std::shared_ptr<Task> task)
|
|||
_tasks.push_back(task);
|
||||
}
|
||||
|
||||
std::shared_ptr<Task> TaskManager::getTask(String & name)
|
||||
std::shared_ptr<Task> TaskManager::getTask(const char * name)
|
||||
{
|
||||
for(std::shared_ptr<Task> & elem : _tasks)
|
||||
{
|
||||
|
|
@ -22,14 +22,14 @@ std::shared_ptr<Task> TaskManager::getTask(String & name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool TaskManager::setup(std::shared_ptr<Configuration> config)
|
||||
bool TaskManager::setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig)
|
||||
{
|
||||
logPrintlnV("will setup all tasks...");
|
||||
for(std::shared_ptr<Task> & elem : _tasks)
|
||||
{
|
||||
logPrintW("call setup from ");
|
||||
logPrintlnW(elem->getName());
|
||||
if(!elem->setup(config))
|
||||
if(!elem->setup(config, boardConfig))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
#include <memory>
|
||||
#include <Arduino.h>
|
||||
#include <configuration.h>
|
||||
#include <BoardFinder.h>
|
||||
|
||||
#include "TaskQueue.h"
|
||||
|
||||
class Task
|
||||
{
|
||||
|
|
@ -15,7 +18,7 @@ public:
|
|||
|
||||
String getName() const { return _name; }
|
||||
|
||||
virtual bool setup(std::shared_ptr<Configuration> config) = 0;
|
||||
virtual bool setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig) = 0;
|
||||
virtual bool loop(std::shared_ptr<Configuration> config) = 0;
|
||||
|
||||
private:
|
||||
|
|
@ -25,17 +28,27 @@ private:
|
|||
class TaskManager
|
||||
{
|
||||
public:
|
||||
TaskManager();
|
||||
|
||||
static TaskManager & instance()
|
||||
{
|
||||
static TaskManager _instance;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
~TaskManager() {}
|
||||
|
||||
void addTask(std::shared_ptr<Task> task);
|
||||
std::shared_ptr<Task> getTask(String & name);
|
||||
std::shared_ptr<Task> getTask(const char * name);
|
||||
|
||||
bool setup(std::shared_ptr<Configuration> config);
|
||||
bool setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig);
|
||||
bool loop(std::shared_ptr<Configuration> config);
|
||||
|
||||
private:
|
||||
std::list<std::shared_ptr<Task>> _tasks;
|
||||
|
||||
TaskManager();
|
||||
TaskManager(const TaskManager &);
|
||||
TaskManager & operator = (const TaskManager &);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
33
lib/TaskManager/TaskQueue.h
Normal file
33
lib/TaskManager/TaskQueue.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef TASK_QUEUE_H_
|
||||
#define TASK_QUEUE_H_
|
||||
|
||||
#include <list>
|
||||
|
||||
template <typename T>
|
||||
class TaskQueue
|
||||
{
|
||||
public:
|
||||
TaskQueue() {}
|
||||
|
||||
void addElement(T elem)
|
||||
{
|
||||
_elements.push_back(elem);
|
||||
}
|
||||
|
||||
T getElement()
|
||||
{
|
||||
T elem = _elements.front();
|
||||
_elements.pop_front();
|
||||
return elem;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return _elements.empty();
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<T> _elements;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -8,7 +8,7 @@ lib_deps =
|
|||
adafruit/Adafruit SSD1306 @ 2.4.0
|
||||
bblanchon/ArduinoJson @ 6.17.0
|
||||
lewisxhe/AXP202X_Library @ 1.1.2
|
||||
peterus/APRS-Decoder-Lib @ 0.0.5
|
||||
peterus/APRS-Decoder-Lib @ 0.0.6
|
||||
peterus/esp-logger @ 0.0.1
|
||||
peterus/ESP-FTP-Server-Lib @ 0.9.5
|
||||
check_tool = cppcheck
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ String create_long_aprs(double lng);
|
|||
|
||||
std::shared_ptr<Configuration> userConfig;
|
||||
std::shared_ptr<BoardConfig> boardConfig;
|
||||
TaskManager taskManager;
|
||||
HardwareSerial Serial(0);
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
|
|
@ -92,20 +91,18 @@ void setup()
|
|||
|
||||
load_config(boardConfig);
|
||||
|
||||
std::shared_ptr<LoraTask> lora_task = std::shared_ptr<LoraTask>(new LoraTask());
|
||||
lora_task->setup(userConfig, boardConfig);
|
||||
taskManager.addTask(lora_task);
|
||||
TaskManager::instance().addTask(std::shared_ptr<Task>(new LoraTask()));
|
||||
if(boardConfig->Type == eETH_BOARD)
|
||||
{
|
||||
taskManager.addTask(std::shared_ptr<Task>(new EthTask()));
|
||||
TaskManager::instance().addTask(std::shared_ptr<Task>(new EthTask()));
|
||||
}
|
||||
taskManager.addTask(std::shared_ptr<Task>(new WifiTask()));
|
||||
taskManager.addTask(std::shared_ptr<Task>(new OTATask()));
|
||||
taskManager.addTask(std::shared_ptr<Task>(new NTPTask()));
|
||||
taskManager.addTask(std::shared_ptr<Task>(new FTPTask()));
|
||||
taskManager.addTask(std::shared_ptr<Task>(new AprsIsTask()));
|
||||
TaskManager::instance().addTask(std::shared_ptr<Task>(new WifiTask()));
|
||||
TaskManager::instance().addTask(std::shared_ptr<Task>(new OTATask()));
|
||||
TaskManager::instance().addTask(std::shared_ptr<Task>(new NTPTask()));
|
||||
TaskManager::instance().addTask(std::shared_ptr<Task>(new FTPTask()));
|
||||
TaskManager::instance().addTask(std::shared_ptr<Task>(new AprsIsTask()));
|
||||
|
||||
taskManager.setup(userConfig);
|
||||
TaskManager::instance().setup(userConfig, boardConfig);
|
||||
|
||||
if(userConfig->display.overwritePin != 0)
|
||||
{
|
||||
|
|
@ -120,7 +117,7 @@ void setup()
|
|||
// cppcheck-suppress unusedFunction
|
||||
void loop()
|
||||
{
|
||||
taskManager.loop(userConfig);
|
||||
TaskManager::instance().loop(userConfig);
|
||||
}
|
||||
|
||||
String create_lat_aprs(double lat)
|
||||
|
|
|
|||
12
src/Task.h
Normal file
12
src/Task.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef TASK_H_
|
||||
#define TASK_H_
|
||||
|
||||
#define TASK_APRS_IS "AprsIsTask"
|
||||
#define TASK_ETH "EthTask"
|
||||
#define TASK_FTP "FTPTask"
|
||||
#define TASK_LORA "LoraTask"
|
||||
#define TASK_NTP "NTPTask"
|
||||
#define TASK_OTA "OTATask"
|
||||
#define TASK_WIFI "WifiTask"
|
||||
|
||||
#endif
|
||||
|
|
@ -2,12 +2,13 @@
|
|||
#include <TimeLib.h>
|
||||
#include "project_configuration.h"
|
||||
#include "TaskAprsIs.h"
|
||||
#include "Task.h"
|
||||
|
||||
String create_lat_aprs(double lat);
|
||||
String create_long_aprs(double lng);
|
||||
|
||||
AprsIsTask::AprsIsTask()
|
||||
: Task("AprsIsTask")
|
||||
: Task(TASK_APRS_IS), _beacon_next_time(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ AprsIsTask::~AprsIsTask()
|
|||
{
|
||||
}
|
||||
|
||||
bool AprsIsTask::setup(std::shared_ptr<Configuration> config)
|
||||
bool AprsIsTask::setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig)
|
||||
{
|
||||
_aprs_is = std::shared_ptr<APRS_IS>(new APRS_IS(config->callsign, config->aprs_is.passcode , "ESP32-APRS-IS", "0.1"));
|
||||
connect(config);
|
||||
|
|
@ -38,6 +39,12 @@ bool AprsIsTask::loop(std::shared_ptr<Configuration> config)
|
|||
}
|
||||
_aprs_is->getAPRSMessage();
|
||||
|
||||
if(!inputQueue.empty())
|
||||
{
|
||||
std::shared_ptr<APRSMessage> msg = inputQueue.getElement();
|
||||
_aprs_is->sendMessage(msg);
|
||||
}
|
||||
|
||||
if(_beacon_next_time < now())
|
||||
{
|
||||
//show_display(userConfig->callsign, "Beacon to APRS-IS Server...");
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@ public:
|
|||
AprsIsTask();
|
||||
virtual ~AprsIsTask();
|
||||
|
||||
virtual bool setup(std::shared_ptr<Configuration> config) override;
|
||||
virtual bool setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig) override;
|
||||
virtual bool loop(std::shared_ptr<Configuration> config) override;
|
||||
|
||||
TaskQueue<std::shared_ptr<APRSMessage>> inputQueue;
|
||||
|
||||
private:
|
||||
std::shared_ptr<APRS_IS> _aprs_is;
|
||||
std::shared_ptr<APRSMessage> _beaconMsg;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <ETH.h>
|
||||
#include <logger.h>
|
||||
#include "TaskEth.h"
|
||||
#include "Task.h"
|
||||
|
||||
volatile bool eth_connected = false;
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ static void WiFiEvent(WiFiEvent_t event)
|
|||
}
|
||||
|
||||
EthTask::EthTask()
|
||||
: Task("EthTask")
|
||||
: Task(TASK_ETH)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +51,7 @@ EthTask::~EthTask()
|
|||
{
|
||||
}
|
||||
|
||||
bool EthTask::setup(std::shared_ptr<Configuration> config)
|
||||
bool EthTask::setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig)
|
||||
{
|
||||
WiFi.onEvent(WiFiEvent);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public:
|
|||
EthTask();
|
||||
virtual ~EthTask();
|
||||
|
||||
virtual bool setup(std::shared_ptr<Configuration> config) override;
|
||||
virtual bool setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig) override;
|
||||
virtual bool loop(std::shared_ptr<Configuration> config) override;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
#include <logger.h>
|
||||
#include "project_configuration.h"
|
||||
#include "TaskFTP.h"
|
||||
#include "Task.h"
|
||||
|
||||
FTPTask::FTPTask()
|
||||
: Task("FTPTask")
|
||||
: Task(TASK_FTP)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -13,7 +14,7 @@ FTPTask::~FTPTask()
|
|||
{
|
||||
}
|
||||
|
||||
bool FTPTask::setup(std::shared_ptr<Configuration> config)
|
||||
bool FTPTask::setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig)
|
||||
{
|
||||
_ftpServer = std::shared_ptr<FTPServer>(new FTPServer());
|
||||
if(config->ftp.active)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public:
|
|||
FTPTask();
|
||||
virtual ~FTPTask();
|
||||
|
||||
virtual bool setup(std::shared_ptr<Configuration> config) override;
|
||||
virtual bool setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig) override;
|
||||
virtual bool loop(std::shared_ptr<Configuration> config) override;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
#include <logger.h>
|
||||
#include <TimeLib.h>
|
||||
#include "project_configuration.h"
|
||||
#include "TaskLora.h"
|
||||
#include "TaskAprsIs.h"
|
||||
#include "Task.h"
|
||||
|
||||
LoraTask::LoraTask()
|
||||
: Task("LoraTask")
|
||||
: Task(TASK_LORA)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -11,11 +14,6 @@ LoraTask::~LoraTask()
|
|||
{
|
||||
}
|
||||
|
||||
bool LoraTask::setup(std::shared_ptr<Configuration> config)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoraTask::setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig)
|
||||
{
|
||||
_lora_aprs = std::shared_ptr<LoRa_APRS>(new LoRa_APRS(boardConfig));
|
||||
|
|
@ -40,6 +38,19 @@ bool LoraTask::setup(std::shared_ptr<Configuration> config, std::shared_ptr<Boar
|
|||
|
||||
bool LoraTask::loop(std::shared_ptr<Configuration> config)
|
||||
{
|
||||
_lora_aprs->checkMessage();
|
||||
if(_lora_aprs->checkMessage())
|
||||
{
|
||||
std::shared_ptr<APRSMessage> msg = _lora_aprs->getMessage();
|
||||
//msg->getAPRSBody()->setData(msg->getAPRSBody()->getData() + " 123");
|
||||
logPrintD("[" + timeString() + "] ");
|
||||
logPrintD("Received packet '");
|
||||
logPrintD(msg->toString());
|
||||
logPrintD("' with RSSI ");
|
||||
logPrintD(String(_lora_aprs->packetRssi()));
|
||||
logPrintD(" and SNR ");
|
||||
logPrintlnD(String(_lora_aprs->packetSnr()));
|
||||
std::shared_ptr<AprsIsTask> is_thread = std::static_pointer_cast<AprsIsTask>(TaskManager::instance().getTask(TASK_APRS_IS));
|
||||
is_thread->inputQueue.addElement(msg);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@ public:
|
|||
LoraTask();
|
||||
virtual ~LoraTask();
|
||||
|
||||
virtual bool setup(std::shared_ptr<Configuration> config) override;
|
||||
virtual bool setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig) override;
|
||||
virtual bool loop(std::shared_ptr<Configuration> config) override;
|
||||
bool setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig);
|
||||
|
||||
private:
|
||||
std::shared_ptr<LoRa_APRS> _lora_aprs;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
#include <TimeLib.h>
|
||||
#include "project_configuration.h"
|
||||
#include "TaskNTP.h"
|
||||
#include "Task.h"
|
||||
|
||||
NTPTask::NTPTask()
|
||||
: Task("NTPTask")
|
||||
: Task(TASK_NTP)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -12,7 +13,7 @@ NTPTask::~NTPTask()
|
|||
{
|
||||
}
|
||||
|
||||
bool NTPTask::setup(std::shared_ptr<Configuration> config)
|
||||
bool NTPTask::setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig)
|
||||
{
|
||||
_ntpClient = std::shared_ptr<NTPClient>(new NTPClient(config->ntpServer.c_str()));
|
||||
_ntpClient->begin();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public:
|
|||
NTPTask();
|
||||
virtual ~NTPTask();
|
||||
|
||||
virtual bool setup(std::shared_ptr<Configuration> config) override;
|
||||
virtual bool setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig) override;
|
||||
virtual bool loop(std::shared_ptr<Configuration> config) override;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
#include <logger.h>
|
||||
#include "project_configuration.h"
|
||||
#include "TaskOTA.h"
|
||||
#include "Task.h"
|
||||
|
||||
OTATask::OTATask()
|
||||
: Task("OTATask")
|
||||
: Task(TASK_OTA)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -11,7 +12,7 @@ OTATask::~OTATask()
|
|||
{
|
||||
}
|
||||
|
||||
bool OTATask::setup(std::shared_ptr<Configuration> config)
|
||||
bool OTATask::setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig)
|
||||
{
|
||||
_ota = std::shared_ptr<ArduinoOTAClass>(new ArduinoOTAClass());
|
||||
_ota->onStart([&]()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public:
|
|||
OTATask();
|
||||
virtual ~OTATask();
|
||||
|
||||
virtual bool setup(std::shared_ptr<Configuration> config) override;
|
||||
virtual bool setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig) override;
|
||||
virtual bool loop(std::shared_ptr<Configuration> config) override;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
#include <logger.h>
|
||||
#include "project_configuration.h"
|
||||
#include "TaskWifi.h"
|
||||
#include "Task.h"
|
||||
|
||||
WifiTask::WifiTask()
|
||||
: Task("WifiTask")
|
||||
: Task(TASK_WIFI)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -12,7 +13,7 @@ WifiTask::~WifiTask()
|
|||
{
|
||||
}
|
||||
|
||||
bool WifiTask::setup(std::shared_ptr<Configuration> config)
|
||||
bool WifiTask::setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig)
|
||||
{
|
||||
//WiFi.onEvent(WiFiEvent);
|
||||
//WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public:
|
|||
WifiTask();
|
||||
virtual ~WifiTask();
|
||||
|
||||
virtual bool setup(std::shared_ptr<Configuration> config) override;
|
||||
virtual bool setup(std::shared_ptr<Configuration> config, std::shared_ptr<BoardConfig> boardConfig) override;
|
||||
virtual bool loop(std::shared_ptr<Configuration> config) override;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -13,11 +13,10 @@ void show_display(String header, String line1, String line2, String line3, int w
|
|||
//void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait = 0);
|
||||
|
||||
#include <APRSMessage.h>
|
||||
#include "SignalSlot.h"
|
||||
#include "TimeLib.h"
|
||||
#include "logger.h"
|
||||
|
||||
class PrintMessageToConsole : public Slot1<std::shared_ptr<APRSMessage>>, public Slot3<std::shared_ptr<APRSMessage>, int, float>
|
||||
/*class PrintMessageToConsole : public Slot1<std::shared_ptr<APRSMessage>>, public Slot3<std::shared_ptr<APRSMessage>, int, float>
|
||||
{
|
||||
public:
|
||||
void action(std::shared_ptr<APRSMessage> msg, int rssi, float snr) override
|
||||
|
|
@ -42,6 +41,6 @@ public:
|
|||
logPrintD(msg->toString());
|
||||
logPrintD("'");
|
||||
}
|
||||
};
|
||||
};*/
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue