-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
72 changed files
with
2,127 additions
and
1,627 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
exclude: '^docs/|/migrations/|devcontainer.json' | ||
default_stages: [commit] | ||
|
||
default_language_version: | ||
python: python3.11 | ||
|
||
fail_fast: false | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-json | ||
- id: check-toml | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: check-builtin-literals | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: detect-private-key | ||
|
||
- repo: https://github.com/adamchainz/django-upgrade | ||
rev: '1.16.0' | ||
hooks: | ||
- id: django-upgrade | ||
args: ['--target-version', '4.2'] | ||
|
||
# Run the Ruff linter. | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.3.2 | ||
hooks: | ||
# Linter | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes] | ||
# Formatter | ||
- id: ruff-format | ||
|
||
- repo: https://github.com/Riverside-Healthcare/djLint | ||
rev: v1.34.1 | ||
hooks: | ||
- id: djlint-reformat-django | ||
- id: djlint-django | ||
|
||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: '' # Use the sha / tag you want to point at | ||
hooks: | ||
- id: mypy | ||
|
||
- repo: https://github.com/pocc/pre-commit-hooks | ||
rev: master | ||
hooks: | ||
- id: clang-format | ||
args: [--style=Google, -i] # inline | ||
- id: clang-tidy | ||
args: [--fix, --fix-errors, --format-style=google] | ||
#- id: oclint | ||
#- id: uncrustify | ||
# args: [-c "/home/simon/Argus/MWIRDetector/firmware/uncrustify_google_cpp_allman.cfg"] | ||
- id: cppcheck | ||
args: [--std=c++17, --language=c++] | ||
- id: cpplint | ||
args: [--headers=h] | ||
#- id: include-what-you-use | ||
|
||
|
||
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date | ||
ci: | ||
autoupdate_schedule: weekly | ||
skip: [] | ||
submodules: false |
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 |
---|---|---|
|
@@ -9,4 +9,3 @@ else() | |
set(PACKAGE_VERSION_EXACT TRUE) | ||
endif() | ||
endif() | ||
|
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 @@ | ||
.metadata | ||
|
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,66 +1,75 @@ | ||
import copy | ||
from jinja2 import Template, Environment, FileSystemLoader | ||
from modbus_generator import MapEntry, DataType, FunctionType, SetAddresses, Slave, WindLDREntry, MakeWindLDRConfig, MapEntry, ModbusRegister | ||
from modbus_generator import ( | ||
DataType, | ||
FunctionType, | ||
SetAddresses, | ||
MapEntry, | ||
ModbusRegister, | ||
) | ||
import modbus_generator | ||
import sys | ||
|
||
input_registers = ( | ||
ModbusRegister('version', DataType.kString, 64, FunctionType.kInput), | ||
ModbusRegister('firmware_version', DataType.kString, 64, FunctionType.kInput), | ||
ModbusRegister('compile_date', DataType.kString, 64, FunctionType.kInput), | ||
ModbusRegister('compile_time', DataType.kString, 64, FunctionType.kInput), | ||
ModbusRegister('serial_number', DataType.kString, 40, FunctionType.kInput), | ||
|
||
ModbusRegister('fault_status', DataType.uint16_t, 1, FunctionType.kInput), | ||
|
||
ModbusRegister('p5_micro_volts', DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister('p5_reading', DataType.uint32_t, 1, FunctionType.kInput), | ||
|
||
ModbusRegister('p23_micro_volts', DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister('p23_reading', DataType.uint32_t, 1, FunctionType.kInput), | ||
|
||
ModbusRegister('vlo_micro_volts', DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister('vlo_reading', DataType.uint32_t, 1, FunctionType.kInput), | ||
|
||
ModbusRegister('thermistor_temp_spi', DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister('thermistor_temp_mcu', DataType.int32_t, 1, FunctionType.kInput), | ||
|
||
ModbusRegister('data_frequency', DataType.uint32_t, 1, FunctionType.kInput), | ||
|
||
ModbusRegister('p3_3_micro_volts', DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister('p3_3_reading', DataType.uint32_t, 1, FunctionType.kInput), | ||
ModbusRegister("version", DataType.kString, 64, FunctionType.kInput), | ||
ModbusRegister("firmware_version", DataType.kString, 64, FunctionType.kInput), | ||
ModbusRegister("compile_date", DataType.kString, 64, FunctionType.kInput), | ||
ModbusRegister("compile_time", DataType.kString, 64, FunctionType.kInput), | ||
ModbusRegister("serial_number", DataType.kString, 40, FunctionType.kInput), | ||
ModbusRegister("fault_status", DataType.uint16_t, 1, FunctionType.kInput), | ||
ModbusRegister("p5_micro_volts", DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister("p5_reading", DataType.uint32_t, 1, FunctionType.kInput), | ||
ModbusRegister("p23_micro_volts", DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister("p23_reading", DataType.uint32_t, 1, FunctionType.kInput), | ||
ModbusRegister("vlo_micro_volts", DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister("vlo_reading", DataType.uint32_t, 1, FunctionType.kInput), | ||
ModbusRegister("thermistor_temp_spi", DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister("thermistor_temp_mcu", DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister("data_frequency", DataType.uint32_t, 1, FunctionType.kInput), | ||
ModbusRegister("p3_3_micro_volts", DataType.int32_t, 1, FunctionType.kInput), | ||
ModbusRegister("p3_3_reading", DataType.uint32_t, 1, FunctionType.kInput), | ||
) | ||
|
||
holding_registers = ( | ||
ModbusRegister('analog_output0', DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister('analog_output1', DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister('isp_mode', DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister('slave_address_unlock', DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister('slave_address', DataType.uint16_t, 1, FunctionType.kHolding), | ||
ModbusRegister('clear_faults', DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister('start_data_read', DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister("analog_output0", DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister("analog_output1", DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister("isp_mode", DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister("slave_address_unlock", DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister("slave_address", DataType.uint16_t, 1, FunctionType.kHolding), | ||
ModbusRegister("clear_faults", DataType.uint32_t, 1, FunctionType.kHolding), | ||
ModbusRegister("start_data_read", DataType.uint32_t, 1, FunctionType.kHolding), | ||
) | ||
|
||
|
||
def GetInputRegisterMapEntries(): | ||
InputRegisterMapEntries = [MapEntry(register=pt) for pt in input_registers] | ||
SetAddresses(InputRegisterMapEntries) | ||
return InputRegisterMapEntries | ||
|
||
|
||
def GetHoldingRegisterMapEntries(): | ||
HoldingRegisterMapEntries = [MapEntry(register=pt) for pt in holding_registers] | ||
SetAddresses(HoldingRegisterMapEntries) | ||
return HoldingRegisterMapEntries | ||
|
||
|
||
if __name__ == "__main__": | ||
modbus_generator.MakeHeader(GetHoldingRegisterMapEntries(), "HoldingRegisterMappedDataStore.h", name="HoldingRegisters") | ||
modbus_generator.MakeHeader(GetInputRegisterMapEntries(), "InputRegisterMappedDataStore.h", name="InputRegisters") | ||
modbus_generator.MakeHeader( | ||
GetHoldingRegisterMapEntries(), | ||
"HoldingRegisterMappedDataStore.h", | ||
name="HoldingRegisters", | ||
) | ||
modbus_generator.MakeHeader( | ||
GetInputRegisterMapEntries(), | ||
"InputRegisterMappedDataStore.h", | ||
name="InputRegisters", | ||
) | ||
|
||
modbus_generator.MakeLibModbusTest( | ||
input_registers=GetInputRegisterMapEntries(), | ||
holding_registers=GetHoldingRegisterMapEntries(), | ||
includes=["HoldingRegisterMappedDataStore.h", "InputRegisterMappedDataStore.h"]) | ||
includes=["HoldingRegisterMappedDataStore.h", "InputRegisterMappedDataStore.h"], | ||
) | ||
|
||
modbus_generator.MakePyModbusTest( | ||
input_registers=GetInputRegisterMapEntries(), | ||
holding_registers=GetHoldingRegisterMapEntries(), | ||
includes=["HoldingRegisterMappedDataStore.h", "InputRegisterMappedDataStore.h"]) | ||
includes=["HoldingRegisterMappedDataStore.h", "InputRegisterMappedDataStore.h"], | ||
) |
Oops, something went wrong.