fix: send decimal channel mask instead of binary string#22
Merged
Conversation
The firmware's SCPI_ParamInt32 parses ENAble:VOLTage:DC as a decimal
integer, but the example app was treating --channels as a binary string
and generating binary masks internally.
Changes:
- IsValidChannelMask: now validates decimal integers instead of 0/1 strings
- Auto-generated all-channel mask: uses (1 << count) - 1 instead of
new string('1', count) which produced the wrong decimal value
- Help text: updated to show decimal bitmask examples
Tested on real hardware (Nq1 at /dev/cu.usbmodem101): --channels 7
correctly logged only channels 0,1,2 (3 analog values per sample).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IsValidChannelMask()only accepted binary strings (0s and 1s) and the--channelshelp text said "0/1 mask". The firmware'sSCPI_ParamInt32parsesENAble:VOLTage:DCas a decimal integer, so--channels 111(intended as binary for ch 0,1,2) was parsed as decimal 111 = wrong channels.new string('1', adcCount)which for 8 channels produced"11111111"— firmware parses as decimal 11,111,111 instead of the correct255.IsValidChannelMasknow validates decimal integers viauint.TryParse.(1 << count) - 1(e.g. 255 for 8 channels).Related: daqifi/daqifi-desktop#439, daqifi/daqifi-core#160
Test plan
--channels 7correctly logged only channels 0,1,2 on real hardware (Nq1 @/dev/cu.usbmodem101) — downloaded file showed 3 analog values per sample🤖 Generated with Claude Code