Helper tools

This commit is contained in:
2024-09-17 13:18:18 +02:00
parent dba4e936e5
commit 18eabf3f0a
3 changed files with 3034 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -17,14 +17,20 @@ typedef struct
} pm8000_reg_map_t;
pm8000_reg_map_t pm8000_reg_map[] = {
[replace]
};
"""
lines = ""
for d in range(1, len(data)):
if not data[d][1].isnumeric():
continue
print("{} @ {}:{} ({}) Tag: {}".format(data[d][0], data[d][1] ,data[d][2] ,data[d][3],data[d][7]))
#print("{} @ {}:{} ({}) Tag: {}".format(data[d][0], data[d][1] ,data[d][2] ,data[d][3],data[d][7]))
lines += " { " + data[d][1] + ", " + data[d][2] + ", \"" + data[d][3] + "\", \"" + data[d][0].encode('ascii',"ignore").decode('ascii') + "\" },\n"
#
print(header.replace("[replace]", lines))
file = open("PM8000_Modbus_Map.h", "w")
file.write(header.replace("[replace]", lines))
file.close()