diff --git a/platformio.ini b/platformio.ini index 2719bff6a..bf462bd08 100644 --- a/platformio.ini +++ b/platformio.ini @@ -98,9 +98,7 @@ build_flags = build_unflags = ${common.unbuild_flags} extra_scripts = - ; pre:scripts/build_interface.py ; builds the WebUI scripts/rename_fw.py ; renames the firmware .bin file - ; scripts/upload.py ; optionally upload the firmware via OTA (if upload_protocol = custom) monitor_speed = 115200 monitor_filters = direct build_type = release @@ -274,8 +272,24 @@ lib_deps = Unity test_testing_command = ${platformio.build_dir}/${this.__env__}/program +; Modbus +; Creating the modbus registers is a multi-step process. Before it was in a shell script called generate_csv_and_headers.sh +; but now moved to pio so everything is in python and cross-platform. The logic is as follows: +; 1. create a dummy modbus_entity_parameters.hpp file so the first pass compiles +; 2. compile the EMS-ESPcode with the EMSESP_MODBUS flag set +; 3. run the entity_dump test command and generate the dump_entities.csv file +; 4. use the dump_entities.csv file with update_modbus_registers.py script to generate the modbus_entity_parameters.hpp file +; 5. clean up everything and start again with the EMSESP_STANDALONE flag set +; 6. run the entity_dump test command again to create the real dump_entities.csv file +; 7. create the Modbus-Entity-Registers.md file +; 8. create the dump_telegrams.csv file +; +; To run this in pio use the steps +; pio run -e build_modbus +; pio run -e build_standalone -t clean -t build + # builds the modbus_entity_parameters.hpp header file -# pio run -e build_modbus -t build +# pio run -e build_modbus [env:build_modbus] extends = env:native targets = build @@ -287,8 +301,7 @@ custom_test_command = entity_dump custom_output_file = dump_entities.csv custom_post_script = scripts/build_modbus_entity_parameters_post.py -; builds the real dump_entities.csv and dump_telegrams.csv files -; and the Modbus-Entity-Registers.md file +; builds the real dump_entities.csv and dump_telegrams.csv files, and also the Modbus-Entity-Registers.md file ; to be run after build_modbus with: pio run -e build_standalone -t clean -t build [env:build_standalone] extends = env:native diff --git a/scripts/build_interface.py b/scripts/build_interface.py index 8b967cded..21482ac5e 100755 --- a/scripts/build_interface.py +++ b/scripts/build_interface.py @@ -110,7 +110,7 @@ def build_webUI(*args, **kwargs): env.Exit(1) env.Exit(0) -# Create custom target that only runs the script +# Create custom target that only runs the script and then exits, without continuing with the pio workflow env.AddCustomTarget( name="build", dependencies=None, @@ -118,3 +118,10 @@ env.AddCustomTarget( title="build web interface", description="installs pnpm packages, updates libraries and builds web UI" ) + +# this is if its called with the target=build, so it will continue with the pio workflow +if not (env.IsCleanTarget()): + success = buildWeb() + if not success: + print("Web interface build failed!") + \ No newline at end of file