mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
adapt write function
Signed-off-by: Alexandra <alexandra.bach@eonerc.rwth-aachen.de>
This commit is contained in:
parent
9cd8729646
commit
e7865c424a
1 changed files with 12 additions and 12 deletions
|
@ -95,7 +95,7 @@ int SMUNode::parse(json_t *json)
|
|||
dumpers[idx].setActive();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!modeIn || strcmp(modeIn, "MODE_FREERUN")==0)
|
||||
|
@ -146,8 +146,8 @@ int SMUNode::parse(json_t *json)
|
|||
else if (strcmp(sample_rateIn, "FS_200kSPS")==0) {
|
||||
sample_rate = FS_200kSPS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (json_is_object(in_json) && json_object_get(in_json, "vectorize")) {
|
||||
throw ConfigError(json, "node-config-node-smu", "Vectorize cannot be overwritten for this node type!");
|
||||
|
@ -168,7 +168,7 @@ int SMUNode::start()
|
|||
daq_cfg.rate = sample_rate;
|
||||
daq_cfg.buff = fps;
|
||||
daq_cfg.mode = mode;
|
||||
daq_cfg.sync = sync;
|
||||
daq_cfg.sync = sync;
|
||||
|
||||
|
||||
fd = ::open(SMU_DEV, O_RDWR);
|
||||
|
@ -201,7 +201,7 @@ int SMUNode::start()
|
|||
act.sa_sigaction = data_available_signal;
|
||||
if (sigaction(SMU_SIG_DATA, &act, nullptr))
|
||||
logger->warn("Fail to install ADC handler");
|
||||
|
||||
|
||||
// Update DAQ memory configuration
|
||||
shared_mem_pos = 0;
|
||||
shared_mem_inc = sizeof(smu_mcsc_t);
|
||||
|
@ -212,7 +212,7 @@ int SMUNode::start()
|
|||
logger->warn("Fail to stop the driver");
|
||||
|
||||
// Configure DAQ driver
|
||||
if (::write(fd, &daq_cfg, sizeof(daq_cfg)))
|
||||
if (::write(fd, &daq_cfg, sizeof(daq_cfg.rate)))
|
||||
logger->warn("Fail to configure the driver");
|
||||
|
||||
// Start DAQ driver
|
||||
|
@ -241,7 +241,7 @@ int SMUNode::stop()
|
|||
void SMUNode::sync_signal(int, siginfo_t *info, void*)
|
||||
{
|
||||
|
||||
|
||||
|
||||
ioctl(fd, SMU_IOC_GET_TIME,&sync_signal_mem_pos);
|
||||
sample_time.tv_nsec = sync_signal_mem_pos.tv_nsec; //macht nix
|
||||
sample_time.tv_sec = sync_signal_mem_pos.tv_sec;
|
||||
|
@ -253,7 +253,7 @@ void SMUNode::sync_signal(int, siginfo_t *info, void*)
|
|||
|
||||
void SMUNode::data_available_signal(int, siginfo_t *info, void*)
|
||||
{
|
||||
|
||||
|
||||
mem_pos = (info->si_value.sival_int);
|
||||
/* Signal uldaq_read() about new data */
|
||||
pthread_cond_signal(&cv);
|
||||
|
@ -270,12 +270,12 @@ int SMUNode::_read(struct Sample *smps[], unsigned cnt)
|
|||
size_t mem_pos_local = mem_pos;
|
||||
|
||||
smu_mcsc_t* p = (smu_mcsc_t*)shared_mem;
|
||||
|
||||
|
||||
|
||||
for (unsigned j = 0; j < cnt; j++) {
|
||||
struct Sample *t = smps[j];
|
||||
ts.tv_nsec = mem_pos_local * 1e6 / (sample_rate);//current_sample*1e9* 1/(sample_rate * 1000)
|
||||
|
||||
|
||||
for (unsigned i = 0; i < 8; i++) { //auslagern, Steffen fragen
|
||||
int16_t data = p[mem_pos_local].ch[i];
|
||||
t->data[i].f = ((double)data);
|
||||
|
@ -284,14 +284,14 @@ int SMUNode::_read(struct Sample *smps[], unsigned cnt)
|
|||
}
|
||||
|
||||
mem_pos_local++;
|
||||
|
||||
|
||||
t->flags = (int) SampleFlags::HAS_TS_ORIGIN | (int) SampleFlags::HAS_DATA | (int) SampleFlags::HAS_SEQUENCE;
|
||||
t->ts.origin = ts;
|
||||
t->sequence = sequence++;
|
||||
t->length = 8;
|
||||
t->signals = in.signals;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
|
Loading…
Add table
Reference in a new issue