added new command to test setting threholds from the command line
This commit is contained in:
parent
f82b5acd10
commit
a84c30cb1a
@ -110,6 +110,10 @@
|
||||
//D:[] D: [(Readout of 5 ADC channels as 32-bit integers)]
|
||||
//Slow control snapshot - read all channels of ADC
|
||||
|
||||
#define COMMAND_SET_CLUSTER_THRESHOLD 0x4001
|
||||
//L: ?
|
||||
//D: []
|
||||
//Send 8 bit beam cluster selection threshold
|
||||
|
||||
// ***DATA TRANSFER - SOCKET 1!!!!***
|
||||
|
||||
|
@ -109,6 +109,7 @@ void Device::configure(DeviceConfig &cfg)
|
||||
ctrlSetMasterDelay(deviceConfig.master_delay);
|
||||
ctrlSetSlaveDelay(deviceConfig.slave_delay);
|
||||
ctrlSetGain(deviceConfig.gain);
|
||||
ctrlSetClusterThreshold(deviceConfig.threshold);
|
||||
ctrlConfigBunch(deviceConfig.dma_bunch, deviceConfig.eth_bunch);
|
||||
ctrlConfigPeer(ipshort, DEV_BASE_DATA_PORT+ deviceConfig.device_id);
|
||||
}
|
||||
@ -480,3 +481,17 @@ int Device::ctrlConfigBunch(int dma, int eth)
|
||||
else
|
||||
return queryCtrl(COMMAND_DAQ_DISABLE, txdata, rxdata);*/
|
||||
}
|
||||
|
||||
int Device::ctrlSetClusterThreshold(int threshold)
|
||||
{
|
||||
QVector<unsigned short> rxdata;
|
||||
QVector<unsigned short> txdata;
|
||||
txdata.append((unsigned short)threshold);
|
||||
|
||||
if (threshold)
|
||||
return queryCtrl(COMMAND_SET_CLUSTER_THRESHOLD, txdata, rxdata);
|
||||
else
|
||||
return queryCtrl(COMMAND_SET_CLUSTER_THRESHOLD, txdata, rxdata);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,7 +34,9 @@ public:
|
||||
int gain; //0 (low) or 1 (high); TO BE DONE
|
||||
int dma_bunch;
|
||||
int eth_bunch;
|
||||
int threshold;
|
||||
int max_sensors()
|
||||
|
||||
{
|
||||
switch(hardware_ver)
|
||||
{
|
||||
@ -47,7 +49,7 @@ public:
|
||||
int nr_channels() {return 64*nr_sensors;}
|
||||
DeviceConfig() : own_ip{10,0,7,1}, device_ip{10,0,7,2},
|
||||
device_id{0}, hardware_ver{0}, master{1}, plane{0}, position{0}, nr_sensors{0},
|
||||
period{65535}, tint{1}, master_delay{1}, slave_delay{1}, gain{0}, dma_bunch{1}, eth_bunch{1} {}
|
||||
period{65535}, tint{1}, master_delay{1}, slave_delay{1}, gain{0}, dma_bunch{1}, eth_bunch{1}, threshold{10} {}
|
||||
|
||||
};
|
||||
|
||||
@ -100,6 +102,7 @@ protected:
|
||||
int ctrlConfigBunch(int dma, int eth);
|
||||
int ctrlSetMasterDelay(int tint);
|
||||
int ctrlSetSlaveDelay(int tint);
|
||||
int ctrlSetClusterThreshold(int threshold);
|
||||
protected slots:
|
||||
void onConnected();
|
||||
void onSocketError(QAbstractSocket::SocketError socketError);
|
||||
|
@ -28,7 +28,7 @@ void DialogDevices::showEvent(QShowEvent * event)
|
||||
|
||||
ui->spinNrDevices->setValue(deviceSettings->value("NrDevices", int(1)).toInt());
|
||||
|
||||
ui->tableDevices->setColumnCount(8);
|
||||
ui->tableDevices->setColumnCount(9);
|
||||
QStringList h_header;
|
||||
h_header.append("IP Address");
|
||||
h_header.append("Hardware ver.");
|
||||
@ -38,6 +38,7 @@ void DialogDevices::showEvent(QShowEvent * event)
|
||||
h_header.append("Master");
|
||||
h_header.append("Master dly");
|
||||
h_header.append("Slave dly");
|
||||
h_header.append("Threshold");
|
||||
ui->tableDevices->setHorizontalHeaderLabels(h_header);
|
||||
|
||||
importSettings();
|
||||
@ -89,6 +90,8 @@ void DialogDevices::importSettings()
|
||||
ui->tableDevices->setItem(dev_nr, 6, newItem );
|
||||
newItem = new QTableWidgetItem(deviceSettings->value("SlaveDelay","1").toString());
|
||||
ui->tableDevices->setItem(dev_nr, 7, newItem );
|
||||
newItem = new QTableWidgetItem(deviceSettings->value("ClusThresh","10").toString());
|
||||
ui->tableDevices->setItem(dev_nr, 8, newItem );
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,6 +204,20 @@ int DialogDevices::validateAndSave()
|
||||
if (generated.compare(user_data) != 0)
|
||||
data_ok = 0;
|
||||
ui->tableDevices->item(dev_nr,7)->setText(generated);
|
||||
|
||||
//now cluster threshold
|
||||
user_data = ui->tableDevices->item(dev_nr,8)->text();
|
||||
num_value = user_data.toInt();
|
||||
if (num_value < 1)
|
||||
num_value = 1;
|
||||
if (num_value > 255)
|
||||
num_value = 255;
|
||||
generated = QString("%1").arg(num_value);
|
||||
//if the strings are identical, save the value and return 1
|
||||
if (generated.compare(user_data) != 0)
|
||||
data_ok = 0;
|
||||
ui->tableDevices->item(dev_nr,8)->setText(generated);
|
||||
|
||||
}
|
||||
|
||||
//now store the data
|
||||
@ -225,6 +242,9 @@ int DialogDevices::validateAndSave()
|
||||
deviceSettings->setValue("Master", ui->tableDevices->item(dev_nr,5)->text());
|
||||
deviceSettings->setValue("MasterDelay", ui->tableDevices->item(dev_nr,6)->text());
|
||||
deviceSettings->setValue("SlaveDelay", ui->tableDevices->item(dev_nr,7)->text());
|
||||
deviceSettings->setValue("Threshold", ui->tableDevices->item(dev_nr,8)->text());
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user