Skip to content

Commit 44fcf07

Browse files
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

File tree

NEWS.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,11 @@ several `FSD` notifications into one executed action. [PR #3097]
636636
- `apc_modbus` driver updates:
637637
* Fixed register range in a logging string.
638638
* Add outlet group timers.
639+
* Fixed outlet group command handling to dynamically detect available groups
640+
(MOG, SOG0 - SOG2) in the device. Commands and variables are now only
641+
exposed for outlet groups actually present on the UPS. Global `load.*` and
642+
`shutdown.*` commands now correctly target all available outlet groups.
643+
[PR #3395]
639644

640645

641646
Release notes for NUT 2.8.4 - what's new since 2.8.3

0 commit comments

Comments
 (0)