Merge remote-tracking branch 'upstream/master' into http-server

This commit is contained in:
iranl
2024-08-31 22:08:10 +02:00
28 changed files with 380 additions and 156 deletions

View File

@@ -12,7 +12,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
board: [esp32, esp32-s3, esp32-c3, esp32-c6, esp32-h2, esp32-solo1] board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1]
build: [release, debug] build: [release, debug]
env: env:
BOARD: ${{ matrix.board }} BOARD: ${{ matrix.board }}
@@ -62,11 +62,6 @@ jobs:
run: | run: |
BOARD=`echo $BOARD | tr '[:lower:]' '[:upper:]'` BOARD=`echo $BOARD | tr '[:lower:]' '[:upper:]'`
# fix for docs
if [ "$BOARD" = "ESP32DEV" ]; then
BOARD="ESP32"
fi
# look for documentation on flash and copy the command # look for documentation on flash and copy the command
command=`sed -n '/^Howto flash (esptool)$/,$p' ${DOC} | sed -n '/^## '"${BOARD}"'$/,\${ n; n; p; }' | head -n1` command=`sed -n '/^Howto flash (esptool)$/,$p' ${DOC} | sed -n '/^## '"${BOARD}"'$/,\${ n; n; p; }' | head -n1`

View File

@@ -18,7 +18,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
board: [esp32, esp32-s3, esp32-c3, esp32-c6, esp32-h2, esp32-solo1] board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1]
build: [release, debug] build: [release, debug]
env: env:
BOARD: ${{ matrix.board }} BOARD: ${{ matrix.board }}
@@ -67,11 +67,6 @@ jobs:
run: | run: |
BOARD=`echo $BOARD | tr '[:lower:]' '[:upper:]'` BOARD=`echo $BOARD | tr '[:lower:]' '[:upper:]'`
# fix for docs
if [ "$BOARD" = "ESP32DEV" ]; then
BOARD="ESP32"
fi
# look for documentation on flash and copy the command # look for documentation on flash and copy the command
command=`sed -n '/^Howto flash (esptool)$/,$p' ${DOC} | sed -n '/^## '"${BOARD}"'$/,\${ n; n; p; }' | head -n1` command=`sed -n '/^Howto flash (esptool)$/,$p' ${DOC} | sed -n '/^## '"${BOARD}"'$/,\${ n; n; p; }' | head -n1`

View File

@@ -34,7 +34,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
board: [esp32, esp32-s3, esp32-c3, esp32-c6, esp32-h2, esp32-solo1] board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1]
build: [release, debug] build: [release, debug]
env: env:
BOARD: ${{ matrix.board }} BOARD: ${{ matrix.board }}
@@ -84,11 +84,6 @@ jobs:
run: | run: |
BOARD=`echo $BOARD | tr '[:lower:]' '[:upper:]'` BOARD=`echo $BOARD | tr '[:lower:]' '[:upper:]'`
# fix for docs
if [ "$BOARD" = "ESP32DEV" ]; then
BOARD="ESP32"
fi
# look for documentation on flash and copy the command # look for documentation on flash and copy the command
command=`sed -n '/^Howto flash (esptool)$/,$p' ${DOC} | sed -n '/^## '"${BOARD}"'$/,\${ n; n; p; }' | head -n1` command=`sed -n '/^Howto flash (esptool)$/,$p' ${DOC} | sed -n '/^## '"${BOARD}"'$/,\${ n; n; p; }' | head -n1`

View File

@@ -12,7 +12,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
board: [esp32, esp32-s3, esp32-c3, esp32-c6, esp32-h2, esp32-solo1] board: [esp32, esp32-s3, esp32-s3-oct, esp32-c3, esp32-c6, esp32-h2, esp32-solo1]
build: [release, debug] build: [release, debug]
env: env:
BOARD: ${{ matrix.board }} BOARD: ${{ matrix.board }}
@@ -61,11 +61,6 @@ jobs:
run: | run: |
BOARD=`echo $BOARD | tr '[:lower:]' '[:upper:]'` BOARD=`echo $BOARD | tr '[:lower:]' '[:upper:]'`
# fix for docs
if [ "$BOARD" = "ESP32DEV" ]; then
BOARD="ESP32"
fi
# look for documentation on flash and copy the command # look for documentation on flash and copy the command
command=`sed -n '/^Howto flash (esptool)$/,$p' ${DOC} | sed -n '/^## '"${BOARD}"'$/,\${ n; n; p; }' | head -n1` command=`sed -n '/^Howto flash (esptool)$/,$p' ${DOC} | sed -n '/^## '"${BOARD}"'$/,\${ n; n; p; }' | head -n1`

View File

