changeset 92:be35821a4974 kittz

Stable to test. button sensitiveness fix. + global_constants.
author Dmitry Romanov <kitt@bk.ru>
date Mon, 26 Nov 2018 10:50:39 +0300
parents 8b0fadd413c6
children 3d6ccfb0190b
files Common/Inc/settings.h Discovery/Inc/global_constants.h Discovery/Inc/tMenuEditHardware.h Discovery/Src/settings.c Discovery/Src/tMenuEditHardware.c ostc4pack/OSTC4_Firmware.bin ostc4pack/OSTC4_firmware_upload.bin
diffstat 7 files changed, 58 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/Common/Inc/settings.h	Mon Nov 26 10:13:02 2018 +0300
+++ b/Common/Inc/settings.h	Mon Nov 26 10:50:39 2018 +0300
@@ -32,11 +32,13 @@
 
 //#include "data_central.h"
 
+#include "global_constants.h"
 // From Common/Drivers/
 #include "stm32f4xx_hal.h"
 
 #include <stdint.h>
 
+
 #define NUM_GASES 5
 #define NUM_OFFSET_DILUENT 5
 #define SPECIAL_GAS_ID 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Discovery/Inc/global_constants.h	Mon Nov 26 10:50:39 2018 +0300
@@ -0,0 +1,36 @@
+///////////////////////////////////////////////////////////////////////////////
+/// -*- coding: UTF-8 -*-
+///
+/// \file   Common/Inc/global_constants.h
+/// \brief
+/// \author Dmitry Romanov<kitt@bk.ru>
+/// \date   11.2018
+///
+/// $Id$
+///////////////////////////////////////////////////////////////////////////////
+/// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
+///
+///     This program is free software: you can redistribute it and/or modify
+///     it under the terms of the GNU General Public License as published by
+///     the Free Software Foundation, either version 3 of the License, or
+///     (at your option) any later version.
+///
+///     This program is distributed in the hope that it will be useful,
+///     but WITHOUT ANY WARRANTY; without even the implied warranty of
+///     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+///     GNU General Public License for more details.
+///
+///     You should have received a copy of the GNU General Public License
+///     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef GLOBAL_CONSTANTS_H
+#define GLOBAL_CONSTANTS_H
+//Rename it ahead.
+#define DEFAULT_BUTTONRESPONSIVENESS_GUI 90
+#define MIN_BUTTONRESPONSIVENESS_GUI 50 //50 (-10correction)
+#define MAX_BUTTONRESPONSIVENESS_GUI 110//100 (+10correction)
+#define MIN_BUTTONRESPONSIVENESS MIN_BUTTONRESPONSIVENESS_GUI-10 //MIN_BUTTONRESPONSIVENESS_GUI-10 correction
+#define MAX_BUTTONRESPONSIVENESS MAX_BUTTONRESPONSIVENESS_GUI+10//MIN_BUTTONRESPONSIVENESS_GUI+10correction
+
+#endif
--- a/Discovery/Inc/tMenuEditHardware.h	Mon Nov 26 10:13:02 2018 +0300
+++ b/Discovery/Inc/tMenuEditHardware.h	Mon Nov 26 10:50:39 2018 +0300
@@ -31,6 +31,7 @@
 /* Includes ------------------------------------------------------------------*/
 #include "stm32f4xx_hal.h"
 #include "gfx_engine.h"
+#include "global_constants.h"
 #include "settings.h"
 #include "data_central.h"
 
