We are developing custom C# software using MOZA SDK 1.0.1.8 and are trying to read the physical state of the stalks (specifically multi-position rotary groups like [SwitchesIndex.HeadlightOff, SwitchesIndex.HeadlightPark, SwitchesIndex.HeadlightHigh]).
Currently, calling device.GetStateInfo(out ERRORCODE err) on startup returns an all-zero state array. The correct group state is only populated after the user physically rotates the switch or stalk after the app is already running.
Is there an official SDK function or recommended pattern to force an initial hardware latch state query upon application startup without requiring manual physical interaction?
Gudsen Support Supportposted
about 8 hours ago
Admin
GetStateInfo() combines HID input with the initial switch state synchronized from Pit House. Until communication and synchronization are complete, it may return zeros or incomplete data even when the device is open and connected.
The public SwitchesDevice interface does not expose a separate function to force an initial hardware latch-state query. The recommended approach is to start the MOZA Pit House, confirm that it recognizes the stalks, then open the device and wait for initialization.
Your code already polls continuously, but it only checks whether the returned list is nonempty and does not check err. Please accept the data as a valid, complete position snapshot only when:
Until then, display the positions as “Unknown / Initializing” rather than interpreting zeros as all switches being off. Increasing the polling frequency will not force initial-state synchronization.
If the state remains unavailable after several seconds and only appears after moving the switches, please provide your Pit House version, stalk firmware version, and the err and IsRotarySwitchStateReady values before and after movement. Please also compare the behavior with example/switches_test.cc from the same SDK package so we can investigate further.
Hello MOZA Support Team,
We are developing custom C# software using MOZA SDK 1.0.1.8 and are trying to read the physical state of the stalks (specifically multi-position rotary groups like [SwitchesIndex.HeadlightOff, SwitchesIndex.HeadlightPark, SwitchesIndex.HeadlightHigh]).
Currently, calling device.GetStateInfo(out ERRORCODE err) on startup returns an all-zero state array. The correct group state is only populated after the user physically rotates the switch or stalk after the app is already running.
Is there an official SDK function or recommended pattern to force an initial hardware latch state query upon application startup without requiring manual physical interaction?
Attachments (2)
CustomSwitchesGroups.cs
1.54 KB
Program.cs
5.63 KB
0 Votes
1 Comments
Gudsen Support Support posted about 8 hours ago Admin
GetStateInfo()combines HID input with the initial switch state synchronized from Pit House. Until communication and synchronization are complete, it may return zeros or incomplete data even when the device is open and connected.SwitchesDeviceinterface does not expose a separate function to force an initial hardware latch-state query. The recommended approach is to start the MOZA Pit House, confirm that it recognizes the stalks, then open the device and wait for initialization.err. Please accept the data as a valid, complete position snapshot only when:errandIsRotarySwitchStateReadyvalues before and after movement. Please also compare the behavior withexample/switches_test.ccfrom the same SDK package so we can investigate further.0 Votes
Login or Sign up to post a comment