@@ -47,6 +47,23 @@ As an alternative to Wi-Fi (which is available on any supported ESP32), the foll
In principle all ESP32 (and variants) devices with built-in ethernet port are supported, but might require additional setup using the "Custom LAN setup" option. In principle all ESP32 (and variants) devices with built-in ethernet port are supported, but might require additional setup using the "Custom LAN setup" option.
See the "[Connecting via Ethernet](#connecting-via-ethernet-optional)" section for more information. See the "[Connecting via Ethernet](#connecting-via-ethernet-optional)" section for more information.
## Recommended ESP32 devices
- If WIFI6 is required: ESP32-C6
- If PoE is required: Any of the above mentioned devices with PoE or any other ESP device in combination with a SPI Ethernet module ([W5500](https://www.aliexpress.com/w/wholesale-w5500.html)) and [PoE to Ethernet and USB type B/C splitter](https://aliexpress.com/w/wholesale-poe-splitter-usb-c.html)
- If you want maximum performance and intend to run any or multiple of the following:
- a Nuki Lock and Nuki Opener and/or
- MQTT SSL and/or
- HTTP SSL and/or
- large amounts of keypad codes, timecontrol or authorization entries
- Developing/debugging Nuki devices and/or Nuki Hub
An ESP32-S3 with 2MB of PSRAM or more (look for an ESP32-S3 with the designation N>=4 and R>=2 such as an ESP32-S3 N16R8)
- In general when buying a new device when size and a couple of dollars more or less are not an issue: An ESP32-S3 with 2MB of PSRAM or more.<br>
The ESP32-S3 is a dual-core CPU with many GPIO's, ability to enlarge RAM using PSRAM, ability to connect Ethernet modules over SPI and optionally power the device with a PoE splitter. The only functions missing from the ESP32-S3 as compared to other ESP devices is the ability to use some Ethernet modules only supported by the original ESP32 and the ability to connect over WIFI6 (C6)
## Support Nuki Hub development ## Support Nuki Hub development
If you haven't ordered your Nuki product yet, you can support me by using my referrer code when placing your order:<br> If you haven't ordered your Nuki product yet, you can support me by using my referrer code when placing your order:<br>
@@ -97,6 +114,34 @@ Enable "Register as app" before pairing to allow this. Otherwise the Bridge will
Hybrid mode allows you to use the official Nuki MQTT implemenation on a Nuki Lock 3.0 Pro, Nuki Lock 4.0 or Nuki Lock 4.0 Pro in conjunction with Nuki Hub.<br> Hybrid mode allows you to use the official Nuki MQTT implemenation on a Nuki Lock 3.0 Pro, Nuki Lock 4.0 or Nuki Lock 4.0 Pro in conjunction with Nuki Hub.<br>
See [hybrid mode](/HYBRID.md) for more information. See [hybrid mode](/HYBRID.md) for more information.
## Memory constraints
ESP32 devices have a limited amount of free RAM available.<br>
<br>
On version 9.01 of Nuki Hub with only a Nuki Lock connected the expected free amount of RAM/Heap available is around:
- ESP32: 60 kilobytes / 60.000 bytes
- Other variants (C3/S3/C6/H2): 90-120 kilobytes / 90.000-120.000 bytes
This free amount of RAM can be reduced (temporarily) by certain actions (such as changing Nuki device config) or continuously when enabling the following:
- Connecting both a Nuki opener and a Nuki lock to Nuki Hub
- Enlarging stack sizes of the Nuki and Network task to accommodate large amounts of keypad codes, authorization entries or timecontrol entries
- MQTT SSL (Costs about 30k RAM)
- HTTP SSL (Costs about 30k RAM)
- Developing/debugging Nuki devices and/or Nuki Hub, using WebSerial (Costs about 30k RAM)
The currently available RAM/Heap can be found on the info page of the Web configurator of Nuki Hub.<br>
<br>
When the ESP32 runs out of available RAM this device can crash or otherwise unexpected behaviour can occur.<br>
<br>
Nuki Hub does allow for the use of embedded PSRAM on the regular binaries whenever it is available.<br>
PSRAM is usually 2, 4 or 8MB in size and thus greatly enlarges the 320kb of internal RAM that is available.<br>
It is basically impossible to run out of RAM when PSRAM is available.
You can check on the info page of the Web configurator if PSRAM is available.
Note that there are two build of Nuki Hub for the ESP32-S3 available.<br>
One for devices with no or Quad SPI PSRAM and one for devices with Octal SPI PSRAM.<br>
If your ESP32-S3 device has PSRAM but it is not detected please flash the other S3 binary.
## Configuration ## Configuration
In a browser navigate to the IP address assigned to the ESP32. In a browser navigate to the IP address assigned to the ESP32.

View File

@@ -0,0 +1,50 @@
{
"build": {
"arduino":{
"ldscript": "esp32s3_out.ld"
},
"core": "esp32",
"extra_flags": [
"-DARDUINO_ESP32S3_DEV",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [
[
"0x303A",
"0x1001"
]
],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": [
"bluetooth",
"wifi"
],
"debug": {
"default_tool": "esp-builtin",
"onboard_tools": [
"esp-builtin"
],
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "ESP32-S3 (>=4 MB QD, OCTAL PSRAM)",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 460800
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html",
"vendor": "Espressif"
}

View File

@@ -37,7 +37,7 @@
"arduino", "arduino",
"espidf" "espidf"
], ],
"name": "ESP32-S3 (4 MB QD, No PSRAM)", "name": "ESP32-S3 (>=4 MB QD, QUAD OR NO PSRAM)",
"upload": { "upload": {
"flash_size": "4MB", "flash_size": "4MB",
"maximum_ram_size": 327680, "maximum_ram_size": 327680,

View File

@@ -9,6 +9,8 @@ def get_board_name(env):
if env.get('BOARD') == 'esp32-solo1': if env.get('BOARD') == 'esp32-solo1':
board = env.get('BOARD').replace('-', '') board = env.get('BOARD').replace('-', '')
elif env.get('BOARD') == 'nuki-esp32-s3-oct':
board = 'esp32s3oct'
return board return board
def create_target_dir(env): def create_target_dir(env):

View File

@@ -73,7 +73,7 @@ monitor_filters =
[env:esp32] [env:esp32]
board = esp32dev board = esp32dev
board_build.cmake_extra_args = board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults" -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.defaults.esp32"
extra_scripts = extra_scripts =
pre:pio_package_pre.py pre:pio_package_pre.py
post:pio_package_post.py post:pio_package_post.py
@@ -89,21 +89,33 @@ build_flags =
[env:esp32-c3] [env:esp32-c3]
extends = env:esp32 extends = env:esp32
board = esp32-c3-devkitc-02 board = esp32-c3-devkitc-02
board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults"
[env:esp32-s3] [env:esp32-s3]
extends = env:esp32 extends = env:esp32
board = nuki-esp32-s3 board = nuki-esp32-s3
board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.defaults.esp32-s3"
[env:esp32-s3-oct]
extends = env:esp32
board = nuki-esp32-s3-oct
board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults;sdkconfig.defaults.esp32-s3-oct"
[env:esp32-c6] [env:esp32-c6]
extends = env:esp32 extends = env:esp32
board = esp32-c6-devkitm-1 board = esp32-c6-devkitm-1
board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults"
[env:esp32-h2] [env:esp32-h2]
extends = env:esp32 extends = env:esp32
board = esp32-h2-devkitm-1 board = esp32-h2-devkitm-1
board_build.cmake_extra_args = board_build.cmake_extra_args =
-DNUKI_TARGET_H2=y -DNUKI_TARGET_H2=y
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults" -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.release.defaults"
lib_ignore = lib_ignore =
BLE BLE
BluetoothSerial BluetoothSerial
@@ -124,7 +136,7 @@ board_build.cmake_extra_args =
extends = env:esp32 extends = env:esp32
custom_build = debug custom_build = debug
board_build.cmake_extra_args = board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults" -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.defaults.esp32"
build_flags = build_flags =
${env.build_flags} ${env.build_flags}
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
@@ -213,7 +225,28 @@ build_flags =
extends = env:esp32-s3 extends = env:esp32-s3
custom_build = debug custom_build = debug
board_build.cmake_extra_args = board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults" -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.defaults.esp32-s3"
build_flags =
${env.build_flags}
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
-DCONFIG_NIMBLE_CPP_LOG_LEVEL=0
-DCONFIG_BT_NIMBLE_LOG_LEVEL=0
-DDEBUG_NUKIHUB
-DDEBUG_SENSE_NUKI
-DDEBUG_NUKI_COMMAND
-DDEBUG_NUKI_CONNECT
-DDEBUG_NUKI_COMMUNICATION
;-DDEBUG_NUKI_HEX_DATA
-DDEBUG_NUKI_READABLE_DATA
-DCONFIG_ASYNC_TCP_QUEUE_SIZE=128
-DCONFIG_ASYNC_TCP_STACK_SIZE=8192
-DWS_MAX_QUEUED_MESSAGES=512
[env:esp32-s3-oct_dbg]
extends = env:esp32-s3-oct
custom_build = debug
board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug.defaults;sdkconfig.defaults.esp32-s3-oct"
build_flags = build_flags =
${env.build_flags} ${env.build_flags}
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG

View File

@@ -36,6 +36,13 @@ e000 boot_app0.bin
10000 nuki_hub_esp32s3.bin 10000 nuki_hub_esp32s3.bin
280000 nuki_hub_updater_esp32s3.bin 280000 nuki_hub_updater_esp32s3.bin
ESP32-S3-OCT
e000 boot_app0.bin
0 bootloader.bin
8000 nuki_hub.partitions.bin
10000 nuki_hub_esp32s3oct.bin
280000 nuki_hub_updater_esp32s3oct.bin
ESP32-C3 ESP32-C3
e000 boot_app0.bin e000 boot_app0.bin
0 bootloader.bin 0 bootloader.bin
@@ -84,6 +91,10 @@ esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset
esptool.py --chip esp32s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32s3.bin 0x280000 nuki_hub_updater_esp32s3.bin 0x8000 nuki_hub.partitions.bin esptool.py --chip esp32s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32s3.bin 0x280000 nuki_hub_updater_esp32s3.bin 0x8000 nuki_hub.partitions.bin
## ESP32-S3-OCT
esptool.py --chip esp32s3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32s3oct.bin 0x280000 nuki_hub_updater_esp32s3oct.bin 0x8000 nuki_hub.partitions.bin
## ESP32-C3 ## ESP32-C3
esptool.py --chip esp32c3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32c3.bin 0x280000 nuki_hub_updater_esp32c3.bin 0x8000 nuki_hub.partitions.bin esptool.py --chip esp32c3 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq keep --flash_size detect 0xe000 boot_app0.bin 0x0 bootloader.bin 0x10000 nuki_hub_esp32c3.bin 0x280000 nuki_hub_updater_esp32c3.bin 0x8000 nuki_hub.partitions.bin

View File

@@ -2,4 +2,6 @@ CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y
CONFIG_LOG_DEFAULT_LEVEL=4 CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_ESP_IPC_TASK_STACK_SIZE=8192 CONFIG_ESP_IPC_TASK_STACK_SIZE=8192
CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y
CONFIG_BOOTLOADER_LOG_LEVEL=1 CONFIG_BOOTLOADER_LOG_LEVEL=1
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y

6
sdkconfig.defaults.esp32 Normal file
View File

@@ -0,0 +1,6 @@
CONFIG_SPIRAM=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768

View File

@@ -0,0 +1,6 @@
CONFIG_SPIRAM=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768

View File

@@ -0,0 +1,7 @@
CONFIG_SPIRAM=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768
CONFIG_SPIRAM_MODE_OCT=y

View File

@@ -1 +1,7 @@
CONFIG_FREERTOS_UNICORE=y CONFIG_FREERTOS_UNICORE=y
CONFIG_SPIRAM=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768

View File

@@ -23,6 +23,20 @@
#define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32c3.bin" #define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32c3.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32c3.bin" #define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32c3.bin"
#elif defined(CONFIG_IDF_TARGET_ESP32S3) #elif defined(CONFIG_IDF_TARGET_ESP32S3)
#if defined(CONFIG_SPIRAM_MODE_OCT)
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32s3oct.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32s3oct.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32s3oct.bin"
#define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_updater_esp32s3oct.bin"
#define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_esp32s3oct.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_updater_esp32s3oct.bin"
#define GITHUB_LATEST_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/nuki_hub_esp32s3oct.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/nuki_hub_updater_esp32s3oct.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_esp32s3oct.bin"
#define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32s3oct.bin"
#define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32s3oct.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32s3oct.bin"
#else
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32s3.bin" #define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32s3.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32s3.bin" #define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32s3.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32s3.bin" #define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32s3.bin"
@@ -35,6 +49,7 @@
#define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32s3.bin" #define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32s3.bin"
#define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32s3.bin" #define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32s3.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32s3.bin" #define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32s3.bin"
#endif
#elif defined(CONFIG_IDF_TARGET_ESP32C6) #elif defined(CONFIG_IDF_TARGET_ESP32C6)
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32c6.bin" #define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32c6.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32c6.bin" #define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32c6.bin"

View File

@@ -256,10 +256,10 @@ void NukiOpenerWrapper::update()
if(_nextLockAction != (NukiOpener::LockAction)0xff) if(_nextLockAction != (NukiOpener::LockAction)0xff)
{ {
_retryCount = 0; int retryCount = 0;
Nuki::CmdResult cmdResult; Nuki::CmdResult cmdResult = (Nuki::CmdResult)-1;
while(_retryCount < _nrOfRetries + 1 && cmdResult != Nuki::CmdResult::Success) while(retryCount < _nrOfRetries + 1 && cmdResult != Nuki::CmdResult::Success)
{ {
cmdResult = _nukiOpener.lockAction(_nextLockAction, 0, 0); cmdResult = _nukiOpener.lockAction(_nextLockAction, 0, 0);
char resultStr[15] = {0}; char resultStr[15] = {0};
@@ -275,15 +275,15 @@ void NukiOpenerWrapper::update()
Log->print(F("Opener: Last command failed, retrying after ")); Log->print(F("Opener: Last command failed, retrying after "));
Log->print(_retryDelay); Log->print(_retryDelay);
Log->print(F(" milliseconds. Retry ")); Log->print(F(" milliseconds. Retry "));
Log->print(_retryCount + 1); Log->print(retryCount + 1);
Log->print(" of "); Log->print(" of ");
Log->println(_nrOfRetries); Log->println(_nrOfRetries);
_network->publishRetry(std::to_string(_retryCount + 1)); _network->publishRetry(std::to_string(retryCount + 1));
delay(_retryDelay); delay(_retryDelay);
++_retryCount; ++retryCount;
} }
postponeBleWatchdog(); postponeBleWatchdog();
} }
@@ -292,14 +292,14 @@ void NukiOpenerWrapper::update()
{ {
_nextLockAction = (NukiOpener::LockAction) 0xff; _nextLockAction = (NukiOpener::LockAction) 0xff;
_network->publishRetry("--"); _network->publishRetry("--");
_retryCount = 0; retryCount = 0;
if(_intervalLockstate > 10) _nextLockStateUpdateTs = ts + 10 * 1000; if(_intervalLockstate > 10) _nextLockStateUpdateTs = ts + 10 * 1000;
} }
else else
{ {
Log->println(F("Opener: Maximum number of retries exceeded, aborting.")); Log->println(F("Opener: Maximum number of retries exceeded, aborting."));
_network->publishRetry("failed"); _network->publishRetry("failed");
_retryCount = 0; retryCount = 0;
_nextLockAction = (NukiOpener::LockAction) 0xff; _nextLockAction = (NukiOpener::LockAction) 0xff;
} }
} }
@@ -380,17 +380,15 @@ void NukiOpenerWrapper::unpair()
void NukiOpenerWrapper::updateKeyTurnerState() void NukiOpenerWrapper::updateKeyTurnerState()
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(result != Nuki::CmdResult::Success && retryCount < _nrOfRetries + 1)
{ {
Log->print(F("Querying opener state: ")); Log->print(F("Result (attempt "));
Log->print(retryCount + 1);
Log->print("): ");
result =_nukiOpener.requestOpenerState(&_keyTurnerState); result =_nukiOpener.requestOpenerState(&_keyTurnerState);
++retryCount;
if(result != Nuki::CmdResult::Success) {
++_retryCount;
}
else break;
} }
char resultStr[15]; char resultStr[15];
@@ -455,15 +453,15 @@ void NukiOpenerWrapper::updateKeyTurnerState()
void NukiOpenerWrapper::updateBatteryState() void NukiOpenerWrapper::updateBatteryState()
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
Log->print(F("Querying opener battery state: ")); Log->print(F("Querying opener battery state: "));
result = _nukiOpener.requestBatteryReport(&_batteryReport); result = _nukiOpener.requestBatteryReport(&_batteryReport);
delay(250); delay(250);
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -511,15 +509,15 @@ void NukiOpenerWrapper::updateConfig()
if(isPinSet()) { if(isPinSet()) {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
Log->println(F("Nuki opener PIN is set")); Log->println(F("Nuki opener PIN is set"));
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
result = _nukiOpener.verifySecurityPin(); result = _nukiOpener.verifySecurityPin();
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -599,15 +597,15 @@ void NukiOpenerWrapper::updateAuthData(bool retrieved)
if(!retrieved) if(!retrieved)
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
Log->print(F("Retrieve log entries: ")); Log->print(F("Retrieve log entries: "));
result = _nukiOpener.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 1, false); result = _nukiOpener.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 1, false);
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -672,15 +670,15 @@ void NukiOpenerWrapper::updateKeypad(bool retrieved)
if(!retrieved) if(!retrieved)
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
Log->print(F("Querying opener keypad: ")); Log->print(F("Querying opener keypad: "));
result = _nukiOpener.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD)); result = _nukiOpener.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD));
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -739,15 +737,15 @@ void NukiOpenerWrapper::updateTimeControl(bool retrieved)
if(!retrieved) if(!retrieved)
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
Log->print(F("Querying opener timecontrol: ")); Log->print(F("Querying opener timecontrol: "));
result = _nukiOpener.retrieveTimeControlEntries(); result = _nukiOpener.retrieveTimeControlEntries();
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -800,15 +798,15 @@ void NukiOpenerWrapper::updateAuth(bool retrieved)
if(!retrieved) if(!retrieved)
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries) while(retryCount < _nrOfRetries)
{ {
Log->print(F("Querying opener authorization: ")); Log->print(F("Querying opener authorization: "));
result = _nukiOpener.retrieveAuthorizationEntries(0, _preferences->getInt(preference_auth_max_entries, MAX_AUTH)); result = _nukiOpener.retrieveAuthorizationEntries(0, _preferences->getInt(preference_auth_max_entries, MAX_AUTH));
delay(250); delay(250);
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -1098,9 +1096,9 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
if((int)_basicOpenerConfigAclPrefs[i] == 1) if((int)_basicOpenerConfigAclPrefs[i] == 1)
{ {
cmdResult = Nuki::CmdResult::Error; cmdResult = Nuki::CmdResult::Error;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
if(strcmp(basicKeys[i], "name") == 0) if(strcmp(basicKeys[i], "name") == 0)
{ {
@@ -1256,7 +1254,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
} }
if(cmdResult != Nuki::CmdResult::Success) { if(cmdResult != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -1288,9 +1286,9 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
if((int)_advancedOpenerConfigAclPrefs[j] == 1) if((int)_advancedOpenerConfigAclPrefs[j] == 1)
{ {
cmdResult = Nuki::CmdResult::Error; cmdResult = Nuki::CmdResult::Error;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
if(strcmp(advancedKeys[j], "intercomID") == 0) if(strcmp(advancedKeys[j], "intercomID") == 0)
{ {
@@ -1513,8 +1511,9 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
else jsonResult[advancedKeys[j]] = "invalidValue"; else jsonResult[advancedKeys[j]] = "invalidValue";
} }
if(cmdResult != Nuki::CmdResult::Success) { if(cmdResult != Nuki::CmdResult::Success)
++_retryCount; {
++retryCount;
} }
else break; else break;
} }
@@ -1614,9 +1613,9 @@ void NukiOpenerWrapper::onKeypadCommandReceived(const char *command, const uint
int codeInt = code.toInt(); int codeInt = code.toInt();
bool codeValid = codeInt > 100000 && codeInt < 1000000 && (code.indexOf('0') == -1); bool codeValid = codeInt > 100000 && codeInt < 1000000 && (code.indexOf('0') == -1);
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
if(strcmp(command, "add") == 0) if(strcmp(command, "add") == 0)
{ {
@@ -1705,7 +1704,7 @@ void NukiOpenerWrapper::onKeypadCommandReceived(const char *command, const uint
} }
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -1799,9 +1798,9 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
} }
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
if(strcmp(action, "delete") == 0) { if(strcmp(action, "delete") == 0) {
if(idExists) if(idExists)
@@ -2151,7 +2150,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
} }
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -2238,9 +2237,9 @@ void NukiOpenerWrapper::onTimeControlCommandReceived(const char *value)
} }
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
if(strcmp(action, "delete") == 0) { if(strcmp(action, "delete") == 0) {
if(idExists) if(idExists)
@@ -2377,7 +2376,7 @@ void NukiOpenerWrapper::onTimeControlCommandReceived(const char *value)
} }
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -2471,11 +2470,12 @@ void NukiOpenerWrapper::onAuthCommandReceived(const char *value)
} }
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries) while(retryCount < _nrOfRetries)
{ {
if(strcmp(action, "delete") == 0) { if(strcmp(action, "delete") == 0)
{
if(idExists) if(idExists)
{ {
result = _nukiOpener.deleteAuthorizationEntry(authId); result = _nukiOpener.deleteAuthorizationEntry(authId);
@@ -2835,7 +2835,7 @@ void NukiOpenerWrapper::onAuthCommandReceived(const char *value)
} }
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -2895,15 +2895,15 @@ void NukiOpenerWrapper::notify(Nuki::EventType eventType)
void NukiOpenerWrapper::readConfig() void NukiOpenerWrapper::readConfig()
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
result = _nukiOpener.requestConfig(&_nukiConfig); result = _nukiOpener.requestConfig(&_nukiConfig);
_nukiConfigValid = result == Nuki::CmdResult::Success; _nukiConfigValid = result == Nuki::CmdResult::Success;
if(!_nukiConfigValid) { if(!_nukiConfigValid) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -2921,15 +2921,15 @@ void NukiOpenerWrapper::readConfig()
void NukiOpenerWrapper::readAdvancedConfig() void NukiOpenerWrapper::readAdvancedConfig()
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
result = _nukiOpener.requestAdvancedConfig(&_nukiAdvancedConfig); result = _nukiOpener.requestAdvancedConfig(&_nukiAdvancedConfig);
_nukiAdvancedConfigValid = result == Nuki::CmdResult::Success; _nukiAdvancedConfigValid = result == Nuki::CmdResult::Success;
if(!_nukiAdvancedConfigValid) { if(!_nukiAdvancedConfigValid) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }

View File

@@ -108,7 +108,6 @@ private:
bool _disableNonJSON = false; bool _disableNonJSON = false;
int _nrOfRetries = 0; int _nrOfRetries = 0;
int _retryDelay = 0; int _retryDelay = 0;
int _retryCount = 0;
int _retryConfigCount = 0; int _retryConfigCount = 0;
int _retryLockstateCount = 0; int _retryLockstateCount = 0;
int64_t _nextRetryTs = 0; int64_t _nextRetryTs = 0;

View File

@@ -257,10 +257,10 @@ void NukiWrapper::update()
} }
if(_nextLockAction != (NukiLock::LockAction)0xff) if(_nextLockAction != (NukiLock::LockAction)0xff)
{ {
_retryCount = 0; int retryCount = 0;
Nuki::CmdResult cmdResult; Nuki::CmdResult cmdResult;
while(_retryCount < _nrOfRetries + 1 && cmdResult != Nuki::CmdResult::Success) while(retryCount < _nrOfRetries + 1 && cmdResult != Nuki::CmdResult::Success)
{ {
cmdResult = _nukiLock.lockAction(_nextLockAction, 0, 0); cmdResult = _nukiLock.lockAction(_nextLockAction, 0, 0);
char resultStr[15] = {0}; char resultStr[15] = {0};
@@ -275,15 +275,15 @@ void NukiWrapper::update()
Log->print(F("Lock: Last command failed, retrying after ")); Log->print(F("Lock: Last command failed, retrying after "));
Log->print(_retryDelay); Log->print(_retryDelay);
Log->print(F(" milliseconds. Retry ")); Log->print(F(" milliseconds. Retry "));
Log->print(_retryCount + 1); Log->print(retryCount + 1);
Log->print(" of "); Log->print(" of ");
Log->println(_nrOfRetries); Log->println(_nrOfRetries);
_network->publishRetry(std::to_string(_retryCount + 1)); _network->publishRetry(std::to_string(retryCount + 1));
delay(_retryDelay); delay(_retryDelay);
++_retryCount; ++retryCount;
} }
postponeBleWatchdog(); postponeBleWatchdog();
} }
@@ -292,7 +292,7 @@ void NukiWrapper::update()
{ {
_nextLockAction = (NukiLock::LockAction) 0xff; _nextLockAction = (NukiLock::LockAction) 0xff;
_network->publishRetry("--"); _network->publishRetry("--");
_retryCount = 0; retryCount = 0;
if(!_network->_offConnected) _statusUpdated = true; Log->println(F("Lock: updating status after action")); if(!_network->_offConnected) _statusUpdated = true; Log->println(F("Lock: updating status after action"));
_statusUpdatedTs = ts; _statusUpdatedTs = ts;
if(_intervalLockstate > 10) _nextLockStateUpdateTs = ts + 10 * 1000; if(_intervalLockstate > 10) _nextLockStateUpdateTs = ts + 10 * 1000;
@@ -301,7 +301,7 @@ void NukiWrapper::update()
{ {
Log->println(F("Lock: Maximum number of retries exceeded, aborting.")); Log->println(F("Lock: Maximum number of retries exceeded, aborting."));
_network->publishRetry("failed"); _network->publishRetry("failed");
_retryCount = 0; retryCount = 0;
_nextLockAction = (NukiLock::LockAction) 0xff; _nextLockAction = (NukiLock::LockAction) 0xff;
} }
} }
@@ -443,20 +443,17 @@ void NukiWrapper::unpair()
void NukiWrapper::updateKeyTurnerState() void NukiWrapper::updateKeyTurnerState()
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
Log->println("Querying lock state"); Log->println(F("Querying lock state"));
while(_retryCount < _nrOfRetries + 1) while(result != Nuki::CmdResult::Success && retryCount < _nrOfRetries + 1)
{ {
Log->print(F("Result (attempt ")); Log->print(F("Result (attempt "));
Log->print(_retryCount + 1); Log->print(retryCount + 1);
Log->print("): "); Log->print(F("): "));
result =_nukiLock.requestKeyTurnerState(&_keyTurnerState); result =_nukiLock.requestKeyTurnerState(&_keyTurnerState);
if(result != Nuki::CmdResult::Success) { ++retryCount;
++_retryCount;
}
else break;
} }
char resultStr[15]; char resultStr[15];
@@ -519,19 +516,19 @@ void NukiWrapper::updateKeyTurnerState()
void NukiWrapper::updateBatteryState() void NukiWrapper::updateBatteryState()
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
Log->println("Querying lock battery state"); Log->println("Querying lock battery state");
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
Log->print(F("Result (attempt ")); Log->print(F("Result (attempt "));
Log->print(_retryCount + 1); Log->print(retryCount + 1);
Log->print("): "); Log->print("): ");
result = _nukiLock.requestBatteryReport(&_batteryReport); result = _nukiLock.requestBatteryReport(&_batteryReport);
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -578,14 +575,14 @@ void NukiWrapper::updateConfig()
if(isPinSet()) { if(isPinSet()) {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
Log->println(F("Nuki Lock PIN is set")); Log->println(F("Nuki Lock PIN is set"));
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
result = _nukiLock.verifySecurityPin(); result = _nukiLock.verifySecurityPin();
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -665,14 +662,14 @@ void NukiWrapper::updateAuthData(bool retrieved)
if(!retrieved) if(!retrieved)
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
Log->print(F("Retrieve log entries: ")); Log->print(F("Retrieve log entries: "));
result = _nukiLock.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 1, false); result = _nukiLock.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 1, false);
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -736,14 +733,14 @@ void NukiWrapper::updateKeypad(bool retrieved)
if(!retrieved) if(!retrieved)
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
Log->print(F("Querying lock keypad: ")); Log->print(F("Querying lock keypad: "));
result = _nukiLock.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD)); result = _nukiLock.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD));
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -802,14 +799,14 @@ void NukiWrapper::updateTimeControl(bool retrieved)
if(!retrieved) if(!retrieved)
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
Log->print(F("Querying lock timecontrol: ")); Log->print(F("Querying lock timecontrol: "));
result = _nukiLock.retrieveTimeControlEntries(); result = _nukiLock.retrieveTimeControlEntries();
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -862,15 +859,15 @@ void NukiWrapper::updateAuth(bool retrieved)
if(!retrieved) if(!retrieved)
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries) while(retryCount < _nrOfRetries)
{ {
Log->print(F("Querying lock authorization: ")); Log->print(F("Querying lock authorization: "));
result = _nukiLock.retrieveAuthorizationEntries(0, _preferences->getInt(preference_auth_max_entries, MAX_AUTH)); result = _nukiLock.retrieveAuthorizationEntries(0, _preferences->getInt(preference_auth_max_entries, MAX_AUTH));
delay(250); delay(250);
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -1289,9 +1286,9 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
if((int)_basicLockConfigaclPrefs[i] == 1) if((int)_basicLockConfigaclPrefs[i] == 1)
{ {
cmdResult = Nuki::CmdResult::Error; cmdResult = Nuki::CmdResult::Error;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
if(strcmp(basicKeys[i], "name") == 0) if(strcmp(basicKeys[i], "name") == 0)
{ {
@@ -1469,7 +1466,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
} }
if(cmdResult != Nuki::CmdResult::Success) { if(cmdResult != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -1501,9 +1498,9 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
if((int)_advancedLockConfigaclPrefs[j] == 1) if((int)_advancedLockConfigaclPrefs[j] == 1)
{ {
cmdResult = Nuki::CmdResult::Error; cmdResult = Nuki::CmdResult::Error;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
if(strcmp(advancedKeys[j], "unlockedPositionOffsetDegrees") == 0) if(strcmp(advancedKeys[j], "unlockedPositionOffsetDegrees") == 0)
{ {
@@ -1753,7 +1750,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
} }
if(cmdResult != Nuki::CmdResult::Success) { if(cmdResult != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -1880,9 +1877,9 @@ void NukiWrapper::onKeypadCommandReceived(const char *command, const uint &id, c
int codeInt = code.toInt(); int codeInt = code.toInt();
bool codeValid = codeInt > 100000 && codeInt < 1000000 && (code.indexOf('0') == -1); bool codeValid = codeInt > 100000 && codeInt < 1000000 && (code.indexOf('0') == -1);
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
if(strcmp(command, "add") == 0) if(strcmp(command, "add") == 0)
{ {
@@ -1971,7 +1968,7 @@ void NukiWrapper::onKeypadCommandReceived(const char *command, const uint &id, c
} }
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -2065,9 +2062,9 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
} }
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
if(strcmp(action, "delete") == 0) { if(strcmp(action, "delete") == 0) {
if(idExists) if(idExists)
@@ -2417,7 +2414,7 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
} }
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -2504,9 +2501,9 @@ void NukiWrapper::onTimeControlCommandReceived(const char *value)
} }
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
if(strcmp(action, "delete") == 0) { if(strcmp(action, "delete") == 0) {
if(idExists) if(idExists)
@@ -2645,7 +2642,7 @@ void NukiWrapper::onTimeControlCommandReceived(const char *value)
} }
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -2739,9 +2736,9 @@ void NukiWrapper::onAuthCommandReceived(const char *value)
} }
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries) while(retryCount < _nrOfRetries)
{ {
if(strcmp(action, "delete") == 0) { if(strcmp(action, "delete") == 0) {
if(idExists) if(idExists)
@@ -3106,7 +3103,7 @@ void NukiWrapper::onAuthCommandReceived(const char *value)
} }
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
} }
else break; else break;
} }
@@ -3169,9 +3166,9 @@ void NukiWrapper::notify(Nuki::EventType eventType)
void NukiWrapper::readConfig() void NukiWrapper::readConfig()
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
result = _nukiLock.requestConfig(&_nukiConfig); result = _nukiLock.requestConfig(&_nukiConfig);
_nukiConfigValid = result == Nuki::CmdResult::Success; _nukiConfigValid = result == Nuki::CmdResult::Success;
@@ -3182,7 +3179,7 @@ void NukiWrapper::readConfig()
Log->println(resultStr); Log->println(resultStr);
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
Log->println("Failed to retrieve lock config, retrying in 1s"); Log->println("Failed to retrieve lock config, retrying in 1s");
delay(1000); delay(1000);
} }
@@ -3193,9 +3190,9 @@ void NukiWrapper::readConfig()
void NukiWrapper::readAdvancedConfig() void NukiWrapper::readAdvancedConfig()
{ {
Nuki::CmdResult result = (Nuki::CmdResult)-1; Nuki::CmdResult result = (Nuki::CmdResult)-1;
_retryCount = 0; int retryCount = 0;
while(_retryCount < _nrOfRetries + 1) while(retryCount < _nrOfRetries + 1)
{ {
result = _nukiLock.requestAdvancedConfig(&_nukiAdvancedConfig); result = _nukiLock.requestAdvancedConfig(&_nukiAdvancedConfig);
_nukiAdvancedConfigValid = result == Nuki::CmdResult::Success; _nukiAdvancedConfigValid = result == Nuki::CmdResult::Success;
@@ -3206,7 +3203,7 @@ void NukiWrapper::readAdvancedConfig()
Log->println(resultStr); Log->println(resultStr);
if(result != Nuki::CmdResult::Success) { if(result != Nuki::CmdResult::Success) {
++_retryCount; ++retryCount;
Log->println("Failed to retrieve lock advanced config, retrying in 1s"); Log->println("Failed to retrieve lock advanced config, retrying in 1s");
delay(1000); delay(1000);
} }

View File

@@ -130,7 +130,6 @@ private:
uint _maxAuthEntryCount = 0; uint _maxAuthEntryCount = 0;
int _nrOfRetries = 0; int _nrOfRetries = 0;
int _retryDelay = 0; int _retryDelay = 0;
int _retryCount = 0;
int _retryConfigCount = 0; int _retryConfigCount = 0;
int _retryLockstateCount = 0; int _retryLockstateCount = 0;
int _rssiPublishInterval = 0; int _rssiPublishInterval = 0;

View File

@@ -4,6 +4,9 @@
#include "Logger.h" #include "Logger.h"
#include "RestartReason.h" #include "RestartReason.h"
#include <esp_task_wdt.h> #include <esp_task_wdt.h>
#ifdef CONFIG_SOC_SPIRAM_SUPPORTED
#include <esp_psram.h>
#endif
#ifndef CONFIG_IDF_TARGET_ESP32H2 #ifndef CONFIG_IDF_TARGET_ESP32H2
#include <esp_wifi.h> #include <esp_wifi.h>
#endif #endif
@@ -3128,7 +3131,6 @@ esp_err_t WebCfgServer::buildAccLvlHtml(PsychicRequest *request)
response.print("</table><br>"); response.print("</table><br>");
response.print("<br><input type=\"submit\" name=\"submit\" value=\"Save\">"); response.print("<br><input type=\"submit\" name=\"submit\" value=\"Save\">");
} }
response.print("</form>"); response.print("</form>");
response.print("</body></html>"); response.print("</body></html>");
return response.endSend(); return response.endSend();
@@ -3265,8 +3267,28 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request)
response.print(getRestartReason()); response.print(getRestartReason());
response.print("\nLast restart reason ESP: "); response.print("\nLast restart reason ESP: ");
response.print(getEspRestartReason()); response.print(getEspRestartReason());
response.print("\nFree heap: "); response.print("\nFree internal heap: ");
response.print(esp_get_free_heap_size()); response.print(ESP.getFreeHeap());
response.print("\nTotal internal heap: ");
response.print(ESP.getHeapSize());
#ifdef CONFIG_SOC_SPIRAM_SUPPORTED
if(esp_psram_get_size() > 0)
{
response.print("\nPSRAM Available: Yes");
response.print("\nTotal PSRAM: ");
response.print(esp_psram_get_size());
response.print("\nFree PSRAM: ");
response.print((esp_get_free_heap_size() - ESP.getFreeHeap()));
response.print("\nTotal free heap: ");
response.print(esp_get_free_heap_size());
}
else
{
response.print("\nPSRAM Available: No");
}
#else
response.print("\nPSRAM Available: No");
#endif
response.print("\nNetwork task stack high watermark: "); response.print("\nNetwork task stack high watermark: ");
response.print(uxTaskGetStackHighWaterMark(networkTaskHandle)); response.print(uxTaskGetStackHighWaterMark(networkTaskHandle));
response.print("\nNuki task stack high watermark: "); response.print("\nNuki task stack high watermark: ");

View File

@@ -520,6 +520,13 @@ void setup()
if(doOta) setupTasks(true); if(doOta) setupTasks(true);
else setupTasks(false); else setupTasks(false);
#ifdef DEBUG_NUKIHUB
Log->print("Task Name\tStatus\tPrio\tHWM\tTask\tAffinity\n");
char stats_buffer[1024];
vTaskList(stats_buffer);
Log->println(stats_buffer);
#endif
} }
void loop() void loop()

