-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move common Modbus/TCP client support files to general module
To be used from future Modbus/TCP Battery module too.
- Loading branch information
Showing
23 changed files
with
98 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Modbus Value Type.uint8.enum | ||
meters_modbus_tcp_defs.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Modbus Value Type.uint8.enum |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import sys | ||
import tinkerforge_util as tfutil | ||
|
||
tfutil.create_parent_module(__file__, 'software') | ||
|
||
from software import util | ||
|
||
def make_modbus_value_type(register_count, is_signed, is_float, register_order_is_le): | ||
assert 1 <= register_count <= 4, register_count | ||
|
||
# bit [0..2] bit [3] bit [4] bit [5] | ||
return register_count | ((1 if is_signed else 0) << 3) | ((1 if is_float else 0) << 4) | ((1 if register_order_is_le else 0) << 5) | ||
|
||
|
||
modbus_value_types = [ | ||
('None', 0), | ||
('U16', make_modbus_value_type(1, False, False, False)), | ||
('S16', make_modbus_value_type(1, True, False, False)), | ||
('U32BE', make_modbus_value_type(2, False, False, False)), | ||
('U32LE', make_modbus_value_type(2, False, False, True)), | ||
('S32BE', make_modbus_value_type(2, True, False, False)), | ||
('S32LE', make_modbus_value_type(2, True, False, True)), | ||
('F32BE', make_modbus_value_type(2, True, True, False)), | ||
('F32LE', make_modbus_value_type(2, True, True, True)), | ||
('U64BE', make_modbus_value_type(4, False, False, False)), | ||
('U64LE', make_modbus_value_type(4, False, False, True)), | ||
('S64BE', make_modbus_value_type(4, True, False, False)), | ||
('S64LE', make_modbus_value_type(4, True, False, True)), | ||
('F64BE', make_modbus_value_type(4, True, True, False)), | ||
('F64LE', make_modbus_value_type(4, True, True, True)), | ||
] | ||
|
||
with open('Modbus Value Type.uint8.enum', 'w', encoding='utf-8') as f: | ||
f.write('# WARNING: This file is generated\n') | ||
|
||
for item in modbus_value_types: | ||
f.write(f'{item[0]} = {item[1]}\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
; Use empty module.ini to make git create this directory for pio_hooks.py to generate files into |