#ifndef OTA_UPDATER_H #define OTA_UPDATER_H #include #include #include // 使用 extern 声明全局变量 deviceID 和 serverAddress extern String deviceID; extern String serverAddress; extern uint16_t otaPort; // 新增 OTA 端口号 void setupWiFiConfig(); bool connectWiFiWithTimeout(uint32_t timeoutMs); class OTAUpdater { public: OTAUpdater(uint16_t port, const String& currentVersion); // 移除 serverUrl 参数 void checkForUpdates(); private: uint16_t _port; // 端口号 String _currentVersion; // 当前固件版本 bool downloadAndUpdateFirmware(); }; #endif