Commit 44fcf07
committed
apc_modbus: Fix outlet group command handling to be dynamic
Replace hardcoded outlet group commands with dynamic detection and
handling based on the `SOGRelayConfigSetting` register. This ensures
commands and variables are only exposed for outlet groups that are
actually present on the UPS.
Key changes:
- Add `APC_VF_UNAVAILABLE` flag to mark registers for absent outlet
groups
- Add outlet group info table tracking presence and target bits for each
group (`MOG`, `SOG0` to `SOG2`)
- Dynamically enumerate `outlet.group.N.id`,
`outlet.group.N.designator` and `outlet.group.N.status` variables
based on detected groups
- Replace static outlet command entries with
`_apc_modbus_handle_outlet_cmd()` which parses `load.*`, `shutdown.*`,
and `outlet.group.N.*` commands at runtime
- Global `load.*` and `shutdown.*` commands now target all available
outlet groups instead of only the main outlet group (`MOG`)
- Add `outlet.group.N.*` commands (`load.off`, `load.on`, `load.cycle`,
etc.) for each detected group
- Update `upsdrv_shutdown()` to use the unified command handler
- Add `OutletStatus_BF` bitfield definitions to header
This fixes issues where commands were exposed for non-existent outlet
groups and ensures load/shutdown operations affect all outlets on UPS
units with switched outlet groups.
Signed-off-by: Axel Gembe <axel@gembe.net>1 parent 0ddee01 commit 44fcf07
3 files changed
Lines changed: 390 additions & 73 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
639 | 644 | | |
640 | 645 | | |
641 | 646 | | |
| |||
0 commit comments