Browse Source

## 0.6.5 2022-11-25

* fix/workaround minHeatingOffTime active after reboot
* changed max button press time to be detected as short press from 200 to 350ms
FloKra 1 year ago
parent
commit
c1d989924a

+ 10 - 7
.vscode/extensions.json

@@ -1,7 +1,10 @@
-{
-    // See http://go.microsoft.com/fwlink/?LinkId=827846
-    // for the documentation about the extensions.json format
-    "recommendations": [
-        "platformio.platformio-ide"
-    ]
-}
+{
+    // See http://go.microsoft.com/fwlink/?LinkId=827846
+    // for the documentation about the extensions.json format
+    "recommendations": [
+        "platformio.platformio-ide"
+    ],
+    "unwantedRecommendations": [
+        "ms-vscode.cpptools-extension-pack"
+    ]
+}

+ 5 - 0
CHANGELOG.md

@@ -1,5 +1,10 @@
 # WiFiThermostat - Changelog
 
+## 0.6.5 2022-11-25
+
+* fix/workaround minHeatingOffTime active after reboot
+* changed max button press time to be detected as short press from 200 to 350ms 
+
 ## 0.6.4 2021-03-22
 
 * updated Arduino core to 2.7.4

BIN
releases/bin/WiFiThermostat.ino.d1_mini.20221125_v0.6.5.bin


BIN
releases/src/WiFiThermostat_0.6.5.zip


+ 16 - 9
src/Buttonhandling.ino

@@ -1,4 +1,11 @@
 
+const unsigned int buttonMaxClickTime = 500;
+const unsigned int buttonMaxClickTime_2 = 350;     // actual max time a button may be pressed to get detected as short press/click
+const unsigned int buttonDebounceTime = 50;
+const unsigned int buttonRepeatTime = 50;
+const unsigned int buttonHoldTime = 50;
+const unsigned int buttonRepeatTime_menuButton = 1000;
+
 // Use this function to configure the internal Bounce object to suit you. See the documentation at: https://github.com/thomasfredericks/Bounce2/wiki
 // This function can be left out if the defaults are acceptable - just don't call configureButton
 void configurePushButton(Bounce &bouncedButton)
@@ -12,19 +19,19 @@ void setupInputsButtons()
   //pinMode(PIN_PIRSENSOR, INPUT);
   buttonPlus.configureButton(configurePushButton);
   //buttonPlus.onPress(onButtonPressed); // When the button is first pressed, call the function onButtonPressed (further down the page)
-  buttonPlus.onHoldRepeat(1000, 350, onButtonHeld); // Once the button has been held for 1 second (1000ms) call onButtonHeld. Call it again every 350ms until it is let go
-  buttonPlus.onRelease(50, 500, onButtonReleased);  // When the button is held >50ms and released after <500ms, call onButtonReleased
+  buttonPlus.onHoldRepeat(buttonHoldTime, buttonRepeatTime, onButtonHeld); // Once the button has been held for 1 second (1000ms) call onButtonHeld. Call it again every 350ms until it is let go
+  buttonPlus.onRelease(buttonDebounceTime, buttonMaxClickTime, onButtonReleased);  // When the button is held >50ms and released after <500ms, call onButtonReleased
 
   buttonMinus.configureButton(configurePushButton);
   //buttonMinus.onPress(onButtonPressed); // When the button is first pressed, call the function onButtonPressed (further down the page)
-  buttonMinus.onHoldRepeat(1000, 350, onButtonHeld); // Once the button has been held for 1 second (1000ms) call onButtonHeld. Call it again every 350ms until it is let go
-  buttonMinus.onRelease(50, 500, onButtonReleased);  // When the button is held >50ms and released after <500ms, call onButtonReleased
+  buttonMinus.onHoldRepeat(buttonHoldTime, buttonRepeatTime, onButtonHeld); // Once the button has been held for 1 second (1000ms) call onButtonHeld. Call it again every 350ms until it is let go
+  buttonMinus.onRelease(buttonDebounceTime, buttonMaxClickTime, onButtonReleased);  // When the button is held >50ms and released after <500ms, call onButtonReleased
 
   buttonMode.configureButton(configurePushButton);
   //buttonMode.onPress(onButtonPressed); // When the button is first pressed, call the function onButtonPressed (further down the page)
   //buttonMode.onHold(1000, onButtonHeldNoRepeat); // Once the button has been held for 1 second (1000ms) call onButtonHeld
