Merge pull request #3741 from opentx/3djc/companion-disable-Horus
3djc/companion disable horus
This commit is contained in:
@@ -1765,6 +1765,33 @@ QString getBoardName(BoardEnum board)
|
||||
}
|
||||
}
|
||||
|
||||
const int Firmware::getFlashSize()
|
||||
{
|
||||
switch (board) {
|
||||
case BOARD_STOCK:
|
||||
return FSIZE_STOCK;
|
||||
case BOARD_M128:
|
||||
return FSIZE_M128;
|
||||
case BOARD_MEGA2560:
|
||||
case BOARD_GRUVIN9X:
|
||||
return FSIZE_GRUVIN9X;
|
||||
case BOARD_SKY9X:
|
||||
return FSIZE_SKY9X;
|
||||
case BOARD_9XRPRO:
|
||||
case BOARD_AR9X:
|
||||
return FSIZE_9XRPRO;
|
||||
case BOARD_TARANIS:
|
||||
case BOARD_TARANIS_PLUS:
|
||||
case BOARD_TARANIS_X9E:
|
||||
case BOARD_FLAMENCO:
|
||||
return FSIZE_TARANIS;
|
||||
case BOARD_HORUS:
|
||||
return FSIZE_HORUS;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Firmware * GetFirmware(QString id)
|
||||
{
|
||||
foreach(Firmware * firmware, firmwares) {
|
||||
|
||||
@@ -37,6 +37,15 @@
|
||||
#define EESIZE_9XRPRO (128*4096)
|
||||
#define EESIZE_MAX EESIZE_9XRPRO
|
||||
|
||||
#define FSIZE_STOCK (64*1024)
|
||||
#define FSIZE_M128 (128*1024)
|
||||
#define FSIZE_GRUVIN9X (256*1024)
|
||||
#define FSIZE_TARANIS (512*1024)
|
||||
#define FSIZE_SKY9X (256*1024)
|
||||
#define FSIZE_9XRPRO (512*1024)
|
||||
#define FSIZE_HORUS (2048*1024)
|
||||
#define FSIZE_MAX FSIZE_HORUS
|
||||
|
||||
QString getBoardName(BoardEnum board);
|
||||
|
||||
#define IS_9X(board) (board==BOARD_STOCK || board==BOARD_M128)
|
||||
@@ -1671,6 +1680,8 @@ class Firmware {
|
||||
virtual bool isTelemetrySourceAvailable(int source) = 0;
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0) = 0;
|
||||
|
||||
const int getFlashSize();
|
||||
|
||||
public:
|
||||
QList<const char *> languages;
|
||||
|
||||
@@ -44,7 +44,7 @@ int getFileType(const QString &fullFileName)
|
||||
}
|
||||
|
||||
FirmwareInterface::FirmwareInterface(const QString &filename):
|
||||
flash(MAX_FSIZE, 0),
|
||||
flash(FSIZE_MAX, 0),
|
||||
flashSize(0),
|
||||
versionId(0),
|
||||
eepromVersion(0),
|
||||
@@ -59,11 +59,11 @@ FirmwareInterface::FirmwareInterface(const QString &filename):
|
||||
QFile file(filename);
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // reading HEX TEXT file
|
||||
QTextStream inputStream(&file);
|
||||
flashSize = HexInterface(inputStream).load((uint8_t *)flash.data(), MAX_FSIZE);
|
||||
flashSize = HexInterface(inputStream).load((uint8_t *)flash.data(), FSIZE_MAX);
|
||||
file.close();
|
||||
if (flashSize == 0) {
|
||||
file.open(QIODevice::ReadOnly);
|
||||
flashSize = file.read((char *)flash.data(), MAX_FSIZE);
|
||||
flashSize = file.read((char *)flash.data(), FSIZE_MAX);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,7 +342,10 @@ bool FirmwareInterface::isValid()
|
||||
|
||||
unsigned int FirmwareInterface::save(QString fileName)
|
||||
{
|
||||
uint8_t binflash[MAX_FSIZE];
|
||||
uint8_t *binflash = (uint8_t*)malloc(FSIZE_MAX);
|
||||
if (binflash == NULL) {
|
||||
return -1;
|
||||
}
|
||||
memcpy(&binflash, flash.constData(), flashSize);
|
||||
QFile file(fileName);
|
||||
|
||||
@@ -350,6 +353,7 @@ unsigned int FirmwareInterface::save(QString fileName)
|
||||
|
||||
if (fileType == FILE_TYPE_HEX) {
|
||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text)) { //reading HEX TEXT file
|
||||
free(binflash);
|
||||
return -1;
|
||||
}
|
||||
QTextStream outputStream(&file);
|
||||
@@ -358,6 +362,7 @@ unsigned int FirmwareInterface::save(QString fileName)
|
||||
}
|
||||
else {
|
||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { //reading HEX TEXT file
|
||||
free(binflash);
|
||||
return -1;
|
||||
}
|
||||
file.write((char*)binflash, flashSize);
|
||||
@@ -365,5 +370,6 @@ unsigned int FirmwareInterface::save(QString fileName)
|
||||
|
||||
file.close();
|
||||
|
||||
free(binflash);
|
||||
return flashSize;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <QImage>
|
||||
#include <QByteArray>
|
||||
|
||||
#define MAX_FSIZE (512*1024)
|
||||
#define SPLASH_WIDTH (128)
|
||||
#define SPLASH_HEIGHT (64)
|
||||
#define SPLASHX9D_WIDTH (212)
|
||||
|
||||
@@ -920,15 +920,38 @@ void MainWindow::about()
|
||||
void MainWindow::updateMenus()
|
||||
{
|
||||
bool hasMdiChild = (activeMdiChild() != 0);
|
||||
saveAct->setEnabled(hasMdiChild);
|
||||
saveAsAct->setEnabled(hasMdiChild);
|
||||
pasteAct->setEnabled(hasMdiChild ? activeMdiChild()->hasPasteData() : false);
|
||||
writeEepromAct->setEnabled(hasMdiChild);
|
||||
separatorAct->setVisible(hasMdiChild);
|
||||
|
||||
bool hasSelection = (activeMdiChild() && activeMdiChild()->hasSelection());
|
||||
cutAct->setEnabled(hasSelection);
|
||||
copyAct->setEnabled(hasSelection);
|
||||
|
||||
if(GetCurrentFirmware()->getBoard() == BOARD_HORUS) {
|
||||
newAct->setEnabled(false);
|
||||
openAct->setEnabled(false);
|
||||
saveAct->setEnabled(false);
|
||||
saveAsAct->setEnabled(false);
|
||||
writeEepromAct->setEnabled(false);
|
||||
readEepromAct->setEnabled(false);
|
||||
writeBackupToRadioAct->setEnabled(false);
|
||||
readBackupToFileAct->setEnabled(false);
|
||||
cutAct->setEnabled(false);
|
||||
copyAct->setEnabled(false);
|
||||
pasteAct->setEnabled(false);
|
||||
for (int i=0; i<MAX_RECENT; ++i)
|
||||
recentFileActs[i]->setEnabled(false);
|
||||
} else {
|
||||
newAct->setEnabled(true);
|
||||
openAct->setEnabled(true);
|
||||
saveAct->setEnabled(hasMdiChild);
|
||||
saveAsAct->setEnabled(hasMdiChild);
|
||||
cutAct->setEnabled(hasSelection);
|
||||
copyAct->setEnabled(hasSelection);
|
||||
pasteAct->setEnabled(hasMdiChild ? activeMdiChild()->hasPasteData() : false);
|
||||
writeEepromAct->setEnabled(hasMdiChild);
|
||||
readEepromAct->setEnabled(true);
|
||||
writeBackupToRadioAct->setEnabled(true);
|
||||
readBackupToFileAct->setEnabled(true);
|
||||
for (int i=0; i<MAX_RECENT; ++i)
|
||||
recentFileActs[i]->setEnabled(true);
|
||||
}
|
||||
separatorAct->setVisible(hasMdiChild);
|
||||
simulateAct->setEnabled(hasSelection);
|
||||
printAct->setEnabled(hasSelection);
|
||||
loadbackupAct->setEnabled(hasMdiChild);
|
||||
@@ -1448,6 +1471,8 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
|
||||
|
||||
void MainWindow::dropEvent(QDropEvent *event)
|
||||
{
|
||||
if(GetCurrentFirmware()->getBoard()== BOARD_HORUS)
|
||||
return;
|
||||
QList<QUrl> urls = event->mimeData()->urls();
|
||||
if (urls.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -66,7 +66,7 @@ QStringList getDfuArgs(const QString & cmd, const QString & filename)
|
||||
burnConfigDialog bcd;
|
||||
QString memory = "0x08000000";
|
||||
if (cmd == "-U") {
|
||||
memory.append(QString(":%1").arg(MAX_FSIZE));
|
||||
memory.append(QString(":%1").arg(GetCurrentFirmware()->getFlashSize()));
|
||||
}
|
||||
args << bcd.getDFUArgs();
|
||||
if (!filename.endsWith(".dfu")) {
|
||||
|
||||
Reference in New Issue
Block a user