mirror of
https://github.com/esphome/esphome.git
synced 2025-11-18 07:45:56 +00:00
[wifi] Skip redundant setter calls for default values
This commit is contained in:
@@ -479,11 +479,14 @@ async def to_code(config):
|
|||||||
cg.add(var.set_min_auth_mode(config[CONF_MIN_AUTH_MODE]))
|
cg.add(var.set_min_auth_mode(config[CONF_MIN_AUTH_MODE]))
|
||||||
if config[CONF_FAST_CONNECT]:
|
if config[CONF_FAST_CONNECT]:
|
||||||
cg.add_define("USE_WIFI_FAST_CONNECT")
|
cg.add_define("USE_WIFI_FAST_CONNECT")
|
||||||
cg.add(var.set_passive_scan(config[CONF_PASSIVE_SCAN]))
|
# passive_scan defaults to false in C++ - only set if true
|
||||||
|
if config[CONF_PASSIVE_SCAN]:
|
||||||
|
cg.add(var.set_passive_scan(True))
|
||||||
if CONF_OUTPUT_POWER in config:
|
if CONF_OUTPUT_POWER in config:
|
||||||
cg.add(var.set_output_power(config[CONF_OUTPUT_POWER]))
|
cg.add(var.set_output_power(config[CONF_OUTPUT_POWER]))
|
||||||
|
# enable_on_boot defaults to true in C++ - only set if false
|
||||||
cg.add(var.set_enable_on_boot(config[CONF_ENABLE_ON_BOOT]))
|
if not config[CONF_ENABLE_ON_BOOT]:
|
||||||
|
cg.add(var.set_enable_on_boot(False))
|
||||||
|
|
||||||
if CORE.is_esp8266:
|
if CORE.is_esp8266:
|
||||||
cg.add_library("ESP8266WiFi", None)
|
cg.add_library("ESP8266WiFi", None)
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ class WiFiComponent : public Component {
|
|||||||
bool btm_{false};
|
bool btm_{false};
|
||||||
bool rrm_{false};
|
bool rrm_{false};
|
||||||
#endif
|
#endif
|
||||||
bool enable_on_boot_;
|
bool enable_on_boot_{true};
|
||||||
bool got_ipv4_address_{false};
|
bool got_ipv4_address_{false};
|
||||||
bool keep_scan_results_{false};
|
bool keep_scan_results_{false};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user