diff --git a/companion/src/firmwares/boards.cpp b/companion/src/firmwares/boards.cpp index c80df5f81..ebc2550e9 100644 --- a/companion/src/firmwares/boards.cpp +++ b/companion/src/firmwares/boards.cpp @@ -32,17 +32,14 @@ // External access is only via getEEpromSize() and getFlashSize() #define EESIZE_TARANIS (32*1024) -#define EESIZE_SKY9X (128*4096) -#define EESIZE_9XRPRO (128*4096) -#define EESIZE_MAX EESIZE_9XRPRO +#define EESIZE_MAX EESIZE_TARANIS // getFlashSize() (and these macros) is only used by radiointerface::getDfuArgs (perhaps can find a better way?) -#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 +#define FSIZE_512KB (512*1024) +#define FSIZE_1MB (1024*1024) +#define FSIZE_2MB (2048*1024) +#define FSIZE_MAX FSIZE_2MB // pre v2.10 static const StringTagMappingTable legacyTrimSourcesLut = { @@ -121,10 +118,6 @@ uint32_t Boards::getFourCC(Type board) return 0x3C78746F; case BOARD_TARANIS_X9LITES: return 0x3E78746F; - case BOARD_SKY9X: - case BOARD_AR9X: - case BOARD_9XRPRO: - return 0x3278746F; case BOARD_BETAFPV_LR3PRO: return 0x4578746F; case BOARD_IFLIGHT_COMMANDO8: @@ -173,11 +166,6 @@ uint32_t Boards::getFourCC(Type board) int Boards::getEEpromSize(Board::Type board) { switch (board) { - case BOARD_SKY9X: - return EESIZE_SKY9X; - case BOARD_9XRPRO: - case BOARD_AR9X: - return EESIZE_9XRPRO; case BOARD_TARANIS_XLITES: case BOARD_TARANIS_XLITE: case BOARD_TARANIS_X7: @@ -237,11 +225,6 @@ int Boards::getEEpromSize(Board::Type board) int Boards::getFlashSize(Type board) { switch (board) { - case BOARD_SKY9X: - return FSIZE_SKY9X; - case BOARD_9XRPRO: - case BOARD_AR9X: - return FSIZE_9XRPRO; case BOARD_TARANIS_XLITES: case BOARD_TARANIS_XLITE: case BOARD_TARANIS_X7: @@ -255,26 +238,27 @@ int Boards::getFlashSize(Type board) case BOARD_BETAFPV_LR3PRO: case BOARD_IFLIGHT_COMMANDO8: case BOARD_JUMPER_T12: - case BOARD_JUMPER_T12MAX: - case BOARD_JUMPER_T14: case BOARD_JUMPER_T20: - case BOARD_JUMPER_T20V2: case BOARD_JUMPER_TLITE: case BOARD_JUMPER_TLITE_F4: case BOARD_JUMPER_TPRO: case BOARD_JUMPER_TPROV2: - case BOARD_JUMPER_TPROS: - case BOARD_JUMPER_BUMBLEBEE: case BOARD_RADIOMASTER_TX12: case BOARD_RADIOMASTER_TX12_MK2: case BOARD_RADIOMASTER_ZORRO: - case BOARD_RADIOMASTER_BOXER: case BOARD_RADIOMASTER_T8: case BOARD_RADIOMASTER_POCKET: - case BOARD_RADIOMASTER_MT12: - case BOARD_RADIOMASTER_GX12: + return FSIZE_512KB; case BOARD_HELLORADIOSKY_V14: - return FSIZE_TARANIS; + case BOARD_JUMPER_BUMBLEBEE: + case BOARD_JUMPER_T12MAX: + case BOARD_JUMPER_T14: + case BOARD_JUMPER_T20V2: + case BOARD_JUMPER_TPROS: + case BOARD_RADIOMASTER_GX12: + case BOARD_RADIOMASTER_BOXER: + case BOARD_RADIOMASTER_MT12: + return FSIZE_1MB; case BOARD_HORUS_X12S: case BOARD_X10: case BOARD_X10_EXPRESS: @@ -290,7 +274,7 @@ int Boards::getFlashSize(Type board) case BOARD_FLYSKY_ST16: case BOARD_FATFISH_F16: case BOARD_HELLORADIOSKY_V16: - return FSIZE_HORUS; + return FSIZE_2MB; case BOARD_UNKNOWN: return FSIZE_MAX; default: @@ -604,12 +588,6 @@ QString Boards::getBoardName(Board::Type board) return "Taranis X9-Lite"; case BOARD_TARANIS_X9LITES: return "Taranis X9-Lite S"; - case BOARD_SKY9X: - return "Sky9x"; - case BOARD_9XRPRO: - return "9XR-PRO"; - case BOARD_AR9X: - return "AR9X"; case BOARD_HORUS_X12S: return "Horus X12S"; case BOARD_X10: diff --git a/companion/src/firmwares/boards.h b/companion/src/firmwares/boards.h index 265771a3f..b90ca4d02 100644 --- a/companion/src/firmwares/boards.h +++ b/companion/src/firmwares/boards.h @@ -45,9 +45,6 @@ namespace Board { enum Type { BOARD_UNKNOWN = -1, - BOARD_SKY9X, - BOARD_9XRPRO, - BOARD_AR9X, BOARD_TARANIS_X7, BOARD_TARANIS_X7_ACCESS, BOARD_TARANIS_X9D, @@ -479,16 +476,6 @@ class Boards // temporary aliases for transition period, use Boards class instead. #define getBoardCapability(b__, c__) Boards::getCapability(b__, c__) -inline bool IS_SKY9X(Board::Type board) -{ - return board == Board::BOARD_SKY9X || board == Board::BOARD_9XRPRO || board == Board::BOARD_AR9X; -} - -inline bool IS_9XRPRO(Board::Type board) -{ - return board == Board::BOARD_9XRPRO; -} - inline bool IS_BETAFPV_LR3PRO(Board::Type board) { return board == Board::BOARD_BETAFPV_LR3PRO; @@ -790,7 +777,7 @@ inline bool IS_STM32(Board::Type board) inline bool IS_ARM(Board::Type board) { - return IS_STM32(board) || IS_SKY9X(board); + return IS_STM32(board); } inline bool HAS_LARGE_LCD(Board::Type board) diff --git a/companion/src/firmwares/moduledata.cpp b/companion/src/firmwares/moduledata.cpp index 614a4cb7f..10dd31024 100644 --- a/companion/src/firmwares/moduledata.cpp +++ b/companion/src/firmwares/moduledata.cpp @@ -148,37 +148,6 @@ bool ModuleData::isAvailable(PulsesProtocol proto, int port) return false; } } - else if (IS_SKY9X(board)) { - switch (port) { - case 0: - switch (proto) { - case PULSES_PPM: - case PULSES_PXX_XJT_X16: - case PULSES_PXX_XJT_D8: - case PULSES_PXX_XJT_LR12: - case PULSES_PXX_R9M: - case PULSES_LP45: - case PULSES_DSM2: - case PULSES_DSMX: - case PULSES_SBUS: - case PULSES_MULTIMODULE: - return true; - default: - return false; - } - break; - case 1: - switch (proto) { - case PULSES_PPM: - return true; - default: - return false; - } - break; - default: - return false; - } - } else { switch (proto) { case PULSES_PPM: @@ -630,37 +599,6 @@ bool ModuleData::isProtocolAvailable(int moduleidx, unsigned int protocol, Gener return false; } } - else if (IS_SKY9X(board)) { - switch (moduleidx) { - case 0: - switch (protocol) { - case PULSES_PPM: - case PULSES_PXX_XJT_X16: - case PULSES_PXX_XJT_D8: - case PULSES_PXX_XJT_LR12: - case PULSES_PXX_R9M: - case PULSES_LP45: - case PULSES_DSM2: - case PULSES_DSMX: - case PULSES_SBUS: - case PULSES_MULTIMODULE: - return true; - default: - return false; - } - break; - case 1: - switch (protocol) { - case PULSES_PPM: - return true; - default: - return false; - } - break; - default: - return false; - } - } else { switch (protocol) { case PULSES_PPM: diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index f3fedd250..f99c709b1 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -216,8 +216,6 @@ int OpenTxFirmware::getCapability(::Capability capability) return (IS_HORUS_OR_TARANIS(board) ? 500 : (id.contains("ppmca") ? 125 : 0)); case SYMLimits: return 1; - case OptrexDisplay: - return (board == BOARD_SKY9X ? true : false); case HasVario: return Boards::isAir(board); case HasVarioSink: @@ -234,8 +232,6 @@ int OpenTxFirmware::getCapability(::Capability capability) return IS_TARANIS_XLITE(board) && !id.contains("stdr9m"); case HasPPMStart: return true; - case HastxCurrentCalibration: - return (IS_SKY9X(board) ? true : false); case HasVolume: return true; case HasBrightness: diff --git a/companion/src/modeledit/setup_module.cpp b/companion/src/modeledit/setup_module.cpp index ac18c9f6c..187e9c4d4 100644 --- a/companion/src/modeledit/setup_module.cpp +++ b/companion/src/modeledit/setup_module.cpp @@ -367,9 +367,6 @@ void ModulePanel::update() break; case PULSES_PPM: mask |= MASK_SUBTYPES | MASK_PPM_FIELDS | MASK_SBUSPPM_FIELDS| MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT; - if (IS_9XRPRO(board)) { - mask |= MASK_OPEN_DRAIN; - } break; case PULSES_SBUS: module.channelsCount = 16; diff --git a/companion/src/radiointerface.cpp b/companion/src/radiointerface.cpp index e560922d4..f6026cabc 100644 --- a/companion/src/radiointerface.cpp +++ b/companion/src/radiointerface.cpp @@ -105,9 +105,6 @@ QStringList getWriteFirmwareArgs(const QString & filename) if (IS_STM32(board)) { return getDfuArgs("-D", filename); } - else if (board == Board::BOARD_SKY9X) { - return getSambaArgs(QString("send_file {Flash} \"") + filename + "\" 0x400000 0\n" + "FLASH::ScriptGPNMV 2\n"); - } else { return getSambaArgs(QString("send_file {Flash} \"") + filename + "\" 0x400000 0\n" + "FLASH::ScriptGPNMV 2\n"); } @@ -119,9 +116,6 @@ QStringList getReadFirmwareArgs(const QString & filename) if (IS_STM32(board)) { return getDfuArgs("-U", filename); } - else if (board == Board::BOARD_SKY9X) { - return getSambaArgs(QString("receive_file {Flash} \"") + filename + "\" 0x400000 0x40000 0\n"); - } else { return getSambaArgs(QString("receive_file {Flash} \"") + filename + "\" 0x400000 0x80000 0\n"); } diff --git a/companion/src/storage/rlefile.cpp b/companion/src/storage/rlefile.cpp index 37e72ac2f..9876e3d0d 100644 --- a/companion/src/storage/rlefile.cpp +++ b/companion/src/storage/rlefile.cpp @@ -44,46 +44,32 @@ eepromFatHeader(NULL) #define EEPROM_MAX_FILES (EEPROM_MAX_ZONES - 1) #define FIRST_FILE_AVAILABLE (1+MAX_MODELS) -void RleFile::EeFsCreate(uint8_t *eeprom, int size, Board::Type board, unsigned int version) +void RleFile::EeFsCreate(uint8_t *eeprom, int size, Board::Type board, + unsigned int version) { this->eeprom = eeprom; this->eeprom_size = size; this->board = board; this->version = version; - if (IS_SKY9X(board)) { - memset(eeprom, 0xFF, size); - if (version >= 217) { - memset(eeprom, 0, EEPROM_FAT_SIZE); - eepromFatHeader = (EepromHeader *)(eeprom + EEPROM_FAT_SIZE); - eepromFatHeader->mark = EEPROM_MARK; - eepromFatHeader->index = 1; - for (int i=0; ifiles[i].exists = 0; - eepromFatHeader->files[i].zoneIndex = i+1; - } - } - } - else { - eeFsArm = (EeFsArm *)eeprom; - eeFsVersion = 5; - eeFsSize = 8+4*62; - eeFsBlockSize = 64; - eeFsFirstBlock = 1; - eeFsBlocksOffset = eeFsSize - eeFsBlockSize; - eeFsBlocksMax = 1 + (Boards::getEEpromSize(board)-eeFsSize) / eeFsBlockSize; - eeFsLinkSize = sizeof(int16_t); - memset(eeprom, 0, size); - eeFsArm->version = eeFsVersion; - eeFsArm->mySize = eeFsSize; - eeFsArm->freeList = 0; - eeFsArm->bs = 64; - for (unsigned int i=eeFsFirstBlock; ifreeList = eeFsFirstBlock; - // EeFsFlush(); - } + eeFsArm = (EeFsArm *)eeprom; + eeFsVersion = 5; + eeFsSize = 8 + 4 * 62; + eeFsBlockSize = 64; + eeFsFirstBlock = 1; + eeFsBlocksOffset = eeFsSize - eeFsBlockSize; + eeFsBlocksMax = 1 + (Boards::getEEpromSize(board) - eeFsSize) / eeFsBlockSize; + eeFsLinkSize = sizeof(int16_t); + memset(eeprom, 0, size); + eeFsArm->version = eeFsVersion; + eeFsArm->mySize = eeFsSize; + eeFsArm->freeList = 0; + eeFsArm->bs = 64; + for (unsigned int i = eeFsFirstBlock; i < eeFsBlocksMax - 1; i++) + EeFsSetLink(i, i + 1); + EeFsSetLink(eeFsBlocksMax - 1, 0); + eeFsArm->freeList = eeFsFirstBlock; + // EeFsFlush(); } PACK(struct EepromFileHeader @@ -112,21 +98,15 @@ bool RleFile::EeFsOpen(uint8_t *eeprom, int size, Board::Type board) this->eeprom_size = size; this->board = board; - if (IS_SKY9X(board)) { - searchFat(); - return 1; - } - else { - eeFsArm = (EeFsArm *)eeprom; - eeFsVersion = eeFsArm->version; - eeFsSize = 8+4*62; - eeFsBlockSize = 64; - eeFsLinkSize = sizeof(int16_t); - eeFsFirstBlock = 1; - eeFsBlocksOffset = eeFsSize - eeFsBlockSize; - eeFsBlocksMax = 1 + (Boards::getEEpromSize(board)-eeFsSize) / eeFsBlockSize; - return eeFsArm->mySize == eeFsSize; - } + eeFsArm = (EeFsArm *)eeprom; + eeFsVersion = eeFsArm->version; + eeFsSize = 8 + 4 * 62; + eeFsBlockSize = 64; + eeFsLinkSize = sizeof(int16_t); + eeFsFirstBlock = 1; + eeFsBlocksOffset = eeFsSize - eeFsBlockSize; + eeFsBlocksMax = 1 + (Boards::getEEpromSize(board) - eeFsSize) / eeFsBlockSize; + return eeFsArm->mySize == eeFsSize; } void RleFile::eeprom_read_block (void *pointer_ram, unsigned int pointer_eeprom, size_t size) @@ -232,32 +212,14 @@ unsigned int RleFile::openRd(unsigned int i_fileId) { if (IS_FAMILY_HORUS_OR_T16(board)) { return 1; - } - else if (IS_SKY9X(board)) { - if (eepromFatHeader) { - m_fileId = eepromFatHeader->files[i_fileId].zoneIndex; - if (eepromFatHeader->files[i_fileId].exists) { - eeprom_read_block(&m_size, m_fileId*(1<<13)+sizeof(uint16_t), sizeof(uint16_t)); - } - else { - m_size = 0; - } - m_pos = sizeof(EepromFileHeader); - } - else { - m_fileId = get_current_block_number(i_fileId * 2, &m_size); - m_pos = sizeof(t_eeprom_header); - } - return 1; - } - else { - m_fileId = i_fileId; - m_pos = 0; - m_currBlk = eeFsArm->files[m_fileId].startBlk; - m_ofs = 0; - m_zeroes = 0; - m_bRlc = 0; - m_err = ERR_NONE; //error reasons + } else { + m_fileId = i_fileId; + m_pos = 0; + m_currBlk = eeFsArm->files[m_fileId].startBlk; + m_ofs = 0; + m_zeroes = 0; + m_bRlc = 0; + m_err = ERR_NONE; // error reasons return eeFsArm->files[m_fileId].typ; } } @@ -287,69 +249,48 @@ unsigned int RleFile::read(uint8_t *buf, unsigned int i_len) // G: Read runlength (RLE) compressed bytes into buf. unsigned int RleFile::readRlc12(uint8_t *buf, unsigned int i_len, bool rlc2) { - if (IS_FAMILY_HORUS_OR_T16(board)) - return 0; + if (IS_FAMILY_HORUS_OR_T16(board)) return 0; memset(buf, 0, i_len); - if (IS_SKY9X(board)) { - int len; - if (eepromFatHeader) { - len = std::min((int)i_len, (int)m_size + (int)sizeof(EepromFileHeader) - (int)m_pos); - eeprom_read_block(buf, (m_fileId << 13) + m_pos, len); - m_pos += len; + unsigned int i = 0; + for (; 1;) { + uint8_t ln = std::min(m_zeroes, i_len - i); + memset(&buf[i], 0, ln); + i += ln; + m_zeroes -= ln; + if (m_zeroes) break; + + ln = std::min(m_bRlc, i_len - i); + uint8_t lr = read(&buf[i], ln); + i += lr; + m_bRlc -= lr; + if (m_bRlc) break; + + if (read(&m_bRlc, 1) != 1) break; // read how many bytes to read + + if (!(m_bRlc & 0x7f)) { + qDebug() << "RLC decoding error!"; + return 0; } - else { - len = std::min((int)i_len, (int)m_size + (int)sizeof(t_eeprom_header) - (int)m_pos); - if (len > 0) { - eeprom_read_block(buf, (m_fileId << 12) + m_pos, len); - m_pos += len; + + if (rlc2) { + if (m_bRlc & 0x80) { // if contains high byte + m_zeroes = (m_bRlc >> 4) & 0x7; + m_bRlc = m_bRlc & 0x0f; + } else if (m_bRlc & 0x40) { + m_zeroes = m_bRlc & 0x3f; + m_bRlc = 0; + } + // else m_bRlc + } else { + if (m_bRlc & 0x80) { // if contains high byte + m_zeroes = m_bRlc & 0x7f; + m_bRlc = 0; } } - return len; - } - else { - unsigned int i=0; - for( ; 1; ) { - uint8_t ln = std::min(m_zeroes, i_len-i); - memset(&buf[i], 0, ln); - i += ln; - m_zeroes -= ln; - if(m_zeroes) break; - - ln = std::min(m_bRlc, i_len-i); - uint8_t lr = read(&buf[i], ln); - i += lr ; - m_bRlc -= lr; - if(m_bRlc) break; - - if (read(&m_bRlc, 1) !=1) break; //read how many bytes to read - - if (!(m_bRlc & 0x7f)) { - qDebug() << "RLC decoding error!"; - return 0; - } - - if (rlc2) { - if(m_bRlc&0x80){ // if contains high byte - m_zeroes =(m_bRlc>>4) & 0x7; - m_bRlc = m_bRlc & 0x0f; - } - else if(m_bRlc&0x40){ - m_zeroes = m_bRlc & 0x3f; - m_bRlc = 0; - } - //else m_bRlc - } - else { - if(m_bRlc&0x80){ // if contains high byte - m_zeroes = m_bRlc & 0x7f; - m_bRlc = 0; - } - } - } - return i; } + return i; } unsigned int importRlc(QByteArray & dst, QByteArray & src, unsigned int rlcVersion) @@ -509,83 +450,59 @@ unsigned int RleFile::writeRlc1(unsigned int i_fileId, unsigned int typ, const u /* * Write runlength (RLE) compressed bytes */ -unsigned int RleFile::writeRlc2(unsigned int i_fileId, unsigned int typ, const uint8_t *buf, unsigned int i_len) +unsigned int RleFile::writeRlc2(unsigned int i_fileId, unsigned int typ, + const uint8_t *buf, unsigned int i_len) { - if (IS_FAMILY_HORUS_OR_T16(board)) - return 0; + if (IS_FAMILY_HORUS_OR_T16(board)) return 0; - if (IS_SKY9X(board)) { - openRd(i_fileId); - if (eepromFatHeader) { - eepromFatHeader->files[i_fileId].exists = 1; - eeprom_write_block(buf, (m_fileId << 13) + m_pos, i_len); - { - EepromFileHeader header; - header.fileIndex = i_fileId; - header.size = i_len; - eeprom_write_block(&header, (m_fileId << 13), sizeof(header)); - } - } - else { - eeprom_write_block(buf, (m_fileId << 12) + m_pos, i_len); - t_eeprom_header header; - header.sequence_no = 1; - header.data_size = i_len; - header.flags = 0; - header.hcsum = byte_checksum((uint8_t *) &header, 7); - eeprom_write_block(&header, (m_fileId << 12), sizeof(header)); - } - return i_len; - } - else { - create(i_fileId, typ); - bool run0 = buf[0] == 0; - uint8_t cnt = 1; - uint8_t cnt0 = 0; - uint16_t i = 0; - if (i_len==0) goto close; + create(i_fileId, typ); + bool run0 = buf[0] == 0; + uint8_t cnt = 1; + uint8_t cnt0 = 0; + uint16_t i = 0; + if (i_len == 0) goto close; - //RLE compression: - //rb = read byte - //if (rb | 0x80) write rb & 0x7F zeros - //else write rb bytes - for (i=1; 1; i++) { // !! laeuft ein byte zu weit !! - bool cur0 = buf[i] == 0; - if (i==i_len || cur0 != run0 || cnt==0x3f || (cnt0 && cnt==0xf)) { - if (run0){ - assert(cnt0==0); - if (cnt<8 && i!=i_len) - cnt0 = cnt; //aufbew fuer spaeter - else { - if (write1(cnt|0x40)!=1) goto error;//-cnt&0x3f - } - } + // RLE compression: + // rb = read byte + // if (rb | 0x80) write rb & 0x7F zeros + // else write rb bytes + for (i = 1; 1; i++) { // !! laeuft ein byte zu weit !! + bool cur0 = buf[i] == 0; + if (i == i_len || cur0 != run0 || cnt == 0x3f || (cnt0 && cnt == 0xf)) { + if (run0) { + assert(cnt0 == 0); + if (cnt < 8 && i != i_len) + cnt0 = cnt; // aufbew fuer spaeter else { - if (cnt0) { - if (write1(0x80 | (cnt0<<4) | cnt)!=1) goto error;//-cnt0xx-cnt - cnt0 = 0; - } - else { - if (write1(cnt)!=1) goto error;//-cnt - } - uint8_t ret = write(&buf[i-cnt], cnt); - if (ret != cnt) { cnt-=ret; goto error;}//-cnt + if (write1(cnt | 0x40) != 1) goto error; //-cnt&0x3f } - cnt=0; - if (i==i_len) break; - run0 = cur0; + } else { + if (cnt0) { + if (write1(0x80 | (cnt0 << 4) | cnt) != 1) goto error; //-cnt0xx-cnt + cnt0 = 0; + } else { + if (write1(cnt) != 1) goto error; //-cnt + } + uint8_t ret = write(&buf[i - cnt], cnt); + if (ret != cnt) { + cnt -= ret; + goto error; + } //-cnt } - cnt++; + cnt = 0; + if (i == i_len) break; + run0 = cur0; } - if (0) { - error: - i-=cnt+cnt0; - } - - close: - closeTrunc(); - return i; + cnt++; } + if (0) { + error: + i -= cnt + cnt0; + } + +close: + closeTrunc(); + return i; } uint8_t RleFile::byte_checksum( uint8_t *p, unsigned int size )