mirror of https://github.com/EspoTek/Labrador.git
Hex display on serial decoder
This commit is contained in:
parent
398f8252bf
commit
40bed49c25
|
@ -336,14 +336,11 @@ int isoBuffer::cap_x2fromLast(double seconds, int x1, double vtop)
|
||||||
return capSample(-x1, kSamplesSeekingCap, seconds, vtop, fX1X2Comp);
|
return capSample(-x1, kSamplesSeekingCap, seconds, vtop, fX1X2Comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void isoBuffer::serialManage(double baudRate, UartParity parity)
|
void isoBuffer::serialManage(double baudRate, UartParity parity, bool hexDisplay)
|
||||||
{
|
{
|
||||||
if (m_decoder == NULL)
|
if (m_decoder == NULL)
|
||||||
{
|
{
|
||||||
m_decoder = new uartStyleDecoder(baudRate, this);
|
m_decoder = new uartStyleDecoder(baudRate, this);
|
||||||
|
|
||||||
connect(m_decoder, &uartStyleDecoder::wireDisconnected,
|
|
||||||
m_virtualParent, &isoDriver::serialNeedsDisabling);
|
|
||||||
}
|
}
|
||||||
if (!m_isDecoding)
|
if (!m_isDecoding)
|
||||||
{
|
{
|
||||||
|
@ -353,6 +350,7 @@ void isoBuffer::serialManage(double baudRate, UartParity parity)
|
||||||
|
|
||||||
m_decoder->m_baudRate = baudRate;
|
m_decoder->m_baudRate = baudRate;
|
||||||
m_decoder->setParityMode(parity);
|
m_decoder->setParityMode(parity);
|
||||||
|
m_decoder->setHexDisplay(hexDisplay);
|
||||||
m_decoder->serialDecode();
|
m_decoder->serialDecode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
int cap_x0fromLast(double seconds, double vbot);
|
int cap_x0fromLast(double seconds, double vbot);
|
||||||
int cap_x1fromLast(double seconds, int x0, double vbot);
|
int cap_x1fromLast(double seconds, int x0, double vbot);
|
||||||
int cap_x2fromLast(double seconds, int x1, double vtop);
|
int cap_x2fromLast(double seconds, int x1, double vtop);
|
||||||
void serialManage(double baudRate, UartParity parity);
|
void serialManage(double baudRate, UartParity parity, bool hexDisplay);
|
||||||
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);
|
||||||
|
|
|
@ -87,7 +87,7 @@ void isoDriver::timerTick(void){
|
||||||
internalBuffer375_CH2->m_channel = 1;
|
internalBuffer375_CH2->m_channel = 1;
|
||||||
frameActionGeneric(1,2);
|
frameActionGeneric(1,2);
|
||||||
if(serialDecodeEnabled_CH1 && serialType == 0){
|
if(serialDecodeEnabled_CH1 && serialType == 0){
|
||||||
internalBuffer375_CH2->serialManage(baudRate_CH1, parity_CH1);
|
internalBuffer375_CH2->serialManage(baudRate_CH1, parity_CH1, hexDisplay_CH1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -104,7 +104,7 @@ void isoDriver::timerTick(void){
|
||||||
|
|
||||||
frameActionGeneric(2,0);
|
frameActionGeneric(2,0);
|
||||||
if(serialDecodeEnabled_CH1 && serialType == 0){
|
if(serialDecodeEnabled_CH1 && serialType == 0){
|
||||||
internalBuffer375_CH1->serialManage(baudRate_CH1, parity_CH1);
|
internalBuffer375_CH1->serialManage(baudRate_CH1, parity_CH1, hexDisplay_CH1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
@ -116,10 +116,10 @@ void isoDriver::timerTick(void){
|
||||||
internalBuffer375_CH2->m_channel = 2;
|
internalBuffer375_CH2->m_channel = 2;
|
||||||
frameActionGeneric(2,2);
|
frameActionGeneric(2,2);
|
||||||
if(serialDecodeEnabled_CH1 && serialType == 0){
|
if(serialDecodeEnabled_CH1 && serialType == 0){
|
||||||
internalBuffer375_CH1->serialManage(baudRate_CH1, parity_CH1);
|
internalBuffer375_CH1->serialManage(baudRate_CH1, parity_CH1, hexDisplay_CH1);
|
||||||
}
|
}
|
||||||
if(serialDecodeEnabled_CH2 && serialType == 0){
|
if(serialDecodeEnabled_CH2 && serialType == 0){
|
||||||
internalBuffer375_CH2->serialManage(baudRate_CH2, parity_CH2);
|
internalBuffer375_CH2->serialManage(baudRate_CH2, parity_CH2, hexDisplay_CH2);
|
||||||
}
|
}
|
||||||
if (serialDecodeEnabled_CH1 && serialType == 1)
|
if (serialDecodeEnabled_CH1 && serialType == 1)
|
||||||
{
|
{
|
||||||
|
@ -1493,3 +1493,13 @@ void isoDriver::attenuationChanged_CH2(int attenuationIndex)
|
||||||
throw std::runtime_error("Unknown attenuation index for CH2");
|
throw std::runtime_error("Unknown attenuation index for CH2");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void isoDriver::setHexDisplay_CH1(bool enabled)
|
||||||
|
{
|
||||||
|
hexDisplay_CH1 = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void isoDriver::setHexDisplay_CH2(bool enabled)
|
||||||
|
{
|
||||||
|
hexDisplay_CH2 = enabled;
|
||||||
|
}
|
||||||
|
|
|
@ -121,6 +121,8 @@ private:
|
||||||
bool snapshotEnabled_CH1 = false;
|
bool snapshotEnabled_CH1 = false;
|
||||||
bool snapshotEnabled_CH2 = false;
|
bool snapshotEnabled_CH2 = false;
|
||||||
bool firstFrame = true;
|
bool firstFrame = true;
|
||||||
|
bool hexDisplay_CH1 = false;
|
||||||
|
bool hexDisplay_CH2 = false;
|
||||||
//Generic Functions
|
//Generic Functions
|
||||||
void analogConvert(short *shortPtr, QVector<double> *doublePtr, int TOP, bool AC, int channel);
|
void analogConvert(short *shortPtr, QVector<double> *doublePtr, int TOP, bool AC, int channel);
|
||||||
void digitalConvert(short *shortPtr, QVector<double> *doublePtr);
|
void digitalConvert(short *shortPtr, QVector<double> *doublePtr);
|
||||||
|
@ -276,6 +278,8 @@ public slots:
|
||||||
void offsetChanged_CH2(double newOffset);
|
void offsetChanged_CH2(double newOffset);
|
||||||
void attenuationChanged_CH1(int attenuationIndex);
|
void attenuationChanged_CH1(int attenuationIndex);
|
||||||
void attenuationChanged_CH2(int attenuationIndex);
|
void attenuationChanged_CH2(int attenuationIndex);
|
||||||
|
void setHexDisplay_CH1(bool enabled);
|
||||||
|
void setHexDisplay_CH2(bool enabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ISODRIVER_H
|
#endif // ISODRIVER_H
|
||||||
|
|
|
@ -212,6 +212,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
connect(ui->hideCH1Box, SIGNAL(toggled(bool)), ui->controller_iso, SLOT(hideCH1(bool)));
|
connect(ui->hideCH1Box, SIGNAL(toggled(bool)), ui->controller_iso, SLOT(hideCH1(bool)));
|
||||||
connect(ui->hideCH2Box, SIGNAL(toggled(bool)), ui->controller_iso, SLOT(hideCH2(bool)));
|
connect(ui->hideCH2Box, SIGNAL(toggled(bool)), ui->controller_iso, SLOT(hideCH2(bool)));
|
||||||
|
|
||||||
|
connect(ui->actionHexDisplay, &QAction::toggled, ui->controller_iso, &isoDriver::setHexDisplay_CH1);
|
||||||
|
connect(ui->actionHexDisplay_2, &QAction::toggled, ui->controller_iso, &isoDriver::setHexDisplay_CH2);
|
||||||
|
|
||||||
ui->hideCH1Box->setVisible(false);
|
ui->hideCH1Box->setVisible(false);
|
||||||
ui->hideCH2Box->setVisible(false);
|
ui->hideCH2Box->setVisible(false);
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,15 @@ void uartStyleDecoder::decodeNextUartBit(bool bitValue)
|
||||||
parityCheckFailed = false;
|
parityCheckFailed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_hexDisplay)
|
||||||
|
{
|
||||||
|
m_serialBuffer.insert_hex(decodedDatabit);
|
||||||
|
m_serialBuffer.insert(" ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_serialBuffer.insert(decodedDatabit);
|
m_serialBuffer.insert(decodedDatabit);
|
||||||
|
}
|
||||||
|
|
||||||
currentUartSymbol = 0;
|
currentUartSymbol = 0;
|
||||||
dataBit_current = 0;
|
dataBit_current = 0;
|
||||||
|
@ -228,6 +236,11 @@ void uartStyleDecoder::setParityMode(UartParity newParity)
|
||||||
parity = newParity;
|
parity = newParity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uartStyleDecoder::setHexDisplay(bool enabled)
|
||||||
|
{
|
||||||
|
m_hexDisplay = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
bool uartStyleDecoder::isParityCorrect(uint32_t bitField) const
|
bool uartStyleDecoder::isParityCorrect(uint32_t bitField) const
|
||||||
{
|
{
|
||||||
assert(parity != UartParity::None);
|
assert(parity != UartParity::None);
|
||||||
|
|
|
@ -42,15 +42,24 @@ private:
|
||||||
void decodeNextUartBit(bool bitValue);
|
void decodeNextUartBit(bool bitValue);
|
||||||
bool jitterCompensationProcedure(bool current_bit);
|
bool jitterCompensationProcedure(bool current_bit);
|
||||||
|
|
||||||
|
bool m_hexDisplay = false;
|
||||||
|
|
||||||
QPlainTextEdit *console;
|
QPlainTextEdit *console;
|
||||||
isoBufferBuffer m_serialBuffer;
|
isoBufferBuffer m_serialBuffer;
|
||||||
public:
|
public:
|
||||||
double m_baudRate;
|
double m_baudRate;
|
||||||
QTimer m_updateTimer; // IMPORTANT: must be after m_serialBuffer. construction / destruction order matters
|
QTimer m_updateTimer; // IMPORTANT: must be after m_serialBuffer. construction / destruction order matters
|
||||||
|
|
||||||
public:
|
|
||||||
void serialDecode();
|
void serialDecode();
|
||||||
int serialDistance() const;
|
int serialDistance() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void wireDisconnected(int);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateConsole();
|
||||||
|
void setParityMode(UartParity newParity);
|
||||||
|
void setHexDisplay(bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char decodeDatabit(int mode, short symbol) const;
|
char decodeDatabit(int mode, short symbol) const;
|
||||||
char decodeBaudot(short symbol) const;
|
char decodeBaudot(short symbol) const;
|
||||||
|
@ -62,11 +71,7 @@ private:
|
||||||
UartParity parityOf(uint32_t bitField) const;
|
UartParity parityOf(uint32_t bitField) const;
|
||||||
|
|
||||||
bool parityCheckFailed = false;
|
bool parityCheckFailed = false;
|
||||||
signals:
|
|
||||||
void wireDisconnected(int);
|
|
||||||
public slots:
|
|
||||||
void updateConsole();
|
|
||||||
void setParityMode(UartParity newParity);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UARTSTYLEDECODER_H
|
#endif // UARTSTYLEDECODER_H
|
||||||
|
|
|
@ -1695,6 +1695,7 @@
|
||||||
<addaction name="menuBaud_Rate"/>
|
<addaction name="menuBaud_Rate"/>
|
||||||
<addaction name="menuData_Bits"/>
|
<addaction name="menuData_Bits"/>
|
||||||
<addaction name="menuParity_Bit"/>
|
<addaction name="menuParity_Bit"/>
|
||||||
|
<addaction name="actionHexDisplay"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuUART_2">
|
<widget class="QMenu" name="menuUART_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -1734,6 +1735,7 @@
|
||||||
<addaction name="menuBaud_Rate_2"/>
|
<addaction name="menuBaud_Rate_2"/>
|
||||||
<addaction name="menuData_Bits_2"/>
|
<addaction name="menuData_Bits_2"/>
|
||||||
<addaction name="menuParity_Bit_2"/>
|
<addaction name="menuParity_Bit_2"/>
|
||||||
|
<addaction name="actionHexDisplay_2"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuProtocol">
|
<widget class="QMenu" name="menuProtocol">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -2555,6 +2557,22 @@
|
||||||
<string>&Documentation</string>
|
<string>&Documentation</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionHexDisplay">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Hex Display</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionHexDisplay_2">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Hex Display</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
Loading…
Reference in New Issue