3.1.19. waf_tools.diag_array_config_validate
Validate and render the foxBMS diagnosis array configuration.
This module validates the diag_array_cfg.json configuration file that
defines the diagnostic event table used by the foxBMS diagnostic engine.
It ensures consistency between the JSON configuration, the DIAG_ID_e
enumeration in diag_cfg.h, and the DBC file’s fatal error signal choices.
- The validation performs the following checks:
Structure - All required keys (
event,sensitivity,severity,delay,enabled,callback) are present in each entry.Value ranges - Sensitivity, severity, delay, and enabled values are restricted to the supported C literal mappings.
Header consistency - Event names and their order match the
DIAG_ID_eenum entries insrc/app/engine/config/diag_cfg.h.DBC consistency - All fatal error events have matching entries in the
FatalErrorCodesignal choices of thef_BmsFatalErrorCAN message defines intools/dbc/foxbms.dbc.
Additionally, the module provides render_diag_array() which converts
validated entries into C struct initializer lines for use by the code
generator (waf_tools.config_codegen_task).
3.1.19.1. Usage
The validator is typically passed as a callback to the codegen_config
feature in a waf build script:
bld(
features="codegen_config",
json=bld.srcnode.find_node(f"conf/bms/diag_array_cfg.json"),
validator=diag_array_config_validate.validate_diag_array_configuration,
target=f"{cp}diag_array_cfg",
)
3.1.19.2. Dependencies
waf_tools.config_validate_utils- JSON file reading utilities.cantools- DBC file parsing for CAN signal validation.
Functions
|
Render validated diagnostic array entries into C initializer lines. |
|
Validate the diagnostic array configuration file. |
Classes
|
Complete diagnostic array configuration. |
|
Single entry in the diagnostic array configuration. |
Exceptions
Raised for an invalid diagnostic array configuration. |