kopia lustrzana https://gitlab.com/Teuniz/DSRemote
Wave inspector: fixed a bug that caused an error in case of a relatively high DC-offset.
rodzic
c7bc6d1f81
commit
d9490a188b
2
global.h
2
global.h
|
@ -35,7 +35,7 @@
|
|||
|
||||
|
||||
#define PROGRAM_NAME "DSRemote"
|
||||
#define PROGRAM_VERSION "0.39_2302091112"
|
||||
#define PROGRAM_VERSION "0.40_2304101223"
|
||||
|
||||
#define MAX_PATHLEN (1024)
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ void UI_Mainwindow::get_deep_memory_waveform(void)
|
|||
|
||||
if(devparms.yinc[chn] < 1e-6)
|
||||
{
|
||||
snprintf(str, 512, "Error, parameter \"YINC\" out of range: %e line %i file %s", devparms.yinc[chn], __LINE__, __FILE__);
|
||||
snprintf(str, 512, "Error, parameter \"YINC\" out of range for channel %i: %e line %i file %s", chn, devparms.yinc[chn], __LINE__, __FILE__);
|
||||
goto OUT_ERROR;
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ void UI_Mainwindow::get_deep_memory_waveform(void)
|
|||
|
||||
if((yref[chn] < 1) || (yref[chn] > 255))
|
||||
{
|
||||
snprintf(str, 512, "Error, parameter \"YREF\" out of range: %i line %i file %s", yref[chn], __LINE__, __FILE__);
|
||||
snprintf(str, 512, "Error, parameter \"YREF\" out of range for channel %i: %i line %i file %s", chn, yref[chn], __LINE__, __FILE__);
|
||||
goto OUT_ERROR;
|
||||
}
|
||||
|
||||
|
@ -367,12 +367,16 @@ void UI_Mainwindow::get_deep_memory_waveform(void)
|
|||
|
||||
devparms.yor[chn] = atoi(device->buf);
|
||||
|
||||
if((devparms.yor[chn] < -255) || (devparms.yor[chn] > 255))
|
||||
if((devparms.yor[chn] < -32000) || (devparms.yor[chn] > 32000))
|
||||
{
|
||||
snprintf(str, 512, "Error, parameter \"YOR\" out of range: %i line %i file %s", devparms.yor[chn], __LINE__, __FILE__);
|
||||
snprintf(str, 512, "Error, parameter \"YOR\" out of range for channel %i: %i line %i file %s", chn, devparms.yor[chn], __LINE__, __FILE__);
|
||||
goto OUT_ERROR;
|
||||
}
|
||||
|
||||
// printf("yinc[%i] : %f\n", chn, devparms.yinc[chn]);
|
||||
// printf("yref[%i] : %i\n", chn, yref[chn]);
|
||||
// printf("yor[%i] : %i\n", chn, devparms.yor[chn]);
|
||||
|
||||
empty_buf = 0;
|
||||
|
||||
for(bytes_rcvd=0; bytes_rcvd<mempnts ;)
|
||||
|
@ -452,7 +456,7 @@ void UI_Mainwindow::get_deep_memory_waveform(void)
|
|||
break;
|
||||
}
|
||||
|
||||
wavbuf[chn][bytes_rcvd + k] = ((int)(((unsigned char *)device->buf)[k]) - yref[chn] - devparms.yor[chn]) << 5;
|
||||
wavbuf[chn][bytes_rcvd + k] = ((int)(((unsigned char *)device->buf)[k])) - yref[chn] - devparms.yor[chn];
|
||||
}
|
||||
|
||||
bytes_rcvd += n;
|
||||
|
@ -714,14 +718,14 @@ void UI_Mainwindow::save_wave_inspector_buffer_to_edf(struct device_settings *d_
|
|||
edf_set_digital_minimum(hdl, j, -32768);
|
||||
if(d_parms->chanscale[chn] > 2)
|
||||
{
|
||||
edf_set_physical_maximum(hdl, j, d_parms->yinc[chn] * 32767.0 / 32.0);
|
||||
edf_set_physical_minimum(hdl, j, d_parms->yinc[chn] * -32768.0 / 32.0);
|
||||
edf_set_physical_maximum(hdl, j, d_parms->yinc[chn] * 32767.0);
|
||||
edf_set_physical_minimum(hdl, j, d_parms->yinc[chn] * -32768.0);
|
||||
edf_set_physical_dimension(hdl, j, "V");
|
||||
}
|
||||
else
|
||||
{
|
||||
edf_set_physical_maximum(hdl, j, 1000.0 * d_parms->yinc[chn] * 32767.0 / 32.0);
|
||||
edf_set_physical_minimum(hdl, j, 1000.0 * d_parms->yinc[chn] * -32768.0 / 32.0);
|
||||
edf_set_physical_maximum(hdl, j, 1000.0 * d_parms->yinc[chn] * 32767.0);
|
||||
edf_set_physical_minimum(hdl, j, 1000.0 * d_parms->yinc[chn] * -32768.0);
|
||||
edf_set_physical_dimension(hdl, j, "mV");
|
||||
}
|
||||
snprintf(str, 512, "CHAN%i", chn + 1);
|
||||
|
@ -943,7 +947,7 @@ void UI_Mainwindow::save_screen_waveform()
|
|||
|
||||
if(devparms.yinc[chn] < 1e-6)
|
||||
{
|
||||
snprintf(str, 512, "Error, parameter \"YINC\" out of range: %e line %i file %s", devparms.yinc[chn], __LINE__, __FILE__);
|
||||
snprintf(str, 512, "Error, parameter \"YINC\" out of range for channel %i: %e line %i file %s", chn, devparms.yinc[chn], __LINE__, __FILE__);
|
||||
goto OUT_ERROR;
|
||||
}
|
||||
|
||||
|
@ -959,7 +963,7 @@ void UI_Mainwindow::save_screen_waveform()
|
|||
|
||||
if((yref[chn] < 1) || (yref[chn] > 255))
|
||||
{
|
||||
snprintf(str, 512, "Error, parameter \"YREF\" out of range: %i line %i file %s", yref[chn], __LINE__, __FILE__);
|
||||
snprintf(str, 512, "Error, parameter \"YREF\" out of range for channel %i: %i line %i file %s", chn, yref[chn], __LINE__, __FILE__);
|
||||
goto OUT_ERROR;
|
||||
}
|
||||
|
||||
|
@ -975,7 +979,7 @@ void UI_Mainwindow::save_screen_waveform()
|
|||
|
||||
if((devparms.yor[chn] < -255) || (devparms.yor[chn] > 255))
|
||||
{
|
||||
snprintf(str, 512, "Error, parameter \"YOR\" out of range: %i line %i file %s", devparms.yor[chn], __LINE__, __FILE__);
|
||||
snprintf(str, 512, "Error, parameter \"YOR\" out of range for channel %i: %i line %i file %s", chn, devparms.yor[chn], __LINE__, __FILE__);
|
||||
goto OUT_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -306,11 +306,11 @@ void WaveCurve::paintEvent(QPaintEvent *)
|
|||
continue;
|
||||
}
|
||||
|
||||
v_sense = ((double)curve_h / ((devparms->chanscale[chn] * devparms->vertdivisions) / devparms->yinc[chn])) / -32.0;
|
||||
v_sense = ((double)curve_h / ((devparms->chanscale[chn] * devparms->vertdivisions) / devparms->yinc[chn])) / -1.0;
|
||||
|
||||
h_trace_offset = curve_h / 2;
|
||||
|
||||
h_trace_offset += (devparms->yor[chn] * v_sense * 32.0);
|
||||
h_trace_offset += devparms->yor[chn] * v_sense;
|
||||
|
||||
painter->setPen(QPen(QBrush(SignalColor[chn], Qt::SolidPattern), tracewidth, Qt::SolidLine, Qt::SquareCap, Qt::BevelJoin));
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue