Add command AIN:ACQUIRE:ENABLE

This commit is contained in:
Joris van Rantwijk 2024-10-11 21:02:09 +02:00
parent 2bf8b9f938
commit ce08bd84e4
3 changed files with 35 additions and 6 deletions

View File

@ -119,6 +119,7 @@ In the response string, such data elements are separated by space characters.
| `AIN:TRIGGER:STATUS?` | Trigger status. |
| `AIN:TRIGGER:EXT:CHANNEL` | External trigger channel. |
| `AIN:TRIGGER:EXT:EDGE` | External trigger edge. |
| `AIN:ACQUIRE:ENABLE` | Enable analog acquisition. |
| `TT:SAMPLE?` | Digital input state. |
| `TT:EVENT:MASK` | Timetagger event mask. |
| `TT:MARK` | Emit timetagger marker. |
@ -382,6 +383,18 @@ This command selects rising or falling edges in the external trigger signal.
Query: `AIN:TRIGGER:EXT:EDGE?` <br>
Response: either `RISING` or `FALLING`.
### `AIN:ACQUIRE:ENABLE`
Command: `AIN:ACQUIRE:ENABLE en` <br>
Parameter _en_: either `0` or `1`.
This command enables or disables analog acquisition.
When enabled, analog samples are acquired according to the configured trigger mode.
When disabled, all triggers are ignored and any ongoing analog acquisition stops immediately.
Query: `AIN:ACQUIRE:ENABLE?` <br>
Response: either `0` or `1`.
### `TT:SAMPLE?`
Query: `TT:SAMPLE?` <br>

View File

@ -543,9 +543,6 @@ public:
m_device.set_record_length(1024);
m_device.set_timetagger_event_mask(0);
m_device.clear_adc_range();
// Enable analog acquisition.
m_device.set_acquisition_enabled(true);
}
/**
@ -901,6 +898,12 @@ private:
}
}
/** Handle command AIN:ACQUIRE:ENABLE? */
std::string qry_acquire_enable(CommandEnvironment env)
{
return m_device.is_acquisition_enabled() ? "1" : "0";
}
/** Handle command TT:SAMPLE? */
std::string qry_tt_sample(CommandEnvironment env)
{
@ -1288,6 +1291,18 @@ private:
return "OK";
}
/** Handle command AIN:ACQUIRE:ENABLE */
std::string cmd_acquire_enable(CommandEnvironment env,
const std::string& arg)
{
unsigned int n;
if ((! parse_uint(arg, n)) || (n > 1)) {
return err_invalid_argument();
}
m_device.set_acquisition_enabled(n != 0);
return "OK";
}
/** Handle command TT:EVENT:MASK */
std::string cmd_tt_event_mask(CommandEnvironment env,
const std::string& arg)
@ -1367,6 +1382,7 @@ private:
{ "ain:chN:sample:raw?", &CommandHandler::qry_channel_sample },
{ "ain:chN:minmax?", &CommandHandler::qry_channel_minmax },
{ "ain:chN:minmax:raw?", &CommandHandler::qry_channel_minmax },
{ "ain:acquire:enable?", &CommandHandler::qry_acquire_enable },
{ "ain:srate?", &CommandHandler::qry_srate },
{ "ain:srate:divisor?", &CommandHandler::qry_srate_divisor },
{ "ain:srate:mode?", &CommandHandler::qry_srate_mode },
@ -1402,6 +1418,7 @@ private:
{ "ain:chN:offset:RR", &CommandHandler::cmd_channel_offset },
{ "ain:chN:gain", &CommandHandler::cmd_channel_gain },
{ "ain:chN:gain:RR", &CommandHandler::cmd_channel_gain },
{ "ain:acquire:enable", &CommandHandler::cmd_acquire_enable },
{ "ain:srate", &CommandHandler::cmd_srate },
{ "ain:srate:divisor", &CommandHandler::cmd_srate_divisor },
{ "ain:srate:mode", &CommandHandler::cmd_srate_mode },
@ -1864,13 +1881,12 @@ int run_remote_control_server(
command_handler.add_data_server(acq_server);
command_handler.add_data_server(timetagger_server);
// Restore firmware status on exit from this function.
// Disable DMA on exit from this function.
struct ScopeGuard {
PuzzleFwDevice& m_device;
ScopeGuard(PuzzleFwDevice& device) : m_device(device) { }
~ScopeGuard() {
m_device.set_dma_enabled(false);
m_device.set_acquisition_enabled(false);
}
} scope_guard(device);

View File

@ -1,2 +1,2 @@
#define PUZZLEFW_SW_MAJOR 0
#define PUZZLEFW_SW_MINOR 3
#define PUZZLEFW_SW_MINOR 4