Allow BLE transmit power up to 20 on newer ESP32 models

This commit is contained in:
iranl
2025-01-28 15:36:37 +01:00
parent c436757c23
commit 0b96ec6b2c
4 changed files with 55 additions and 1 deletions

View File

@@ -285,7 +285,7 @@ In a browser navigate to the IP address assigned to the ESP32.
- Lock: Nuki Bridge is running alongside Nuki Hub: Enable to allow Nuki Hub to co-exist with a Nuki Bridge by registering Nuki Hub as an (smartphone) app instead of a bridge. Changing this setting will require re-pairing. Enabling this setting is strongly discouraged as described in the "[Pairing with a Nuki Lock or Opener](#pairing-with-a-nuki-lock-or-opener)" section of this README, ***unless when used in [Hybrid mode](/HYBRID.md) (Official MQTT / Nuki Hub co-existance)*** - Lock: Nuki Bridge is running alongside Nuki Hub: Enable to allow Nuki Hub to co-exist with a Nuki Bridge by registering Nuki Hub as an (smartphone) app instead of a bridge. Changing this setting will require re-pairing. Enabling this setting is strongly discouraged as described in the "[Pairing with a Nuki Lock or Opener](#pairing-with-a-nuki-lock-or-opener)" section of this README, ***unless when used in [Hybrid mode](/HYBRID.md) (Official MQTT / Nuki Hub co-existance)***
- Opener: Nuki Bridge is running alongside Nuki Hub: Enable to allow Nuki Hub to co-exist with a Nuki Bridge by registering Nuki Hub as an (smartphone) app instead of a bridge. Changing this setting will require re-pairing. Enabling this setting is strongly discouraged as described in the "[Pairing with a Nuki Lock or Opener](#pairing-with-a-nuki-lock-or-opener)" section of this README - Opener: Nuki Bridge is running alongside Nuki Hub: Enable to allow Nuki Hub to co-exist with a Nuki Bridge by registering Nuki Hub as an (smartphone) app instead of a bridge. Changing this setting will require re-pairing. Enabling this setting is strongly discouraged as described in the "[Pairing with a Nuki Lock or Opener](#pairing-with-a-nuki-lock-or-opener)" section of this README
- Restart if bluetooth beacons not received: Set to a positive integer to restart the Nuki Hub after the set amount of seconds has passed without receiving a bluetooth beacon from the Nuki device, set to -1 to disable, default 60. Because the bluetooth stack of the ESP32 can silently fail it is not recommended to disable this setting. - Restart if bluetooth beacons not received: Set to a positive integer to restart the Nuki Hub after the set amount of seconds has passed without receiving a bluetooth beacon from the Nuki device, set to -1 to disable, default 60. Because the bluetooth stack of the ESP32 can silently fail it is not recommended to disable this setting.
- BLE transmit power in dB: Set to a integer between -12 and 9 to set the Bluetooth transmit power, default 9. - BLE transmit power in dB: Set to a integer between -12 and 9 (ESP32) or -12 and 20 (All newer ESP32 variants) to set the Bluetooth transmit power, default 9.
- Update Nuki Hub and Lock/Opener time using NTP: Enable to update the ESP32 time and Nuki Lock and/or Nuki Opener time every 12 hours using a NTP time server. Updating the Nuki device time requires the Nuki security code / PIN to be set, see "[Nuki Lock PIN / Nuki Opener PIN](#nuki-lock-pin--nuki-opener-pin)" below. - Update Nuki Hub and Lock/Opener time using NTP: Enable to update the ESP32 time and Nuki Lock and/or Nuki Opener time every 12 hours using a NTP time server. Updating the Nuki device time requires the Nuki security code / PIN to be set, see "[Nuki Lock PIN / Nuki Opener PIN](#nuki-lock-pin--nuki-opener-pin)" below.
- NTP server: Set to the NTP server you want to use, defaults to "pool.ntp.org". If DHCP is used and NTP servers are provided using DHCP these will take precedence over the specified NTP server. - NTP server: Set to the NTP server you want to use, defaults to "pool.ntp.org". If DHCP is used and NTP servers are provided using DHCP these will take precedence over the specified NTP server.

View File

