Skip to content

Fix: Allow writing -1 to register 2704 (MaxDischargePower) #1580#54

Open
drurew wants to merge 2 commits intovictronenergy:masterfrom
drurew:fix/issue-1580
Open

Fix: Allow writing -1 to register 2704 (MaxDischargePower) #1580#54
drurew wants to merge 2 commits intovictronenergy:masterfrom
drurew:fix/issue-1580

Conversation

@drurew
Copy link
Copy Markdown

@drurew drurew commented Feb 15, 2026

Description

This PR addresses Issue #1580 where writing -1 to register 2704 was treated as a scaled value (resulting in -0.1 or invalid values) instead of the special 'unlimited' flag.

Changes

  • Introduced a new Modbus type int16_ul (int16 unlimited) in mappings.h and mappings.cpp.
  • int16_ul behaves exactly like int16 (with scaling), EXCEPT:
    • Read: If the DBus value is -1.0, it reports as 0xFFFF (-1).
    • Write: If the Modbus value is 0xFFFF (-1), it writes -1.0 to DBus (bypassing scaling).
  • Updated attributes.csv to use int16_ul for register 2704 (MaxDischargePower).

Verification

  • Verified logic via standalone script simulating the getValue and setValues transformations.

…89). Correctly handle lowerBound() returning end() when address is inside the last register block.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant