1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-12 08:12:22 +01:00

Generate ARDUINO_VERSION_CODE in Python code (#3101)

Co-authored-by: Otto winter <otto@otto-winter.com>
This commit is contained in:
Oxan van Leeuwen
2022-01-24 10:34:34 +01:00
committed by GitHub
parent f2d677d51a
commit cdda648360
15 changed files with 71 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
#include "wifi_component.h"
#include "esphome/core/macros.h"
#include "esphome/core/defines.h"
#ifdef USE_ESP8266
@@ -20,7 +20,7 @@ extern "C" {
#if LWIP_IPV6
#include "lwip/netif.h" // struct netif
#endif
#if ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0)
#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0)
#include "LwipDhcpServer.h"
#define wifi_softap_set_dhcps_lease(lease) dhcpSoftAP.set_dhcps_lease(lease)
#define wifi_softap_set_dhcps_lease_time(time) dhcpSoftAP.set_dhcps_lease_time(time)
@@ -238,7 +238,7 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
conf.bssid_set = 0;
}
#if ARDUINO_VERSION_CODE >= VERSION_CODE(2, 4, 0)
#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(2, 4, 0)
if (ap.get_password().empty()) {
conf.threshold.authmode = AUTH_OPEN;
} else {
@@ -528,7 +528,7 @@ void WiFiComponent::wifi_event_callback(System_Event_t *event) {
ESP_LOGVV(TAG, "Event: AP receive Probe Request MAC=%s RSSI=%d", format_mac_addr(it.mac).c_str(), it.rssi);
break;
}
#if ARDUINO_VERSION_CODE >= VERSION_CODE(2, 4, 0)
#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(2, 4, 0)
case EVENT_OPMODE_CHANGED: {
auto it = event->event_info.opmode_changed;
ESP_LOGV(TAG, "Event: Changed Mode old=%s new=%s", LOG_STR_ARG(get_op_mode_str(it.old_opmode)),
@@ -614,7 +614,7 @@ bool WiFiComponent::wifi_scan_start_() {
config.bssid = nullptr;
config.channel = 0;
config.show_hidden = 1;
#if ARDUINO_VERSION_CODE >= VERSION_CODE(2, 4, 0)
#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(2, 4, 0)
config.scan_type = WIFI_SCAN_TYPE_ACTIVE;
if (first_scan) {
config.scan_time.active.min = 100;
@@ -693,7 +693,7 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
return false;
}
#if ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0)
#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0)
dhcpSoftAP.begin(&info);
#endif