@@ -76,7 +76,30 @@ void NukiOpenerWrapper::readSettings()
if(pwrLvl >= 9) if(pwrLvl >= 9)
{ {
#if defined(CONFIG_IDF_TARGET_ESP32)
powerLevel = ESP_PWR_LVL_P9; powerLevel = ESP_PWR_LVL_P9;
#else
if(pwrLvl >= 20)
{
powerLevel = ESP_PWR_LVL_P20;
}
else if(pwrLvl >= 18)
{
powerLevel = ESP_PWR_LVL_P18;
}
else if(pwrLvl >= 15)
{
powerLevel = ESP_PWR_LVL_P15;
}
else if(pwrLvl >= 12)
{
powerLevel = ESP_PWR_LVL_P12;
}
else
{
powerLevel = ESP_PWR_LVL_P9;
}
#endif
} }
else if(pwrLvl >= 6) else if(pwrLvl >= 6)
{ {

View File

@@ -82,7 +82,30 @@ void NukiWrapper::readSettings()
if(pwrLvl >= 9) if(pwrLvl >= 9)
{ {
#if defined(CONFIG_IDF_TARGET_ESP32)
powerLevel = ESP_PWR_LVL_P9; powerLevel = ESP_PWR_LVL_P9;
#else
if(pwrLvl >= 20)
{
powerLevel = ESP_PWR_LVL_P20;
}
else if(pwrLvl >= 18)
{
powerLevel = ESP_PWR_LVL_P18;
}
else if(pwrLvl >= 15)
{
powerLevel = ESP_PWR_LVL_P15;
}
else if(pwrLvl >= 12)
{
powerLevel = ESP_PWR_LVL_P12;
}
else
{
powerLevel = ESP_PWR_LVL_P9;
}
#endif
} }
else if(pwrLvl >= 6) else if(pwrLvl >= 6)
{ {

View File

@@ -3363,7 +3363,11 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
} }
else if(key == "TXPWR") else if(key == "TXPWR")
{ {
#if defined(CONFIG_IDF_TARGET_ESP32)
if(value.toInt() >= -12 && value.toInt() <= 9) if(value.toInt() >= -12 && value.toInt() <= 9)
#else
if(value.toInt() >= -12 && value.toInt() <= 20)
#endif
{ {
if(_preferences->getInt(preference_ble_tx_power, 9) != value.toInt()) if(_preferences->getInt(preference_ble_tx_power, 9) != value.toInt())
{ {
@@ -5848,7 +5852,11 @@ esp_err_t WebCfgServer::buildNukiConfigHtml(PsychicRequest *request, PsychicResp
printCheckBox(&response, "REGAPPOPN", "Opener: Nuki Bridge is running alongside Nuki Hub (needs re-pairing if changed)", _preferences->getBool(preference_register_opener_as_app), ""); printCheckBox(&response, "REGAPPOPN", "Opener: Nuki Bridge is running alongside Nuki Hub (needs re-pairing if changed)", _preferences->getBool(preference_register_opener_as_app), "");
} }
printInputField(&response, "RSBC", "Restart if bluetooth beacons not received (seconds; -1 to disable)", _preferences->getInt(preference_restart_ble_beacon_lost), 10, ""); printInputField(&response, "RSBC", "Restart if bluetooth beacons not received (seconds; -1 to disable)", _preferences->getInt(preference_restart_ble_beacon_lost), 10, "");
#if defined(CONFIG_IDF_TARGET_ESP32)
printInputField(&response, "TXPWR", "BLE transmit power in dB (minimum -12, maximum 9)", _preferences->getInt(preference_ble_tx_power, 9), 10, ""); printInputField(&response, "TXPWR", "BLE transmit power in dB (minimum -12, maximum 9)", _preferences->getInt(preference_ble_tx_power, 9), 10, "");
#else
printInputField(&response, "TXPWR", "BLE transmit power in dB (minimum -12, maximum 20)", _preferences->getInt(preference_ble_tx_power, 9), 10, "");
#endif
printCheckBox(&response, "UPTIME", "Update Nuki Hub and Lock/Opener time using NTP", _preferences->getBool(preference_update_time, false), ""); printCheckBox(&response, "UPTIME", "Update Nuki Hub and Lock/Opener time using NTP", _preferences->getBool(preference_update_time, false), "");
printInputField(&response, "TIMESRV", "NTP server", _preferences->getString(preference_time_server, "pool.ntp.org").c_str(), 255, ""); printInputField(&response, "TIMESRV", "NTP server", _preferences->getString(preference_time_server, "pool.ntp.org").c_str(), 255, "");