mirror of https://github.com/EspoTek/Labrador.git
Isodriver refactor - part 1 (#81)
* isodriver.h: reflow comments, one declaration/line * move delay to a struct that handles display settings * Make changes related to isoDriver::window - move isoDriver::window to display struct - remove isoDriver::windowAtPause - remove isoDriver::setWindow - call isoDriver::timeWindowUpdated signal where deemed necessary * Make changes related to isoDriver display settings - move x0, y0, x1, and y1 from isoDriver to DisplayControl - Replace some ternaries with std::max and std::min - Add some comments * Move topRange and botRange from isoDriver into DisplayControl * Move most of isoDriver::setVoltageRange into DisplayControl
This commit is contained in:
parent
0c1604cb5e
commit
b0e1d1eaf4
|
@ -45,12 +45,6 @@ void isoDriver::setAxes(QCustomPlot *newAxes){
|
||||||
qDebug() << "axes = " << axes;
|
qDebug() << "axes = " << axes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::setWindow(int newWindow){
|
|
||||||
window = pow( (double)10, ( (double)newWindow / 10) );
|
|
||||||
windowAtPause = window;
|
|
||||||
qDebug() << "window = " << window;
|
|
||||||
}
|
|
||||||
|
|
||||||
void isoDriver::timerTick(void){
|
void isoDriver::timerTick(void){
|
||||||
//qDebug() << "isoDriver SEZ Tick!";
|
//qDebug() << "isoDriver SEZ Tick!";
|
||||||
if(firstFrame){
|
if(firstFrame){
|
||||||
|
@ -216,8 +210,8 @@ void isoDriver::analogConvert(short *shortPtr, QVector<double> *doublePtr, int T
|
||||||
void isoDriver::digitalConvert(short *shortPtr, QVector<double> *doublePtr){
|
void isoDriver::digitalConvert(short *shortPtr, QVector<double> *doublePtr){
|
||||||
|
|
||||||
double *data = doublePtr->data();
|
double *data = doublePtr->data();
|
||||||
double top = topRange - (topRange - botRange)/10;
|
double top = display.topRange - (display.topRange - display.botRange) / 10;
|
||||||
double bot = botRange + (topRange - botRange)/10;
|
double bot = display.botRange + (display.topRange - display.botRange) / 10;
|
||||||
for (int i=0;i<GRAPH_SAMPLES;i++){
|
for (int i=0;i<GRAPH_SAMPLES;i++){
|
||||||
data[i] = shortPtr[i] ? top : bot;
|
data[i] = shortPtr[i] ? top : bot;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +226,6 @@ void isoDriver::fileStreamConvert(float *floatPtr, QVector<double> *doublePtr){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void isoDriver::startTimer(){
|
void isoDriver::startTimer(){
|
||||||
/*if (isoTimer!=NULL){
|
/*if (isoTimer!=NULL){
|
||||||
delete isoTimer;
|
delete isoTimer;
|
||||||
|
@ -255,70 +248,103 @@ void isoDriver::setVisible_CH2(bool visible){
|
||||||
axes->graph(1)->setVisible(visible);
|
axes->graph(1)->setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::setVoltageRange(QWheelEvent *event){
|
void isoDriver::setVoltageRange(QWheelEvent* event)
|
||||||
|
{
|
||||||
if(doNotTouchGraph && !fileModeEnabled) return;
|
if(doNotTouchGraph && !fileModeEnabled) return;
|
||||||
|
|
||||||
|
bool isProperlyPaused = properlyPaused();
|
||||||
|
double maxWindowSize = fileModeEnabled ? daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
||||||
|
|
||||||
|
display.setVoltageRange(event, isProperlyPaused, maxWindowSize, axes);
|
||||||
|
|
||||||
|
if (!(event->modifiers() == Qt::ControlModifier))
|
||||||
|
if (autoGainEnabled && !isProperlyPaused)
|
||||||
|
autoGain();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayControl::setVoltageRange (QWheelEvent* event, bool isProperlyPaused, double maxWindowSize, QCustomPlot* axes)
|
||||||
|
{
|
||||||
if (!(event->modifiers() == Qt::ControlModifier)){
|
if (!(event->modifiers() == Qt::ControlModifier)){
|
||||||
double c = (topRange - botRange) / (double)400;
|
double c = (topRange - botRange) / (double)400;
|
||||||
|
|
||||||
QCPRange range = axes->yAxis->range();
|
QCPRange range = axes->yAxis->range();
|
||||||
|
|
||||||
double pixPct = (double)100 - ((double)100 * (((double)axes->yAxis->pixelToCoord(event->y())-range.lower) / (double)(range.upper - range.lower)));
|
double pixPct = (double)100 - ((double)100 * (((double)axes->yAxis->pixelToCoord(event->y())-range.lower) / range.size()));
|
||||||
if (pixPct<0) pixPct = 0;
|
if (pixPct < 0) pixPct = 0;
|
||||||
if (pixPct>100) pixPct = 100;
|
if (pixPct > 100) pixPct = 100;
|
||||||
|
|
||||||
|
|
||||||
qDebug() << "WHEEL @ " << pixPct << "%";
|
qDebug() << "WHEEL @ " << pixPct << "%";
|
||||||
qDebug() << range.upper;
|
qDebug() << range.upper;
|
||||||
//qDebug() << event->delta();
|
|
||||||
|
|
||||||
if (event->delta()==120){
|
if (event->delta()==120){
|
||||||
topRange -= c* ((double)pixPct);
|
topRange -= c * ((double)pixPct);
|
||||||
botRange += c* ((double)100 - (double)pixPct);
|
botRange += c * ((double)100 - (double)pixPct);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
topRange += c* ((double)pixPct);
|
topRange += c * ((double)pixPct);
|
||||||
botRange -= c* ((double)100 - (double)pixPct);
|
botRange -= c * ((double)100 - (double)pixPct);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topRange > (double)20) topRange = (double)20;
|
if (topRange > (double)20) topRange = (double)20;
|
||||||
if (botRange <- (double)20) botRange = (double)-20;
|
if (botRange < -(double)20) botRange = (double)-20;
|
||||||
if (autoGainEnabled && !properlyPaused()) autoGain();
|
|
||||||
topRangeUpdated(topRange);
|
topRangeUpdated(topRange);
|
||||||
botRangeUpdated(botRange);
|
botRangeUpdated(botRange);
|
||||||
}
|
}
|
||||||
else if(properlyPaused()){
|
else
|
||||||
|
{
|
||||||
double c = (window) / (double)200;
|
double c = (window) / (double)200;
|
||||||
QCPRange range = axes->xAxis->range();
|
QCPRange range = axes->xAxis->range();
|
||||||
|
|
||||||
double pixPct = (double)100 * (((double)axes->xAxis->pixelToCoord(event->x())-range.lower) / (double)(range.upper - range.lower));
|
double pixPct = (double)100 * ((double)axes->xAxis->pixelToCoord(event->x()) - range.lower);
|
||||||
if (pixPct<0) pixPct = 0;
|
|
||||||
if (pixPct>100) pixPct = 100;
|
pixPct /= isProperlyPaused ? (double)(range.upper - range.lower)
|
||||||
|
: (double)(window);
|
||||||
|
|
||||||
|
if (pixPct < 0)
|
||||||
|
pixPct = 0;
|
||||||
|
|
||||||
|
if (pixPct > 100)
|
||||||
|
pixPct = 100;
|
||||||
|
|
||||||
qDebug() << "WHEEL @ " << pixPct << "%";
|
qDebug() << "WHEEL @ " << pixPct << "%";
|
||||||
qDebug() << event->delta();
|
qDebug() << event->delta();
|
||||||
|
|
||||||
if (event->delta()==120){
|
if (not isProperlyPaused)
|
||||||
window -= c* ((double)pixPct);
|
|
||||||
delay += c* ((double)100 - (double)pixPct) * pixPct/100;
|
|
||||||
delayUpdated(delay);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
window += c* ((double)pixPct);
|
|
||||||
delay -= c* ((double)100 - (double)pixPct) * pixPct/100;
|
|
||||||
delayUpdated(delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
double mws = fileModeEnabled ? daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
|
||||||
|
|
||||||
if (window > mws)
|
|
||||||
{
|
{
|
||||||
window = mws;
|
qDebug() << "TIGGERED";
|
||||||
|
qDebug() << "upper = " << range.upper << "lower = " << range.lower;
|
||||||
|
qDebug() << "window = " << window;
|
||||||
|
qDebug() << c * ((double)pixPct);
|
||||||
|
qDebug() << c * ((double)100 - (double)pixPct) * pixPct / 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event->delta() == 120)
|
||||||
|
{
|
||||||
|
window -= c * ((double)pixPct);
|
||||||
|
delay += c * ((double)100 - (double)pixPct) * pixPct / 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window += c * ((double)pixPct);
|
||||||
|
delay -= c * ((double)100 - (double)pixPct) * pixPct / 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: delayUpdated and timeWindowUpdated are called more than once beyond here,
|
||||||
|
// maybe they should only be called once at the end?
|
||||||
|
|
||||||
|
delayUpdated(delay);
|
||||||
|
timeWindowUpdated(window);
|
||||||
|
|
||||||
|
qDebug() << window << delay;
|
||||||
|
|
||||||
|
if (window > maxWindowSize)
|
||||||
|
{
|
||||||
|
window = maxWindowSize;
|
||||||
timeWindowUpdated(window);
|
timeWindowUpdated(window);
|
||||||
}
|
}
|
||||||
if ((window + delay) > mws)
|
if ((window + delay) > maxWindowSize)
|
||||||
{
|
{
|
||||||
delay -= window + delay - mws;
|
delay = maxWindowSize - window;
|
||||||
delayUpdated(delay);
|
delayUpdated(delay);
|
||||||
}
|
}
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
|
@ -326,54 +352,9 @@ void isoDriver::setVoltageRange(QWheelEvent *event){
|
||||||
delay = 0;
|
delay = 0;
|
||||||
delayUpdated(delay);
|
delayUpdated(delay);
|
||||||
}
|
}
|
||||||
qDebug() << window << delay;
|
|
||||||
} else {
|
|
||||||
qDebug() << "TIGGERED";
|
|
||||||
double c = (window) / (double)200;
|
|
||||||
QCPRange range = axes->xAxis->range();
|
|
||||||
|
|
||||||
double pixPct = (double)100 * (((double)axes->xAxis->pixelToCoord(event->x())-range.lower) / (double)(window));
|
|
||||||
if (pixPct<0) pixPct = 0;
|
|
||||||
if (pixPct>100) pixPct = 100;
|
|
||||||
|
|
||||||
qDebug() << "WHEEL @ " << pixPct << "%";
|
|
||||||
qDebug() << event->delta();
|
|
||||||
qDebug() << "upper = " << range.upper << "lower = " << range.lower;
|
|
||||||
qDebug() << "window = " << window;
|
|
||||||
qDebug() << c* ((double)pixPct);
|
|
||||||
qDebug() << c* ((double)100 - (double)pixPct) * pixPct/100;
|
|
||||||
|
|
||||||
if (event->delta()==120){
|
|
||||||
window -= c* ((double)pixPct);
|
|
||||||
delay += c* ((double)100 - (double)pixPct) * pixPct/100;
|
|
||||||
delayUpdated(delay);
|
|
||||||
timeWindowUpdated(window);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
window += c* ((double)pixPct);
|
|
||||||
delay -= c* ((double)100 - (double)pixPct) * pixPct/100;
|
|
||||||
delayUpdated(delay);
|
|
||||||
timeWindowUpdated(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
double mws = fileModeEnabled ? daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
|
||||||
|
|
||||||
if (window > mws) window = mws;
|
|
||||||
if ((window + delay) > mws)
|
|
||||||
{
|
|
||||||
delay -= window + delay - mws;
|
|
||||||
delayUpdated(delay);
|
|
||||||
}
|
|
||||||
if (delay < 0)
|
|
||||||
{
|
|
||||||
delay = 0;
|
|
||||||
delayUpdated(delay);
|
|
||||||
}
|
|
||||||
windowAtPause = window;
|
|
||||||
qDebug() << window << delay;
|
|
||||||
}
|
}
|
||||||
//changeTimeAxis(event->delta()==-120);
|
|
||||||
//qDebug() << window;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isoDriver::properlyPaused(){
|
bool isoDriver::properlyPaused(){
|
||||||
|
@ -397,10 +378,9 @@ void isoDriver::pauseEnable_CH1(bool enabled){
|
||||||
paused_CH1 = enabled;
|
paused_CH1 = enabled;
|
||||||
|
|
||||||
if(!properlyPaused()) {
|
if(!properlyPaused()) {
|
||||||
delay = 0;
|
display.delay = 0;
|
||||||
delayUpdated(delay);
|
delayUpdated(display.delay);
|
||||||
if (autoGainEnabled) autoGain();
|
if (autoGainEnabled) autoGain();
|
||||||
//window = windowAtPause;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!enabled) clearBuffers(1,0,1);
|
if(!enabled) clearBuffers(1,0,1);
|
||||||
|
@ -412,10 +392,9 @@ void isoDriver::pauseEnable_CH2(bool enabled){
|
||||||
paused_CH2 = enabled;
|
paused_CH2 = enabled;
|
||||||
|
|
||||||
if(!properlyPaused()){
|
if(!properlyPaused()){
|
||||||
delay = 0;
|
display.delay = 0;
|
||||||
delayUpdated(delay);
|
delayUpdated(display.delay);
|
||||||
if (autoGainEnabled) autoGain();
|
if (autoGainEnabled) autoGain();
|
||||||
//window = windowAtPause;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!enabled) clearBuffers(0,1,0);
|
if(!enabled) clearBuffers(0,1,0);
|
||||||
|
@ -425,9 +404,8 @@ void isoDriver::pauseEnable_multimeter(bool enabled){
|
||||||
paused_multimeter = enabled;
|
paused_multimeter = enabled;
|
||||||
|
|
||||||
if(!properlyPaused()) {
|
if(!properlyPaused()) {
|
||||||
delay = 0;
|
display.delay = 0;
|
||||||
delayUpdated(delay);
|
delayUpdated(display.delay);
|
||||||
//window = windowAtPause;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!enabled) clearBuffers(1,0,0);
|
if(!enabled) clearBuffers(1,0,0);
|
||||||
|
@ -436,8 +414,8 @@ void isoDriver::pauseEnable_multimeter(bool enabled){
|
||||||
|
|
||||||
|
|
||||||
void isoDriver::autoGain(){
|
void isoDriver::autoGain(){
|
||||||
double maxgain = vcc / (2 * ((double)topRange - vref) * R4/(R3+R4));
|
double maxgain = vcc / (2 * ((double)display.topRange - vref) * R4/(R3+R4));
|
||||||
double mingain = vcc / (2 * ((double)botRange - vref) * R4/(R3+R4));
|
double mingain = vcc / (2 * ((double)display.botRange - vref) * R4/(R3+R4));
|
||||||
maxgain = fmin(fabs(mingain) * 0.98, fabs(maxgain) * 0.98);
|
maxgain = fmin(fabs(mingain) * 0.98, fabs(maxgain) * 0.98);
|
||||||
|
|
||||||
double snap[8] = {64, 32, 16, 8, 4, 2, 1, 0.5};
|
double snap[8] = {64, 32, 16, 8, 4, 2, 1, 0.5};
|
||||||
|
@ -477,16 +455,16 @@ void isoDriver::graphMousePress(QMouseEvent *event){
|
||||||
qDebug() << event->button();
|
qDebug() << event->button();
|
||||||
if (horiCursorEnabled && (event->button() == Qt::LeftButton)){
|
if (horiCursorEnabled && (event->button() == Qt::LeftButton)){
|
||||||
placingHoriAxes = true;
|
placingHoriAxes = true;
|
||||||
y0 = axes->yAxis->pixelToCoord(event->y());
|
display.y0 = axes->yAxis->pixelToCoord(event->y());
|
||||||
#ifndef PLATFORM_ANDROID
|
#ifndef PLATFORM_ANDROID
|
||||||
}else if(vertCursorEnabled && (event->button() == Qt::RightButton)){
|
}else if(vertCursorEnabled && (event->button() == Qt::RightButton)){
|
||||||
#else
|
#else
|
||||||
}if(vertCursorEnabled){
|
}if(vertCursorEnabled){
|
||||||
#endif
|
#endif
|
||||||
placingVertAxes = true;
|
placingVertAxes = true;
|
||||||
x0 = axes->xAxis->pixelToCoord(event->x());
|
display.x0 = axes->xAxis->pixelToCoord(event->x());
|
||||||
}
|
}
|
||||||
qDebug() << "x0 =" << x0 << "x1 =" << x1 << "y0 =" << y0 << "y1 =" << y1;
|
qDebug() << "x0 =" << display.x0 << "x1 =" << display.x1 << "y0 =" << display.y0 << "y1 =" << display.y1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::graphMouseRelease(QMouseEvent *event){
|
void isoDriver::graphMouseRelease(QMouseEvent *event){
|
||||||
|
@ -499,18 +477,18 @@ void isoDriver::graphMouseRelease(QMouseEvent *event){
|
||||||
#endif
|
#endif
|
||||||
placingVertAxes = false;
|
placingVertAxes = false;
|
||||||
}
|
}
|
||||||
qDebug() << "x0 =" << x0 << "x1 =" << x1 << "y0 =" << y0 << "y1 =" << y1;
|
qDebug() << "x0 =" << display.x0 << "x1 =" << display.x1 << "y0 =" << display.y0 << "y1 =" << display.y1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::graphMouseMove(QMouseEvent *event){
|
void isoDriver::graphMouseMove(QMouseEvent *event){
|
||||||
if(horiCursorEnabled && placingHoriAxes){
|
if(horiCursorEnabled && placingHoriAxes){
|
||||||
y1 = axes->yAxis->pixelToCoord(event->y());
|
display.y1 = axes->yAxis->pixelToCoord(event->y());
|
||||||
#ifndef PLATFORM_ANDROID
|
#ifndef PLATFORM_ANDROID
|
||||||
} else if(vertCursorEnabled && placingVertAxes){
|
} else if(vertCursorEnabled && placingVertAxes){
|
||||||
#else
|
#else
|
||||||
} if(vertCursorEnabled && placingVertAxes){
|
} if(vertCursorEnabled && placingVertAxes){
|
||||||
#endif
|
#endif
|
||||||
x1 = axes->xAxis->pixelToCoord(event->x());
|
display.x1 = axes->xAxis->pixelToCoord(event->x());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,25 +514,25 @@ void isoDriver::udateCursors(void){
|
||||||
|
|
||||||
QVector<double> vert0x(2), vert1x(2), hori0x(2), hori1x(2), vert0y(2), vert1y(2), hori0y(2), hori1y(2);
|
QVector<double> vert0x(2), vert1x(2), hori0x(2), hori1x(2), vert0y(2), vert1y(2), hori0y(2), hori1y(2);
|
||||||
|
|
||||||
vert0x[0] = x0;
|
vert0x[0] = display.x0;
|
||||||
vert0x[1] = x0;
|
vert0x[1] = display.x0;
|
||||||
vert0y[0] = botRange;
|
vert0y[0] = display.botRange;
|
||||||
vert0y[1] = topRange;
|
vert0y[1] = display.topRange;
|
||||||
|
|
||||||
vert1x[0] = x1;
|
vert1x[0] = display.x1;
|
||||||
vert1x[1] = x1;
|
vert1x[1] = display.x1;
|
||||||
vert1y[0] = botRange;
|
vert1y[0] = display.botRange;
|
||||||
vert1y[1] = topRange;
|
vert1y[1] = display.topRange;
|
||||||
|
|
||||||
hori0x[0] = -window - delay;
|
hori0x[0] = -display.window - display.delay;
|
||||||
hori0x[1] = -delay;
|
hori0x[1] = -display.delay;
|
||||||
hori0y[0] = y0;
|
hori0y[0] = display.y0;
|
||||||
hori0y[1] = y0;
|
hori0y[1] = display.y0;
|
||||||
|
|
||||||
hori1x[0] = -window - delay;
|
hori1x[0] = -display.window - display.delay;
|
||||||
hori1x[1] = -delay;
|
hori1x[1] = -display.delay;
|
||||||
hori1y[0] = y1;
|
hori1y[0] = display.y1;
|
||||||
hori1y[1] = y1;
|
hori1y[1] = display.y1;
|
||||||
|
|
||||||
if(vertCursorEnabled){
|
if(vertCursorEnabled){
|
||||||
axes->graph(2)->setData(vert0x, vert0y);
|
axes->graph(2)->setData(vert0x, vert0y);
|
||||||
|
@ -571,13 +549,13 @@ void isoDriver::udateCursors(void){
|
||||||
|
|
||||||
QString *cursorStatsString = new QString();
|
QString *cursorStatsString = new QString();
|
||||||
|
|
||||||
v0->value = y0;
|
v0->value = display.y0;
|
||||||
v1->value = y1;
|
v1->value = display.y1;
|
||||||
dv->value = y0-y1;
|
dv->value = display.y0-display.y1;
|
||||||
t0->value = x0;
|
t0->value = display.x0;
|
||||||
t1->value = x1;
|
t1->value = display.x1;
|
||||||
dt->value = fabs(x0-x1);
|
dt->value = fabs(display.x0 - display.x1);
|
||||||
f->value = 1/(x1-x0);
|
f->value = 1 / (display.x1 - display.x0);
|
||||||
|
|
||||||
char temp_hori[64];
|
char temp_hori[64];
|
||||||
char temp_vert[64];
|
char temp_vert[64];
|
||||||
|
@ -647,7 +625,8 @@ void isoDriver::setTriggerMode(int newMode)
|
||||||
triggerStateChanged();
|
triggerStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::frameActionGeneric(char CH1_mode, char CH2_mode) //0 for off, 1 for ana, 2 for dig, -1 for ana750, -2 for file
|
//0 for off, 1 for ana, 2 for dig, -1 for ana750, -2 for file
|
||||||
|
void isoDriver::frameActionGeneric(char CH1_mode, char CH2_mode)
|
||||||
{
|
{
|
||||||
//qDebug() << "made it to frameActionGeneric";
|
//qDebug() << "made it to frameActionGeneric";
|
||||||
if(!paused_CH1 && CH1_mode == - 1){
|
if(!paused_CH1 && CH1_mode == - 1){
|
||||||
|
@ -688,7 +667,7 @@ void isoDriver::frameActionGeneric(char CH1_mode, char CH2_mode) //0 for off, 1
|
||||||
double triggerDelay = 0;
|
double triggerDelay = 0;
|
||||||
if (triggerEnabled)
|
if (triggerEnabled)
|
||||||
{
|
{
|
||||||
triggerDelay = (triggerMode < 2) ? internalBuffer375_CH1->getDelayedTriggerPoint(window) - window : internalBuffer375_CH2->getDelayedTriggerPoint(window) - window;
|
triggerDelay = (triggerMode < 2) ? internalBuffer375_CH1->getDelayedTriggerPoint(display.window) - display.window : internalBuffer375_CH2->getDelayedTriggerPoint(display.window) - display.window;
|
||||||
|
|
||||||
if (triggerDelay < 0)
|
if (triggerDelay < 0)
|
||||||
triggerDelay = 0;
|
triggerDelay = 0;
|
||||||
|
@ -697,10 +676,10 @@ void isoDriver::frameActionGeneric(char CH1_mode, char CH2_mode) //0 for off, 1
|
||||||
if(singleShotEnabled && (triggerDelay != 0))
|
if(singleShotEnabled && (triggerDelay != 0))
|
||||||
singleShotTriggered(1);
|
singleShotTriggered(1);
|
||||||
|
|
||||||
readData375_CH1 = internalBuffer375_CH1->readBuffer(window,GRAPH_SAMPLES,CH1_mode==2, delay + triggerDelay);
|
readData375_CH1 = internalBuffer375_CH1->readBuffer(display.window,GRAPH_SAMPLES,CH1_mode==2, display.delay + triggerDelay);
|
||||||
if(CH2_mode) readData375_CH2 = internalBuffer375_CH2->readBuffer(window,GRAPH_SAMPLES,CH2_mode==2, delay + triggerDelay);
|
if(CH2_mode) readData375_CH2 = internalBuffer375_CH2->readBuffer(display.window,GRAPH_SAMPLES,CH2_mode==2, display.delay + triggerDelay);
|
||||||
if(CH1_mode == -1) readData750 = internalBuffer750->readBuffer(window,GRAPH_SAMPLES,false, delay + triggerDelay);
|
if(CH1_mode == -1) readData750 = internalBuffer750->readBuffer(display.window,GRAPH_SAMPLES,false, display.delay + triggerDelay);
|
||||||
if(CH1_mode == -2) readDataFile = internalBufferFile->readBuffer(window,GRAPH_SAMPLES,false, delay);
|
if(CH1_mode == -2) readDataFile = internalBufferFile->readBuffer(display.window,GRAPH_SAMPLES,false, display.delay);
|
||||||
|
|
||||||
QVector<double> x(GRAPH_SAMPLES), CH1(GRAPH_SAMPLES), CH2(GRAPH_SAMPLES);
|
QVector<double> x(GRAPH_SAMPLES), CH1(GRAPH_SAMPLES), CH2(GRAPH_SAMPLES);
|
||||||
|
|
||||||
|
@ -744,7 +723,7 @@ void isoDriver::frameActionGeneric(char CH1_mode, char CH2_mode) //0 for off, 1
|
||||||
|
|
||||||
|
|
||||||
for (double i=0; i<GRAPH_SAMPLES; i++){
|
for (double i=0; i<GRAPH_SAMPLES; i++){
|
||||||
x[i] = -(window*i)/((double)(GRAPH_SAMPLES-1)) - delay;
|
x[i] = -(display.window*i)/((double)(GRAPH_SAMPLES-1)) - display.delay;
|
||||||
if (x[i]>0) {
|
if (x[i]>0) {
|
||||||
CH1[i] = 0;
|
CH1[i] = 0;
|
||||||
CH2[i] = 0;
|
CH2[i] = 0;
|
||||||
|
@ -760,8 +739,8 @@ void isoDriver::frameActionGeneric(char CH1_mode, char CH2_mode) //0 for off, 1
|
||||||
}else{
|
}else{
|
||||||
axes->graph(0)->setData(x,CH1);
|
axes->graph(0)->setData(x,CH1);
|
||||||
if(CH2_mode) axes->graph(1)->setData(x,CH2);
|
if(CH2_mode) axes->graph(1)->setData(x,CH2);
|
||||||
axes->xAxis->setRange(-window-delay,-delay);
|
axes->xAxis->setRange(-display.window - display.delay, -display.delay);
|
||||||
axes->yAxis->setRange(topRange, botRange);
|
axes->yAxis->setRange(display.topRange, display.botRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(snapshotEnabled_CH1){
|
if(snapshotEnabled_CH1){
|
||||||
|
@ -804,13 +783,13 @@ void isoDriver::multimeterAction(){
|
||||||
}
|
}
|
||||||
|
|
||||||
double triggerDelay = 0;
|
double triggerDelay = 0;
|
||||||
readData375_CH1 = internalBuffer375_CH1->readBuffer(window,GRAPH_SAMPLES, false, delay + ((triggerEnabled&&!paused_multimeter) ? triggerDelay + window/2 : 0));
|
readData375_CH1 = internalBuffer375_CH1->readBuffer(display.window,GRAPH_SAMPLES, false, display.delay + ((triggerEnabled&&!paused_multimeter) ? triggerDelay + display.window/2 : 0));
|
||||||
|
|
||||||
QVector<double> x(GRAPH_SAMPLES), CH1(GRAPH_SAMPLES);
|
QVector<double> x(GRAPH_SAMPLES), CH1(GRAPH_SAMPLES);
|
||||||
analogConvert(readData375_CH1.get(), &CH1, 2048, 0, 1); //No AC coupling!
|
analogConvert(readData375_CH1.get(), &CH1, 2048, 0, 1); //No AC coupling!
|
||||||
|
|
||||||
for (double i=0; i<GRAPH_SAMPLES; i++){
|
for (double i=0; i<GRAPH_SAMPLES; i++){
|
||||||
x[i] = -(window*i)/((double)(GRAPH_SAMPLES-1)) - delay;
|
x[i] = -(display.window*i)/((double)(GRAPH_SAMPLES-1)) - display.delay;
|
||||||
if (x[i]>0) {
|
if (x[i]>0) {
|
||||||
CH1[i] = 0;
|
CH1[i] = 0;
|
||||||
}
|
}
|
||||||
|
@ -819,8 +798,8 @@ void isoDriver::multimeterAction(){
|
||||||
|
|
||||||
udateCursors();
|
udateCursors();
|
||||||
|
|
||||||
axes->xAxis->setRange(-window-delay,-delay);
|
axes->xAxis->setRange(-display.window - display.delay, -display.delay);
|
||||||
axes->yAxis->setRange(topRange, botRange);
|
axes->yAxis->setRange(display.topRange, display.botRange);
|
||||||
|
|
||||||
axes->replot();
|
axes->replot();
|
||||||
multimeterStats();
|
multimeterStats();
|
||||||
|
@ -1148,25 +1127,28 @@ void isoDriver::slowTimerTick(){
|
||||||
update_CH2 = true;
|
update_CH2 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::setTopRange(double newTop){
|
void isoDriver::setTopRange(double newTop)
|
||||||
topRange = newTop;
|
{
|
||||||
topRangeUpdated(topRange);
|
// NOTE: Should this be clamped to 20?
|
||||||
|
display.topRange = newTop;
|
||||||
|
topRangeUpdated(display.topRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::setBotRange(double newBot){
|
void isoDriver::setBotRange(double newBot)
|
||||||
botRange = newBot;
|
{
|
||||||
botRangeUpdated(botRange);
|
// NOTE: Should this be clamped to 20?
|
||||||
|
display.botRange = newBot;
|
||||||
|
botRangeUpdated(display.botRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::setTimeWindow(double newWindow){
|
void isoDriver::setTimeWindow(double newWindow){
|
||||||
window = newWindow;
|
display.window = newWindow;
|
||||||
windowAtPause = window;
|
timeWindowUpdated(display.window);
|
||||||
timeWindowUpdated(window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::setDelay(double newDelay){
|
void isoDriver::setDelay(double newDelay){
|
||||||
delay = newDelay;
|
display.delay = newDelay;
|
||||||
delayUpdated(delay);
|
delayUpdated(display.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoDriver::takeSnapshot(QString *fileName, unsigned char channel){
|
void isoDriver::takeSnapshot(QString *fileName, unsigned char channel){
|
||||||
|
@ -1389,20 +1371,20 @@ void isoDriver::disableFileMode(){
|
||||||
|
|
||||||
//Shrink screen back, if necessary.
|
//Shrink screen back, if necessary.
|
||||||
double mws = fileModeEnabled ? daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
double mws = fileModeEnabled ? daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
||||||
if (window > mws)
|
if (display.window > mws)
|
||||||
{
|
{
|
||||||
window = mws;
|
display.window = mws;
|
||||||
timeWindowUpdated(window);
|
timeWindowUpdated(display.window);
|
||||||
}
|
}
|
||||||
if ((window + delay) > mws)
|
if ((display.window + display.delay) > mws)
|
||||||
{
|
{
|
||||||
delay -= window + delay - mws;
|
display.delay -= display.window + display.delay - mws;
|
||||||
delayUpdated(delay);
|
delayUpdated(display.delay);
|
||||||
}
|
}
|
||||||
if (delay < 0)
|
if (display.delay < 0)
|
||||||
{
|
{
|
||||||
delay = 0;
|
display.delay = 0;
|
||||||
delayUpdated(delay);
|
delayUpdated(display.delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,38 @@
|
||||||
class isoBuffer;
|
class isoBuffer;
|
||||||
class isoBuffer_file;
|
class isoBuffer_file;
|
||||||
|
|
||||||
//isoDriver is a huge class. It handles everything related to the isochronous IN stream - and perhaps that constraint was applied a bit too loosely (spot the C programmer...).
|
// isoDriver is a huge class. It handles everything related to the
|
||||||
//Too much stuff is handled in this class, and it's too heavily entangled with the (generic/win/unix)UsbDriver classes.
|
// isochronous IN stream - and perhaps that constraint was applied
|
||||||
//That is one of the things I plan on fixing, and in fact the reason why I began the commenting!
|
// a bit too loosely (spot the C programmer...).
|
||||||
|
|
||||||
|
// Too much stuff is handled in this class, and it's too heavily
|
||||||
|
// entangled with the (generic/win/unix)UsbDriver classes.
|
||||||
|
|
||||||
|
// That is one of the things I plan on fixing, and in fact
|
||||||
|
// the reason why I began the commenting!
|
||||||
|
|
||||||
|
class DisplayControl : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
|
||||||
|
double delay = 0;
|
||||||
|
double window = 0.01;
|
||||||
|
double y0 = 0;
|
||||||
|
double y1 = 0;
|
||||||
|
double x0 = 0;
|
||||||
|
double x1 = 0;
|
||||||
|
double topRange = 2.5;
|
||||||
|
double botRange = -0.5;
|
||||||
|
|
||||||
|
void setVoltageRange (QWheelEvent* event, bool isProperlyPaused, double maxWindowSize, QCustomPlot* axes);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void topRangeUpdated(double);
|
||||||
|
void botRangeUpdated(double);
|
||||||
|
void timeWindowUpdated(double);
|
||||||
|
void delayUpdated(double);
|
||||||
|
};
|
||||||
|
|
||||||
class isoDriver : public QLabel
|
class isoDriver : public QLabel
|
||||||
{
|
{
|
||||||
|
@ -26,26 +55,30 @@ public:
|
||||||
explicit isoDriver(QWidget *parent = 0);
|
explicit isoDriver(QWidget *parent = 0);
|
||||||
void autoGain(void);
|
void autoGain(void);
|
||||||
//Generic Vars
|
//Generic Vars
|
||||||
isoBuffer *internalBuffer375_CH1, *internalBuffer375_CH2, *internalBuffer750;
|
isoBuffer *internalBuffer375_CH1;
|
||||||
|
isoBuffer *internalBuffer375_CH2;
|
||||||
|
isoBuffer *internalBuffer750;
|
||||||
isoBuffer_file *internalBufferFile = NULL;
|
isoBuffer_file *internalBufferFile = NULL;
|
||||||
#if QCP_VER == 1
|
#if QCP_VER == 1
|
||||||
QCPItemText *cursorTextPtr;
|
QCPItemText *cursorTextPtr;
|
||||||
#endif
|
#endif
|
||||||
genericUsbDriver *driver;
|
genericUsbDriver *driver;
|
||||||
bool doNotTouchGraph = true;
|
bool doNotTouchGraph = true;
|
||||||
double ch1_ref = 1.65, ch2_ref = 1.65;
|
double ch1_ref = 1.65;
|
||||||
double frontendGain_CH1 = (R4/(R3+R4)), frontendGain_CH2 = (R4/(R3+R4));
|
double ch2_ref = 1.65;
|
||||||
|
double frontendGain_CH1 = (R4/(R3+R4));
|
||||||
|
double frontendGain_CH2 = (R4/(R3+R4));
|
||||||
UartParity parity_CH1 = UartParity::None;
|
UartParity parity_CH1 = UartParity::None;
|
||||||
UartParity parity_CH2 = UartParity::None;
|
UartParity parity_CH2 = UartParity::None;
|
||||||
//State Vars
|
//State Vars
|
||||||
bool AC_CH1 = false, AC_CH2 = false;
|
bool AC_CH1 = false;
|
||||||
|
bool AC_CH2 = false;
|
||||||
bool cursorStatsEnabled = true;
|
bool cursorStatsEnabled = true;
|
||||||
int baudRate_CH1 = 9600, baudRate_CH2 = 9600;
|
int baudRate_CH1 = 9600;
|
||||||
|
int baudRate_CH2 = 9600;
|
||||||
double currentVmean;
|
double currentVmean;
|
||||||
//Display Control Vars (Variables that control how the buffers are displayed)
|
//Display Control Vars (Variables that control how the buffers are displayed)
|
||||||
double delay = 0, window = 0.01;
|
DisplayControl display;
|
||||||
double y0=0, y1=0, x0=0, x1=0;
|
|
||||||
double topRange=2.5, botRange=-0.5;
|
|
||||||
//Generic Functions
|
//Generic Functions
|
||||||
void setDriver(genericUsbDriver *newDriver);
|
void setDriver(genericUsbDriver *newDriver);
|
||||||
void setAxes(QCustomPlot *newAxes);
|
void setAxes(QCustomPlot *newAxes);
|
||||||
|
@ -57,9 +90,14 @@ public:
|
||||||
double daq_maxWindowSize;
|
double daq_maxWindowSize;
|
||||||
private:
|
private:
|
||||||
//Those bloody bools that just Enable/Disable a single property
|
//Those bloody bools that just Enable/Disable a single property
|
||||||
bool paused_CH1 = false, paused_CH2 = false, paused_multimeter = false;
|
bool paused_CH1 = false;
|
||||||
|
bool paused_CH2 = false;
|
||||||
|
bool paused_multimeter = false;
|
||||||
bool autoGainEnabled = true;
|
bool autoGainEnabled = true;
|
||||||
bool placingHoriAxes = false, placingVertAxes = false, horiCursorEnabled = false, vertCursorEnabled = false;
|
bool placingHoriAxes = false; // TODO: move into DisplayControl
|
||||||
|
bool placingVertAxes = false; // TODO: move into DisplayControl
|
||||||
|
bool horiCursorEnabled = false; // TODO: move into DisplayControl
|
||||||
|
bool vertCursorEnabled = false; // TODO: move into DisplayControl
|
||||||
bool triggerEnabled = false;
|
bool triggerEnabled = false;
|
||||||
bool singleShotEnabled = false;
|
bool singleShotEnabled = false;
|
||||||
bool multimeterShow = true;
|
bool multimeterShow = true;
|
||||||
|
@ -75,9 +113,11 @@ private:
|
||||||
bool forceAmps = false;
|
bool forceAmps = false;
|
||||||
bool forceOhms = false;
|
bool forceOhms = false;
|
||||||
bool forceNFarads = false;
|
bool forceNFarads = false;
|
||||||
bool serialDecodeEnabled_CH1 = false, serialDecodeEnabled_CH2 = false;
|
bool serialDecodeEnabled_CH1 = false;
|
||||||
|
bool serialDecodeEnabled_CH2 = false;
|
||||||
bool XYmode = false;
|
bool XYmode = false;
|
||||||
bool update_CH1 = true, update_CH2 = true;
|
bool update_CH1 = true;
|
||||||
|
bool update_CH2 = true;
|
||||||
bool snapshotEnabled_CH1 = false;
|
bool snapshotEnabled_CH1 = false;
|
||||||
bool snapshotEnabled_CH2 = false;
|
bool snapshotEnabled_CH2 = false;
|
||||||
bool firstFrame = true;
|
bool firstFrame = true;
|
||||||
|
@ -93,18 +133,29 @@ private:
|
||||||
void frameActionGeneric(char CH1_mode, char CH2_mode);
|
void frameActionGeneric(char CH1_mode, char CH2_mode);
|
||||||
void triggerStateChanged();
|
void triggerStateChanged();
|
||||||
//Variables that are just pointers to other classes/vars
|
//Variables that are just pointers to other classes/vars
|
||||||
QCustomPlot *axes;
|
QCustomPlot *axes; // TODO: move into DisplayControl
|
||||||
std::unique_ptr<short[]> readData375_CH1;
|
std::unique_ptr<short[]> readData375_CH1;
|
||||||
std::unique_ptr<short[]> readData375_CH2;
|
std::unique_ptr<short[]> readData375_CH2;
|
||||||
std::unique_ptr<short[]> readData750;
|
std::unique_ptr<short[]> readData750;
|
||||||
float *readDataFile;
|
float *readDataFile;
|
||||||
char *isoTemp = NULL;
|
char *isoTemp = NULL;
|
||||||
short *isoTemp_short = NULL;
|
short *isoTemp_short = NULL;
|
||||||
siprint *v0, *v1, *dv, *t0, *t1, *dt, *f;
|
siprint *v0;
|
||||||
|
siprint *v1;
|
||||||
|
siprint *dv;
|
||||||
|
siprint *t0;
|
||||||
|
siprint *t1;
|
||||||
|
siprint *dt;
|
||||||
|
siprint *f;
|
||||||
//Scope/MM++ related variables
|
//Scope/MM++ related variables
|
||||||
double currentVmax, currentVmin, currentVRMS;
|
double currentVmax;
|
||||||
|
double currentVmin;
|
||||||
|
double currentVRMS;
|
||||||
double multi = 0;
|
double multi = 0;
|
||||||
double xmin = 20, xmax = -20, ymin = 20, ymax = -20;
|
double xmin = 20;
|
||||||
|
double xmax = -20;
|
||||||
|
double ymin = 20;
|
||||||
|
double ymax = -20;
|
||||||
double estimated_resistance = 0;
|
double estimated_resistance = 0;
|
||||||
int multimeterRsource = 0;
|
int multimeterRsource = 0;
|
||||||
int triggerMode = 0;
|
int triggerMode = 0;
|
||||||
|
@ -121,8 +172,9 @@ private:
|
||||||
i2c::i2cDecoder* twoWire = nullptr;
|
i2c::i2cDecoder* twoWire = nullptr;
|
||||||
bool twoWireStateInvalid = true;
|
bool twoWireStateInvalid = true;
|
||||||
//Generic Vars
|
//Generic Vars
|
||||||
double windowAtPause = 0.01;
|
QTimer* isoTimer = NULL;
|
||||||
QTimer* isoTimer = NULL, *slowTimer = NULL, *fileTimer = NULL;
|
QTimer *slowTimer = NULL;
|
||||||
|
QTimer *fileTimer = NULL;
|
||||||
long total_read = 0;
|
long total_read = 0;
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
QFile *snapshotFile_CH1;
|
QFile *snapshotFile_CH1;
|
||||||
|
@ -163,7 +215,6 @@ signals:
|
||||||
void timeWindowUpdated(double);
|
void timeWindowUpdated(double);
|
||||||
void delayUpdated(double);
|
void delayUpdated(double);
|
||||||
public slots:
|
public slots:
|
||||||
void setWindow(int newWindow);
|
|
||||||
void setVoltageRange(QWheelEvent *event);
|
void setVoltageRange(QWheelEvent *event);
|
||||||
void timerTick(void);
|
void timerTick(void);
|
||||||
void pauseEnable_CH1(bool enabled);
|
void pauseEnable_CH1(bool enabled);
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include "espospinbox.h"
|
#include "espospinbox.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#define DO_QUOTE(X) #X
|
#define DO_QUOTE(X) #X
|
||||||
#define QUOTE(X) DO_QUOTE(X)
|
#define QUOTE(X) DO_QUOTE(X)
|
||||||
|
|
||||||
|
@ -1072,32 +1074,32 @@ void MainWindow::ctrlArrowDownTriggered(){
|
||||||
|
|
||||||
void MainWindow::cycleDelayRight(){
|
void MainWindow::cycleDelayRight(){
|
||||||
qDebug() << "RIGHT";
|
qDebug() << "RIGHT";
|
||||||
ui->controller_iso->delay -= ui->controller_iso->window/10;
|
ui->controller_iso->display.delay -= ui->controller_iso->display.window/10;
|
||||||
if(ui->controller_iso->delay < 0) ui->controller_iso->delay = 0;
|
if(ui->controller_iso->display.delay < 0) ui->controller_iso->display.delay = 0;
|
||||||
ui->controller_iso->delayUpdated(ui->controller_iso->delay);
|
ui->controller_iso->delayUpdated(ui->controller_iso->display.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::cycleDelayLeft(){
|
void MainWindow::cycleDelayLeft(){
|
||||||
qDebug() << "LEFT";
|
qDebug() << "LEFT";
|
||||||
double mws = ui->controller_iso->fileModeEnabled ? ui->controller_iso->daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
double mws = ui->controller_iso->fileModeEnabled ? ui->controller_iso->daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
||||||
ui->controller_iso->delay += ui->controller_iso->window/10;
|
ui->controller_iso->display.delay += ui->controller_iso->display.window/10;
|
||||||
if(ui->controller_iso->delay > (mws - ui->controller_iso->window)) ui->controller_iso->delay = (mws - ui->controller_iso->window);
|
if(ui->controller_iso->display.delay > (mws - ui->controller_iso->display.window)) ui->controller_iso->display.delay = (mws - ui->controller_iso->display.window);
|
||||||
ui->controller_iso->delayUpdated(ui->controller_iso->delay);
|
ui->controller_iso->delayUpdated(ui->controller_iso->display.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::cycleDelayRight_large(){
|
void MainWindow::cycleDelayRight_large(){
|
||||||
qDebug() << "RIGHT";
|
qDebug() << "RIGHT";
|
||||||
ui->controller_iso->delay -= ui->controller_iso->window/2;
|
ui->controller_iso->display.delay -= ui->controller_iso->display.window/2;
|
||||||
if(ui->controller_iso->delay < 0) ui->controller_iso->delay = 0;
|
if(ui->controller_iso->display.delay < 0) ui->controller_iso->display.delay = 0;
|
||||||
ui->controller_iso->delayUpdated(ui->controller_iso->delay);
|
ui->controller_iso->delayUpdated(ui->controller_iso->display.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::cycleDelayLeft_large(){
|
void MainWindow::cycleDelayLeft_large(){
|
||||||
qDebug() << "LEFT";
|
qDebug() << "LEFT";
|
||||||
double mws = ui->controller_iso->fileModeEnabled ? ui->controller_iso->daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
double mws = ui->controller_iso->fileModeEnabled ? ui->controller_iso->daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
||||||
ui->controller_iso->delay += ui->controller_iso->window/2;
|
ui->controller_iso->display.delay += ui->controller_iso->display.window/2;
|
||||||
if(ui->controller_iso->delay > (mws - ui->controller_iso->window)) ui->controller_iso->delay = (mws - ui->controller_iso->window);
|
if(ui->controller_iso->display.delay > (mws - ui->controller_iso->display.window)) ui->controller_iso->display.delay = (mws - ui->controller_iso->display.window);
|
||||||
ui->controller_iso->delayUpdated(ui->controller_iso->delay);
|
ui->controller_iso->delayUpdated(ui->controller_iso->display.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::enableLabradorDebugging(){
|
void MainWindow::enableLabradorDebugging(){
|
||||||
|
@ -1177,27 +1179,27 @@ void MainWindow::on_actionSnap_to_Cursors_triggered()
|
||||||
{
|
{
|
||||||
double xLeft, xRight, yBot, yTop;
|
double xLeft, xRight, yBot, yTop;
|
||||||
|
|
||||||
yTop = ui->controller_iso->y1 > ui->controller_iso->y0 ? ui->controller_iso->y1 : ui->controller_iso->y0;
|
yTop = std::max(ui->controller_iso->display.y1, ui->controller_iso->display.y0);
|
||||||
yBot = ui->controller_iso->y1 > ui->controller_iso->y0 ? ui->controller_iso->y0 : ui->controller_iso->y1;
|
yBot = std::min(ui->controller_iso->display.y1, ui->controller_iso->display.y0);
|
||||||
|
|
||||||
xRight = ui->controller_iso->x1 > ui->controller_iso->x0 ? ui->controller_iso->x1 : ui->controller_iso->x0;
|
xRight = std::max(ui->controller_iso->display.x1, ui->controller_iso->display.x0);
|
||||||
xLeft = ui->controller_iso->x1 > ui->controller_iso->x0 ? ui->controller_iso->x0 : ui->controller_iso->x1;
|
xLeft = std::min(ui->controller_iso->display.x1, ui->controller_iso->display.x0);
|
||||||
|
|
||||||
if((yBot-yTop) != 0){
|
if((yBot-yTop) != 0){
|
||||||
ui->controller_iso->topRange = yTop;
|
ui->controller_iso->display.topRange = yTop;
|
||||||
ui->controller_iso->botRange = yBot;
|
ui->controller_iso->display.botRange = yBot;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((xLeft - xRight) != 0){
|
if((xLeft - xRight) != 0){
|
||||||
ui->controller_iso->delay = - xRight;
|
ui->controller_iso->display.delay = - xRight;
|
||||||
ui->controller_iso->window = xRight - xLeft;
|
ui->controller_iso->display.window = xRight - xLeft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionEnter_Manually_triggered()
|
void MainWindow::on_actionEnter_Manually_triggered()
|
||||||
{
|
{
|
||||||
ui->controller_iso->delay = 0;
|
ui->controller_iso->display.delay = 0;
|
||||||
scopeRangeEnterDialog dialog(this, ui->controller_iso->topRange, ui->controller_iso->botRange, ui->controller_iso->window, ui->controller_iso->delay);
|
scopeRangeEnterDialog dialog(this, ui->controller_iso->display.topRange, ui->controller_iso->display.botRange, ui->controller_iso->display.window, ui->controller_iso->display.delay);
|
||||||
dialog.setModal(true);
|
dialog.setModal(true);
|
||||||
connect(&dialog, SIGNAL(yTopUpdated(double)), ui->controller_iso, SLOT(setTopRange(double)));
|
connect(&dialog, SIGNAL(yTopUpdated(double)), ui->controller_iso, SLOT(setTopRange(double)));
|
||||||
connect(&dialog, SIGNAL(yBotUpdated(double)), ui->controller_iso, SLOT(setBotRange(double)));
|
connect(&dialog, SIGNAL(yBotUpdated(double)), ui->controller_iso, SLOT(setBotRange(double)));
|
||||||
|
@ -2300,7 +2302,7 @@ void MainWindow::on_actionShow_Range_Dialog_on_Main_Page_triggered(bool checked)
|
||||||
qDebug() << "on_actionShow_Range_Dialog_on_Main_Page_triggered" << checked;
|
qDebug() << "on_actionShow_Range_Dialog_on_Main_Page_triggered" << checked;
|
||||||
if (checked)
|
if (checked)
|
||||||
{
|
{
|
||||||
scopeRangeSwitch = new scopeRangeEnterDialog(nullptr, false, ui->controller_iso->topRange, ui->controller_iso->botRange, ui->controller_iso->window, ui->controller_iso->delay);
|
scopeRangeSwitch = new scopeRangeEnterDialog(nullptr, false, ui->controller_iso->display.topRange, ui->controller_iso->display.botRange, ui->controller_iso->display.window, ui->controller_iso->display.delay);
|
||||||
scopeRangeSwitch->setWindowFlags(Qt::Widget);
|
scopeRangeSwitch->setWindowFlags(Qt::Widget);
|
||||||
ui->verticalLayout_5->insertWidget(2, scopeRangeSwitch);
|
ui->verticalLayout_5->insertWidget(2, scopeRangeSwitch);
|
||||||
connect(scopeRangeSwitch, SIGNAL(yTopUpdated(double)), ui->controller_iso, SLOT(setTopRange(double)));
|
connect(scopeRangeSwitch, SIGNAL(yTopUpdated(double)), ui->controller_iso, SLOT(setTopRange(double)));
|
||||||
|
|
Loading…
Reference in New Issue