mirror of
https://github.com/lora-aprs/LoRa_APRS_iGate.git
synced 2026-03-16 18:24:43 +01:00
remove smart pointer from ota
This commit is contained in:
parent
b16ea9dd81
commit
7a6473e30e
|
|
@ -11,10 +11,9 @@ OTATask::~OTATask() {
|
|||
}
|
||||
|
||||
bool OTATask::setup(System &system) {
|
||||
_ota = std::shared_ptr<ArduinoOTAClass>(new ArduinoOTAClass());
|
||||
_ota->onStart([&]() {
|
||||
_ota.onStart([&]() {
|
||||
String type;
|
||||
if (_ota->getCommand() == U_FLASH)
|
||||
if (_ota.getCommand() == U_FLASH)
|
||||
type = "sketch";
|
||||
else // U_SPIFFS
|
||||
type = "filesystem";
|
||||
|
|
@ -44,16 +43,16 @@ bool OTATask::setup(System &system) {
|
|||
else if (error == OTA_END_ERROR)
|
||||
logPrintlnE("End Failed");
|
||||
});
|
||||
_ota->setHostname(system.getUserConfig()->callsign.c_str());
|
||||
_ota.setHostname(system.getUserConfig()->callsign.c_str());
|
||||
_stateInfo = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OTATask::loop(System &system) {
|
||||
if (!_beginCalled) {
|
||||
_ota->begin();
|
||||
_ota.begin();
|
||||
_beginCalled = true;
|
||||
}
|
||||
_ota->handle();
|
||||
_ota.handle();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ public:
|
|||
virtual bool loop(System &system) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ArduinoOTAClass> _ota;
|
||||
bool _beginCalled;
|
||||
ArduinoOTAClass _ota;
|
||||
bool _beginCalled;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue