2828#include < LittleFS.h>
2929#endif // FILESYSTEM_FEATURE
3030#include " core/esp3d.h"
31- #include " core/esp3doutput .h"
32- #include " core/commands .h"
31+ #include " core/esp3d_commands .h"
32+ #include " core/esp3d_hal .h"
3333#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
3434#include < soc/rtc_wdt.h>
3535#endif // CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
3838#endif // SDSUPPORT
3939
4040
41+
4142Esp3DLib esp3dlib;
4243
4344Esp3D myesp3d;
@@ -54,7 +55,7 @@ void ESP3DLibTaskfn( void * parameter )
5455#endif // #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
5556 vTaskDelay (1 / portTICK_RATE_MS);
5657 }
57- vTaskDelete ( Hal ::xHandle );
58+ vTaskDelete ( ESP3DHal ::xHandle );
5859}
5960
6061
@@ -74,10 +75,17 @@ void Esp3DLib::init()
7475bool Esp3DLib::parse (char * cmd)
7576{
7677 if (myesp3d.started () && esp3d_commands.is_esp_command ((uint8_t *)cmd, strlen (cmd))) {
77- // command come from other serial port
78- ESP3DOutput output (ESP_ECHO_SERIAL_CLIENT);
79- esp3d_commands.process ((uint8_t *)cmd, strlen (cmd),& output, LEVEL_ADMIN);
80- return true ;
78+ // command come from other serial port
79+ ESP3DMessage *msg = ESP3DMessageManager::newMsg (
80+ ESP3DClientType::echo_serial,ESP3DClientType::command ,(uint8_t *)cmd,
81+ strlen (cmd), ESP3DAuthenticationLevel::admin);
82+ if (msg) {
83+ // process command
84+ esp3d_commands.process (msg);
85+ } else {
86+ esp3d_log_e (" Cannot create message" );
87+ }
88+ return true ;
8189 }
8290 return false ;
8391}
@@ -106,14 +114,14 @@ void Esp3DLib::idletask()
106114 8192 , /* Stack size of task */
107115 NULL , /* parameter of the task */
108116 ESP3DLIB_RUNNING_PRIORITY, /* priority of the task */
109- &(Hal ::xHandle), /* Task handle to keep track of created task */
117+ &(ESP3DHal ::xHandle), /* Task handle to keep track of created task */
110118 ESP3DLIB_RUNNING_CORE /* Core to run the task */
111119 );
112120#ifdef DISABLE_WDT_ESP3DLIB_TASK
113- esp_task_wdt_delete (Hal ::xHandle);
121+ esp_task_wdt_delete (ESP3DHal ::xHandle);
114122#endif // DISABLE_WDT_ESP3DLIB_TASK
115123 }
116124 }
117- Hal ::wait (0 ); // Yield to other tasks
125+ ESP3DHal ::wait (0 ); // Yield to other tasks
118126}
119127#endif // ESP3DLIB_ENV
0 commit comments