Work in progress.

merge-requests/1/head
Teuniz 2016-12-28 19:11:51 +01:00
rodzic 781417c216
commit cd823a6896
7 zmienionych plików z 340 dodań i 295 usunięć

Wyświetl plik

@ -35,7 +35,7 @@
#define PROGRAM_NAME "DSRemote"
#define PROGRAM_VERSION "0.33_1612281501"
#define PROGRAM_VERSION "0.33_1612281910"
#define MAX_PATHLEN 4096
@ -274,7 +274,9 @@ struct device_settings
int show_fps;
// below here is use for the wave inspector
int wave_mem_view_sample_start;
int wave_mem_view_enabled;
};

Wyświetl plik

@ -1486,11 +1486,11 @@ void UI_Mainwindow::saveButtonClicked()
{
QMenu menu;
menu.addAction("Save screen waveform", this, SLOT(save_screen_waveform()));
menu.addAction("Save memory waveform", this, SLOT(save_mem_wav()));
menu.addAction("Analyze memory waveform", this, SLOT(analyze_mem_wav()));
menu.addAction("Save screenshot", this, SLOT(save_screenshot()));
menu.addAction("Factory", this, SLOT(set_to_factory()));
menu.addAction("Save screen waveform", this, SLOT(save_screen_waveform()));
menu.addAction("Save memory waveform", this, SLOT(save_mem_wav()));
menu.addAction("Wave Inspector", this, SLOT(analyze_mem_wav()));
menu.addAction("Save screenshot", this, SLOT(save_screenshot()));
menu.addAction("Factory", this, SLOT(set_to_factory()));
menu.exec(saveButton->mapToGlobal(QPoint(0,0)));
}

Wyświetl plik

