refactor: remove ESP8266 support and legacy flash wrappers

This commit is contained in:
Yurii committed 2026-10-21 04:34:00 +03:00
1 parent 959a15c11f
commit b72bccb3d7
24 files changed
+2027 -2415

No files matched your search

-24
View File
@@ -1,24 +0,0 @@
#include <WiFiClient.h>
class MqttWiFiClient : public WiFiClient {
public:
#ifdef ARDUINO_ARCH_ESP8266
void flush() override {
if (this->connected()) {
WiFiClient::flush(0);
}
}
void stop() override {
this->abort();
}
#endif
#ifdef ARDUINO_ARCH_ESP32
void setSync(bool) {}
bool getSync() {
return false;
}
#endif
};
-16
View File
@@ -1,9 +1,7 @@
#pragma once
#include <Arduino.h>
#include <MqttClient.h>
#ifdef ARDUINO_ARCH_ESP32
#include <mutex>
#endif
class MqttWriter {
@@ -17,17 +15,13 @@ public:
this->bufferSize = bufferSize;
this->buffer = static_cast<uint8_t*>(malloc(bufferSize * sizeof(*this->buffer)));
#ifdef ARDUINO_ARCH_ESP32
this->mutex = new std::mutex();
#endif
}
~MqttWriter() {
free(this->buffer);
#ifdef ARDUINO_ARCH_ESP32
delete this->mutex;
#endif
}
MqttWriter* setYieldCallback(YieldCallback callback = nullptr) {
@@ -49,15 +43,9 @@ public:
}
bool lock() {
#ifdef ARDUINO_ARCH_ESP32
if (!this->mutex->try_lock()) {
return false;
}
#else
if (this->isLocked()) {
return false;
}
#endif
this->locked = true;
this->writeAfterLock = 0;
@@ -72,9 +60,7 @@ public:
void unlock() {
this->locked = false;
#if defined(ARDUINO_ARCH_ESP32)
this->mutex->unlock();
#endif
}
bool publish(const char* topic, const JsonVariantConst doc, bool retained = false) {
@@ -212,9 +198,7 @@ protected:
size_t bufferSize = 64;
size_t bufferPos = 0;
bool locked = false;
#ifdef ARDUINO_ARCH_ESP32
mutable std::mutex* mutex;
#endif
unsigned long lockedTime = 0;
size_t writeAfterLock = 0;
};