mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
Merge remote-tracking branch 'origin/templatable-value-specialize' into test_merge_to_beta_again
This commit is contained in:
@@ -378,7 +378,8 @@ async def esp32_ble_tracker_start_scan_action_to_code(
|
||||
):
|
||||
paren = await cg.get_variable(config[CONF_ID])
|
||||
var = cg.new_Pvariable(action_id, template_arg, paren)
|
||||
cg.add(var.set_continuous(config[CONF_CONTINUOUS]))
|
||||
template_ = await cg.templatable(config[CONF_CONTINUOUS], args, cg.bool_)
|
||||
cg.add(var.set_continuous(template_))
|
||||
return var
|
||||
|
||||
|
||||
|
||||
@@ -823,9 +823,11 @@ async def templatable(
|
||||
"""Generate code for a templatable config option.
|
||||
|
||||
If `value` is a templated value, the lambda expression is returned.
|
||||
For std::string output, constants are returned as-is (with PROGMEM wrapping).
|
||||
For std::string output, constants are returned as-is (with PROGMEM wrapping),
|
||||
using the std::string-specific TemplatableValue specialization.
|
||||
For all other output types, constants are wrapped in stateless lambdas
|
||||
so that TemplatableValue can store them as function pointers.
|
||||
so that TemplatableFn-backed macro-generated fields can store them as
|
||||
function pointers.
|
||||
|
||||
:param value: The value to process.
|
||||
:param args: The arguments for the lambda expression.
|
||||
|
||||
Reference in New Issue
Block a user