@ -2625,7 +2625,7 @@ void UI_Mainwindow::screenUpdate()
{
if(devparms.math_decode_display)
{
serial_decoder();
serial_decoder(&devparms);
}
waveForm->drawCurve(&devparms, device);

Wyświetl plik

@ -114,6 +114,8 @@ public:
void set_cue_cmd(const char *);
void serial_decoder(struct device_settings *);
struct device_settings devparms;
QLabel *statusLabel;
@ -238,7 +240,6 @@ private:
int get_metric_factor(double);
void get_device_model(const char *);
double get_stepsize_divide_by_1000(double);
void serial_decoder(void);
inline unsigned char reverse_bitorder_8(unsigned char);
inline unsigned int reverse_bitorder_32(unsigned int);
void save_memory_waveform(int);

Plik diff jest za duży Load Diff

Wyświetl plik

@ -39,7 +39,7 @@ UI_wave_window::UI_wave_window(struct device_settings *p_devparms, short *wbuf[M
mainwindow = (UI_Mainwindow *)parnt;
setMinimumSize(840, 635);
setWindowTitle("Wave Memory");
setWindowTitle("Wave Inspector");
devparms = (struct device_settings *)calloc(1, sizeof(struct device_settings));
if(devparms == NULL)
@ -67,6 +67,18 @@ UI_wave_window::UI_wave_window(struct device_settings *p_devparms, short *wbuf[M
devparms->timebaseoffset = 0;
devparms->math_decode_uart_tx_nval = 0;
devparms->math_decode_uart_rx_nval = 0;
devparms->math_decode_spi_mosi_nval = 0;
devparms->math_decode_spi_miso_nval = 0;
devparms->wave_mem_view_enabled = 1;
if(devparms->math_decode_display)
{
mainwindow->serial_decoder(devparms);
}
wavcurve = new WaveCurve;
wavcurve->setBackgroundColor(Qt::black);
wavcurve->setSignalColor1(Qt::yellow);
@ -276,10 +288,10 @@ void UI_wave_window::zoom_in()
void UI_wave_window::zoom_out()
{
if(devparms->timebasescale >= ((double)devparms->acquirememdepth / devparms->samplerate) / (double)devparms->hordivisions)
{
devparms->timebasescale = ((double)devparms->acquirememdepth / devparms->samplerate) / (double)devparms->hordivisions;
double dtmp = round_up_step125(devparms->timebasescale, NULL);
if(dtmp >= ((double)devparms->acquirememdepth / devparms->samplerate) / (double)devparms->hordivisions)
{
return;
}

Wyświetl plik

@ -945,7 +945,9 @@ void WaveCurve::draw_decoder(QPainter *painter, int dw, int dh)
line_h_spi_miso=0,
spi_chars=1,
pixel_per_bit=1,
samples_per_div;
samples_per_div,
sample_start,
sample_end;
double pix_per_smpl;
@ -954,6 +956,15 @@ void WaveCurve::draw_decoder(QPainter *painter, int dw, int dh)
samples_per_div = devparms->samplerate * devparms->timebasescale;
sample_start = devparms->wave_mem_view_sample_start;
sample_end = devparms->hordivisions * samples_per_div + sample_start;
if(sample_end > bufsize)
{
sample_end = bufsize;
}
if(devparms->modelserie == 6)
{
base_line = (dh / 2) - (((double)dh / 400.0) * devparms->math_decode_pos);
@ -981,7 +992,7 @@ void WaveCurve::draw_decoder(QPainter *painter, int dw, int dh)
if(devparms->math_decode_mode == DECODE_MODE_UART)
{
pixel_per_bit = ((double)dw / 12.0 / devparms->timebasescale) / (double)devparms->math_decode_uart_baud;
pixel_per_bit = ((double)dw / devparms->hordivisions / devparms->timebasescale) / (double)devparms->math_decode_uart_baud;
cell_width = pixel_per_bit * devparms->math_decode_uart_width;
@ -1014,9 +1025,12 @@ void WaveCurve::draw_decoder(QPainter *painter, int dw, int dh)
{
for(i=0; i<devparms->math_decode_uart_tx_nval; i++)
{
painter->fillRect(devparms->math_decode_uart_tx_val_pos[i] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 26, Qt::black);
if((devparms->math_decode_uart_tx_val_pos[i] >= sample_start) && (devparms->math_decode_uart_tx_val_pos[i] < sample_end))
{
painter->fillRect(devparms->math_decode_uart_tx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 26, Qt::black);
painter->drawRect(devparms->math_decode_uart_tx_val_pos[i] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 26);
painter->drawRect(devparms->math_decode_uart_tx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 26);
}
}
}
@ -1024,9 +1038,12 @@ void WaveCurve::draw_decoder(QPainter *painter, int dw, int dh)
{
for(i=0; i<devparms->math_decode_uart_rx_nval; i++)
{
painter->fillRect(devparms->math_decode_uart_rx_val_pos[i] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 26, Qt::black);
if((devparms->math_decode_uart_rx_val_pos[i] >= sample_start) && (devparms->math_decode_uart_rx_val_pos[i] < sample_end))
{
painter->fillRect(devparms->math_decode_uart_rx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 26, Qt::black);
painter->drawRect(devparms->math_decode_uart_rx_val_pos[i] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 26);
painter->drawRect(devparms->math_decode_uart_rx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 26);
}
}
}
@ -1052,55 +1069,58 @@ void WaveCurve::draw_decoder(QPainter *painter, int dw, int dh)
for(i=0; i<devparms->math_decode_uart_tx_nval; i++)
{
if(devparms->math_decode_format == 0) // hex
if((devparms->math_decode_uart_tx_val_pos[i] >= sample_start) && (devparms->math_decode_uart_tx_val_pos[i] < sample_end))
{
sprintf(str, "%02X", devparms->math_decode_uart_tx_val[i]);
painter->drawText(devparms->math_decode_uart_tx_val_pos[i] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
}
else if(devparms->math_decode_format == 1) // ASCII
if(devparms->math_decode_format == 0) // hex
{
ascii_decode_control_char(devparms->math_decode_uart_tx_val[i], str);
sprintf(str, "%02X", devparms->math_decode_uart_tx_val[i]);
painter->drawText(devparms->math_decode_uart_tx_val_pos[i] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
painter->drawText(devparms->math_decode_uart_tx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
}
else if(devparms->math_decode_format == 2) // decimal
else if(devparms->math_decode_format == 1) // ASCII
{
sprintf(str, "%u", (unsigned int)devparms->math_decode_uart_tx_val[i]);
ascii_decode_control_char(devparms->math_decode_uart_tx_val[i], str);
painter->drawText(devparms->math_decode_uart_tx_val_pos[i] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
painter->drawText(devparms->math_decode_uart_tx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
}
else if(devparms->math_decode_format == 3) // binary
else if(devparms->math_decode_format == 2) // decimal
{
for(j=0; j<devparms->math_decode_uart_width; j++)
{
str[devparms->math_decode_uart_width - 1 - j] = ((devparms->math_decode_uart_tx_val[i] >> j) & 1) + '0';
}
sprintf(str, "%u", (unsigned int)devparms->math_decode_uart_tx_val[i]);
str[j] = 0;
painter->drawText(devparms->math_decode_uart_tx_val_pos[i] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
painter->drawText(devparms->math_decode_uart_tx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
}
else if(devparms->math_decode_format == 4) // line
else if(devparms->math_decode_format == 3) // binary
{
for(j=0; j<devparms->math_decode_uart_width; j++)
{
str[j] = ((devparms->math_decode_uart_tx_val[i] >> j) & 1) + '0';
str[devparms->math_decode_uart_width - 1 - j] = ((devparms->math_decode_uart_tx_val[i] >> j) & 1) + '0';
}
str[j] = 0;
painter->drawText(devparms->math_decode_uart_tx_val_pos[i] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
painter->drawText(devparms->math_decode_uart_tx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
}
else if(devparms->math_decode_format == 4) // line
{
for(j=0; j<devparms->math_decode_uart_width; j++)
{
str[j] = ((devparms->math_decode_uart_tx_val[i] >> j) & 1) + '0';
}
if(devparms->math_decode_uart_tx_err[i])
{
painter->setPen(Qt::red);
str[j] = 0;
painter->drawText(devparms->math_decode_uart_tx_val_pos[i] * pix_per_smpl + cell_width, line_h_uart_tx - 13, 25, 25, Qt::AlignCenter, "?");
painter->drawText(devparms->math_decode_uart_tx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
}
painter->setPen(Qt::white);
}
if(devparms->math_decode_uart_tx_err[i])
{
painter->setPen(Qt::red);
painter->drawText(devparms->math_decode_uart_tx_val_pos[i - sample_start] * pix_per_smpl + cell_width, line_h_uart_tx - 13, 25, 25, Qt::AlignCenter, "?");
painter->setPen(Qt::white);
}
}
}
}
@ -1124,55 +1144,58 @@ void WaveCurve::draw_decoder(QPainter *painter, int dw, int dh)
for(i=0; i<devparms->math_decode_uart_rx_nval; i++)
{
if(devparms->math_decode_format == 0) // hex
if((devparms->math_decode_uart_rx_val_pos[i] >= sample_start) && (devparms->math_decode_uart_rx_val_pos[i] < sample_end))
{
sprintf(str, "%02X", devparms->math_decode_uart_rx_val[i]);
painter->drawText(devparms->math_decode_uart_rx_val_pos[i] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
}
else if(devparms->math_decode_format == 1) // ASCII
if(devparms->math_decode_format == 0) // hex
{
ascii_decode_control_char(devparms->math_decode_uart_rx_val[i], str);
sprintf(str, "%02X", devparms->math_decode_uart_rx_val[i]);
painter->drawText(devparms->math_decode_uart_rx_val_pos[i] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
painter->drawText(devparms->math_decode_uart_rx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
}
else if(devparms->math_decode_format == 2) // decimal
else if(devparms->math_decode_format == 1) // ASCII
{
sprintf(str, "%u", (unsigned int)devparms->math_decode_uart_rx_val[i]);
ascii_decode_control_char(devparms->math_decode_uart_rx_val[i], str);
painter->drawText(devparms->math_decode_uart_rx_val_pos[i] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
painter->drawText(devparms->math_decode_uart_rx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
}
else if(devparms->math_decode_format == 3) // binary
else if(devparms->math_decode_format == 2) // decimal
{
for(j=0; j<devparms->math_decode_uart_width; j++)
{
str[devparms->math_decode_uart_width - 1 - j] = ((devparms->math_decode_uart_rx_val[i] >> j) & 1) + '0';
}
sprintf(str, "%u", (unsigned int)devparms->math_decode_uart_rx_val[i]);
str[j] = 0;
painter->drawText(devparms->math_decode_uart_rx_val_pos[i] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
painter->drawText(devparms->math_decode_uart_rx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
}
else if(devparms->math_decode_format == 4) // line
else if(devparms->math_decode_format == 3) // binary
{
for(j=0; j<devparms->math_decode_uart_width; j++)
{
str[j] = ((devparms->math_decode_uart_rx_val[i] >> j) & 1) + '0';
str[devparms->math_decode_uart_width - 1 - j] = ((devparms->math_decode_uart_rx_val[i] >> j) & 1) + '0';
}
str[j] = 0;
painter->drawText(devparms->math_decode_uart_rx_val_pos[i] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
painter->drawText(devparms->math_decode_uart_rx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
}
else if(devparms->math_decode_format == 4) // line
{
for(j=0; j<devparms->math_decode_uart_width; j++)
{
str[j] = ((devparms->math_decode_uart_rx_val[i] >> j) & 1) + '0';
}
if(devparms->math_decode_uart_rx_err[i])
{
painter->setPen(Qt::red);
str[j] = 0;
painter->drawText(devparms->math_decode_uart_rx_val_pos[i] * pix_per_smpl + cell_width, line_h_uart_rx - 13, 25, 25, Qt::AlignCenter, "?");
painter->drawText(devparms->math_decode_uart_rx_val_pos[i - sample_start] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
}
painter->setPen(Qt::white);
}
if(devparms->math_decode_uart_rx_err[i])
{
painter->setPen(Qt::red);
painter->drawText(devparms->math_decode_uart_rx_val_pos[i - sample_start] * pix_per_smpl + cell_width, line_h_uart_rx - 13, 25, 25, Qt::AlignCenter, "?");
painter->setPen(Qt::white);
}
}
}
}
}