This commit is contained in:
J. Nick Koston 2025-06-29 22:24:28 -05:00
parent 8563a5785f
commit 727161f1db
No known key found for this signature in database
4 changed files with 9 additions and 2 deletions

View File

@ -47,7 +47,9 @@ void CaptivePortal::start() {
this->base_->init(); this->base_->init();
if (!this->initialized_) { if (!this->initialized_) {
this->base_->add_handler(this); this->base_->add_handler(this);
#ifdef USE_WEBSERVER_OTA
this->base_->add_ota_handler(); this->base_->add_ota_handler();
#endif
} }
#ifdef USE_ARDUINO #ifdef USE_ARDUINO

View File

@ -256,8 +256,10 @@ void WebServer::setup() {
#endif #endif
this->base_->add_handler(this); this->base_->add_handler(this);
#ifdef USE_WEBSERVER_OTA
if (this->allow_ota_) if (this->allow_ota_)
this->base_->add_ota_handler(); this->base_->add_ota_handler();
#endif
// doesn't need defer functionality - if the queue is full, the client JS knows it's alive because it's clearly // doesn't need defer functionality - if the queue is full, the client JS knows it's alive because it's clearly
// getting a lot of events // getting a lot of events

View File

@ -186,11 +186,12 @@ void OTARequestHandler::handleRequest(AsyncWebServerRequest *request) {
#endif // USE_WEBSERVER_OTA #endif // USE_WEBSERVER_OTA
} }
void WebServerBase::add_ota_handler() {
#ifdef USE_WEBSERVER_OTA #ifdef USE_WEBSERVER_OTA
void WebServerBase::add_ota_handler() {
this->add_handler(new OTARequestHandler(this)); // NOLINT this->add_handler(new OTARequestHandler(this)); // NOLINT
#endif
} }
#endif
float WebServerBase::get_setup_priority() const { float WebServerBase::get_setup_priority() const {
// Before WiFi (captive portal) // Before WiFi (captive portal)
return setup_priority::WIFI + 2.0f; return setup_priority::WIFI + 2.0f;

View File

@ -110,7 +110,9 @@ class WebServerBase : public Component {
void add_handler(AsyncWebHandler *handler); void add_handler(AsyncWebHandler *handler);
#ifdef USE_WEBSERVER_OTA
void add_ota_handler(); void add_ota_handler();
#endif
void set_port(uint16_t port) { port_ = port; } void set_port(uint16_t port) { port_ = port; }
uint16_t get_port() const { return port_; } uint16_t get_port() const { return port_; }