mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fixes #2148
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# creates an CSV file called "dump_entities.cvs" with all devices and their entities
|
|
||||||
# run from top folder like `sh ./scripts/dump_entities.sh`
|
|
||||||
rm -f dump_entities.csv
|
|
||||||
make clean
|
|
||||||
make ARGS=-DEMSESP_STANDALONE
|
|
||||||
echo "test entity_dump" | ./emsesp | python3 ./scripts/strip_csv.py > dump_entities.csv
|
|
||||||
cat dump_entities.csv
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# creates an CSV file called "dump_telegrams.cvs" with all devices and their telegrams
|
|
||||||
# run from top folder like `sh ./scripts/dump_telegrams.sh`
|
|
||||||
rm -f dump_telegrams.csv
|
|
||||||
make clean
|
|
||||||
make ARGS=-DEMSESP_STANDALONE
|
|
||||||
echo "test telegram_dump" | ./emsesp | python3 ./scripts/strip_csv.py > dump_telegrams.csv
|
|
||||||
cat dump_telegrams.csv
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# This is used to build the contents of the `Modbus-Entity-Registers.md` file used in the emsesp.org documentation.
|
|
||||||
|
|
||||||
make clean
|
|
||||||
make ARGS=-DEMSESP_STANDALONE
|
|
||||||
echo "test entity_dump" | ./emsesp | python3 ./scripts/strip_csv.py | python3 ./scripts/generate-modbus-register-doc.py
|
|
||||||
@@ -37,20 +37,24 @@ EOL
|
|||||||
make clean
|
make clean
|
||||||
make ARGS=-DEMSESP_STANDALONE
|
make ARGS=-DEMSESP_STANDALONE
|
||||||
|
|
||||||
# dump_entities.csv
|
# Generate Modbus entity parameters
|
||||||
rm -f dump_entities.csv
|
# One to build the modbus_entity_parameters.hpp header file
|
||||||
echo "test entity_dump" | ./emsesp | python3 ./scripts/strip_csv.py >dump_entities.csv
|
# And then run entity_dump test again to create the dump_entities.csv file with the correct modbus counts
|
||||||
ls -al dump_entities.csv
|
|
||||||
|
|
||||||
# dump_telegrams.csv
|
|
||||||
rm -f dump_telegrams.csv
|
|
||||||
echo "test telegram_dump" | ./emsesp | python3 ./scripts/strip_csv.py >dump_telegrams.csv
|
|
||||||
ls -al dump_telegrams.csv
|
|
||||||
|
|
||||||
# generate ./src/modbus_entity_parameters.hpp
|
|
||||||
rm -f ./src/modbus_entity_parameters.hpp
|
rm -f ./src/modbus_entity_parameters.hpp
|
||||||
cat dump_entities.csv | python3 ./scripts/update_modbus_registers.py >./src/modbus_entity_parameters.hpp
|
echo "test entity_dump" | ./emsesp | python3 ./scripts/strip_csv.py | python3 ./scripts/update_modbus_registers.py >./src/modbus_entity_parameters.hpp
|
||||||
ls -al ./src/modbus_entity_parameters.hpp
|
ls -al ./src/modbus_entity_parameters.hpp
|
||||||
|
|
||||||
# generate doc - Modbus-Entity-Registers.md used in the emsesp.org documentation.
|
# dump_entities.csv
|
||||||
cat dump_entities.csv | python3 ./scripts/generate-modbus-register-doc.py >./docs/Modbus-Entity-Registers.md
|
make ARGS=-DEMSESP_STANDALONE
|
||||||
|
rm -f ./docs/dump_entities.csv
|
||||||
|
echo "test entity_dump" | ./emsesp | python3 ./scripts/strip_csv.py >./docs/dump_entities.csv
|
||||||
|
ls -al ./docs/dump_entities.csv
|
||||||
|
|
||||||
|
# dump_telegrams.csv
|
||||||
|
rm -f ./docs/dump_telegrams.csv
|
||||||
|
echo "test telegram_dump" | ./emsesp | python3 ./scripts/strip_csv.py >./docs/dump_telegrams.csv
|
||||||
|
ls -al ./docs/dump_telegrams.csv
|
||||||
|
|
||||||
|
# generate doc - Modbus-Entity-Registers.md used in the emsesp.org documentation
|
||||||
|
rm -f ./docs/Modbus-Entity-Registers.md
|
||||||
|
cat ./docs/dump_entities.csv | python3 ./scripts/generate-modbus-register-doc.py >./docs/Modbus-Entity-Registers.md
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Update modbus parameters from entity definitions.
|
|
||||||
# This script generates c++ code for the modbus parameter definitions.
|
|
||||||
#
|
|
||||||
# Run this script from the EMS-ESP32 root directory with the command `bash ./scripts/update_modbus_registers.sh`.
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
case $1 in
|
|
||||||
--reset)
|
|
||||||
RESET=YES
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--force)
|
|
||||||
FORCE=YES
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
* | -* | --*)
|
|
||||||
echo "Unknown option $1"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$RESET" = "YES" ]; then
|
|
||||||
if [ "$FORCE" != "YES" ]; then
|
|
||||||
read -p "Are you sure you want to reset all modbus entity parameters, potentially generating new register mappings? WARNING: This might introduce breaking changes for end users. [yes/no] " CONFIRMATION
|
|
||||||
if [ "$CONFIRMATION" != "yes" ]; then
|
|
||||||
echo "Aborted."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo "Resetting modbus configuration"
|
|
||||||
cat >./src/modbus_entity_parameters.hpp <<EOL
|
|
||||||
#include "modbus.h"
|
|
||||||
#include "emsdevice.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is auto-generated by the update_modbus_registers.sh script. Do not modify.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
namespace emsesp {
|
|
||||||
|
|
||||||
using dt = EMSdevice::DeviceType;
|
|
||||||
|
|
||||||
#define REGISTER_MAPPING(device_type, device_value_tag_type, long_name, modbus_register_offset, modbus_register_count) \\
|
|
||||||
{ device_type, device_value_tag_type, long_name[0], modbus_register_offset, modbus_register_count }
|
|
||||||
|
|
||||||
// IMPORTANT: This list MUST be ordered by keys "device_type", "device_value_tag_type" and "modbus_register_offset" in this order.
|
|
||||||
const std::initializer_list<Modbus::EntityModbusInfo> Modbus::modbus_register_mappings = {};
|
|
||||||
|
|
||||||
} // namespace emsesp
|
|
||||||
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
EOL
|
|
||||||
fi
|
|
||||||
|
|
||||||
make clean
|
|
||||||
make ARGS=-DEMSESP_STANDALONE
|
|
||||||
echo "test entity_dump" | ./emsesp | python3 ./scripts/strip_csv.py | python3 ./scripts/update_modbus_registers.py >./src/modbus_entity_parameters.hpp
|
|
||||||
echo "Modbus entity parameters written to ./src/modbus_entity_parameters.hpp."
|
|
||||||
Reference in New Issue
Block a user