--- a/Discovery/Src/settings.c	Mon Nov 26 10:13:02 2018 +0300
+++ b/Discovery/Src/settings.c	Mon Nov 26 10:50:39 2018 +0300
@@ -55,7 +55,7 @@
 {
     .versionFirst   = 1,
     .versionSecond 	= 4,
-    .versionThird   = 3,
+    .versionThird   = 6,
     .versionBeta    = 2,
 
     /* 4 bytes with trailing 0 */
@@ -256,10 +256,10 @@
     .totalDiveCounter = 0,
     .personalDiveCount = 0,
     .showDebugInfo = 0,
-    .ButtonResponsiveness[0] = 90, // new hw 170306
-    .ButtonResponsiveness[1] = 90, // new hw 170306
-    .ButtonResponsiveness[2] = 90, // new hw 170306
-    .ButtonResponsiveness[3] = 90, // new hw 170306
+    .ButtonResponsiveness[0] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306
+    .ButtonResponsiveness[1] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306
+    .ButtonResponsiveness[2] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306
+    .ButtonResponsiveness[3] = DEFAULT_BUTTONRESPONSIVENESS_GUI, // new hw 170306
     .nonMetricalSystem = 0,
     .fallbackToFixedSetpoint = 1,
     .bluetoothActive = 0,
@@ -301,7 +301,7 @@
     .timeoutSurfacemodeWithSensors = 600,
     .VPM_model = 0,
     .GF_model = 0,
-    .FactoryButtonBase = 90,
+    .FactoryButtonBase = DEFAULT_BUTTONRESPONSIVENESS_GUI,
     .FactoryButtonBalance[0] = 3,
     .FactoryButtonBalance[1] = 3,
     .FactoryButtonBalance[2] = 3,
@@ -2655,14 +2655,14 @@
 {
     uint32_t newSensitivity;
 
-    if(inputValueRaw > 110)
+    if(inputValueRaw > MAX_BUTTONRESPONSIVENESS)
     {
-            inputValueRaw = 110;
+            inputValueRaw = MAX_BUTTONRESPONSIVENESS;
     }
     else
-    if(inputValueRaw < 50)
+    if(inputValueRaw < MIN_BUTTONRESPONSIVENESS)
     {
-            inputValueRaw = 50;
+            inputValueRaw = MIN_BUTTONRESPONSIVENESS;
     }
 
     // the unbalanced value
@@ -2690,9 +2690,9 @@
             break;
         }
 
-        if(newSensitivity > 110)
+        if(newSensitivity > MAX_BUTTONRESPONSIVENESS)
         {
-                newSensitivity = 110;
+                newSensitivity = MAX_BUTTONRESPONSIVENESS;
         }
         outArray4Values[i] = newSensitivity;
     }
--- a/Discovery/Src/tMenuEditHardware.c	Mon Nov 26 10:13:02 2018 +0300
+++ b/Discovery/Src/tMenuEditHardware.c	Mon Nov 26 10:50:39 2018 +0300
@@ -36,6 +36,7 @@
 #include "tCCR.h"
 #include "tMenuEdit.h"
 
+
 /* Private function prototypes -----------------------------------------------*/
 void openEdit_Bluetooth(void);
 void openEdit_Compass(void);
@@ -758,16 +759,16 @@
     if(action == ACTION_BUTTON_NEXT)
     {
         digitContentNew = digitContent - '0';
-        if(digitContentNew >= 110)
+        if(digitContentNew >= MAX_BUTTONRESPONSIVENESS_GUI)
         {
-            digitContentNew = 70;
+            digitContentNew = MIN_BUTTONRESPONSIVENESS_GUI;
         }
         else
         {
             remainder = digitContentNew%5;
             digitContentNew += 5 - remainder;
-            if(digitContentNew >= 110)
-                digitContentNew = 110;
+            if(digitContentNew >= MAX_BUTTONRESPONSIVENESS_GUI)
+                digitContentNew = MAX_BUTTONRESPONSIVENESS_GUI;
         }
         return '0' + digitContentNew;
     }
@@ -775,8 +776,8 @@
     if(action == ACTION_BUTTON_BACK)
     {
         digitContentNew = digitContent - '0';
-        if(digitContentNew <= 70)
-            digitContentNew = 110;
+        if(digitContentNew <= MIN_BUTTONRESPONSIVENESS_GUI)
+            digitContentNew = MAX_BUTTONRESPONSIVENESS_GUI;
         else
         {
             remainder = digitContentNew%5;
Binary file ostc4pack/OSTC4_Firmware.bin has changed
Binary file ostc4pack/OSTC4_firmware_upload.bin has changed