feat: integrate MCP and ES3C28P audio support with upstream compatibility updates
This commit is contained in:
@@ -107,6 +107,23 @@ static bool decrypt(const std::string& ssidInput, std::string& ssidOutput) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Strip PKCS#7 padding
|
||||
if (result_length > 0) {
|
||||
uint8_t pad_val = result[result_length - 1];
|
||||
if (pad_val >= 1 && pad_val <= 16 && pad_val <= result_length) {
|
||||
bool valid_padding = true;
|
||||
for (size_t i = result_length - pad_val; i < result_length; ++i) {
|
||||
if (result[i] != pad_val) {
|
||||
valid_padding = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (valid_padding) {
|
||||
result[result_length - pad_val] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ssidOutput = reinterpret_cast<char*>(result);
|
||||
free(result);
|
||||
return true;
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#include <Tactility/service/wifi/WifiSettings.h>
|
||||
|
||||
#include <esp_wifi_default.h>
|
||||
#include <esp_mac.h>
|
||||
#include <esp_netif.h>
|
||||
#include <mdns.h>
|
||||
#include <lwip/esp_netif_net_stack.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <atomic>
|
||||
@@ -543,6 +546,28 @@ static void dispatchEnable(std::shared_ptr<Wifi> wifi) {
|
||||
}
|
||||
wifi->netif = esp_netif_create_default_wifi_sta();
|
||||
|
||||
if (wifi->netif != nullptr) {
|
||||
uint8_t mac[6];
|
||||
char hostname[32];
|
||||
if (esp_read_mac(mac, ESP_MAC_WIFI_STA) == ESP_OK) {
|
||||
snprintf(hostname, sizeof(hostname), "kidsOS-%02X%02X", mac[4], mac[5]);
|
||||
} else {
|
||||
strncpy(hostname, "kidsOS", sizeof(hostname));
|
||||
}
|
||||
LOGGER.info("Setting DHCP Hostname to '{}'", hostname);
|
||||
esp_netif_set_hostname(wifi->netif, hostname);
|
||||
|
||||
// Initialize mDNS
|
||||
esp_err_t mdns_err = mdns_init();
|
||||
if (mdns_err == ESP_OK) {
|
||||
LOGGER.info("mDNS initialized, setting hostname to '{}.local'", hostname);
|
||||
mdns_hostname_set(hostname);
|
||||
mdns_instance_name_set("kidsOS Tactility Device");
|
||||
} else {
|
||||
LOGGER.error("Failed to initialize mDNS: {}", (int)mdns_err);
|
||||
}
|
||||
}
|
||||
|
||||
// Warning: this is the memory-intensive operation
|
||||
// It uses over 117kB of RAM with default settings for S3 on IDF v5.1.2
|
||||
wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT();
|
||||
|
||||
Reference in New Issue
Block a user