Embed gzipped web assets at build time and type LED edit commands.

Generate the web UI headers from c/web/ via scripts/embed_file.py (minify + gzip) and serve them with Content-Encoding, replacing the checked-in web_*.h blobs. Move the LED driver/presets into lib/leds, and parse preset edits into a typed cmd_preset_t on core0 instead of passing raw JSON to core1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-11-08 22:18:10 +13:00
1 parent b3e9fc9663
commit bf0429c505
19 files changed
+395 -2205

No files matched your search

+39
View File
@@ -21,16 +21,55 @@ file(GLOB_RECURSE LIB_SOURCES CONFIGURE_DEPENDS
"${CMAKE_CURRENT_LIST_DIR}/lib/**/*.cpp"
)
# Embed web UI from normal files under web/ (headers generated into build/)
set(WEB_GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(EMBED_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/scripts/embed_file.py")
set(WEB_ASSETS
"${WEB_GEN_DIR}/web_index_html.h"
"${WEB_GEN_DIR}/web_main_js.h"
"${WEB_GEN_DIR}/web_styles_css.h"
)
add_custom_command(
OUTPUT "${WEB_GEN_DIR}/web_index_html.h"
COMMAND ${CMAKE_COMMAND} -E make_directory "${WEB_GEN_DIR}"
COMMAND python3 "${EMBED_SCRIPT}"
"${CMAKE_CURRENT_LIST_DIR}/web/index.html" web_index_html
"${WEB_GEN_DIR}/web_index_html.h"
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/web/index.html" "${EMBED_SCRIPT}"
VERBATIM
)
add_custom_command(
OUTPUT "${WEB_GEN_DIR}/web_main_js.h"
COMMAND ${CMAKE_COMMAND} -E make_directory "${WEB_GEN_DIR}"
COMMAND python3 "${EMBED_SCRIPT}"
"${CMAKE_CURRENT_LIST_DIR}/web/static/main.js" web_main_js
"${WEB_GEN_DIR}/web_main_js.h"
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/web/static/main.js" "${EMBED_SCRIPT}"
VERBATIM
)
add_custom_command(
OUTPUT "${WEB_GEN_DIR}/web_styles_css.h"
COMMAND ${CMAKE_COMMAND} -E make_directory "${WEB_GEN_DIR}"
COMMAND python3 "${EMBED_SCRIPT}"
"${CMAKE_CURRENT_LIST_DIR}/web/static/styles.css" web_styles_css
"${WEB_GEN_DIR}/web_styles_css.h"
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/web/static/styles.css" "${EMBED_SCRIPT}"
VERBATIM
)
add_custom_target(web_assets DEPENDS ${WEB_ASSETS})
add_executable(led_hoop
${SRC_SOURCES}
${LIB_SOURCES}
)
add_dependencies(led_hoop web_assets)
target_include_directories(led_hoop PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/src
${CMAKE_CURRENT_LIST_DIR}/lib
${CMAKE_CURRENT_LIST_DIR}/lib/httpserver
${WEB_GEN_DIR}
)
target_link_libraries(led_hoop