mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
auto comments
This commit is contained in:
@@ -3,9 +3,11 @@
|
|||||||
# This script generates c++ code for the modbus parameter definitions.
|
# This script generates c++ code for the modbus parameter definitions.
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# - first, dump all entities to csv by running 'scripts/dump_entities.sh'
|
# - first, dump all entities to csv by running 'sh ./scripts/dump_entities.sh'
|
||||||
# - then run 'cat ../dump_entities.csv | python3 update_modbus_registers.py > ../src/modbus_entity_parameters.hpp'
|
# - then run 'cat ../dump_entities.csv | python3 update_modbus_registers.py > ../src/modbus_entity_parameters.hpp'
|
||||||
# from the "scripts" folder
|
# from the "scripts" folder
|
||||||
|
# OR
|
||||||
|
# run `sh ./scripts/update_modbus_registers.sh` from the root folder
|
||||||
|
|
||||||
import fileinput
|
import fileinput
|
||||||
import csv
|
import csv
|
||||||
@@ -114,6 +116,12 @@ device_type_names = [
|
|||||||
cpp_file_template = Template('''#include "modbus.h"
|
cpp_file_template = Template('''#include "modbus.h"
|
||||||
#include "emsdevice.h"
|
#include "emsdevice.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is auto-generated by the update_modbus_registers.sh script. Do not modify.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
using dt = EMSdevice::DeviceType;
|
using dt = EMSdevice::DeviceType;
|
||||||
@@ -125,7 +133,10 @@ using dt = EMSdevice::DeviceType;
|
|||||||
const std::initializer_list<Modbus::EntityModbusInfo> Modbus::modbus_register_mappings = {
|
const std::initializer_list<Modbus::EntityModbusInfo> Modbus::modbus_register_mappings = {
|
||||||
$entries};
|
$entries};
|
||||||
|
|
||||||
} // namespace emsesp''')
|
} // namespace emsesp
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
''')
|
||||||
# cpp_entry_template = Template(
|
# cpp_entry_template = Template(
|
||||||
# ' {std::make_tuple($devtype, $tagtype, std::string(\"$shortname\")), {$registeroffset, $registercount}},\n')
|
# ' {std::make_tuple($devtype, $tagtype, std::string(\"$shortname\")), {$registeroffset, $registercount}},\n')
|
||||||
cpp_entry_template = Template(
|
cpp_entry_template = Template(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# Update modbus parameters from entity definitions.
|
# Update modbus parameters from entity definitions.
|
||||||
# This script generates c++ code for the modbus parameter definitions.
|
# This script generates c++ code for the modbus parameter definitions.
|
||||||
#
|
#
|
||||||
# Run this script from the EMS-ESP32 root directory with the command `scripts/update_modbus_registers.sh`.
|
# Run this script from the EMS-ESP32 root directory with the command `sh ./scripts/update_modbus_registers.sh`.
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
@@ -35,6 +35,12 @@ if [ "$RESET" = "YES" ]; then
|
|||||||
#include "modbus.h"
|
#include "modbus.h"
|
||||||
#include "emsdevice.h"
|
#include "emsdevice.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is auto-generated by the update_modbus_registers.sh script. Do not modify.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
using dt = EMSdevice::DeviceType;
|
using dt = EMSdevice::DeviceType;
|
||||||
@@ -46,6 +52,9 @@ using dt = EMSdevice::DeviceType;
|
|||||||
const std::initializer_list<Modbus::EntityModbusInfo> Modbus::modbus_register_mappings = {};
|
const std::initializer_list<Modbus::EntityModbusInfo> Modbus::modbus_register_mappings = {};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
EOL
|
EOL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -53,3 +62,4 @@ make clean
|
|||||||
make ARGS=-DEMSESP_STANDALONE
|
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 "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."
|
echo "Modbus entity parameters written to ./src/modbus_entity_parameters.hpp."
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
#include "modbus.h"
|
#include "modbus.h"
|
||||||
#include "emsdevice.h"
|
#include "emsdevice.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is auto-generated by the update_modbus_registers.sh script. Do not modify.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
using dt = EMSdevice::DeviceType;
|
using dt = EMSdevice::DeviceType;
|
||||||
@@ -513,3 +519,6 @@ const std::initializer_list<Modbus::EntityModbusInfo> Modbus::modbus_register_ma
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user