From 5910f425d73319038eb41dd23af6cf555b2b78e9 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sun, 2 Nov 2014 15:24:23 -0800 Subject: [PATCH] Remove unused code, add error address --- src/ui/px4_configuration/PX4Bootloader.cc | 48 ++--------------------- src/ui/px4_configuration/PX4Bootloader.h | 11 +----- 2 files changed, 5 insertions(+), 54 deletions(-) diff --git a/src/ui/px4_configuration/PX4Bootloader.cc b/src/ui/px4_configuration/PX4Bootloader.cc index 556b57409..2014f308f 100644 --- a/src/ui/px4_configuration/PX4Bootloader.cc +++ b/src/ui/px4_configuration/PX4Bootloader.cc @@ -78,54 +78,12 @@ static quint32 crc32(const uint8_t *src, unsigned len, unsigned state) return state; } -#if 0 -const struct PX4Bootloader::serialPortErrorString PX4Bootloader::_rgSerialPortErrors[14] = { - { QextSerialPort::NoError, "No error occurred." }, - { QextSerialPort::DeviceNotFoundError, "An error occurred while attempting to open a non-existing device." }, - { QextSerialPort::PermissionError, "An error occurred while attempting to open an already opened device by another process or a user not having enough permission and credentials to open." }, - { QextSerialPort::OpenError, "An error occurred while attempting to open an already opened device in this object." }, - { QextSerialPort::NotOpenError, "This error occurs when an operation is executed that can only be successfully performed if the device is open." }, - { QextSerialPort::ParityError, "Parity error detected by the hardware while reading data." }, - { QextSerialPort::FramingError, "Framing error detected by the hardware while reading data." }, - { QextSerialPort::BreakConditionError, "Break condition detected by the hardware on the input line." }, - { QextSerialPort::WriteError, "An I/O error occurred while writing the data." }, - { QextSerialPort::ReadError, "An I/O error occurred while reading the data." }, - { QextSerialPort::ResourceError, "An I/O error occurred when a resource becomes unavailable, e.g. when the device is unexpectedly removed from the system." }, - { QextSerialPort::UnsupportedOperationError, "The requested device operation is not supported or prohibited by the running operating system." }, - { QextSerialPort::TimeoutError, "A timeout error occurred." }, - { QextSerialPort::UnknownError, "An unidentified error occurred." } -}; -#endif - PX4Bootloader::PX4Bootloader(QObject *parent) : QObject(parent) { } -/// @brief Translate a QextSerialPort::SerialPortError code into a string. -const char* PX4Bootloader::_serialPortErrorString(int error) -{ - Q_UNUSED(error); -#if 0 -Again: - for (size_t i=0; iwrite((const char*)data, maxSize); @@ -301,7 +259,7 @@ bool PX4Bootloader::program(QextSerialPort* port, const QString& firmwareFilenam } } if (failed) { - _errorString = tr("Flash failed: %1").arg(_errorString); + _errorString = tr("Flash failed: %1 at address 0x%2").arg(_errorString).arg(bytesSent, 8, 16, QLatin1Char('0')); qWarning() << _errorString; return false; } @@ -393,12 +351,14 @@ bool PX4Bootloader::_bootloaderVerifyRev2(QextSerialPort* port, const QString fi } } if (failed) { + _errorString = tr("Verify failed: %1 at address: 0x%2").arg(_errorString).arg(bytesVerified, 8, 16, QLatin1Char('0')); + qWarning() << _errorString; return false; } for (int i=0; i