Allow checkReachableRegister to be defined also within a block
This commit is contained in:
parent
2de980e9a5
commit
5db18ec40f
@ -127,7 +127,7 @@ Depending on your device the amount of errors in a row can vary and can be speci
|
|||||||
|
|
||||||
In order to check if the device is reachable, a register can be defined by the developer as a test register.
|
In order to check if the device is reachable, a register can be defined by the developer as a test register.
|
||||||
For this purpose the `checkReachableRegister` property has been introduced. The property describes the `id` of the register which will be used for testing the communication. The register should be mandatory on the device
|
For this purpose the `checkReachableRegister` property has been introduced. The property describes the `id` of the register which will be used for testing the communication. The register should be mandatory on the device
|
||||||
and only one register in size to speed up things. During the check the response data will be ignored, only the communication will be tested. The register must be *readable* and be defined in the `registers` section of your JSON file.
|
and only one register in size to speed up things. During the check the response data will be ignored, only the communication will be tested. The register must be *readable* and be defined in the `registers` section of your JSON file or in a block.
|
||||||
|
|
||||||
## Endianness
|
## Endianness
|
||||||
|
|
||||||
|
|||||||
@ -758,6 +758,18 @@ for registerDefinition in registerJson['registers']:
|
|||||||
registerExists = True
|
registerExists = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if 'blocks' in registerJson:
|
||||||
|
for blockDefinition in registerJson['blocks']:
|
||||||
|
for registerDefinition in blockDefinition['registers']:
|
||||||
|
if registerDefinition['id'] == checkReachableRegister:
|
||||||
|
if not 'R' in registerDefinition['access']:
|
||||||
|
logger.warning('Error: The specified \"checkReachableRegister\" is not readable. Please select a manadtory readable register as checkReachableRegister.')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
checkReachableRegister = registerDefinition
|
||||||
|
registerExists = True
|
||||||
|
break
|
||||||
|
|
||||||
if not registerExists:
|
if not registerExists:
|
||||||
logger.warning('Error: Could not find the given \"checkReachableRegister\". Please make sure the specified register matches the \"id\" of a defined register.')
|
logger.warning('Error: Could not find the given \"checkReachableRegister\". Please make sure the specified register matches the \"id\" of a defined register.')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user