119 {
122
123 Serial.println(
"FastLED OTA Example");
124 Serial.println(
"===================");
125
126
129
130
131
132
133#if USE_WIFI
134
135 Serial.println(
"Starting Wi-Fi (async mode)...");
137 Serial.println(
"Wi-Fi connecting in background...");
138 Serial.println(
"LEDs will show connection status:");
139 Serial.println(
" - Pulsing blue: Connecting...");
140 Serial.println(
" - Solid green: Connected!");
141
142
144 if (failed != 0) {
145 Serial.println(
"\nWARNING: Some OTA services failed to initialize:");
147 Serial.println(
" - mDNS failed: Device won't be discoverable at hostname.local");
148 Serial.println(
" Try accessing via IP address instead");
149 }
151 Serial.println(
" - HTTP server failed: Web OTA unavailable");
152 Serial.println(
" You can still use Arduino IDE OTA (port 3232)");
153 }
155 Serial.println(
" - ArduinoOTA failed: IDE OTA unavailable");
156 Serial.println(
" You can still use Web OTA interface");
157 }
158 }
159#else
160
161
162 Serial.println(
"Starting OTA services (network assumed configured)...");
164 Serial.println(
"OTA services started successfully");
165 } else {
166 Serial.println(
"OTA services failed to start");
167 }
168
169
171 if (failed != 0) {
172 Serial.println(
"\nWARNING: Some OTA services failed to initialize:");
174 Serial.println(
" - mDNS failed: Device won't be discoverable at hostname.local");
175 Serial.println(
" Try accessing via IP address instead");
176 }
178 Serial.println(
" - HTTP server failed: Web OTA unavailable");
179 Serial.println(
" You can still use Arduino IDE OTA (port 3232)");
180 }
182 Serial.println(
" - ArduinoOTA failed: IDE OTA unavailable");
183 Serial.println(
" You can still use Web OTA interface");
184 }
185 }
186#endif
187
188
189 ota.onProgress([](
size_t written,
size_t total){
190
192 msg << "OTA Progress: " << written << "/" << total << " (" << (int)((written * 100) / total) << "%)";
194 });
195 ota.onError([](
const char* error_msg){
196
198 msg << "OTA error: " << error_msg;
200 });
202
204 msg <<
"OTA state: " << (int)
state;
206 });
207
208
209
210 ota.onBeforeReboot([](){
211 Serial.println(
"OTA complete! Preparing to reboot...");
212 Serial.println(
"Saving state and turning off LEDs...");
213
214
217
218
219
220
221
222
223 });
224
225 Serial.println(
"Setup complete. Running LED animation...");
226}
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_NO_EXCEPT
void fill_solid(CRGB *targetArray, int numToFill, const CRGB &color) FL_NO_EXCEPT
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_NO_EXCEPT
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>