Mercurial > public > ostc_companion
comparison OSTC4Operations.cpp @ 14:e47e0f59101d default tip
Enable OSTC 4/5 Icon option
The button for uploading the icon is now activated based on the first FW
version supporting this function
| author | Ideenmodellierer |
|---|---|
| date | Mon, 12 Jan 2026 18:47:00 +0100 |
| parents | ac837fe1d590 |
| children |
comparison
equal
deleted
inserted
replaced
| 13:facf83163013 | 14:e47e0f59101d |
|---|---|
| 46 | 46 |
| 47 #define FIRMWARE_BLOCK 0x40 // 64 bytes | 47 #define FIRMWARE_BLOCK 0x40 // 64 bytes |
| 48 #define FIRMWARE_BLOCK_DELAY 15 // 15 msec. | 48 #define FIRMWARE_BLOCK_DELAY 15 // 15 msec. |
| 49 #define FIRMWARE_BLOCK_FAST 0x300 // 4096 bytes | 49 #define FIRMWARE_BLOCK_FAST 0x300 // 4096 bytes |
| 50 | 50 |
| 51 #define MIN_FW_ICON_MAJOR 1 | |
| 52 #define MIN_FW_ICON_MINOR 7 | |
| 53 #define MIN_FW_ICON_STEP 5 | |
| 54 | |
| 51 ////////////////////////////////////////////////////////////////////////////// | 55 ////////////////////////////////////////////////////////////////////////////// |
| 52 | 56 |
| 53 QSize OSTC4Operations::nameSize() const | 57 QSize OSTC4Operations::nameSize() const |
| 54 { | 58 { |
| 55 return QSize(12, 4); | 59 return QSize(12, 4); |
| 64 | 68 |
| 65 HardwareOperations::CompanionFeatures OSTC4Operations::supported() const | 69 HardwareOperations::CompanionFeatures OSTC4Operations::supported() const |
| 66 { | 70 { |
| 67 // No DUMPSCREEN | 71 // No DUMPSCREEN |
| 68 | 72 |
| 69 CompanionFeatures features; | 73 return m_supportedFeatures; |
| 70 features |= PARAMETERS; | |
| 71 features |= DATE; | |
| 72 features |= NAME; | |
| 73 features |= FIRMWARE; | |
| 74 features |= HELIUM_DIVE; | |
| 75 features |= CCR_DIVE; | |
| 76 features |= BLUETOOTH; | |
| 77 features |= VPM_MODEL; | |
| 78 features |= SIGNAL_CHECK; | |
| 79 features |= ICON; | |
| 80 | |
| 81 return features; | |
| 82 } | 74 } |
| 83 | 75 |
| 84 QString OSTC4Operations::firmwareTemplate() const | 76 QString OSTC4Operations::firmwareTemplate() const |
| 85 { | 77 { |
| 86 return "ostc4*.bin"; | 78 return "ostc4*.bin"; |
| 130 getCommonIdentity(); | 122 getCommonIdentity(); |
| 131 | 123 |
| 132 //---- Main firmware ----------------------------------------------------- | 124 //---- Main firmware ----------------------------------------------------- |
| 133 QString mainFW; | 125 QString mainFW; |
| 134 { | 126 { |
| 135 unsigned char echo = retryCommand(_serial, 'k'); // 0x69 OSTC4 FW Details. | 127 unsigned char echo = retryCommand(_serial, 'k'); // 0x6B OSTC4 FW Details. |
| 136 if (echo != 'k') | 128 if (echo != 'k') |
| 137 LOG_THROW("Bad firmware details."); | 129 LOG_THROW("Bad firmware details."); |
| 138 | 130 |
| 139 unsigned char reply[4 + 1]; | 131 unsigned char reply[4 + 1]; |
| 140 _serial.writeByte(0xFF); // Main firmware | 132 _serial.writeByte(0xFF); // Main firmware |
| 145 mainFW = QString::asprintf("%d.%02d.%02d%s", | 137 mainFW = QString::asprintf("%d.%02d.%02d%s", |
| 146 reply[0], | 138 reply[0], |
| 147 reply[1], | 139 reply[1], |
| 148 reply[2], | 140 reply[2], |
| 149 reply[3] ? "beta" : ""); | 141 reply[3] ? "beta" : ""); |
| 142 if((reply[0] > MIN_FW_ICON_MAJOR) | |
| 143 || ((reply[0] == MIN_FW_ICON_MAJOR) && (reply[1] > MIN_FW_ICON_MINOR)) | |
| 144 || ((reply[0] == MIN_FW_ICON_MAJOR) && (reply[1] = MIN_FW_ICON_MINOR) && (reply[2] >= MIN_FW_ICON_STEP))) | |
| 145 { | |
| 146 m_supportedFeatures |= ICON; | |
| 147 } | |
| 150 } | 148 } |
| 151 | 149 |
| 152 //---- RTE firmware ------------------------------------------------------ | 150 //---- RTE firmware ------------------------------------------------------ |
| 153 QString rteFW; | 151 QString rteFW; |
| 154 { | 152 { |
| 155 unsigned char echo = retryCommand(_serial, 'k'); // 0x69 OSTC4 FW Details. | 153 unsigned char echo = retryCommand(_serial, 'k'); // 0x6B OSTC4 FW Details. |
| 156 if (echo != 'k') | 154 if (echo != 'k') |
| 157 LOG_THROW("Bad firmware details."); | 155 LOG_THROW("Bad firmware details."); |
| 158 | 156 |
| 159 unsigned char reply[4 + 1]; | 157 unsigned char reply[4 + 1]; |
| 160 _serial.writeByte(0xFE); // RTE firmware | 158 _serial.writeByte(0xFE); // RTE firmware |
| 170 } | 168 } |
| 171 | 169 |
| 172 //---- Font Package ------------------------------------------------------ | 170 //---- Font Package ------------------------------------------------------ |
| 173 QString fontPKG; | 171 QString fontPKG; |
| 174 { | 172 { |
| 175 unsigned char echo = retryCommand(_serial, 'k'); // 0x69 OSTC4 FW Details. | 173 unsigned char echo = retryCommand(_serial, 'k'); // 0x6B OSTC4 FW Details. |
| 176 if (echo != 'k') | 174 if (echo != 'k') |
| 177 LOG_THROW("Bad firmware details."); | 175 LOG_THROW("Bad firmware details."); |
| 178 | 176 |
| 179 unsigned char reply[4 + 1]; | 177 unsigned char reply[4 + 1]; |
| 180 _serial.writeByte(0x10); // Font Package | 178 _serial.writeByte(0x10); // Font Package |
| 209 OSTC4Operations::OSTC4Operations() | 207 OSTC4Operations::OSTC4Operations() |
| 210 : fileChecksum(0, 0) | 208 : fileChecksum(0, 0) |
| 211 { | 209 { |
| 212 emulatorName = "OSTC4/5"; | 210 emulatorName = "OSTC4/5"; |
| 213 m_crcWrapper = new CrcWrapper(nullptr); | 211 m_crcWrapper = new CrcWrapper(nullptr); |
| 212 | |
| 213 m_supportedFeatures |= PARAMETERS; | |
| 214 m_supportedFeatures |= DATE; | |
| 215 m_supportedFeatures |= NAME; | |
| 216 m_supportedFeatures |= FIRMWARE; | |
| 217 m_supportedFeatures |= HELIUM_DIVE; | |
| 218 m_supportedFeatures |= CCR_DIVE; | |
| 219 m_supportedFeatures |= BLUETOOTH; | |
| 220 m_supportedFeatures |= VPM_MODEL; | |
| 221 m_supportedFeatures |= SIGNAL_CHECK; | |
| 222 // m_supportedFeatures |= ICON; will be set based on FW version | |
| 214 } | 223 } |
| 215 | 224 |
| 216 ////////////////////////////////////////////////////////////////////////////// | 225 ////////////////////////////////////////////////////////////////////////////// |
| 217 | 226 |
| 218 void OSTC4Operations::upgradeFW(const QString &fileName) | 227 void OSTC4Operations::upgradeFW(const QString &fileName) |
