chore(cpn): refactor firmware flashing to use edgetx rs_dfu (#6521)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
co-authored by
raphaelcoeffic
parent
23830197b3
commit
dbce54dec6
@@ -19,8 +19,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _FIRMWAREINTERFACE_H_
|
||||
#define _FIRMWAREINTERFACE_H_
|
||||
#pragma once
|
||||
|
||||
#include <QtCore>
|
||||
#include <QString>
|
||||
@@ -46,11 +45,19 @@ class FirmwareInterface
|
||||
Q_DECLARE_TR_FUNCTIONS("FirmwareInterface")
|
||||
|
||||
public:
|
||||
FirmwareInterface(const QString & filename, QDialog* parentDialog = nullptr);
|
||||
enum FirmwareType{
|
||||
FIRMWARE_TYPE_BIN,
|
||||
FIRMWARE_TYPE_UF2
|
||||
};
|
||||
|
||||
explicit FirmwareInterface(const QString &filename, QDialog* parent = nullptr);
|
||||
explicit FirmwareInterface(const QByteArray &flashData, QDialog* parent = nullptr);
|
||||
|
||||
inline QString getDate() { return date; }
|
||||
inline QString getTime() { return time; }
|
||||
int getSize() { return flashSize; }
|
||||
QString getFlavour() const;
|
||||
inline const QByteArray& getFlash() { return flash; }
|
||||
inline int getSize() { return flashSize; }
|
||||
inline QString getFlavour() const { return flavour; }
|
||||
bool isHardwareCompatible(const FirmwareInterface &previousFirmware) const;
|
||||
inline QString getVersion() { return version; }
|
||||
inline int getEEpromVersion() { return eepromVersion; }
|
||||
@@ -64,31 +71,34 @@ class FirmwareInterface
|
||||
QImage::Format getSplashFormat();
|
||||
unsigned int save(const QString & fileName);
|
||||
bool isValid();
|
||||
FirmwareType getType() { return type; }
|
||||
const QString typeFileExtn() const { return (type == FIRMWARE_TYPE_UF2 ? "uf2" : "bin"); }
|
||||
|
||||
private:
|
||||
QDialog* parentDialog;
|
||||
QByteArray flash;
|
||||
uint flashSize;
|
||||
QString seekString(const QString & string);
|
||||
QString seekLabel(const QString & label);
|
||||
void seekSplash();
|
||||
bool seekSplash(QByteArray sps, QByteArray spe, int size);
|
||||
bool seekSplash(QByteArray splash);
|
||||
uint flashSize = 0;
|
||||
QString filename;
|
||||
QString date;
|
||||
QString time;
|
||||
QString flavour;
|
||||
QString version;
|
||||
QString eepromId;
|
||||
int eepromVersion;
|
||||
int eepromVariant;
|
||||
int eepromVersion = 0;
|
||||
int eepromVariant = 0;
|
||||
QByteArray splash;
|
||||
uint splashOffset;
|
||||
uint splashSize;
|
||||
uint splashWidth;
|
||||
uint splashHeight;
|
||||
QImage::Format splash_format;
|
||||
bool isValidFlag;
|
||||
};
|
||||
uint splashOffset = 0;
|
||||
uint splashSize = 0;
|
||||
uint splashWidth = 0;
|
||||
uint splashHeight = 0;
|
||||
QImage::Format splashFormat;
|
||||
bool isValidFlag = false;
|
||||
FirmwareType type;
|
||||
|
||||
#endif // _FIRMWAREINTERFACE_H_
|
||||
void initFlash(const QByteArray& flashData);
|
||||
QString seekString(const QString & string);
|
||||
QString seekLabel(const QString & label);
|
||||
void seekSplash();
|
||||
bool seekSplash(QByteArray sps, QByteArray spe, int size);
|
||||
bool seekSplash(QByteArray splash);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user