mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 12:36:35 +00:00
Added better handling for command line parameters
This commit is contained in:
@@ -5,11 +5,15 @@
|
||||
#include "defines.hpp"
|
||||
#include "utilsCRC16.hpp"
|
||||
|
||||
SerialPort::SerialPort()
|
||||
SerialPort::SerialPort(QString usePort)
|
||||
: QObject(nullptr)
|
||||
{
|
||||
if (usePort.isEmpty() == true) {
|
||||
usePort = SERIAL_PORT;
|
||||
}
|
||||
|
||||
mSerialPort = new QSerialPort();
|
||||
mSerialPort->setPortName(SERIAL_PORT);
|
||||
mSerialPort->setPortName(usePort);
|
||||
mSerialPort->setBaudRate(QSerialPort::Baud115200);
|
||||
mSerialPort->setDataBits(QSerialPort::Data8);
|
||||
mSerialPort->setStopBits(QSerialPort::OneStop);
|
||||
@@ -17,9 +21,11 @@ SerialPort::SerialPort()
|
||||
|
||||
// Open the serial port
|
||||
if (openPort() == false) {
|
||||
qCritical() << "SerialPort(): Unable to open port";
|
||||
qCritical().noquote().nospace() << "SerialPort(): Unable to open port " << port;
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug().noquote().nospace() << "SerialPort(): Opened port " << port;
|
||||
}
|
||||
|
||||
SerialPort::~SerialPort()
|
||||
|
||||
Reference in New Issue
Block a user