Skip to content

Commit 395b104

Browse files
authored
Merge pull request #22 from daqifi/fix/channel-mask-binary-to-decimal
fix: send decimal channel mask instead of binary string
2 parents 79f8a97 + 6c83b7e commit 395b104

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

Program.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ private static async Task<int> RunSdCardOperationAsync(CliOptions options)
725725
var adcCount = streamingDevice.Metadata.Capabilities.AnalogInputChannels;
726726
if (adcCount > 0)
727727
{
728-
channelMask = new string('1', adcCount);
728+
channelMask = ((1u << adcCount) - 1).ToString();
729729
}
730730
}
731731

@@ -1289,15 +1289,7 @@ private static string GetLogFormatLabel(string fileName)
12891289

12901290
private static bool IsValidChannelMask(string channelMask)
12911291
{
1292-
foreach (var value in channelMask)
1293-
{
1294-
if (value != '0' && value != '1')
1295-
{
1296-
return false;
1297-
}
1298-
}
1299-
1300-
return true;
1292+
return uint.TryParse(channelMask, out _);
13011293
}
13021294

13031295
private static void PrintHelp()
@@ -1322,7 +1314,7 @@ private static void PrintHelp()
13221314
Console.WriteLine("Streaming Options:");
13231315
Console.WriteLine($" --rate <hz> Streaming rate in Hz (default: {DefaultRate}).");
13241316
Console.WriteLine($" --duration <seconds> Duration to stream (default: {DefaultDurationSeconds}).");
1325-
Console.WriteLine(" --channels <mask> Enable ADC channels with a 0/1 mask.");
1317+
Console.WriteLine(" --channels <mask> Enable ADC channels with a decimal bitmask (e.g. 7 = ch 0,1,2).");
13261318
Console.WriteLine(" --limit <count> Stop after N stream messages.");
13271319
Console.WriteLine(" --min-samples <count> Require at least N stream messages (exit code 2 on failure).");
13281320
Console.WriteLine();

0 commit comments

Comments
 (0)