mirror of
https://github.com/esphome/esphome.git
synced 2025-10-12 23:03:46 +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):
|
if cg.is_template(txt_value):
|
||||||
# It's a lambda - evaluate and store using helper
|
# It's a lambda - evaluate and store using helper
|
||||||
templated_value = await cg.templatable(txt_value, [], cg.std_string)
|
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(
|
txt_records.append(
|
||||||
cg.RawExpression(
|
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:
|
else:
|
||||||
|
@@ -132,9 +132,9 @@ void MDNSComponent::compile_records_() {
|
|||||||
|
|
||||||
#ifdef USE_API_NOISE
|
#ifdef USE_API_NOISE
|
||||||
MDNS_STATIC_CONST_CHAR(NOISE_ENCRYPTION, "Noise_NNpsk0_25519_ChaChaPoly_SHA256");
|
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
|
bool has_psk = api::global_api_server->get_noise_ctx()->has_psk();
|
||||||
: TXT_API_ENCRYPTION_SUPPORTED),
|
const char *encryption_key = has_psk ? TXT_API_ENCRYPTION : TXT_API_ENCRYPTION_SUPPORTED;
|
||||||
MDNS_STR(NOISE_ENCRYPTION)});
|
txt_records.push_back({MDNS_STR(encryption_key), MDNS_STR(NOISE_ENCRYPTION)});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ESPHOME_PROJECT_NAME
|
#ifdef ESPHOME_PROJECT_NAME
|
||||||
|
@@ -84,6 +84,7 @@
|
|||||||
#define USE_LVGL_TOUCHSCREEN
|
#define USE_LVGL_TOUCHSCREEN
|
||||||
#define USE_MDNS
|
#define USE_MDNS
|
||||||
#define MDNS_SERVICE_COUNT 3
|
#define MDNS_SERVICE_COUNT 3
|
||||||
|
#define MDNS_DYNAMIC_TXT_COUNT 3
|
||||||
#define USE_MEDIA_PLAYER
|
#define USE_MEDIA_PLAYER
|
||||||
#define USE_NEXTION_TFT_UPLOAD
|
#define USE_NEXTION_TFT_UPLOAD
|
||||||
#define USE_NUMBER
|
#define USE_NUMBER
|
||||||
|
@@ -149,8 +149,14 @@ template<typename T, size_t N> class StaticVector {
|
|||||||
T &operator[](size_t i) { return data_[i]; }
|
T &operator[](size_t i) { return data_[i]; }
|
||||||
const T &operator[](size_t i) const { return data_[i]; }
|
const T &operator[](size_t i) const { return data_[i]; }
|
||||||
|
|
||||||
T &back() { return data_[count_ - 1]; }
|
T &back() {
|
||||||
const T &back() const { return data_[count_ - 1]; }
|
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
|
// For range-based for loops
|
||||||
iterator begin() { return data_.begin(); }
|
iterator begin() { return data_.begin(); }
|
||||||
|
Reference in New Issue
Block a user