Skip to content

Commit c09d3c6

Browse files
committed
Fix compilation issues
1 parent f3d3c72 commit c09d3c6

File tree

8 files changed

+58
-33
lines changed

8 files changed

+58
-33
lines changed

src/core/esp3d_settings.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
*/
2020

2121
#include "../include/esp3d_config.h"
22+
#ifndef STRINGIFY
2223
#define STRINGIFY(x) #x
24+
#endif // STRINGIFY
2325
#define STRING(x) STRINGIFY(x)
2426
#if defined(ESP_SAVE_SETTINGS)
2527
#include "esp3d_message.h"
@@ -853,6 +855,7 @@ bool ESP3DSettings::isValidIntegerSetting(uint32_t value,
853855
return false;
854856
}
855857
switch (settingElement) {
858+
#if COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL == MKS_SERIAL
856859
case ESP_SERIAL_BRIDGE_BAUD:
857860
case ESP_BAUD_RATE:
858861
for (uint8_t i = 0; i < SupportedBaudListSize; i++) {
@@ -861,6 +864,7 @@ bool ESP3DSettings::isValidIntegerSetting(uint32_t value,
861864
}
862865
}
863866
break;
867+
#endif //#if COMMUNICATION_PROTOCOL == RAW_SERIAL || COMMUNICATION_PROTOCOL == MKS_SERIAL
864868
case ESP_WEBDAV_PORT:
865869
case ESP_HTTP_PORT:
866870
case ESP_TELNET_PORT:

src/esp3dlib.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
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
@@ -38,6 +38,7 @@
3838
#endif //SDSUPPORT
3939

4040

41+
4142
Esp3DLib esp3dlib;
4243

4344
Esp3D 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()
7475
bool 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

src/esp3dlib_config.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@
3030
#define ESP_XSTR_(M) #M
3131
#define ESP_XSTR(M) ESP_XSTR_(M)
3232
#endif
33-
#define MARLIN_PATH(PATH) ESP_XSTR(../../../../../Marlin/src/PATH)
33+
#ifndef SRCHOME
34+
#define SRCHOME ../../../../../Marlin/src
35+
#endif
36+
#ifndef HALHOME
37+
#define HALHOME SRCHOME/HAL
38+
#endif
39+
#define MARLIN_HAL_PATH(PATH) HAL_PATH(HALHOME, PATH)
40+
#define MARLIN_PATH(PATH) ESP_XSTR(SRCHOME/PATH)
3441
#include MARLIN_PATH(inc/MarlinConfig.h)
3542

3643
#undef DISABLED
@@ -43,7 +50,7 @@
4350
#else
4451
#define OTASUPPORT
4552
#define WEBSUPPORT
46-
#define SHORT_BUILD_VERSION "2.0.9.3+"
53+
#define SHORT_BUILD_VERSION "2.1.x"
4754

4855
/*********************************************************
4956
*

src/include/esp3d_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#define _VERSION_ESP3D_H
2323

2424
// version and sources location
25-
#define FW_VERSION "3.0.0.a225"
25+
#define FW_VERSION "3.0.0.a226"
2626
#define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0"
2727

2828
#endif //_VERSION_ESP3D_H

src/modules/filesystem/sd/sd_sdfat2_esp32.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,15 @@ bool ESP_SD::rename(const char* oldpath, const char* newpath) {
230230
return SD.rename(oldpath, newpath);
231231
}
232232

233-
bool ESP_SD::format() {
233+
bool ESP_SD::format() {
234+
uint32_t const ERASE_SIZE = 262144L;
235+
uint32_t cardSectorCount = 0;
236+
uint8_t sectorBuffer[512];
237+
// SdCardFactory constructs and initializes the appropriate card.
238+
SdCardFactory cardFactory;
239+
// Pointer to generic SD card.
240+
SdCard* m_card = nullptr;
234241
if (ESP_SD::getState(true) == ESP_SDCARD_IDLE) {
235-
uint32_t const ERASE_SIZE = 262144L;
236-
uint32_t cardSectorCount = 0;
237-
uint8_t sectorBuffer[512];
238-
// SdCardFactory constructs and initializes the appropriate card.
239-
SdCardFactory cardFactory;
240-
// Pointer to generic SD card.
241-
SdCard* m_card = nullptr;
242242
// prepare
243243
m_card = cardFactory.newCard(SD_CONFIG);
244244
if (!m_card || m_card->errorCode()) {
@@ -253,6 +253,9 @@ bool ESP_SD::format() {
253253
}
254254

255255
esp3d_log("Capacity detected :%d GB", cardSectorCount * 5.12e-7);
256+
} else {
257+
esp3d_log_e("SD not ready");
258+
return false;
256259
}
257260

258261
uint32_t firstBlock = 0;
@@ -287,14 +290,11 @@ bool ESP_SD::format() {
287290
: fatFormatter.format(m_card, sectorBuffer, nullptr);
288291

289292
if (!rtn) {
290-
esp3d_log_e(("erase failed");
293+
esp3d_log_e("erase failed");
291294
return false;
292295
}
293296

294297
return true;
295-
}
296-
esp3d_log_e(("cannot erase");
297-
return false;
298298
}
299299

300300
ESP_SDFile ESP_SD::open(const char* path, uint8_t mode) {

src/modules/http/handlers/handle-SD-files.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#endif // ARDUINO_ARCH_ESP8266
3030
#include "../../authentication/authentication_service.h"
3131
#include "../../filesystem/esp_sd.h"
32+
#include "../../../core/esp3d_string.h"
3233

3334
// SD
3435
// SD files list and file commands
@@ -238,10 +239,12 @@ void HTTP_Server::handleSDFileList() {
238239
buffer2send += "\"occupation\":\"0\",";
239240
}
240241
buffer2send += "\"status\":\"" + status + "\",";
241-
buffer2send +=
242-
"\"total\":\"" + esp3d_string::formatBytes(ESP_SD::totalBytes()) + "\",";
243-
buffer2send +=
244-
"\"used\":\"" + esp3d_string::formatBytes(ESP_SD::usedBytes()) + "\"}";
242+
buffer2send += "\"total\":\"" ;
243+
buffer2send += esp3d_string::formatBytes(ESP_SD::totalBytes()) ;
244+
buffer2send += "\",";
245+
buffer2send += "\"used\":\"";
246+
buffer2send += esp3d_string::formatBytes(ESP_SD::usedBytes());
247+
buffer2send += "\"}";
245248
path = "";
246249
_webserver->sendContent_P(buffer2send.c_str(), buffer2send.length());
247250
_webserver->sendContent("");

src/modules/serial2socket/serial2socket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#if defined(ESP3DLIB_ENV) && COMMUNICATION_PROTOCOL == SOCKET_SERIAL
2525
#include <Arduino.h>
26-
26+
#include "../../core/esp3d_message.h"
2727
#include "../../core/esp3d_commands.h"
2828
#include "serial2socket.h"
2929

src/modules/serial2socket/serial2socket.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
#define _SERIAL_2_SOCKET_H_
2323

2424
#include <Print.h>
25-
26-
#include "../../core/esp3d_message.h"
27-
25+
#include "../authentication/authentication_level_types.h"
2826
#define S2S_TXBUFFERSIZE 1200
2927
#define S2S_RXBUFFERSIZE 128
3028
#define S2S_FLUSHTIMEOUT 500
29+
30+
31+
class ESP3DMessage; // forward declaration
32+
33+
3134
class Serial_2_Socket : public Stream {
3235
public:
3336
Serial_2_Socket();

0 commit comments

Comments
 (0)