bug fix; cal/raw display
This commit is contained in:
parent
9c6a9a21a6
commit
b199e21238
@ -30,7 +30,7 @@
|
||||
#define RECEIVER_TIMER_PERIOD_MS 200 // The period of the timer to measure data rate. The measurement is always properly scaled.
|
||||
#define RECEIVER_FRAMES_PER_SIG 100 // The DataReady signal is transmitted only every N frames, not to overload queued signals framework.
|
||||
|
||||
typedef struct
|
||||
typedef struct SyncFrame
|
||||
{
|
||||
// unsigned short channel_id;
|
||||
unsigned short local_ctr;
|
||||
@ -60,8 +60,8 @@ public:
|
||||
struct SensorData {
|
||||
unsigned short raw1; // First 16-bit unsigned short
|
||||
unsigned short raw2; // Second 16-bit unsigned short
|
||||
short cal1; // First 16-bit signed short
|
||||
short cal2; // Second 16-bit signed short
|
||||
signed short cal1; // First 16-bit signed short
|
||||
signed short cal2; // Second 16-bit signed short
|
||||
};
|
||||
SensorData* sensorData; // Renamed from sensor_data
|
||||
|
||||
@ -126,7 +126,7 @@ public:
|
||||
|
||||
int frameRate = 0;
|
||||
int devNr = 0;
|
||||
int sensorsPerBoard = 2;
|
||||
int sensorsPerBoard = 5;
|
||||
|
||||
DataBuffer dataBuffer;
|
||||
|
||||
|
@ -39,6 +39,10 @@ BPMDisplay::BPMDisplay(QWidget *parent) :
|
||||
// Gray out the buttons when they are disabled
|
||||
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));
|
||||
}
|
||||
|
||||
void BPMDisplay::onDataToggleChanged(int state) {
|
||||
showCalibrated = (state == Qt::Checked);
|
||||
plot();
|
||||
}
|
||||
|
@ -29,8 +29,9 @@ public:
|
||||
|
||||
void setTitle(QString title);
|
||||
|
||||
QVector<signed short> buffer;
|
||||
QVector<signed short> buffer; //unsigned short raw; signed short cal
|
||||
QVector<signed short> rmsbuffer;
|
||||
bool showCalibrated = false;
|
||||
|
||||
|
||||
public slots:
|
||||
@ -47,6 +48,7 @@ public slots:
|
||||
void updateRms(unsigned short value);
|
||||
void updateMax(unsigned short value);
|
||||
void updateStatus(unsigned short value);
|
||||
void onDataToggleChanged(int state);
|
||||
|
||||
|
||||
|
||||
@ -57,11 +59,16 @@ protected:
|
||||
QVector<signed short> dataRMS;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
Ui::display *ui;
|
||||
QRadioButton *radioButtonFixedScale; // Pointer to the Fixed Scale radio button
|
||||
QRadioButton *radioButtonAutoscale; // Pointer to the Autoscale radio button
|
||||
QButtonGroup *buttonGroup;
|
||||
|
||||
QCheckBox *checkBoxToggleRawCal; //for show raw or cal data
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
@ -167,10 +167,9 @@
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_expertmode">
|
||||
<widget class="QCheckBox" name="checkBox_toggleRawCal">
|
||||
<property name="text">
|
||||
<string>expert
|
||||
mode</string>
|
||||
<string>Show caled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -182,6 +181,14 @@ calibration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_expertmode">
|
||||
<property name="text">
|
||||
<string>expert
|
||||
mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_loadcalib">
|
||||
<property name="text">
|
||||
|
@ -118,20 +118,20 @@ void DisplayServer::plot()
|
||||
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
|
||||
//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
|
||||
// Use RAW values (index 2*i) or CAL values (index 2*i + 1)
|
||||
rawValue = lastFrame[dev_id].sensorData[i]; // Get int(RAW1+RAW2)
|
||||
std::cerr << rawValue.raw1 << " " << rawValue.raw2 << " " <<rawValue.cal1 << " " <<rawValue.cal2 << " " <<std::endl;
|
||||
if (showRawData) //RAW1, RAW2, ...
|
||||
//std::cerr << i <<" " << rawValue.raw1 << " " << rawValue.raw2 << " " <<rawValue.cal1 << " " <<rawValue.cal2 << " " <<std::endl;
|
||||
if (!displays[plane]->showCalibrated) //RAW1, RAW2, ...
|
||||
{
|
||||
displays[plane]->buffer[current_base + 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] = static_cast<short>(rawValue.raw1);
|
||||
displays[plane]->buffer[current_base + 2*i + 1] = static_cast<short>(rawValue.raw2);
|
||||
}
|
||||
else //CAL1, CAL2
|
||||
{
|
||||
displays[plane]->buffer[current_base + 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] = static_cast<short>(rawValue.cal1);
|
||||
displays[plane]->buffer[current_base + 2*i + 1] = static_cast<short>(rawValue.cal2);
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
void unsetup();
|
||||
|
||||
// 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:
|
||||
|
||||
public slots:
|
||||
|
@ -205,7 +205,7 @@ void EventBuilder::logDataToFile()
|
||||
for (int board = 0; board < totalBoards; board++)
|
||||
{
|
||||
logFile.write((const char*)&(currentFrame[board].sync_frame), sizeof(SyncFrame));
|
||||
logFile.write((const char*)currentFrame[board].sensorData, currentFrame[board].buffer_size*sizeof(int));
|
||||
logFile.write((const char*)currentFrame[board].sensorData, currentFrame[board].buffer_size*sizeof(int)*2);
|
||||
logFile.write((const char*)&(currentFrame[board].rms_frame), sizeof(RMSFrame));
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user