-  buttonMode.onHoldRepeat(1000, 1000, onButtonHeld); // Once the button has been held for 1 second (1000ms) call onButtonHeld
-  buttonMode.onRelease(50, 500, onButtonReleased);   // When the button is held >50ms and released after <500ms, call onButtonReleased
+  buttonMode.onHoldRepeat(buttonHoldTime, buttonRepeatTime_menuButton, onButtonHeld); // Once the button has been held for 1 second (1000ms) call onButtonHeld
+  buttonMode.onRelease(buttonDebounceTime, buttonMaxClickTime, onButtonReleased);   // When the button is held >50ms and released after <500ms, call onButtonReleased
 
   pirSensor.configureButton(configurePushButton);
   //pirSensor.onPress(onButtonPressed); // When the button is first pressed, call the function onButtonPressed (further down the page)
@@ -80,15 +87,15 @@ void onButtonHeldNoRepeat(Button &btn, uint16_t duration)
 // duration reports back the total time that the button was held down
 void onButtonReleased(Button &btn, uint16_t duration)
 {
-  if (btn.is(buttonPlus) && duration < 200)
+  if (btn.is(buttonPlus) && duration < buttonMaxClickTime_2)
   {
     plusButtonAction();
   }
-  else if (btn.is(buttonMinus) && duration < 200)
+  else if (btn.is(buttonMinus) && duration < buttonMaxClickTime_2)
   {
     minusButtonAction();
   }
-  else if (btn.is(buttonMode) && duration < 200)
+  else if (btn.is(buttonMode) && duration < buttonMaxClickTime_2)
   {
     modeButtonAction();
   }

+ 5 - 2
src/WiFiThermostat.ino

@@ -306,8 +306,8 @@ uint8_t presetSaved;
 // global pre set conf variables - not changeable via configuration
 float setTempLowMin = SETTEMP_LOW_MIN;
 float setTempLowMax = SETTEMP_LOW_MAX;
-uint16_t debounceTime = BUTTON_DEBOUNCE_TIME;
-uint16_t buttonHoldTime = BUTTON_HOLD_TIME;
+//uint16_t debounceTime = BUTTON_DEBOUNCE_TIME;    // was never used - now declared in buttonhandling.ino
+//uint16_t buttonHoldTime = BUTTON_HOLD_TIME;      // was never used - now declared in buttonhandling.ino
 unsigned long maxMeasurementAge = MAX_MEASUREMENT_AGE;
 unsigned long maxMeasurementAgeOut = MAX_MEASUREMENT_AGE_OUT;
 
@@ -626,6 +626,9 @@ void setup()
     mqttClientInit();
   }
 
+  // set heatingOffTime to confAdv.heatingMinOffTime so that the heating can start immediately after a reboot
+  heatingOffTime = confAdv.heatingMinOffTime;
+
   sendLog(F("DEV:  setup complete."), LOGLEVEL_INFO);
 } // void setup
 

+ 1 - 1
src/fwversion.h

@@ -1,6 +1,6 @@
 // DEFINE NAMES
 #define FIRMWARE_NAME "WiFiThermostat"
-#define FIRMWARE_VERSION "0.6.4"
+#define FIRMWARE_VERSION "0.6.5"
 #define FIRMWARE_URL "https://git.flokra.at/flo/WiFiThermostat"
 #define FIRMWARE_COPYRIGHT "FloKra"
 #define FIRMWARE_COPYRIGHT_URL "https://www.flokra.at/"