diff 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
line wrap: on
line diff
--- a/OSTC4Operations.cpp	Mon Jan 12 18:45:15 2026 +0100
+++ b/OSTC4Operations.cpp	Mon Jan 12 18:47:00 2026 +0100
@@ -48,6 +48,10 @@
 #define FIRMWARE_BLOCK_DELAY 15   // 15 msec.
 #define FIRMWARE_BLOCK_FAST 0x300 // 4096 bytes
 
+#define MIN_FW_ICON_MAJOR  1
+#define MIN_FW_ICON_MINOR  7
+#define MIN_FW_ICON_STEP  5
+
 //////////////////////////////////////////////////////////////////////////////
 
 QSize OSTC4Operations::nameSize() const
@@ -66,19 +70,7 @@
 {
     // No DUMPSCREEN
 
-    CompanionFeatures features;
-    features |= PARAMETERS;
-    features |= DATE;
-    features |= NAME;
-    features |= FIRMWARE;
-    features |= HELIUM_DIVE;
-    features |= CCR_DIVE;
-    features |= BLUETOOTH;
-    features |= VPM_MODEL;
-    features |= SIGNAL_CHECK;
-    features |= ICON;
-
-    return features;
+    return m_supportedFeatures;
 }
 
 QString OSTC4Operations::firmwareTemplate() const
@@ -132,7 +124,7 @@
     //---- Main firmware -----------------------------------------------------
     QString mainFW;
     {
-        unsigned char echo = retryCommand(_serial, 'k'); // 0x69 OSTC4 FW Details.
+        unsigned char echo = retryCommand(_serial, 'k'); // 0x6B OSTC4 FW Details.
         if (echo != 'k')
             LOG_THROW("Bad firmware details.");
 
@@ -147,12 +139,18 @@
                                    reply[1],
                                    reply[2],
                                    reply[3] ? "beta" : "");
+        if((reply[0] > MIN_FW_ICON_MAJOR)
+            || ((reply[0] == MIN_FW_ICON_MAJOR) && (reply[1] > MIN_FW_ICON_MINOR))
+            || ((reply[0] == MIN_FW_ICON_MAJOR) && (reply[1] = MIN_FW_ICON_MINOR) && (reply[2] >= MIN_FW_ICON_STEP)))
+        {
+            m_supportedFeatures |= ICON;
+        }
     }
 
     //---- RTE firmware ------------------------------------------------------
     QString rteFW;
     {
-        unsigned char echo = retryCommand(_serial, 'k'); // 0x69 OSTC4 FW Details.
+        unsigned char echo = retryCommand(_serial, 'k'); // 0x6B OSTC4 FW Details.
         if (echo != 'k')
             LOG_THROW("Bad firmware details.");
 
@@ -172,7 +170,7 @@
     //---- Font Package ------------------------------------------------------
     QString fontPKG;
     {
-        unsigned char echo = retryCommand(_serial, 'k'); // 0x69 OSTC4 FW Details.
+        unsigned char echo = retryCommand(_serial, 'k'); // 0x6B OSTC4 FW Details.
         if (echo != 'k')
             LOG_THROW("Bad firmware details.");
 
@@ -211,6 +209,17 @@
 {
     emulatorName = "OSTC4/5";
     m_crcWrapper = new CrcWrapper(nullptr);
+
+    m_supportedFeatures |= PARAMETERS;
+    m_supportedFeatures |= DATE;
+    m_supportedFeatures |= NAME;
+    m_supportedFeatures |= FIRMWARE;
+    m_supportedFeatures |= HELIUM_DIVE;
+    m_supportedFeatures |= CCR_DIVE;
+    m_supportedFeatures |= BLUETOOTH;
+    m_supportedFeatures |= VPM_MODEL;
+    m_supportedFeatures |= SIGNAL_CHECK;
+    // m_supportedFeatures |= ICON; will be set based on FW version
 }
 
 //////////////////////////////////////////////////////////////////////////////