From d9d693210a5a5b660a0403b56a5c5c732893d4ff Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 May 2026 21:16:27 +0000 Subject: [PATCH 1/6] Fix firmware build errors in main.cpp and web_server.cpp Agent-Logs-Url: https://github.com/Tecnologic/cymon/sessions/2e0ada59-da81-4ccd-abe0-ed2795c3b25e Co-authored-by: Tecnologic <1442404+Tecnologic@users.noreply.github.com> --- src/main.cpp | 3 ++- src/web/web_server.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 649861b..71346f7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,6 +10,7 @@ #include "cyphal/timesync.hpp" #include "cyphal/variable_fetcher.hpp" #include "esp_efuse.h" +#include "esp_efuse_table.h" #include "esp_timer.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -73,7 +74,7 @@ extern "C" void app_main() { // Wire CAN → Cyphal transport.SetSendFn([&](const cymon::CanFrame& f) { return can_driver.Transmit(f); }); - can_driver.SetRxCallback([&transport](const cymon::CanFrame& frame) { transport.IngestFrame(frame); }); + can_driver.SetRxCallback([](const cymon::CanFrame& frame) { transport.IngestFrame(frame); }); // Cyphal node cymon::CyphalNode::NodeInfo node_info{}; diff --git a/src/web/web_server.cpp b/src/web/web_server.cpp index cdbe468..63ff917 100644 --- a/src/web/web_server.cpp +++ b/src/web/web_server.cpp @@ -48,19 +48,19 @@ bool WebServer::Start() { // Register REST endpoints static const httpd_uri_t uris[] = { - {"/api/nodes", HTTP_GET, HandleGetNodes, nullptr}, - {"/api/session", HTTP_POST, HandlePostSession, nullptr}, - {"/api/session/*", HTTP_DELETE, HandleDeleteSession, nullptr}, - {"/api/wifi", HTTP_POST, HandlePostWifi, nullptr}, - {"/api/can", HTTP_POST, HandlePostCan, nullptr}, - {"/api/settings", HTTP_GET, HandleGetSettings, nullptr}, + {.uri = "/api/nodes", .method = HTTP_GET, .handler = HandleGetNodes, .user_ctx = nullptr}, + {.uri = "/api/session", .method = HTTP_POST, .handler = HandlePostSession, .user_ctx = nullptr}, + {.uri = "/api/session/*", .method = HTTP_DELETE, .handler = HandleDeleteSession, .user_ctx = nullptr}, + {.uri = "/api/wifi", .method = HTTP_POST, .handler = HandlePostWifi, .user_ctx = nullptr}, + {.uri = "/api/can", .method = HTTP_POST, .handler = HandlePostCan, .user_ctx = nullptr}, + {.uri = "/api/settings", .method = HTTP_GET, .handler = HandleGetSettings, .user_ctx = nullptr}, {.uri = "/ws", .method = HTTP_GET, .handler = HandleWebSocket, .user_ctx = nullptr, .is_websocket = true, .handle_ws_control_frames = true}, - {"/*", HTTP_GET, HandleStaticFile, nullptr}, // catch-all for SPIFFS + {.uri = "/*", .method = HTTP_GET, .handler = HandleStaticFile, .user_ctx = nullptr}, // catch-all for SPIFFS }; for (const auto& uri : uris) { From d9324ba2ed3fd3d9f658f7600115c79457f6501f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 21:55:25 +0000 Subject: [PATCH 2/6] Fix web_server.cpp: explicitly initialize all httpd_uri_t fields to suppress GCC -Wmissing-field-initializers Agent-Logs-Url: https://github.com/Tecnologic/cymon/sessions/00860418-9a53-448e-a63a-0332acd88ec0 Co-authored-by: Tecnologic <1442404+Tecnologic@users.noreply.github.com> --- src/web/web_server.cpp | 59 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/src/web/web_server.cpp b/src/web/web_server.cpp index 63ff917..353fb20 100644 --- a/src/web/web_server.cpp +++ b/src/web/web_server.cpp @@ -48,19 +48,62 @@ bool WebServer::Start() { // Register REST endpoints static const httpd_uri_t uris[] = { - {.uri = "/api/nodes", .method = HTTP_GET, .handler = HandleGetNodes, .user_ctx = nullptr}, - {.uri = "/api/session", .method = HTTP_POST, .handler = HandlePostSession, .user_ctx = nullptr}, - {.uri = "/api/session/*", .method = HTTP_DELETE, .handler = HandleDeleteSession, .user_ctx = nullptr}, - {.uri = "/api/wifi", .method = HTTP_POST, .handler = HandlePostWifi, .user_ctx = nullptr}, - {.uri = "/api/can", .method = HTTP_POST, .handler = HandlePostCan, .user_ctx = nullptr}, - {.uri = "/api/settings", .method = HTTP_GET, .handler = HandleGetSettings, .user_ctx = nullptr}, + {.uri = "/api/nodes", + .method = HTTP_GET, + .handler = HandleGetNodes, + .user_ctx = nullptr, + .is_websocket = false, + .handle_ws_control_frames = false, + .supported_subprotocol = nullptr}, + {.uri = "/api/session", + .method = HTTP_POST, + .handler = HandlePostSession, + .user_ctx = nullptr, + .is_websocket = false, + .handle_ws_control_frames = false, + .supported_subprotocol = nullptr}, + {.uri = "/api/session/*", + .method = HTTP_DELETE, + .handler = HandleDeleteSession, + .user_ctx = nullptr, + .is_websocket = false, + .handle_ws_control_frames = false, + .supported_subprotocol = nullptr}, + {.uri = "/api/wifi", + .method = HTTP_POST, + .handler = HandlePostWifi, + .user_ctx = nullptr, + .is_websocket = false, + .handle_ws_control_frames = false, + .supported_subprotocol = nullptr}, + {.uri = "/api/can", + .method = HTTP_POST, + .handler = HandlePostCan, + .user_ctx = nullptr, + .is_websocket = false, + .handle_ws_control_frames = false, + .supported_subprotocol = nullptr}, + {.uri = "/api/settings", + .method = HTTP_GET, + .handler = HandleGetSettings, + .user_ctx = nullptr, + .is_websocket = false, + .handle_ws_control_frames = false, + .supported_subprotocol = nullptr}, {.uri = "/ws", .method = HTTP_GET, .handler = HandleWebSocket, .user_ctx = nullptr, .is_websocket = true, - .handle_ws_control_frames = true}, - {.uri = "/*", .method = HTTP_GET, .handler = HandleStaticFile, .user_ctx = nullptr}, // catch-all for SPIFFS + .handle_ws_control_frames = true, + .supported_subprotocol = nullptr}, + {.uri = "/*", + .method = HTTP_GET, + .handler = HandleStaticFile, + .user_ctx = nullptr, + .is_websocket = false, + .handle_ws_control_frames = false, + .supported_subprotocol = nullptr}, // catch-all for SPIFFS }; for (const auto& uri : uris) { From 631e40980493adedc0c6970fbad0f055e227fa98 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 07:42:04 +0000 Subject: [PATCH 3/6] Fix libcanard and o1heap C compilation errors with library.json build flags Agent-Logs-Url: https://github.com/Tecnologic/cymon/sessions/de85d3bc-198e-4652-9792-13665d807d86 Co-authored-by: Tecnologic <1442404+Tecnologic@users.noreply.github.com> --- lib/libcanard/library.json | 8 ++++++++ lib/o1heap/library.json | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 lib/libcanard/library.json create mode 100644 lib/o1heap/library.json diff --git a/lib/libcanard/library.json b/lib/libcanard/library.json new file mode 100644 index 0000000..0cb873d --- /dev/null +++ b/lib/libcanard/library.json @@ -0,0 +1,8 @@ +{ + "name": "libcanard", + "version": "4.0.0", + "build": { + "flags": ["-std=gnu17", "-Wno-error"], + "unflags": ["-std=gnu23"] + } +} diff --git a/lib/o1heap/library.json b/lib/o1heap/library.json new file mode 100644 index 0000000..5062e1d --- /dev/null +++ b/lib/o1heap/library.json @@ -0,0 +1,8 @@ +{ + "name": "o1heap", + "version": "2.0.0", + "build": { + "flags": ["-std=gnu17", "-Wno-error"], + "unflags": ["-std=gnu23"] + } +} From 8fccb69b804b70508c293e5290242490a18f2963 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 07:52:00 +0000 Subject: [PATCH 4/6] Use -std=c11 for vendored C libs to fix random() symbol conflict and stdbit.h absence Agent-Logs-Url: https://github.com/Tecnologic/cymon/sessions/de85d3bc-198e-4652-9792-13665d807d86 Co-authored-by: Tecnologic <1442404+Tecnologic@users.noreply.github.com> --- lib/libcanard/library.json | 4 ++-- lib/o1heap/library.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libcanard/library.json b/lib/libcanard/library.json index 0cb873d..5fbffa4 100644 --- a/lib/libcanard/library.json +++ b/lib/libcanard/library.json @@ -2,7 +2,7 @@ "name": "libcanard", "version": "4.0.0", "build": { - "flags": ["-std=gnu17", "-Wno-error"], - "unflags": ["-std=gnu23"] + "flags": ["-std=c11", "-Wno-error"], + "unflags": ["-std=gnu23", "-std=gnu17"] } } diff --git a/lib/o1heap/library.json b/lib/o1heap/library.json index 5062e1d..7e37794 100644 --- a/lib/o1heap/library.json +++ b/lib/o1heap/library.json @@ -2,7 +2,7 @@ "name": "o1heap", "version": "2.0.0", "build": { - "flags": ["-std=gnu17", "-Wno-error"], - "unflags": ["-std=gnu23"] + "flags": ["-std=c11", "-Wno-error"], + "unflags": ["-std=gnu23", "-std=gnu17"] } } From a0579f68d014423c72cefc89fdc5da8824610906 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 08:02:57 +0000 Subject: [PATCH 5/6] Fix random() conflict in canard.c with a PlatformIO wrapper that controls stdlib.h inclusion order Agent-Logs-Url: https://github.com/Tecnologic/cymon/sessions/de85d3bc-198e-4652-9792-13665d807d86 Co-authored-by: Tecnologic <1442404+Tecnologic@users.noreply.github.com> --- lib/libcanard/canard_pio.c | 17 +++++++++++++++++ lib/libcanard/library.json | 1 + 2 files changed, 18 insertions(+) create mode 100644 lib/libcanard/canard_pio.c diff --git a/lib/libcanard/canard_pio.c b/lib/libcanard/canard_pio.c new file mode 100644 index 0000000..c3313f1 --- /dev/null +++ b/lib/libcanard/canard_pio.c @@ -0,0 +1,17 @@ +// canard_pio.c — PlatformIO/ESP-IDF wrapper for canard.c +// +// Problem: ESP-IDF's platform_include/assert.h (included by canard.c via +// ) unconditionally includes , which in +// Espressif's picolibc declares `long int random(void)`. +// This conflicts with libcanard's internal `static uint64_t random(...)`. +// +// Fix: include here first, with _GNU_SOURCE and _BSD_SOURCE +// temporarily undefined so that random() is NOT declared. The stdlib.h +// header guard then prevents the double-inclusion that would re-declare +// random() when assert.h later pulls it in. + +#undef _GNU_SOURCE +#undef _BSD_SOURCE +#include + +#include "canard.c" diff --git a/lib/libcanard/library.json b/lib/libcanard/library.json index 5fbffa4..b0f84d2 100644 --- a/lib/libcanard/library.json +++ b/lib/libcanard/library.json @@ -2,6 +2,7 @@ "name": "libcanard", "version": "4.0.0", "build": { + "srcFilter": "+", "flags": ["-std=c11", "-Wno-error"], "unflags": ["-std=gnu23", "-std=gnu17"] } From 54e64702b61c4ce2342e84ca3caa72177d77fd2c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 08:07:55 +0000 Subject: [PATCH 6/6] Fix em dash in canard_pio.c comment (use ASCII hyphen) Agent-Logs-Url: https://github.com/Tecnologic/cymon/sessions/de85d3bc-198e-4652-9792-13665d807d86 Co-authored-by: Tecnologic <1442404+Tecnologic@users.noreply.github.com> --- lib/libcanard/canard_pio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libcanard/canard_pio.c b/lib/libcanard/canard_pio.c index c3313f1..cc557a0 100644 --- a/lib/libcanard/canard_pio.c +++ b/lib/libcanard/canard_pio.c @@ -1,4 +1,4 @@ -// canard_pio.c — PlatformIO/ESP-IDF wrapper for canard.c +// canard_pio.c - PlatformIO/ESP-IDF wrapper for canard.c // // Problem: ESP-IDF's platform_include/assert.h (included by canard.c via // ) unconditionally includes , which in