1616 #error "This library only supports boards with an ESP8266 or ESP32 processor."
1717#endif
1818
19+ #define SerialOutput Serial
20+
1921static const char serverIndex[] PROGMEM =
2022 R"( <!DOCTYPE html>
2123 <html lang='en'>
@@ -74,7 +76,7 @@ void ESPAsyncHTTPUpdateServer::setup(AsyncWebServer *server, const String &path,
7476 if (!_authenticated)
7577 {
7678#ifdef ESPASYNCHTTPUPDATESERVER_DEBUG
77- Serial .printf (" Unauthenticated Update\n " );
79+ SerialOutput .printf (" Unauthenticated Update\n " );
7880#endif
7981 return ;
8082 } });
@@ -112,26 +114,26 @@ void ESPAsyncHTTPUpdateServer::setup(AsyncWebServer *server, const String &path,
112114 {
113115 _updaterError.clear ();
114116#ifdef ESPASYNCHTTPUPDATESERVER_DEBUG
115- Serial .setDebugOutput (true );
117+ SerialOutput .setDebugOutput (true );
116118#endif
117119 _authenticated = (_username == emptyString || _password == emptyString || request->authenticate (_username.c_str (), _password.c_str ()));
118120 if (!_authenticated)
119121 {
120122#ifdef ESPASYNCHTTPUPDATESERVER_DEBUG
121- Serial .printf (" Unauthenticated Update\n " );
123+ SerialOutput .printf (" Unauthenticated Update\n " );
122124#endif
123125 return ;
124126 }
125127#ifdef ESPASYNCHTTPUPDATESERVER_DEBUG
126- Serial .printf (" Update: %s\n " , filename.c_str ());
128+ SerialOutput .printf (" Update: %s\n " , filename.c_str ());
127129#endif
128130#ifdef ESP8266
129131 Update.runAsync (true );
130132#endif
131133 if (inputName == " filesystem" )
132134 {
133135#ifdef ESPASYNCHTTPUPDATESERVER_DEBUG
134- Serial .println (" updating filesystem" );
136+ SerialOutput .println (" updating filesystem" );
135137#endif
136138
137139#ifdef ESP8266
@@ -156,7 +158,7 @@ void ESPAsyncHTTPUpdateServer::setup(AsyncWebServer *server, const String &path,
156158 else
157159 {
158160#ifdef ESPASYNCHTTPUPDATESERVER_DEBUG
159- Serial .println (" updating flash" );
161+ SerialOutput .println (" updating flash" );
160162#endif
161163 uint32_t maxSketchSpace = (ESP.getFreeSketchSpace () - 0x1000 ) & 0xFFFFF000 ;
162164 if (!Update.begin (maxSketchSpace, U_FLASH))
@@ -169,7 +171,7 @@ void ESPAsyncHTTPUpdateServer::setup(AsyncWebServer *server, const String &path,
169171 if (_authenticated && len && !_updaterError.length ())
170172 {
171173#ifdef ESPASYNCHTTPUPDATESERVER_DEBUG
172- Serial .printf (" ." );
174+ SerialOutput .printf (" ." );
173175#endif
174176 if (Update.write (data, len) != len)
175177 _setUpdaterError ();
@@ -180,13 +182,13 @@ void ESPAsyncHTTPUpdateServer::setup(AsyncWebServer *server, const String &path,
180182 if (Update.end (true ))
181183 { // true to set the size to the current progress
182184#ifdef ESPASYNCHTTPUPDATESERVER_DEBUG
183- Serial .println (" Update Success: \n Rebooting...\n " );
185+ SerialOutput .println (" Update Success: \n Rebooting...\n " );
184186#endif
185187 }
186188 else
187189 _setUpdaterError ();
188190#ifdef ESPASYNCHTTPUPDATESERVER_DEBUG
189- Serial .setDebugOutput (false );
191+ SerialOutput .setDebugOutput (false );
190192#endif
191193 }
192194 else
0 commit comments