This commit is contained in:
iranl
2025-06-09 21:58:55 +02:00
parent e9412e90e9
commit fc1ee70a2c
14 changed files with 162 additions and 49 deletions

View File

@@ -5,12 +5,27 @@
#define NUKI_HUB_VERSION "9.11"
#define NUKI_HUB_VERSION_INT (uint32_t)911
#define NUKI_HUB_BUILD "unknownbuildnr"
#define NUKI_HUB_DATE "2025-05-05"
#define NUKI_HUB_DATE "2025-06-09"
#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"
#if defined(CONFIG_IDF_TARGET_ESP32C3)
#if defined(CONFIG_IDF_TARGET_ESP32P4)
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32p4.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32p4.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32p4.bin"
#define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_updater_esp32p4.bin"
#define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_esp32p4.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_updater_esp32p4.bin"
#define GITHUB_LATEST_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/nuki_hub_esp32p4.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/nuki_hub_updater_esp32p4.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_esp32p4.bin"
#define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32p4.bin"
#define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32p4.bin"
#define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32p4.bin"
#define NUKI_HUB_HW (char*)"ESP32-P4"
#define BOOT_BUTTON_GPIO (gpio_num_t)35
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32c3.bin"
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32c3.bin"
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32c3.bin"

View File

@@ -162,6 +162,7 @@ void NukiWrapper::readSettings()
_forceKeypad = _preferences->getBool(preference_lock_force_keypad, false);
_forceId = _preferences->getBool(preference_lock_force_id, false);
_isUltra = _preferences->getBool(preference_lock_gemini_enabled, false);
_isDebugging = _preferences->getBool(preference_debug_hex_data, false);
_preferences->getBytes(preference_conf_lock_basic_acl, &_basicLockConfigaclPrefs, sizeof(_basicLockConfigaclPrefs));
_preferences->getBytes(preference_conf_lock_advanced_acl, &_advancedLockConfigaclPrefs, sizeof(_advancedLockConfigaclPrefs));
@@ -360,7 +361,10 @@ void NukiWrapper::update(bool reboot)
Log->println("Updating Lock config based on timer or query");
_nextConfigUpdateTs = ts + _intervalConfig * 1000;
updateConfig();
updateDebug();
if(_isDebugging)
{
updateDebug();
}
}
if(_waitAuthLogUpdateTs != 0 && ts > _waitAuthLogUpdateTs)
{

View File

@@ -141,6 +141,7 @@ private:
bool _keypadEnabled = false;
bool _forceId = false;
bool _isUltra = false;
bool _isDebugging = false;
uint _maxKeypadCodeCount = 0;
uint _maxTimeControlEntryCount = 0;
uint _maxAuthEntryCount = 0;

View File

@@ -6977,6 +6977,9 @@ const std::vector<std::pair<String, String>> WebCfgServer::getNetworkDetectionOp
options.push_back(std::make_pair("9", "ETH01-Evo"));
options.push_back(std::make_pair("13", "Waveshare ESP32-S3-ETH / ESP32-S3-ETH-POE"));
options.push_back(std::make_pair("14", "LilyGO T-ETH-Lite-ESP32S3"));
options.push_back(std::make_pair("15", "Waveshare ESP32-P4-NANO"));
options.push_back(std::make_pair("16", "Waveshare ESP32-P4-Module-DEV-KIT"));
options.push_back(std::make_pair("17", "ESP32-P4-Function-EV-Board"));
options.push_back(std::make_pair("11", "Custom LAN module"));
return options;

View File

@@ -15,5 +15,8 @@ enum class NetworkDeviceType
ETH01_Evo,
Waveshare_ESP32_S3_ETH,
LilyGO_T_ETH_Lite_S3,
Waveshare_ESP32_P4_NANO,
Waveshare_ESP32_P4_Module_DEV_KIT,
ESP32_P4_Function_EV_Board,
CUSTOM
};

View File

@@ -20,29 +20,39 @@ const String WifiDevice::deviceName() const
void WifiDevice::initialize()
{
ssid = _preferences->getString(preference_wifi_ssid, "");
ssid.trim();
pass = _preferences->getString(preference_wifi_pass, "");
pass.trim();
WiFi.setHostname(_hostname.c_str());
if (_hostname != "fakep4forhosted") {
ssid = _preferences->getString(preference_wifi_ssid, "");
ssid.trim();
pass = _preferences->getString(preference_wifi_pass, "");
pass.trim();
WiFi.setHostname(_hostname.c_str());
WiFi.onEvent([&](WiFiEvent_t event, WiFiEventInfo_t info)
{
onWifiEvent(event, info);
});
WiFi.onEvent([&](WiFiEvent_t event, WiFiEventInfo_t info)
{
onWifiEvent(event, info);
});
if(isWifiConfigured())
{
Log->println(String("Attempting to connect to saved SSID ") + String(ssid));
_openAP = false;
if(isWifiConfigured())
{
Log->println(String("Attempting to connect to saved SSID ") + String(ssid));
_openAP = false;
}
else
{
Log->println("No SSID or Wifi password saved, opening AP");
_openAP = true;
}
scan(false, true);
}
else
{
Log->println("No SSID or Wifi password saved, opening AP");
_openAP = true;
WiFi.disconnect(true);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(5000);
Log->println("Dummy WiFi device for Hosted on P4 done");
}
scan(false, true);
return;
}
@@ -177,7 +187,7 @@ bool WifiDevice::connect()
}
return false;
}
}
return true;
}

