File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,6 +178,12 @@ namespace ESP32_Helper
178178 ESP.restart ();
179179 return true ;
180180 }
181+ else if (cmdTmp.cmdEquals (" Ping" ))
182+ {
183+ // Handle Ping command
184+ println (" Pong" );
185+ return true ;
186+ }
181187 else
182188 {
183189 // Check all registered handlers (default namespaces + user custom handlers)
@@ -278,27 +284,20 @@ namespace ESP32_Helper
278284 isString = false ;
279285 }
280286 }
281- if (cmdTmp.cmdEquals (" Ping" ))
282- {
283- // Handle Ping command
284- println (" Pong" );
285- }
286- else
287- {
288- Printer::println (" Command Received : %s" , cmdTmp.ToString ().c_str ());
289- HandleCommand (cmdTmp);
290- }
287+ Printer::println (" Command Received : %s" , cmdTmp.ToString ().c_str ());
288+ HandleCommand (cmdTmp);
291289 }
292290
293291 bool HasWaitingCommand () { return awaitingCommand.MessagesWaiting () > 0 ; }
294292
295293 Command GetCommand ()
296294 {
297- Command cmd;
298- if (HasWaitingCommand ())
295+ if (!HasWaitingCommand ())
299296 {
300- awaitingCommand. Receive (cmd);
297+ return nullptr ; // No command available
301298 }
299+ Command cmd;
300+ awaitingCommand.Receive (cmd);
302301 return cmd;
303302 }
304303
You can’t perform that action at this time.
0 commit comments