fix preference_reset_mqtt_topics check
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#define NUKI_HUB_VERSION "9.03"
|
#define NUKI_HUB_VERSION "9.03"
|
||||||
#define NUKI_HUB_BUILD "unknownbuildnr"
|
#define NUKI_HUB_BUILD "unknownbuildnr"
|
||||||
#define NUKI_HUB_DATE "2024-11-30"
|
#define NUKI_HUB_DATE "2024-12-01"
|
||||||
|
|
||||||
#define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest"
|
#define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest"
|
||||||
#define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json"
|
#define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json"
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -209,12 +211,20 @@ inline void initPreferences(Preferences* preferences)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int configVer = preferences->getInt(preference_config_version);
|
int lastConfigVer = preferences->getInt(preference_config_version);
|
||||||
|
int currentConfigVer = atof(NUKI_HUB_VERSION) * 100;
|
||||||
|
|
||||||
if(configVer < (atof(NUKI_HUB_VERSION) * 100))
|
Log->print("Last config version: ");
|
||||||
{
|
Log->println(lastConfigVer);
|
||||||
if (configVer < 834)
|
Log->print("Current config version: ");
|
||||||
|
Log->println(currentConfigVer);
|
||||||
|
|
||||||
|
if(lastConfigVer >= currentConfigVer) return;
|
||||||
|
|
||||||
|
if (lastConfigVer < 834)
|
||||||
{
|
{
|
||||||
|
Log->println("Migration 834");
|
||||||
|
|
||||||
if(preferences->getInt(preference_keypad_control_enabled))
|
if(preferences->getInt(preference_keypad_control_enabled))
|
||||||
{
|
{
|
||||||
preferences->putBool(preference_keypad_info_enabled, true);
|
preferences->putBool(preference_keypad_info_enabled, true);
|
||||||
@@ -303,8 +313,10 @@ inline void initPreferences(Preferences* preferences)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (configVer < 901)
|
if (lastConfigVer < 901)
|
||||||
{
|
{
|
||||||
|
Log->println("Migration 901");
|
||||||
|
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32S3)
|
#if defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||||
if (preferences->getInt(preference_network_hardware) == 3)
|
if (preferences->getInt(preference_network_hardware) == 3)
|
||||||
{
|
{
|
||||||
@@ -315,11 +327,11 @@ inline void initPreferences(Preferences* preferences)
|
|||||||
{
|
{
|
||||||
preferences->putInt(preference_network_hardware, 3);
|
preferences->putInt(preference_network_hardware, 3);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
preferences->putBool(preference_reset_mqtt_topics, true);
|
preferences->putBool(preference_reset_mqtt_topics, true);
|
||||||
preferences->putInt(preference_config_version, atof(NUKI_HUB_VERSION) * 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preferences->putInt(preference_config_version, currentConfigVer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user