mirror of https://github.com/EspoTek/Labrador.git
trigger frequency displayed
This commit is contained in:
parent
ae7c631de0
commit
b24e39fb8b
|
@ -358,6 +358,7 @@ void isoBuffer::setTriggerType(TriggerType newType)
|
||||||
{
|
{
|
||||||
qDebug() << "Trigger Type: " << (uint8_t)newType;
|
qDebug() << "Trigger Type: " << (uint8_t)newType;
|
||||||
m_triggerType = newType;
|
m_triggerType = newType;
|
||||||
|
m_lastTriggerDetlaT = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoBuffer::setTriggerLevel(double voltageLevel, uint16_t top, bool acCoupled)
|
void isoBuffer::setTriggerLevel(double voltageLevel, uint16_t top, bool acCoupled)
|
||||||
|
@ -366,6 +367,7 @@ void isoBuffer::setTriggerLevel(double voltageLevel, uint16_t top, bool acCouple
|
||||||
m_triggerSensitivity = static_cast<short>(1 + abs(voltageLevel * kTriggerSensitivityMultiplier * static_cast<double>(top) / 128.));
|
m_triggerSensitivity = static_cast<short>(1 + abs(voltageLevel * kTriggerSensitivityMultiplier * static_cast<double>(top) / 128.));
|
||||||
qDebug() << "Trigger Level: " << m_triggerLevel;
|
qDebug() << "Trigger Level: " << m_triggerLevel;
|
||||||
qDebug() << "Trigger sensitivity:" << m_triggerSensitivity;
|
qDebug() << "Trigger sensitivity:" << m_triggerSensitivity;
|
||||||
|
m_lastTriggerDetlaT = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Clear trigger
|
// TODO: Clear trigger
|
||||||
|
@ -442,6 +444,11 @@ double isoBuffer::getDelayedTriggerPoint(double delay)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double isoBuffer::getTriggerFrequencyHz()
|
||||||
|
{
|
||||||
|
return (m_lastTriggerDetlaT == 0) ? -1. : static_cast<double>(m_samplesPerSecond) / static_cast<double>(m_lastTriggerDetlaT);
|
||||||
|
}
|
||||||
|
|
||||||
void isoBuffer::addTriggerPosition(uint32_t position)
|
void isoBuffer::addTriggerPosition(uint32_t position)
|
||||||
{
|
{
|
||||||
static uint32_t s_lastPosition = 0;
|
static uint32_t s_lastPosition = 0;
|
||||||
|
|
|
@ -86,6 +86,7 @@ public:
|
||||||
void setTriggerType(TriggerType newType);
|
void setTriggerType(TriggerType newType);
|
||||||
void setTriggerLevel(double voltageLevel, uint16_t top, bool acCoupled);
|
void setTriggerLevel(double voltageLevel, uint16_t top, bool acCoupled);
|
||||||
double getDelayedTriggerPoint(double delay);
|
double getDelayedTriggerPoint(double delay);
|
||||||
|
double getTriggerFrequencyHz();
|
||||||
|
|
||||||
// ---- MEMBER VARIABLES ----
|
// ---- MEMBER VARIABLES ----
|
||||||
|
|
||||||
|
|
|
@ -1126,15 +1126,16 @@ void isoDriver::triggerGroupStateChange(bool enabled){
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::broadcastStats(bool CH2){
|
void isoDriver::broadcastStats(bool CH2){
|
||||||
if(CH2){
|
if (CH2 && update_CH2)
|
||||||
if(!update_CH2) return;
|
{
|
||||||
update_CH2 = false;
|
update_CH2 = false;
|
||||||
sendVmax_CH2(currentVmax);
|
sendVmax_CH2(currentVmax);
|
||||||
sendVmin_CH2(currentVmin);
|
sendVmin_CH2(currentVmin);
|
||||||
sendVmean_CH2(currentVmean);
|
sendVmean_CH2(currentVmean);
|
||||||
sendVRMS_CH2(currentVRMS);
|
sendVRMS_CH2(currentVRMS);
|
||||||
} else{
|
}
|
||||||
if(!update_CH1) return;
|
else if (update_CH1)
|
||||||
|
{
|
||||||
update_CH1 = false;
|
update_CH1 = false;
|
||||||
sendVmax_CH1(currentVmax);
|
sendVmax_CH1(currentVmax);
|
||||||
sendVmin_CH1(currentVmin);
|
sendVmin_CH1(currentVmin);
|
||||||
|
@ -1146,6 +1147,39 @@ void isoDriver::broadcastStats(bool CH2){
|
||||||
void isoDriver::slowTimerTick(){
|
void isoDriver::slowTimerTick(){
|
||||||
update_CH1 = true;
|
update_CH1 = true;
|
||||||
update_CH2 = true;
|
update_CH2 = true;
|
||||||
|
|
||||||
|
bool frequencyLabelVisible = false;
|
||||||
|
|
||||||
|
if (triggerEnabled)
|
||||||
|
{
|
||||||
|
double triggerFrequency;
|
||||||
|
switch(triggerMode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
triggerFrequency = (driver->deviceMode == 6) ? internalBuffer750->getTriggerFrequencyHz() : internalBuffer375_CH1->getTriggerFrequencyHz();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
triggerFrequency = internalBuffer375_CH2->getTriggerFrequencyHz();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (triggerFrequency > 0.)
|
||||||
|
{
|
||||||
|
frequencyLabelVisible = true;
|
||||||
|
siprint triggerFreqSiprint("Hz", triggerFrequency);
|
||||||
|
siprint periodSiprint("s", 1. / triggerFrequency);
|
||||||
|
|
||||||
|
QString cursorString;
|
||||||
|
cursorString.sprintf(" Trigger ΔT = %s, f = %s ", periodSiprint.printVal(), triggerFreqSiprint.printVal());
|
||||||
|
triggerFrequencyLabel->setText(cursorString);
|
||||||
|
}
|
||||||
|
qDebug() << triggerFrequency << "Hz";
|
||||||
|
}
|
||||||
|
|
||||||
|
triggerFrequencyLabel->setVisible(frequencyLabelVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::setTopRange(double newTop)
|
void isoDriver::setTopRange(double newTop)
|
||||||
|
|
|
@ -61,6 +61,7 @@ public:
|
||||||
isoBuffer_file *internalBufferFile = NULL;
|
isoBuffer_file *internalBufferFile = NULL;
|
||||||
#if QCP_VER == 1
|
#if QCP_VER == 1
|
||||||
QCPItemText *cursorTextPtr;
|
QCPItemText *cursorTextPtr;
|
||||||
|
QCPItemText *triggerFrequencyLabel;
|
||||||
#endif
|
#endif
|
||||||
genericUsbDriver *driver;
|
genericUsbDriver *driver;
|
||||||
bool doNotTouchGraph = true;
|
bool doNotTouchGraph = true;
|
||||||
|
|
|
@ -278,8 +278,22 @@ void MainWindow::initialisePlot()
|
||||||
textLabel->setPen(QPen(Qt::white));
|
textLabel->setPen(QPen(Qt::white));
|
||||||
textLabel->setBrush(QBrush(Qt::black));
|
textLabel->setBrush(QBrush(Qt::black));
|
||||||
|
|
||||||
textLabel->setVisible(0);
|
QCPItemText* triggerFrequencyLabel = new QCPItemText(ui->scopeAxes);
|
||||||
|
ui->scopeAxes->addItem(triggerFrequencyLabel);
|
||||||
|
triggerFrequencyLabel->setPositionAlignment(Qt::AlignBottom|Qt::AlignHCenter);
|
||||||
|
triggerFrequencyLabel->position->setType(QCPItemPosition::ptAxisRectRatio);
|
||||||
|
triggerFrequencyLabel->position->setCoords(0.5, 0.98);
|
||||||
|
triggerFrequencyLabel->setText("Default Trigger Frequency Text");
|
||||||
|
triggerFrequencyLabel->setFont(QFont("Courier New", 16));
|
||||||
|
triggerFrequencyLabel->setColor(Qt::white);
|
||||||
|
triggerFrequencyLabel->setPen(QPen(Qt::white));
|
||||||
|
triggerFrequencyLabel->setBrush(QBrush(Qt::black));
|
||||||
|
|
||||||
|
|
||||||
|
textLabel->setVisible(false);
|
||||||
|
triggerFrequencyLabel->setVisible(false);
|
||||||
ui->controller_iso->cursorTextPtr = textLabel;
|
ui->controller_iso->cursorTextPtr = textLabel;
|
||||||
|
ui->controller_iso->triggerFrequencyLabel = triggerFrequencyLabel;
|
||||||
|
|
||||||
ui->scopeAxes->yAxis->setAutoTickCount(9);
|
ui->scopeAxes->yAxis->setAutoTickCount(9);
|
||||||
ui->scopeAxes->xAxis->setAutoTickCount(9);
|
ui->scopeAxes->xAxis->setAutoTickCount(9);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "siprint.h"
|
#include "siprint.h"
|
||||||
|
|
||||||
siprint::siprint(char *unitsInit, double valInit)
|
siprint::siprint(const char *unitsInit, double valInit)
|
||||||
{
|
{
|
||||||
strncpy(units, unitsInit, 6);
|
strncpy(units, unitsInit, 6);
|
||||||
value = valInit;
|
value = valInit;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
class siprint
|
class siprint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
siprint(char *unitsInit, double valInit);
|
siprint(const char *unitsInit, double valInit);
|
||||||
char* printVal();
|
char* printVal();
|
||||||
char units[6];
|
char units[6];
|
||||||
double value;
|
double value;
|
||||||
|
|
Loading…
Reference in New Issue