View File

@@ -11,6 +11,9 @@
NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDeviceType, String hostname, Preferences *preferences, IPConfiguration *ipConfiguration)
{
NetworkDevice* device = nullptr;
#if defined(CONFIG_IDF_TARGET_ESP32P4)
bool fakedevice = true;
#endif
switch (networkDeviceType)
{
@@ -91,7 +94,35 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
ETH_PHY_SPI_MOSI_ETHLITES3_W5500,
ETH_PHY_W5500);
break;
#if defined(CONFIG_IDF_TARGET_ESP32P4)
case NetworkDeviceType::Waveshare_ESP32_P4_NANO:
device = new EthernetDevice(hostname, preferences, ipConfiguration, "Waveshare ESP32-P4-NANO",
1,
51,
31,
52,
ETH_PHY_IP101,
ETH_CLOCK_GPIO0_IN);
break;
case NetworkDeviceType::Waveshare_ESP32_P4_Module_DEV_KIT:
device = new EthernetDevice(hostname, preferences, ipConfiguration, "Waveshare ESP32-P4-Module-DEV-KIT",
1,
51,
31,
52,
ETH_PHY_IP101,
ETH_CLOCK_GPIO0_IN);
break;
case NetworkDeviceType::ESP32_P4_Function_EV_Board:
device = new EthernetDevice(hostname, preferences, ipConfiguration, "ESP32-P4-Function-EV-Board",
1,
51,
31,
52,
ETH_PHY_IP101,
ETH_CLOCK_GPIO0_IN);
break;
#endif
case NetworkDeviceType::CUSTOM:
{
int custPHY = preferences->getInt(preference_network_custom_phy, 0);
@@ -153,6 +184,9 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
else
{
device = new WifiDevice(hostname, preferences, ipConfiguration);
#if defined(CONFIG_IDF_TARGET_ESP32P4)
fakedevice = false;
#endif
}
#endif
}
@@ -183,9 +217,15 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
#ifndef CONFIG_IDF_TARGET_ESP32H2
case NetworkDeviceType::WiFi:
device = new WifiDevice(hostname, preferences, ipConfiguration);
#if defined(CONFIG_IDF_TARGET_ESP32P4)
fakedevice = false;
#endif
break;
default:
device = new WifiDevice(hostname, preferences, ipConfiguration);
#if defined(CONFIG_IDF_TARGET_ESP32P4)
fakedevice = false;
#endif
break;
#else
default:
@@ -202,5 +242,16 @@ NetworkDevice *NetworkDeviceInstantiator::Create(NetworkDeviceType networkDevice
#endif
}
#if defined(CONFIG_IDF_TARGET_ESP32P4)
if (fakedevice) {
Log->println("Create dummy WiFi device for Hosted on P4");
NetworkDevice* device2 = nullptr;
device2 = new WifiDevice("fakep4forhosted", preferences, ipConfiguration);
device2->initialize();
delete device2;
device2 = NULL;
}
#endif
return device;
}

View File

@@ -38,6 +38,12 @@ NetworkDeviceType NetworkUtil::GetDeviceTypeFromPreference(int hardwareDetect, i
return NetworkDeviceType::Waveshare_ESP32_S3_ETH;
case 14:
return NetworkDeviceType::LilyGO_T_ETH_Lite_S3;
case 15:
return NetworkDeviceType::Waveshare_ESP32_P4_NANO;
case 16:
return NetworkDeviceType::Waveshare_ESP32_P4_Module_DEV_KIT;
case 17:
return NetworkDeviceType::ESP32_P4_Function_EV_Board;
default:
Log->println("Unknown hardware selected, falling back to Wi-Fi.");
return NetworkDeviceType::WiFi;
@@ -101,7 +107,7 @@ eth_clock_mode_t NetworkUtil::GetCustomClock(int custCLKpref)
case 0:
return ETH_CLOCK_GPIO0_IN;
break;
case 1:
case 1:
return ETH_CLOCK_GPIO0_OUT;
break;
case 2: