Commit 868b95e
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 50ec847 commit 868b95e
3 files changed
Lines changed: 386 additions & 72 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
184 | 189 | | |
185 | 190 | | |
186 | 191 | | |
| |||
0 commit comments