added start_delay between adc config and pulse card start; configurable via backend.conf

This commit is contained in:
Markus Rosenstihl 2019-05-23 17:17:57 +02:00
parent b3c0e85c0c
commit 45008c2138

View File

@ -11,6 +11,7 @@
#include "drivers/SpinCore-PulseBlaster24Bit/SpinCore-PulseBlaster24Bit.h"
#include <glib.h>
#include <time.h>
#include <fstream>
/**
@ -29,6 +30,7 @@
@{
*/
struct timespec start_delay;
class general_hardware: public hardware
{
@ -90,8 +92,15 @@ public:
}
else
USRCONF = 1;
if (!(SYSCONF | USRCONF))
if (!(SYSCONF | USRCONF)) {
error = NULL;
throw(core_exception("configuration failed!\n"));
}
int start_delay_msec = g_key_file_get_integer(cfg_file, "PB", "start_delay_msec", &error);
::start_delay = { start_delay_msec/1000, start_delay_msec%1000 * 1000000L};
if (error)
g_error("%s",error->message);
printf("done!\n");
/* configure ADC card */
@ -144,6 +153,7 @@ public:
g_error("%s",error->message);
error = NULL;
my_pts = new PTS_latched(pts_id);
// PTS 500 has 0.36 or 0.72 above 200MHz ; PTS 310 has 0.225 degrees/step
my_pts->phase_step = (float) g_key_file_get_double(cfg_file, "PTS", "phase_stepsize", &error);
if (error)
@ -172,6 +182,8 @@ public:
the_adc->set_daq(*work_copy);
else
throw ADC_exception("the_adc == NULL\n");
// ADC configured wait start_delay_msec before loading and starting pulse card
nanosleep(&::start_delay, NULL);
// the pulse generator is necessary
if (with_sync) {
my_pulseblaster->run_pulse_program_w_sync(*work_copy, my_adc->get_sample_clock_frequency());
@ -232,7 +244,7 @@ public:
core(conf)
{
the_hardware = new general_hardware();
the_name = "berta core";
the_name = "general core";
}
virtual const std::string& core_name() const
{