auto comments

This commit is contained in:
proddy
2024-07-14 23:45:07 +02:00
parent 5f1cc56939
commit 7fc2afc11b
3 changed files with 33 additions and 3 deletions

View File

@@ -3,9 +3,11 @@
# This script generates c++ code for the modbus parameter definitions.
#
# 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'
# from the "scripts" folder
# OR
# run `sh ./scripts/update_modbus_registers.sh` from the root folder
import fileinput
import csv
@@ -114,6 +116,12 @@ device_type_names = [
cpp_file_template = Template('''#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;
@@ -125,7 +133,10 @@ using dt = EMSdevice::DeviceType;
const std::initializer_list<Modbus::EntityModbusInfo> Modbus::modbus_register_mappings = {
$entries};
} // namespace emsesp''')
} // namespace emsesp
// clang-format off
''')
# cpp_entry_template = Template(
# ' {std::make_tuple($devtype, $tagtype, std::string(\"$shortname\")), {$registeroffset, $registercount}},\n')
cpp_entry_template = Template(