kopia lustrzana https://gitlab.com/Teuniz/DSRemote
Lots of bugfixes and improvements for the serial decoder.
rodzic
151de99792
commit
39683f3580
4
global.h
4
global.h
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
|
|
||||||
#define PROGRAM_NAME "DSRemote"
|
#define PROGRAM_NAME "DSRemote"
|
||||||
#define PROGRAM_VERSION "0.33_1612081745"
|
#define PROGRAM_VERSION "0.33_1612091806"
|
||||||
|
|
||||||
#define MAX_PATHLEN 4096
|
#define MAX_PATHLEN 4096
|
||||||
|
|
||||||
|
@ -223,9 +223,11 @@ struct device_settings
|
||||||
int math_decode_uart_tx_nval; // number of decoded characters
|
int math_decode_uart_tx_nval; // number of decoded characters
|
||||||
unsigned char math_decode_uart_tx_val[DECODE_MAX_CHARS]; // array with decoded characters
|
unsigned char math_decode_uart_tx_val[DECODE_MAX_CHARS]; // array with decoded characters
|
||||||
int math_decode_uart_tx_val_pos[DECODE_MAX_CHARS]; // array with position of the decoded characters
|
int math_decode_uart_tx_val_pos[DECODE_MAX_CHARS]; // array with position of the decoded characters
|
||||||
|
int math_decode_uart_tx_err[DECODE_MAX_CHARS]; // array with protocol errors, non zero means an error
|
||||||
int math_decode_uart_rx_nval; // number of decoded characters
|
int math_decode_uart_rx_nval; // number of decoded characters
|
||||||
unsigned char math_decode_uart_rx_val[DECODE_MAX_CHARS]; // array with decoded characters
|
unsigned char math_decode_uart_rx_val[DECODE_MAX_CHARS]; // array with decoded characters
|
||||||
int math_decode_uart_rx_val_pos[DECODE_MAX_CHARS]; // array with position of the decoded characters
|
int math_decode_uart_rx_val_pos[DECODE_MAX_CHARS]; // array with position of the decoded characters
|
||||||
|
int math_decode_uart_rx_err[DECODE_MAX_CHARS]; // array with protocol errors, non zero means an error
|
||||||
|
|
||||||
char *screenshot_buf;
|
char *screenshot_buf;
|
||||||
short *wavebuf[MAX_CHNS];
|
short *wavebuf[MAX_CHNS];
|
||||||
|
|
|
@ -70,7 +70,8 @@ void UI_Mainwindow::serial_decoder(void)
|
||||||
spi_miso_bit0_pos=0,
|
spi_miso_bit0_pos=0,
|
||||||
spi_clk_new,
|
spi_clk_new,
|
||||||
spi_clk_old,
|
spi_clk_old,
|
||||||
spi_chars=1;
|
spi_chars=1,
|
||||||
|
stop_bit_error;
|
||||||
|
|
||||||
unsigned int uart_val=0,
|
unsigned int uart_val=0,
|
||||||
spi_mosi_val=0,
|
spi_mosi_val=0,
|
||||||
|
@ -406,11 +407,14 @@ void UI_Mainwindow::serial_decoder(void)
|
||||||
if(!devparms.math_decode_uart_pol) // positive, line level RS-232 or negative, cpu level TTL/CMOS?
|
if(!devparms.math_decode_uart_pol) // positive, line level RS-232 or negative, cpu level TTL/CMOS?
|
||||||
{
|
{
|
||||||
uart_val = ~uart_val;
|
uart_val = ~uart_val;
|
||||||
|
|
||||||
|
uart_val &= (0xff >> (8 - uart_tx_data_bit));
|
||||||
}
|
}
|
||||||
|
|
||||||
devparms.math_decode_uart_tx_val[devparms.math_decode_uart_tx_nval] =uart_val;
|
devparms.math_decode_uart_tx_val[devparms.math_decode_uart_tx_nval] = uart_val;
|
||||||
|
|
||||||
devparms.math_decode_uart_tx_val_pos[devparms.math_decode_uart_tx_nval++] = i - (uart_tx_data_bit * uart_sample_per_bit);
|
devparms.math_decode_uart_tx_val_pos[devparms.math_decode_uart_tx_nval] =
|
||||||
|
i - (uart_tx_data_bit * uart_sample_per_bit) + (0.5 * uart_sample_per_bit);
|
||||||
|
|
||||||
uart_tx_data_bit = 0;
|
uart_tx_data_bit = 0;
|
||||||
|
|
||||||
|
@ -418,6 +422,47 @@ void UI_Mainwindow::serial_decoder(void)
|
||||||
|
|
||||||
uart_tx_x_pos += uart_sample_per_bit;
|
uart_tx_x_pos += uart_sample_per_bit;
|
||||||
|
|
||||||
|
i = uart_tx_x_pos;
|
||||||
|
|
||||||
|
devparms.math_decode_uart_tx_err[devparms.math_decode_uart_tx_nval] = 0;
|
||||||
|
|
||||||
|
stop_bit_error = 0; // check stop bit
|
||||||
|
|
||||||
|
if(i < devparms.wavebufsz)
|
||||||
|
{
|
||||||
|
if(devparms.modelserie == 6)
|
||||||
|
{
|
||||||
|
if(devparms.wavebuf[devparms.math_decode_uart_tx - 1][i] >= devparms.math_decode_threshold_uart_tx)
|
||||||
|
{
|
||||||
|
stop_bit_error = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // modelserie = 1, 2 or 4
|
||||||
|
{
|
||||||
|
if(devparms.wavebuf[devparms.math_decode_uart_tx - 1][i] >= threshold[devparms.math_decode_uart_tx - 1])
|
||||||
|
{
|
||||||
|
stop_bit_error = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(devparms.math_decode_uart_pol)
|
||||||
|
{
|
||||||
|
if(stop_bit_error)
|
||||||
|
{
|
||||||
|
stop_bit_error = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stop_bit_error = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stop_bit_error)
|
||||||
|
{
|
||||||
|
devparms.math_decode_uart_tx_err[devparms.math_decode_uart_tx_nval] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(devparms.math_decode_uart_stop == 1)
|
if(devparms.math_decode_uart_stop == 1)
|
||||||
{
|
{
|
||||||
uart_tx_x_pos += uart_sample_per_bit / 2;
|
uart_tx_x_pos += uart_sample_per_bit / 2;
|
||||||
|
@ -433,6 +478,8 @@ void UI_Mainwindow::serial_decoder(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
i = uart_tx_x_pos - 1;
|
i = uart_tx_x_pos - 1;
|
||||||
|
|
||||||
|
devparms.math_decode_uart_tx_nval++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -466,7 +513,6 @@ void UI_Mainwindow::serial_decoder(void)
|
||||||
{
|
{
|
||||||
if(devparms.wavebuf[devparms.math_decode_uart_rx - 1][i] < devparms.math_decode_threshold_uart_rx)
|
if(devparms.wavebuf[devparms.math_decode_uart_rx - 1][i] < devparms.math_decode_threshold_uart_rx)
|
||||||
{
|
{
|
||||||
|
|
||||||
uart_rx_start = 1;
|
uart_rx_start = 1;
|
||||||
|
|
||||||
uart_val = 0;
|
uart_val = 0;
|
||||||
|
@ -502,7 +548,6 @@ void UI_Mainwindow::serial_decoder(void)
|
||||||
{
|
{
|
||||||
if(devparms.wavebuf[devparms.math_decode_uart_rx - 1][i] >= devparms.math_decode_threshold_uart_rx)
|
if(devparms.wavebuf[devparms.math_decode_uart_rx - 1][i] >= devparms.math_decode_threshold_uart_rx)
|
||||||
{
|
{
|
||||||
|
|
||||||
uart_rx_start = 1;
|
uart_rx_start = 1;
|
||||||
|
|
||||||
uart_val = 0;
|
uart_val = 0;
|
||||||
|
@ -560,11 +605,14 @@ void UI_Mainwindow::serial_decoder(void)
|
||||||
if(!devparms.math_decode_uart_pol) // positive, line level RS-232 or negative, cpu level TTL/CMOS?
|
if(!devparms.math_decode_uart_pol) // positive, line level RS-232 or negative, cpu level TTL/CMOS?
|
||||||
{
|
{
|
||||||
uart_val = ~uart_val;
|
uart_val = ~uart_val;
|
||||||
|
|
||||||
|
uart_val &= (0xff >> (8 - uart_rx_data_bit));
|
||||||
}
|
}
|
||||||
|
|
||||||
devparms.math_decode_uart_rx_val[devparms.math_decode_uart_rx_nval] =uart_val;
|
devparms.math_decode_uart_rx_val[devparms.math_decode_uart_rx_nval] = uart_val;
|
||||||
|
|
||||||
devparms.math_decode_uart_rx_val_pos[devparms.math_decode_uart_rx_nval++] = i - (uart_rx_data_bit * uart_sample_per_bit);
|
devparms.math_decode_uart_rx_val_pos[devparms.math_decode_uart_rx_nval] =
|
||||||
|
i - (uart_rx_data_bit * uart_sample_per_bit) + (0.5 * uart_sample_per_bit);
|
||||||
|
|
||||||
uart_rx_data_bit = 0;
|
uart_rx_data_bit = 0;
|
||||||
|
|
||||||
|
@ -572,6 +620,47 @@ void UI_Mainwindow::serial_decoder(void)
|
||||||
|
|
||||||
uart_rx_x_pos += uart_sample_per_bit;
|
uart_rx_x_pos += uart_sample_per_bit;
|
||||||
|
|
||||||
|
i = uart_rx_x_pos;
|
||||||
|
|
||||||
|
devparms.math_decode_uart_rx_err[devparms.math_decode_uart_rx_nval] = 0;
|
||||||
|
|
||||||
|
stop_bit_error = 0; // check stop bit
|
||||||
|
|
||||||
|
if(i < devparms.wavebufsz)
|
||||||
|
{
|
||||||
|
if(devparms.modelserie == 6)
|
||||||
|
{
|
||||||
|
if(devparms.wavebuf[devparms.math_decode_uart_rx - 1][i] >= devparms.math_decode_threshold_uart_rx)
|
||||||
|
{
|
||||||
|
stop_bit_error = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // modelserie = 1, 2 or 4
|
||||||
|
{
|
||||||
|
if(devparms.wavebuf[devparms.math_decode_uart_rx - 1][i] >= threshold[devparms.math_decode_uart_rx - 1])
|
||||||
|
{
|
||||||
|
stop_bit_error = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(devparms.math_decode_uart_pol)
|
||||||
|
{
|
||||||
|
if(stop_bit_error)
|
||||||
|
{
|
||||||
|
stop_bit_error = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stop_bit_error = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stop_bit_error)
|
||||||
|
{
|
||||||
|
devparms.math_decode_uart_rx_err[devparms.math_decode_uart_rx_nval] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(devparms.math_decode_uart_stop == 1)
|
if(devparms.math_decode_uart_stop == 1)
|
||||||
{
|
{
|
||||||
uart_rx_x_pos += uart_sample_per_bit / 2;
|
uart_rx_x_pos += uart_sample_per_bit / 2;
|
||||||
|
@ -587,6 +676,8 @@ void UI_Mainwindow::serial_decoder(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
i = uart_rx_x_pos - 1;
|
i = uart_rx_x_pos - 1;
|
||||||
|
|
||||||
|
devparms.math_decode_uart_rx_nval++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
158
signalcurve.cpp
158
signalcurve.cpp
|
@ -2262,7 +2262,8 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
line_h_uart_rx=0,
|
line_h_uart_rx=0,
|
||||||
line_h_spi_mosi=0,
|
line_h_spi_mosi=0,
|
||||||
line_h_spi_miso=0,
|
line_h_spi_miso=0,
|
||||||
spi_chars=1;
|
spi_chars=1,
|
||||||
|
pixel_per_bit=1;
|
||||||
|
|
||||||
double pix_per_smpl;
|
double pix_per_smpl;
|
||||||
|
|
||||||
|
@ -2296,6 +2297,17 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
|
|
||||||
if(devparms->math_decode_mode == DECODE_MODE_UART)
|
if(devparms->math_decode_mode == DECODE_MODE_UART)
|
||||||
{
|
{
|
||||||
|
if(devparms->timebasedelayenable)
|
||||||
|
{
|
||||||
|
pixel_per_bit = ((double)dw / 12.0 / devparms->timebasedelayscale) / (double)devparms->math_decode_uart_baud;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pixel_per_bit = ((double)dw / 12.0 / devparms->timebasescale) / (double)devparms->math_decode_uart_baud;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_width = pixel_per_bit * devparms->math_decode_uart_width;
|
||||||
|
|
||||||
painter->setPen(Qt::green);
|
painter->setPen(Qt::green);
|
||||||
|
|
||||||
if(devparms->math_decode_uart_tx && devparms->math_decode_uart_rx)
|
if(devparms->math_decode_uart_tx && devparms->math_decode_uart_rx)
|
||||||
|
@ -2345,13 +2357,27 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
|
|
||||||
if(devparms->math_decode_uart_tx)
|
if(devparms->math_decode_uart_tx)
|
||||||
{
|
{
|
||||||
painter->drawText(5, line_h_uart_tx - 35, 25, 30, Qt::AlignCenter, "TX");
|
switch(devparms->math_decode_format)
|
||||||
|
{
|
||||||
|
case 0: painter->drawText(5, line_h_uart_tx - 35, 65, 30, Qt::AlignCenter, "Tx[HEX]");
|
||||||
|
break;
|
||||||
|
case 1: painter->drawText(5, line_h_uart_tx - 35, 65, 30, Qt::AlignCenter, "Tx[ASC]");
|
||||||
|
break;
|
||||||
|
case 2: painter->drawText(5, line_h_uart_tx - 35, 65, 30, Qt::AlignCenter, "Tx[DEC]");
|
||||||
|
break;
|
||||||
|
case 3: painter->drawText(5, line_h_uart_tx - 35, 65, 30, Qt::AlignCenter, "Tx[BIN]");
|
||||||
|
break;
|
||||||
|
case 4: painter->drawText(5, line_h_uart_tx - 35, 65, 30, Qt::AlignCenter, "Tx[LINE]");
|
||||||
|
break;
|
||||||
|
default: painter->drawText(5, line_h_uart_tx - 35, 65, 30, Qt::AlignCenter, "Tx[\?\?\?]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for(i=0; i<devparms->math_decode_uart_tx_nval; i++)
|
for(i=0; i<devparms->math_decode_uart_tx_nval; i++)
|
||||||
{
|
{
|
||||||
if(devparms->math_decode_format == 0) // hex
|
if(devparms->math_decode_format == 0) // hex
|
||||||
{
|
{
|
||||||
sprintf(str, "0x%02X", devparms->math_decode_uart_tx_val[i]);
|
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] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
|
||||||
}
|
}
|
||||||
|
@ -2378,41 +2404,61 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
}
|
}
|
||||||
else if(devparms->math_decode_format == 3) // binary
|
else if(devparms->math_decode_format == 3) // binary
|
||||||
{
|
{
|
||||||
str[0] = '0';
|
for(j=0; j<devparms->math_decode_uart_width; j++)
|
||||||
str[1] = 'b';
|
|
||||||
|
|
||||||
for(j=7; j>=0; j--)
|
|
||||||
{
|
{
|
||||||
str[9-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[10] = 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] * 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 == 4) // line
|
||||||
{
|
{
|
||||||
for(j=0; j<8; j++)
|
for(j=0; j<devparms->math_decode_uart_width; j++)
|
||||||
{
|
{
|
||||||
str[j] = ((devparms->math_decode_uart_rx_val[i] >> j) & 1) + '0';
|
str[j] = ((devparms->math_decode_uart_tx_val[i] >> j) & 1) + '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
str[8] = 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] * pix_per_smpl, line_h_uart_tx - 13, cell_width, 30, Qt::AlignCenter, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(devparms->math_decode_uart_tx_err[i])
|
||||||
|
{
|
||||||
|
painter->setPen(Qt::red);
|
||||||
|
|
||||||
|
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->setPen(Qt::white);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(devparms->math_decode_uart_rx)
|
if(devparms->math_decode_uart_rx)
|
||||||
{
|
{
|
||||||
painter->drawText(5, line_h_uart_rx - 35, 25, 30, Qt::AlignCenter, "RX");
|
switch(devparms->math_decode_format)
|
||||||
|
{
|
||||||
|
case 0: painter->drawText(5, line_h_uart_rx - 35, 65, 30, Qt::AlignCenter, "Rx[HEX]");
|
||||||
|
break;
|
||||||
|
case 1: painter->drawText(5, line_h_uart_rx - 35, 65, 30, Qt::AlignCenter, "Rx[ASC]");
|
||||||
|
break;
|
||||||
|
case 2: painter->drawText(5, line_h_uart_rx - 35, 65, 30, Qt::AlignCenter, "Rx[DEC]");
|
||||||
|
break;
|
||||||
|
case 3: painter->drawText(5, line_h_uart_rx - 35, 65, 30, Qt::AlignCenter, "Rx[BIN]");
|
||||||
|
break;
|
||||||
|
case 4: painter->drawText(5, line_h_uart_rx - 35, 65, 30, Qt::AlignCenter, "Rx[LINE]");
|
||||||
|
break;
|
||||||
|
default: painter->drawText(5, line_h_uart_rx - 35, 65, 30, Qt::AlignCenter, "Rx[\?\?\?]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for(i=0; i<devparms->math_decode_uart_rx_nval; i++)
|
for(i=0; i<devparms->math_decode_uart_rx_nval; i++)
|
||||||
{
|
{
|
||||||
if(devparms->math_decode_format == 0) // hex
|
if(devparms->math_decode_format == 0) // hex
|
||||||
{
|
{
|
||||||
sprintf(str, "0x%02X", devparms->math_decode_uart_rx_val[i]);
|
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] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
|
||||||
}
|
}
|
||||||
|
@ -2439,29 +2485,35 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
}
|
}
|
||||||
else if(devparms->math_decode_format == 3) // binary
|
else if(devparms->math_decode_format == 3) // binary
|
||||||
{
|
{
|
||||||
str[0] = '0';
|
for(j=0; j<devparms->math_decode_uart_width; j++)
|
||||||
str[1] = 'b';
|
|
||||||
|
|
||||||
for(j=7; j>=0; j--)
|
|
||||||
{
|
{
|
||||||
str[9-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[10] = 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] * 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 == 4) // line
|
||||||
{
|
{
|
||||||
for(j=0; j<8; j++)
|
for(j=0; j<devparms->math_decode_uart_width; j++)
|
||||||
{
|
{
|
||||||
str[j] = ((devparms->math_decode_uart_rx_val[i] >> j) & 1) + '0';
|
str[j] = ((devparms->math_decode_uart_rx_val[i] >> j) & 1) + '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
str[8] = 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] * pix_per_smpl, line_h_uart_rx - 13, cell_width, 30, Qt::AlignCenter, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(devparms->math_decode_uart_rx_err[i])
|
||||||
|
{
|
||||||
|
painter->setPen(Qt::red);
|
||||||
|
|
||||||
|
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->setPen(Qt::white);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2536,7 +2588,21 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
|
|
||||||
if(devparms->math_decode_spi_mosi)
|
if(devparms->math_decode_spi_mosi)
|
||||||
{
|
{
|
||||||
painter->drawText(5, line_h_spi_mosi - 35, 40, 30, Qt::AlignCenter, "MOSI");
|
switch(devparms->math_decode_format)
|
||||||
|
{
|
||||||
|
case 0: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Mosi[HEX]");
|
||||||
|
break;
|
||||||
|
case 1: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Mosi[ASC]");
|
||||||
|
break;
|
||||||
|
case 2: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Mosi[DEC]");
|
||||||
|
break;
|
||||||
|
case 3: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Mosi[BIN]");
|
||||||
|
break;
|
||||||
|
case 4: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Mosi[LINE]");
|
||||||
|
break;
|
||||||
|
default: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Mosi[\?\?\?]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for(i=0; i<devparms->math_decode_spi_mosi_nval; i++)
|
for(i=0; i<devparms->math_decode_spi_mosi_nval; i++)
|
||||||
{
|
{
|
||||||
|
@ -2544,13 +2610,13 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
{
|
{
|
||||||
switch(spi_chars)
|
switch(spi_chars)
|
||||||
{
|
{
|
||||||
case 1: sprintf(str, "0x%02X", devparms->math_decode_spi_mosi_val[i]);
|
case 1: sprintf(str, "%02X", devparms->math_decode_spi_mosi_val[i]);
|
||||||
break;
|
break;
|
||||||
case 2: sprintf(str, "0x%04X", devparms->math_decode_spi_mosi_val[i]);
|
case 2: sprintf(str, "%04X", devparms->math_decode_spi_mosi_val[i]);
|
||||||
break;
|
break;
|
||||||
case 3: sprintf(str, "0x%06X", devparms->math_decode_spi_mosi_val[i]);
|
case 3: sprintf(str, "%06X", devparms->math_decode_spi_mosi_val[i]);
|
||||||
break;
|
break;
|
||||||
case 4: sprintf(str, "0x%08X", devparms->math_decode_spi_mosi_val[i]);
|
case 4: sprintf(str, "%08X", devparms->math_decode_spi_mosi_val[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2580,15 +2646,12 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
}
|
}
|
||||||
else if(devparms->math_decode_format == 3) // binary
|
else if(devparms->math_decode_format == 3) // binary
|
||||||
{
|
{
|
||||||
str[0] = '0';
|
|
||||||
str[1] = 'b';
|
|
||||||
|
|
||||||
for(j=0; j<devparms->math_decode_spi_width; j++)
|
for(j=0; j<devparms->math_decode_spi_width; j++)
|
||||||
{
|
{
|
||||||
str[devparms->math_decode_spi_width + 1 - j] = ((devparms->math_decode_spi_mosi_val[i] >> j) & 1) + '0';
|
str[devparms->math_decode_spi_width - 1 - j] = ((devparms->math_decode_spi_mosi_val[i] >> j) & 1) + '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
str[j + 2] = 0;
|
str[j] = 0;
|
||||||
|
|
||||||
painter->drawText(devparms->math_decode_spi_mosi_val_pos[i] * pix_per_smpl, line_h_spi_mosi - 13, cell_width, 30, Qt::AlignCenter, str);
|
painter->drawText(devparms->math_decode_spi_mosi_val_pos[i] * pix_per_smpl, line_h_spi_mosi - 13, cell_width, 30, Qt::AlignCenter, str);
|
||||||
}
|
}
|
||||||
|
@ -2608,7 +2671,21 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
|
|
||||||
if(devparms->math_decode_spi_miso)
|
if(devparms->math_decode_spi_miso)
|
||||||
{
|
{
|
||||||
painter->drawText(5, line_h_spi_miso - 35, 40, 30, Qt::AlignCenter, "MISO");
|
switch(devparms->math_decode_format)
|
||||||
|
{
|
||||||
|
case 0: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Miso[HEX]");
|
||||||
|
break;
|
||||||
|
case 1: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Miso[HEX]");
|
||||||
|
break;
|
||||||
|
case 2: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Miso[DEC]");
|
||||||
|
break;
|
||||||
|
case 3: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Miso[BIN]");
|
||||||
|
break;
|
||||||
|
case 4: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Miso[LINE]");
|
||||||
|
break;
|
||||||
|
default: painter->drawText(5, line_h_spi_mosi - 35, 80, 30, Qt::AlignCenter, "Miso[\?\?\?]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for(i=0; i<devparms->math_decode_spi_miso_nval; i++)
|
for(i=0; i<devparms->math_decode_spi_miso_nval; i++)
|
||||||
{
|
{
|
||||||
|
@ -2616,13 +2693,13 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
{
|
{
|
||||||
switch(spi_chars)
|
switch(spi_chars)
|
||||||
{
|
{
|
||||||
case 1: sprintf(str, "0x%02X", devparms->math_decode_spi_miso_val[i]);
|
case 1: sprintf(str, "%02X", devparms->math_decode_spi_miso_val[i]);
|
||||||
break;
|
break;
|
||||||
case 2: sprintf(str, "0x%04X", devparms->math_decode_spi_miso_val[i]);
|
case 2: sprintf(str, "%04X", devparms->math_decode_spi_miso_val[i]);
|
||||||
break;
|
break;
|
||||||
case 3: sprintf(str, "0x%06X", devparms->math_decode_spi_miso_val[i]);
|
case 3: sprintf(str, "%06X", devparms->math_decode_spi_miso_val[i]);
|
||||||
break;
|
break;
|
||||||
case 4: sprintf(str, "0x%08X", devparms->math_decode_spi_miso_val[i]);
|
case 4: sprintf(str, "%08X", devparms->math_decode_spi_miso_val[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2652,15 +2729,12 @@ void SignalCurve::draw_decoder(QPainter *painter, int dw, int dh)
|
||||||
}
|
}
|
||||||
else if(devparms->math_decode_format == 3) // binary
|
else if(devparms->math_decode_format == 3) // binary
|
||||||
{
|
{
|
||||||
str[0] = '0';
|
|
||||||
str[1] = 'b';
|
|
||||||
|
|
||||||
for(j=0; j<devparms->math_decode_spi_width; j++)
|
for(j=0; j<devparms->math_decode_spi_width; j++)
|
||||||
{
|
{
|
||||||
str[devparms->math_decode_spi_width + 1 - j] = ((devparms->math_decode_spi_miso_val[i] >> j) & 1) + '0';
|
str[devparms->math_decode_spi_width - 1 - j] = ((devparms->math_decode_spi_miso_val[i] >> j) & 1) + '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
str[j + 2] = 0;
|
str[j] = 0;
|
||||||
|
|
||||||
painter->drawText(devparms->math_decode_spi_miso_val_pos[i] * pix_per_smpl, line_h_spi_miso - 13, cell_width, 30, Qt::AlignCenter, str);
|
painter->drawText(devparms->math_decode_spi_miso_val_pos[i] * pix_per_smpl, line_h_spi_miso - 13, cell_width, 30, Qt::AlignCenter, str);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue