From 0bf8188570e7bf865cf40846e7db83a677532962 Mon Sep 17 00:00:00 2001 From: Luc <8822552+luc-github@users.noreply.github.com> Date: Tue, 18 Jun 2024 08:15:48 +0800 Subject: [PATCH] Add esp arduino core version to ESP420 repport Bump version --- esp3d/src/core/commands/ESP420.cpp | 22 +++++++++++++++------- esp3d/src/core/esp3d_hal.cpp | 20 ++++++++++++++++++++ esp3d/src/core/esp3d_hal.h | 1 + esp3d/src/include/esp3d_version.h | 2 +- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/esp3d/src/core/commands/ESP420.cpp b/esp3d/src/core/commands/ESP420.cpp index e4cf899b..a75a5a82 100644 --- a/esp3d/src/core/commands/ESP420.cpp +++ b/esp3d/src/core/commands/ESP420.cpp @@ -155,12 +155,27 @@ void ESP3DCommands::ESP420(int cmd_params_pos, ESP3DMessage* msg) { return; } + // FW architecture + tmpstr = ESP3DSettings::TargetBoard(); + if (!dispatchIdValue(json, "FW arch", tmpstr.c_str(), target, requestId, + false)) { + return; + } + // SDK Version tmpstr = ESP.getSdkVersion(); + if (!dispatchIdValue(json, "SDK", tmpstr.c_str(), target, requestId, false)) { return; } + // Arduino Version + tmpstr = ESP3DHal::arduinoVersion(); + if (!dispatchIdValue(json, "Arduino", tmpstr.c_str(), target, requestId, + false)) { + return; + } + // Flash size tmpstr = esp3d_string::formatBytes(ESP.getFlashChipSize()); if (!dispatchIdValue(json, "flash size", tmpstr.c_str(), target, requestId, @@ -728,13 +743,6 @@ void ESP3DCommands::ESP420(int cmd_params_pos, ESP3DMessage* msg) { return; } - // FW architecture - tmpstr = ESP3DSettings::TargetBoard(); - if (!dispatchIdValue(json, "FW arch", tmpstr.c_str(), target, requestId, - false)) { - return; - } - // end of list if (json) { if (!dispatch("]}", target, requestId, ESP3DMessageType::tail)) { diff --git a/esp3d/src/core/esp3d_hal.cpp b/esp3d/src/core/esp3d_hal.cpp index 56a527d1..f077c4de 100644 --- a/esp3d/src/core/esp3d_hal.cpp +++ b/esp3d/src/core/esp3d_hal.cpp @@ -65,6 +65,26 @@ int ESP3DHal::analogRead(uint8_t pin) { #endif } +const char* ESP3DHal::arduinoVersion() { + static String version = ""; +#ifdef ARDUINO_ARCH_ESP32 + version = ESP_ARDUINO_VERSION_MAJOR; + version += "."; + version += ESP_ARDUINO_VERSION_MINOR; + version += "."; + version += ESP_ARDUINO_VERSION_PATCH; +#endif // ARDUINO_ARCH_ESP32 + +#ifdef ARDUINO_ARCH_ESP8266 +#ifdef ARDUINO_ESP8266_RELEASE + version = ARDUINO_ESP8266_RELEASE; +#else + version = ESP.getCoreVersion(); +#endif // ARDUINO_ESP8266_RELEASE +#endif // ARDUINO_ARCH_ESP8266 + return version.c_str(); +} + bool ESP3DHal::analogWrite(uint8_t pin, uint value) { if (value > (_analogRange - 1)) { return false; diff --git a/esp3d/src/core/esp3d_hal.h b/esp3d/src/core/esp3d_hal.h index a1f017e5..b505f6e5 100644 --- a/esp3d/src/core/esp3d_hal.h +++ b/esp3d/src/core/esp3d_hal.h @@ -48,6 +48,7 @@ class ESP3DHal { static bool analogWrite(uint8_t pin, uint value); static void analogWriteFreq(uint32_t freq); static void analogRange(uint32_t range); + static const char * arduinoVersion(); #if defined(ARDUINO_ARCH_ESP32) static TaskHandle_t xHandle; #endif // ARDUINO_ARCH_ESP32 diff --git a/esp3d/src/include/esp3d_version.h b/esp3d/src/include/esp3d_version.h index e244fc8a..569f71c8 100644 --- a/esp3d/src/include/esp3d_version.h +++ b/esp3d/src/include/esp3d_version.h @@ -22,7 +22,7 @@ #define _VERSION_ESP3D_H // version and sources location -#define FW_VERSION "3.0.0.a233" +#define FW_VERSION "3.0.0.a234" #define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0" #endif //_VERSION_ESP3D_H