View File

@@ -8,6 +8,8 @@ def get_board_name(env):
board = env.get('BOARD_MCU') board = env.get('BOARD_MCU')
if env.get('BOARD') == 'esp32-solo1': if env.get('BOARD') == 'esp32-solo1':
board = env.get('BOARD').replace('-', '') board = env.get('BOARD').replace('-', '')
elif env.get('BOARD') == 'nuki-esp32-s3-oct':
board = 'esp32s3oct'
return board return board
def create_target_dir(env): def create_target_dir(env):

View File

@@ -66,6 +66,8 @@ board = esp32dev
extra_scripts = extra_scripts =
pre:pio_package_pre.py pre:pio_package_pre.py
post:pio_package_post.py post:pio_package_post.py
board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32"
[env:updater_esp32-c3] [env:updater_esp32-c3]
extends = env:updater_esp32 extends = env:updater_esp32
@@ -74,6 +76,14 @@ board = esp32-c3-devkitc-02
[env:updater_esp32-s3] [env:updater_esp32-s3]
extends = env:updater_esp32 extends = env:updater_esp32
board = nuki-esp32-s3 board = nuki-esp32-s3
board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32-s3"
[env:updater_esp32-s3-oct]
extends = env:updater_esp32
board = nuki-esp32-s3-oct
board_build.cmake_extra_args =
-DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.esp32-s3-oct"
[env:updater_esp32-c6] [env:updater_esp32-c6]
extends = env:updater_esp32 extends = env:updater_esp32

View File

@@ -0,0 +1,6 @@
CONFIG_SPIRAM=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768

View File

@@ -0,0 +1,6 @@
CONFIG_SPIRAM=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768

View File

@@ -0,0 +1,7 @@
CONFIG_SPIRAM=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768
CONFIG_SPIRAM_MODE_OCT=y

View File

@@ -1 +1,7 @@
CONFIG_FREERTOS_UNICORE=y CONFIG_FREERTOS_UNICORE=y
CONFIG_SPIRAM=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=50768