Skip to content

Commit

Permalink
Fix BLE
Browse files Browse the repository at this point in the history
  • Loading branch information
iranl committed Dec 19, 2024
1 parent 6b13c9b commit a7bb228
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/nuki_ble
Submodule nuki_ble updated 1 files
+22 −16 src/NukiBle.cpp
3 changes: 2 additions & 1 deletion sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,5 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32
CONFIG_HTTPD_WS_SUPPORT=y
CONFIG_ESP_HTTPS_SERVER_ENABLE=n
CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE=y
CONFIG_BOOTLOADER_WDT_TIME_MS=90000
CONFIG_BOOTLOADER_WDT_TIME_MS=90000
CONFIG_LOG_MASTER_LEVEL=y
2 changes: 1 addition & 1 deletion src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#define NUKI_HUB_VERSION "9.05"
#define NUKI_HUB_VERSION_INT (uint32_t)905
#define NUKI_HUB_BUILD "unknownbuildnr"
#define NUKI_HUB_DATE "2024-12-18"
#define NUKI_HUB_DATE "2024-12-19"

#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"
Expand Down
8 changes: 7 additions & 1 deletion src/NukiOpenerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ void NukiOpenerWrapper::initialize()
_nukiOpener.setDebugHexData(_preferences->getBool(preference_debug_hex_data, false));
_nukiOpener.setDebugCommand(_preferences->getBool(preference_debug_command, false));

_nukiOpener.initialize(_preferences->getBool(preference_connect_mode, false));
if (_preferences->getBool(preference_debug_connect, false) || _preferences->getBool(preference_debug_communication, false) || _preferences->getBool(preference_debug_readable_data, false) ||
_preferences->getBool(preference_debug_hex_data, false) || _preferences->getBool(preference_debug_command, false))
{
esp_log_set_level_master(ESP_LOG_DEBUG);
}

_nukiOpener.initialize(_preferences->getBool(preference_connect_mode, true));
_nukiOpener.registerBleScanner(_bleScanner);
_nukiOpener.setEventHandler(this);
_nukiOpener.setConnectTimeout(3);
Expand Down
10 changes: 8 additions & 2 deletions src/NukiWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ void NukiWrapper::initialize()
_nukiLock.setDebugReadableData(_preferences->getBool(preference_debug_readable_data, false));
_nukiLock.setDebugHexData(_preferences->getBool(preference_debug_hex_data, false));
_nukiLock.setDebugCommand(_preferences->getBool(preference_debug_command, false));

_nukiLock.initialize(_preferences->getBool(preference_connect_mode, false));

if (_preferences->getBool(preference_debug_connect, false) || _preferences->getBool(preference_debug_communication, false) || _preferences->getBool(preference_debug_readable_data, false) ||
_preferences->getBool(preference_debug_hex_data, false) || _preferences->getBool(preference_debug_command, false))
{
esp_log_set_level_master(ESP_LOG_DEBUG);
}

_nukiLock.initialize(_preferences->getBool(preference_connect_mode, true));
_nukiLock.registerBleScanner(_bleScanner);
_nukiLock.setEventHandler(this);
_nukiLock.setConnectTimeout(3);
Expand Down
2 changes: 1 addition & 1 deletion src/PreferencesKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ inline void initPreferences(Preferences* preferences)
preferences->putBool(preference_debug_readable_data, false);
preferences->putBool(preference_debug_hex_data, false);
preferences->putBool(preference_debug_command, false);
preferences->putBool(preference_connect_mode, false);
preferences->putBool(preference_connect_mode, true);

#ifndef CONFIG_IDF_TARGET_ESP32H2
WiFi.begin();
Expand Down
4 changes: 2 additions & 2 deletions src/WebCfgServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2780,7 +2780,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, String& message)
}
else if(key == "CONNMODE")
{
if(_preferences->getBool(preference_connect_mode, false) != (value == "1"))
if(_preferences->getBool(preference_connect_mode, true) != (value == "1"))
{
_preferences->putBool(preference_connect_mode, (value == "1"));
Log->print(F("Setting changed: "));
Expand Down Expand Up @@ -3997,7 +3997,7 @@ esp_err_t WebCfgServer::buildNukiConfigHtml(PsychicRequest *request)
response.print("<table>");
printCheckBox(&response, "LOCKENA", "Nuki Lock enabled", _preferences->getBool(preference_lock_enabled), "");
printCheckBox(&response, "OPENA", "Nuki Opener enabled", _preferences->getBool(preference_opener_enabled), "");
printCheckBox(&response, "CONNMODE", "New Nuki Bluetooth connection mode (disable if there are connection issues)", _preferences->getBool(preference_connect_mode, false), "");
printCheckBox(&response, "CONNMODE", "New Nuki Bluetooth connection mode (disable if there are connection issues)", _preferences->getBool(preference_connect_mode, true), "");
response.print("</table><br>");
response.print("<h3>Advanced Nuki Configuration</h3>");
response.print("<table>");
Expand Down
3 changes: 3 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ void setupTasks(bool ota)
void setup()
{
//Set Log level to error for all TAGS
#ifndef DEBUG_NUKIHUB
esp_log_set_level_master(ESP_LOG_ERROR);
#endif
esp_log_level_set("*", ESP_LOG_ERROR);
//Set Log level to none for mqtt TAG
esp_log_level_set("mqtt", ESP_LOG_NONE);
Expand Down
3 changes: 2 additions & 1 deletion updater/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ CONFIG_HTTPD_MAX_URI_LEN=512
CONFIG_HTTPD_ERR_RESP_NO_DELAY=y
CONFIG_HTTPD_PURGE_BUF_LEN=32
CONFIG_HTTPD_WS_SUPPORT=y
CONFIG_ESP_HTTPS_SERVER_ENABLE=n
CONFIG_ESP_HTTPS_SERVER_ENABLE=n
CONFIG_LOG_MASTER_LEVEL=y

0 comments on commit a7bb228

Please sign in to comment.