Close serial AMBE device on disconnect, fixes crash on next connect

pull/3/head
Doug McLain 3 years ago
parent 303aeae633
commit 78f7a07cd9

@ -50,7 +50,7 @@ SerialAMBE::SerialAMBE(QString protocol) :
SerialAMBE::~SerialAMBE() SerialAMBE::~SerialAMBE()
{ {
//m_serial->close(); m_serial->close();
} }
QMap<QString, QString> SerialAMBE::discover_devices() QMap<QString, QString> SerialAMBE::discover_devices()
@ -169,11 +169,9 @@ void SerialAMBE::connect_to_serial(QString p)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fflush(stderr); fflush(stderr);
#endif #endif
//hw_ambe_present = true;
} }
else{ else{
//hw_ambe_present = false; qDebug() << "Error: Failed to open device.";
//std::cerr << "Error: Failed to open device." << std::endl;
} }
} }
} }
@ -199,7 +197,6 @@ void SerialAMBE::process_serial()
m_serialdata.append(d[i]); m_serialdata.append(d[i]);
} }
#ifdef DEBUG #ifdef DEBUG
qDebug() << "RECV: " << d.size() << " : " << m_serialdata.size() << " : " << d.toHex();
fprintf(stderr, "AMBEHW %d:%d:", d.size(), m_serialdata.size()); fprintf(stderr, "AMBEHW %d:%d:", d.size(), m_serialdata.size());
for(int i = 0; i < d.size(); ++i){ for(int i = 0; i < d.size(); ++i){
//if((d.data()[i] == 0x61) && (data.data()[i+1] == 0x01) && (data.data()[i+2] == 0x42) && (data.data()[i+3] == 0x02)){ //if((d.data()[i] == 0x61) && (data.data()[i+1] == 0x01) && (data.data()[i+2] == 0x42) && (data.data()[i+3] == 0x02)){

Loading…
Cancel
Save