Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-pico-bridge
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 754b9ae50c2d
Choose a base ref
...
head repository: ngscopeclient/scopehal-pico-bridge
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 68af445561c0
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on May 6, 2021

  1. Implemented BITS command

    azonenberg committed May 6, 2021
    Copy the full SHA
    68af445 View commit details
Showing with 39 additions and 1 deletion.
  1. +39 −1 src/ps6000d/ScpiServerThread.cpp
40 changes: 39 additions & 1 deletion src/ps6000d/ScpiServerThread.cpp
Original file line number Diff line number Diff line change
@@ -55,6 +55,9 @@
[chan]:RANGE [num]
Sets channel full-scale range to num volts
BITS [num]
Sets ADC bit depth
DEPTH [num]
Sets memory depth
@@ -227,7 +230,7 @@ void ScpiServerThread()
else if(cmd == "CHANS")
ScpiSend(client, to_string(g_numChannels));

//Get memory depth
//Get legal sample rates for the current configuration
else if(cmd == "RATES")
{
string ret = "";
@@ -308,6 +311,39 @@ void ScpiServerThread()
UpdateChannel(channelId);
}

else if( (cmd == "BITS") && (args.size() == 1) )
{
lock_guard<mutex> lock(g_mutex);

ps6000aStop(g_hScope);

//Even though we didn't actually change memory, apparently calling ps6000aSetDeviceResolution
//will invalidate the existing buffers and make ps6000aGetValues() fail with PICO_BUFFERS_NOT_SET.
g_memDepthChanged = true;

int bits = stoi(args[0].c_str());
switch(bits)
{
case 8:
ps6000aSetDeviceResolution(g_hScope, PICO_DR_8BIT);
break;

case 10:
ps6000aSetDeviceResolution(g_hScope, PICO_DR_10BIT);
break;

case 12:
ps6000aSetDeviceResolution(g_hScope, PICO_DR_12BIT);
break;

default:
LogError("User requested invalid resolution (%d bits)\n", bits);
}

if(g_triggerArmed)
StartCapture(false);
}

else if( (cmd == "COUP") && (args.size() == 1) )
{
lock_guard<mutex> lock(g_mutex);
@@ -688,6 +724,8 @@ void StartCapture(bool stopFirst)
g_sampleIntervalDuringArm = g_sampleInterval;
g_triggerSampleIndex = g_memDepth/2;

//TODO: implement g_triggerDelay

if(stopFirst)
ps6000aStop(g_hScope);