bug fix; cal/raw display
This commit is contained in:
parent
9c6a9a21a6
commit
e3d5f52aa2
@ -60,8 +60,8 @@ public:
|
|||||||
struct SensorData {
|
struct SensorData {
|
||||||
unsigned short raw1; // First 16-bit unsigned short
|
unsigned short raw1; // First 16-bit unsigned short
|
||||||
unsigned short raw2; // Second 16-bit unsigned short
|
unsigned short raw2; // Second 16-bit unsigned short
|
||||||
short cal1; // First 16-bit signed short
|
signed short cal1; // First 16-bit signed short
|
||||||
short cal2; // Second 16-bit signed short
|
signed short cal2; // Second 16-bit signed short
|
||||||
};
|
};
|
||||||
SensorData* sensorData; // Renamed from sensor_data
|
SensorData* sensorData; // Renamed from sensor_data
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ public:
|
|||||||
|
|
||||||
int frameRate = 0;
|
int frameRate = 0;
|
||||||
int devNr = 0;
|
int devNr = 0;
|
||||||
int sensorsPerBoard = 2;
|
int sensorsPerBoard = 5;
|
||||||
|
|
||||||
DataBuffer dataBuffer;
|
DataBuffer dataBuffer;
|
||||||
|
|
||||||
|
@ -39,6 +39,10 @@ BPMDisplay::BPMDisplay(QWidget *parent) :
|
|||||||
// Gray out the buttons when they are disabled
|
// Gray out the buttons when they are disabled
|
||||||
ui->pushButton_savecalib->setStyleSheet(expertModeEnabled ? "" : "background-color: gray;");
|
ui->pushButton_savecalib->setStyleSheet(expertModeEnabled ? "" : "background-color: gray;");
|
||||||
|
|
||||||
|
// Check if checkBox_toggleRawCal exists in UI
|
||||||
|
if (ui->checkBox_toggleRawCal) {
|
||||||
|
connect(ui->checkBox_toggleRawCal, &QCheckBox::stateChanged, this, &BPMDisplay::onDataToggleChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -465,3 +469,8 @@ void BPMDisplay::updateStatus(unsigned short value)
|
|||||||
{
|
{
|
||||||
ui->lcdNumber_status->display((value));
|
ui->lcdNumber_status->display((value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BPMDisplay::onDataToggleChanged(int state) {
|
||||||
|
showCalibrated = (state == Qt::Checked);
|
||||||
|
plot();
|
||||||
|
}
|
||||||
|
@ -29,8 +29,9 @@ public:
|
|||||||
|
|
||||||
void setTitle(QString title);
|
void setTitle(QString title);
|
||||||
|
|
||||||
QVector<signed short> buffer;
|
QVector<signed short> buffer; //unsigned short raw; signed short cal
|
||||||
QVector<signed short> rmsbuffer;
|
QVector<signed short> rmsbuffer;
|
||||||
|
bool showCalibrated = false;
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -47,6 +48,7 @@ public slots:
|
|||||||
void updateRms(unsigned short value);
|
void updateRms(unsigned short value);
|
||||||
void updateMax(unsigned short value);
|
void updateMax(unsigned short value);
|
||||||
void updateStatus(unsigned short value);
|
void updateStatus(unsigned short value);
|
||||||
|
void onDataToggleChanged(int state);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -57,11 +59,16 @@ protected:
|
|||||||
QVector<signed short> dataRMS;
|
QVector<signed short> dataRMS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::display *ui;
|
Ui::display *ui;
|
||||||
QRadioButton *radioButtonFixedScale; // Pointer to the Fixed Scale radio button
|
QRadioButton *radioButtonFixedScale; // Pointer to the Fixed Scale radio button
|
||||||
QRadioButton *radioButtonAutoscale; // Pointer to the Autoscale radio button
|
QRadioButton *radioButtonAutoscale; // Pointer to the Autoscale radio button
|
||||||
QButtonGroup *buttonGroup;
|
QButtonGroup *buttonGroup;
|
||||||
|
|
||||||
|
QCheckBox *checkBoxToggleRawCal; //for show raw or cal data
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVector<signed short>> backgroundDataMap; // Map to store background data for each plane
|
QMap<QString, QVector<signed short>> backgroundDataMap; // Map to store background data for each plane
|
||||||
bool subtractBackground = false; // Flag to track if background subtraction is enabled
|
bool subtractBackground = false; // Flag to track if background subtraction is enabled
|
||||||
|
|
||||||
|
@ -167,10 +167,9 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_expertmode">
|
<widget class="QCheckBox" name="checkBox_toggleRawCal">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>expert
|
<string>Show caled</string>
|
||||||
mode</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -182,6 +181,14 @@ calibration</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_expertmode">
|
||||||
|
<property name="text">
|
||||||
|
<string>expert
|
||||||
|
mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_loadcalib">
|
<widget class="QPushButton" name="pushButton_loadcalib">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -118,20 +118,20 @@ void DisplayServer::plot()
|
|||||||
if (nr_channels > lastFrame[dev_id].buffer_size)
|
if (nr_channels > lastFrame[dev_id].buffer_size)
|
||||||
nr_channels = lastFrame[dev_id].buffer_size; //check if there's really some data in the buffer
|
nr_channels = lastFrame[dev_id].buffer_size; //check if there's really some data in the buffer
|
||||||
//WARNING!!! Device order is not yet implemented!!! (probably)
|
//WARNING!!! Device order is not yet implemented!!! (probably)
|
||||||
for (int i = 0; i < int(nr_channels/2); i++){ //should be 32
|
for (int i = 0; i < planeConfig[plane]->nr_sensors * 64 / 2 ; i++){ //should be 32
|
||||||
//displays[plane]->buffer[current_base+i] = lastFrame[dev_id].sensor_data[i]; //old code
|
//displays[plane]->buffer[current_base+i] = lastFrame[dev_id].sensor_data[i]; //old code
|
||||||
// Use RAW values (index 2*i) or CAL values (index 2*i + 1)
|
// Use RAW values (index 2*i) or CAL values (index 2*i + 1)
|
||||||
rawValue = lastFrame[dev_id].sensorData[i]; // Get int(RAW1+RAW2)
|
rawValue = lastFrame[dev_id].sensorData[i]; // Get int(RAW1+RAW2)
|
||||||
std::cerr << rawValue.raw1 << " " << rawValue.raw2 << " " <<rawValue.cal1 << " " <<rawValue.cal2 << " " <<std::endl;
|
//std::cerr << i <<" " << rawValue.raw1 << " " << rawValue.raw2 << " " <<rawValue.cal1 << " " <<rawValue.cal2 << " " <<std::endl;
|
||||||
if (showRawData) //RAW1, RAW2, ...
|
if (!displays[plane]->showCalibrated) //RAW1, RAW2, ...
|
||||||
{
|
{
|
||||||
displays[plane]->buffer[current_base + i] = static_cast<short>(rawValue.raw1);
|
displays[plane]->buffer[current_base + 2*i] = static_cast<short>(rawValue.raw1);
|
||||||
displays[plane]->buffer[current_base + i + 1] = static_cast<short>(rawValue.raw2);
|
displays[plane]->buffer[current_base + 2*i + 1] = static_cast<short>(rawValue.raw2);
|
||||||
}
|
}
|
||||||
else //CAL1, CAL2
|
else //CAL1, CAL2
|
||||||
{
|
{
|
||||||
displays[plane]->buffer[current_base + i] = static_cast<short>(rawValue.cal1);
|
displays[plane]->buffer[current_base + 2*i] = static_cast<short>(rawValue.cal1);
|
||||||
displays[plane]->buffer[current_base + i + 1] = static_cast<short>(rawValue.cal2);
|
displays[plane]->buffer[current_base + 2*i + 1] = static_cast<short>(rawValue.cal2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
void unsetup();
|
void unsetup();
|
||||||
|
|
||||||
// New boolean flag to control display of RAW or CAL data
|
// New boolean flag to control display of RAW or CAL data
|
||||||
bool showRawData = true; // Default is to show RAW data
|
bool showRawData = true; // Default is to show RAW data // use displays[plane]->showCalibrated instead
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
Loading…
Reference in New Issue
Block a user