mirror of
https://github.com/esphome/esphome.git
synced 2025-10-12 14:53:49 +01:00
Merge branch 'mdns_value_flash' into integration
This commit is contained in:
@@ -126,9 +126,11 @@ async def to_code(config):
|
||||
if cg.is_template(txt_value):
|
||||
# It's a lambda - evaluate and store using helper
|
||||
templated_value = await cg.templatable(txt_value, [], cg.std_string)
|
||||
safe_key = cg.safe_exp(txt_key)
|
||||
dynamic_call = f"{var}->add_dynamic_txt_value(({templated_value})())"
|
||||
txt_records.append(
|
||||
cg.RawExpression(
|
||||
f"{{MDNS_STR({cg.safe_exp(txt_key)}), MDNS_STR({var}->add_dynamic_txt_value(({templated_value})()))}}"
|
||||
f"{{MDNS_STR({safe_key}), MDNS_STR({dynamic_call})}}"
|
||||
)
|
||||
)
|
||||
else:
|
||||
|
@@ -132,9 +132,9 @@ void MDNSComponent::compile_records_() {
|
||||
|
||||
#ifdef USE_API_NOISE
|
||||
MDNS_STATIC_CONST_CHAR(NOISE_ENCRYPTION, "Noise_NNpsk0_25519_ChaChaPoly_SHA256");
|
||||
txt_records.push_back({MDNS_STR(api::global_api_server->get_noise_ctx()->has_psk() ? TXT_API_ENCRYPTION
|
||||
: TXT_API_ENCRYPTION_SUPPORTED),
|
||||
MDNS_STR(NOISE_ENCRYPTION)});
|
||||
bool has_psk = api::global_api_server->get_noise_ctx()->has_psk();
|
||||
const char *encryption_key = has_psk ? TXT_API_ENCRYPTION : TXT_API_ENCRYPTION_SUPPORTED;
|
||||
txt_records.push_back({MDNS_STR(encryption_key), MDNS_STR(NOISE_ENCRYPTION)});
|
||||
#endif
|
||||
|
||||
#ifdef ESPHOME_PROJECT_NAME
|
||||
|
@@ -84,6 +84,7 @@
|
||||
#define USE_LVGL_TOUCHSCREEN
|
||||
#define USE_MDNS
|
||||
#define MDNS_SERVICE_COUNT 3
|
||||
#define MDNS_DYNAMIC_TXT_COUNT 3
|
||||
#define USE_MEDIA_PLAYER
|
||||
#define USE_NEXTION_TFT_UPLOAD
|
||||
#define USE_NUMBER
|
||||
|
@@ -149,8 +149,14 @@ template<typename T, size_t N> class StaticVector {
|
||||
T &operator[](size_t i) { return data_[i]; }
|
||||
const T &operator[](size_t i) const { return data_[i]; }
|
||||
|
||||
T &back() { return data_[count_ - 1]; }
|
||||
const T &back() const { return data_[count_ - 1]; }
|
||||
T &back() {
|
||||
assert(count_ > 0 && "back() called on empty StaticVector");
|
||||
return data_[count_ - 1];
|
||||
}
|
||||
const T &back() const {
|
||||
assert(count_ > 0 && "back() called on empty StaticVector");
|
||||
return data_[count_ - 1];
|
||||
}
|
||||
|
||||
// For range-based for loops
|
||||
iterator begin() { return data_.begin(); }
|
||||
|
Reference in New Issue
Block a user