From ed9b32043b24da40395b0bfa2d9ce496509a8403 Mon Sep 17 00:00:00 2001 From: Tyler Kron Date: Sun, 29 Mar 2026 09:54:59 -0600 Subject: [PATCH 1/2] fix: send decimal channel mask for SD card logging instead of binary StartSdCardLogging() used Convert.ToString(analogChannelMask, 2) which produced a binary string (e.g. "111" for channels 0-2). The firmware's SCPI_ParamInt32 parses this as decimal 111, enabling the wrong channels. Changed to analogChannelMask.ToString() to send the correct decimal bitmask (e.g. "7" for channels 0-2). This matches AddChannel/ RemoveChannel which already use decimal via Convert.ToString() without a base parameter. Fixes #439 Co-Authored-By: Claude Opus 4.6 --- Daqifi.Desktop.Test/Device/AbstractStreamingDeviceTests.cs | 4 ++-- Daqifi.Desktop/Device/AbstractStreamingDevice.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Daqifi.Desktop.Test/Device/AbstractStreamingDeviceTests.cs b/Daqifi.Desktop.Test/Device/AbstractStreamingDeviceTests.cs index 8ce2bdb3..7d23c52c 100644 --- a/Daqifi.Desktop.Test/Device/AbstractStreamingDeviceTests.cs +++ b/Daqifi.Desktop.Test/Device/AbstractStreamingDeviceTests.cs @@ -586,8 +586,8 @@ public void StartSdCardLogging_UsesCombinedAnalogMaskAndConfiguresDigitalPortsOn "Core handles this via the channelMask parameter."); CollectionAssert.Contains( device.SentCommands, - $"core:{ScpiMessageProducer.EnableAdcChannels("10101").Data}", - "Core should receive a single combined binary analog mask for the active SD logging channels."); + $"core:{ScpiMessageProducer.EnableAdcChannels("21").Data}", + "Core should receive a decimal channel mask for the active SD logging channels."); } [TestMethod] diff --git a/Daqifi.Desktop/Device/AbstractStreamingDevice.cs b/Daqifi.Desktop/Device/AbstractStreamingDevice.cs index dcfefa45..d15b7819 100644 --- a/Daqifi.Desktop/Device/AbstractStreamingDevice.cs +++ b/Daqifi.Desktop/Device/AbstractStreamingDevice.cs @@ -473,7 +473,7 @@ public void StartSdCardLogging() // The Core package resumes StartSdCardLoggingAsync continuations on the caller's // synchronization context. Running it on the thread pool prevents UI deadlocks. - var channelMaskString = Convert.ToString((long)analogChannelMask, 2); + var channelMaskString = analogChannelMask.ToString(); Task.Run(() => coreDevice.StartSdCardLoggingAsync(channelMask: channelMaskString, format: SdCardLogFormat)).GetAwaiter().GetResult(); IsLoggingToSdCard = coreDevice.IsLoggingToSdCard; From 4d66b318043257b1b397c4e51daa92baf7ffd537 Mon Sep 17 00:00:00 2001 From: Tyler Kron Date: Mon, 30 Mar 2026 09:42:00 -0600 Subject: [PATCH 2/2] fix: use InvariantCulture for SD card channel mask string Ensures the decimal channel mask sent to firmware via SCPI is always formatted with ASCII digits, regardless of the user's locale. Co-Authored-By: Claude Opus 4.6 --- Daqifi.Desktop/Device/AbstractStreamingDevice.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Daqifi.Desktop/Device/AbstractStreamingDevice.cs b/Daqifi.Desktop/Device/AbstractStreamingDevice.cs index d15b7819..50dad990 100644 --- a/Daqifi.Desktop/Device/AbstractStreamingDevice.cs +++ b/Daqifi.Desktop/Device/AbstractStreamingDevice.cs @@ -473,7 +473,7 @@ public void StartSdCardLogging() // The Core package resumes StartSdCardLoggingAsync continuations on the caller's // synchronization context. Running it on the thread pool prevents UI deadlocks. - var channelMaskString = analogChannelMask.ToString(); + var channelMaskString = analogChannelMask.ToString(CultureInfo.InvariantCulture); Task.Run(() => coreDevice.StartSdCardLoggingAsync(channelMask: channelMaskString, format: SdCardLogFormat)).GetAwaiter().GetResult(); IsLoggingToSdCard = coreDevice.IsLoggingToSdCard;