121 {
124
125 Serial.println(
"FastLED OTA Example");
126 Serial.println(
"===================");
127
128
131
132
133
134
135#if USE_WIFI
136
137 Serial.println(
"Starting Wi-Fi (async mode)...");
139 Serial.println(
"Wi-Fi connecting in background...");
140 Serial.println(
"LEDs will show connection status:");
141 Serial.println(
" - Pulsing blue: Connecting...");
142 Serial.println(
" - Solid green: Connected!");
143
144
146 if (failed != 0) {
147 Serial.println(
"\nWARNING: Some OTA services failed to initialize:");
149 Serial.println(
" - mDNS failed: Device won't be discoverable at hostname.local");
150 Serial.println(
" Try accessing via IP address instead");
151 }
153 Serial.println(
" - HTTP server failed: Web OTA unavailable");
154 Serial.println(
" You can still use Arduino IDE OTA (port 3232)");
155 }
157 Serial.println(
" - ArduinoOTA failed: IDE OTA unavailable");
158 Serial.println(
" You can still use Web OTA interface");
159 }
160 }
161#else
162
163
164 Serial.println(
"Starting OTA services (network assumed configured)...");
166 Serial.println(
"OTA services started successfully");
167 } else {
168 Serial.println(
"OTA services failed to start");
169 }
170
171
173 if (failed != 0) {
174 Serial.println(
"\nWARNING: Some OTA services failed to initialize:");
176 Serial.println(
" - mDNS failed: Device won't be discoverable at hostname.local");
177 Serial.println(
" Try accessing via IP address instead");
178 }
180 Serial.println(
" - HTTP server failed: Web OTA unavailable");
181 Serial.println(
" You can still use Arduino IDE OTA (port 3232)");
182 }
184 Serial.println(
" - ArduinoOTA failed: IDE OTA unavailable");
185 Serial.println(
" You can still use Web OTA interface");
186 }
187 }
188#endif
189
190
191 ota.onProgress([](
size_t written,
size_t total){
192
194 msg << "OTA Progress: " << written << "/" << total << " (" << (int)((written * 100) / total) << "%)";
196 });
197 ota.onError([](
const char* error_msg){
198
200 msg << "OTA error: " << error_msg;
202 });
204
206 msg <<
"OTA state: " << (int)
state;
208 });
209
210
211
212 ota.onBeforeReboot([](){
213 Serial.println(
"OTA complete! Preparing to reboot...");
214 Serial.println(
"Saving state and turning off LEDs...");
215
216
219
220
221
222
223
224
225 });
226
227 Serial.println(
"Setup complete. Running LED animation...");
228}
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
static const char * OTA_PASS
static const char * WIFI_SSID
static const char * WIFI_PASS
static const char * HOSTNAME
const char * c_str() const FL_NOEXCEPT
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NOEXCEPT
Fill a range of LEDs with a solid color.
@ HTTP_FAILED
HTTP server failed to start (Web OTA unavailable)
@ MDNS_FAILED
mDNS initialization failed (device not discoverable at hostname.local)
@ ARDUINO_OTA_FAILED
ArduinoOTA initialization failed (IDE OTA unavailable)
void delay(u32 ms, bool run_async=true) FL_NOEXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>