Skip to content

Commit

Permalink
[Build] Fix build on ESP-IDF4.4 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-er committed May 1, 2024
1 parent b54d2d0 commit bd7c7d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/src/DataStructs/WiFi_AP_Candidate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@

WiFi_AP_Candidate::WiFi_AP_Candidate() :
#ifdef ESP32
# if ESP_IDF_VERSION_MAJOR >= 5
country({
.cc = "01",
.schan = 1,
.nchan = 11,
.policy = WIFI_COUNTRY_POLICY_AUTO,
}),
#endif
#endif
last_seen(0), rssi(0), channel(0), index(0), enc_type(0)
{
Expand Down Expand Up @@ -90,8 +92,9 @@ WiFi_AP_Candidate::WiFi_AP_Candidate(uint8_t networkItem) : index(0) {
bits.wps = it->wps;

// FIXME TD-er: Maybe also add other info like 2nd channel, ftm and phy_lr support?

# if ESP_IDF_VERSION_MAJOR >= 5
memcpy(&country, &(it->country), sizeof(wifi_country_t));
#endif
}
#endif // ifdef ESP32
last_seen = millis();
Expand Down Expand Up @@ -207,6 +210,7 @@ String WiFi_AP_Candidate::toString(const String& separator) const {
result += encryption_type();

#ifdef ESP32
# if ESP_IDF_VERSION_MAJOR >= 5
// Country code string
if (country.cc[0] != '\0' && country.cc[1] != '\0') {
result += strformat(F(" '%c%c'"), country.cc[0], country.cc[1]);
Expand All @@ -221,6 +225,7 @@ String WiFi_AP_Candidate::toString(const String& separator) const {
if (country.nchan > 0) {
result += strformat(F(" ch: %d..%d"), country.schan, country.schan + country.nchan - 1);
}
#endif
#endif

if (phy_known()) {
Expand Down
2 changes: 2 additions & 0 deletions src/src/DataStructs/WiFi_AP_Candidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ struct WiFi_AP_Candidate {
// String key;

#ifdef ESP32
# if ESP_IDF_VERSION_MAJOR >= 5
wifi_country_t country;
#endif
#endif

unsigned long last_seen = 0u;
MAC_address bssid;
Expand Down

0 comments on commit bd7c7d6

Please sign in to comment.