Fix future compile error

This commit is contained in:
Theo Arends 2023-04-14 14:14:14 +02:00
parent d88d42341d
commit 36ae802924
3 changed files with 24 additions and 10 deletions

View File

@ -137,10 +137,10 @@ int WiFiClass32::getPhyMode() {
int phy_mode = 0; // " BGNL"
uint8_t protocol_bitmap;
if (esp_wifi_get_protocol(WIFI_IF_STA, &protocol_bitmap) == ESP_OK) {
if (protocol_bitmap & 1) { phy_mode = WIFI_PHY_MODE_11B; } // 1 = 11b
if (protocol_bitmap & 2) { phy_mode = WIFI_PHY_MODE_11G; } // 2 = 11bg
if (protocol_bitmap & 4) { phy_mode = WIFI_PHY_MODE_11N; } // 3 = 11bgn
if (protocol_bitmap & 8) { phy_mode = 4; } // Low rate
if (protocol_bitmap & 1) { phy_mode = TAS_WIFI_PHY_MODE_11B; } // 1 = 11b (WIFI_PHY_MODE_11B)
if (protocol_bitmap & 2) { phy_mode = TAS_WIFI_PHY_MODE_11G; } // 2 = 11bg (WIFI_PHY_MODE_11G)
if (protocol_bitmap & 4) { phy_mode = TAS_WIFI_PHY_MODE_11N; } // 3 = 11bgn (WIFI_PHY_MODE_11N)
if (protocol_bitmap & 8) { phy_mode = 4; } // Low rate (WIFI_PHY_MODE_LR)
}
return phy_mode;
}
@ -240,7 +240,7 @@ int WiFiClass32::hostByName(const char* aHostname, IPAddress& aResult, int32_t t
ip_addr_t addr;
aResult = (uint32_t) 0; // by default set to IPv4 0.0.0.0
dns_ipaddr = *IP4_ADDR_ANY; // by default set to IPv4 0.0.0.0
scrubDNS(); // internal calls to reconnect can zero the DNS servers, save DNS for future use
ip_addr_counter++; // increase counter, from now ignore previous responses
clearStatusBits(WIFI_DNS_IDLE_BIT | WIFI_DNS_DONE_BIT);
@ -260,7 +260,7 @@ int WiFiClass32::hostByName(const char* aHostname, IPAddress& aResult, int32_t t
waitStatusBits(WIFI_DNS_DONE_BIT, timer_ms); //real internal timeout in lwip library is 14[s]
clearStatusBits(WIFI_DNS_DONE_BIT);
}
if (!ip_addr_isany_val(dns_ipaddr)) {
#ifdef USE_IPV6
aResult = dns_ipaddr;

View File

@ -29,11 +29,25 @@
#define WIFI_LIGHT_SLEEP 1
#define WIFI_MODEM_SLEEP 2
// ESP8266
typedef enum WiFiPhyMode
{
WIFI_PHY_MODE_11B = 1, WIFI_PHY_MODE_11G = 2, WIFI_PHY_MODE_11N = 3
TAS_WIFI_PHY_MODE_LR = 0, TAS_WIFI_PHY_MODE_11B = 1, TAS_WIFI_PHY_MODE_11G = 2, TAS_WIFI_PHY_MODE_11N = 3
} WiFiPhyMode_t;
/*
// ESP32 was never defined until IDF 4.4
typedef enum
{
WIFI_PHY_MODE_LR, // PHY mode for Low Rate
WIFI_PHY_MODE_11B, // PHY mode for 11b
WIFI_PHY_MODE_11G, // PHY mode for 11g
WIFI_PHY_MODE_HT20, // PHY mode for 11n Bandwidth HT20
WIFI_PHY_MODE_HT40, // PHY mode for 11n Bandwidth HT40
WIFI_PHY_MODE_HE20, // PHY mode for 11n Bandwidth HE20
} wifi_phy_mode_t;
*/
class WiFiClass32 : public WiFiClass
{
public:

View File

@ -207,7 +207,7 @@ void analogWriteFreqRange(int32_t freq, int32_t range, int32_t pin) {
_analogInit(); // make sure the mapping array is initialized
uint32_t timer0_freq = timer_freq_hz[0]; // global values
uint8_t timer0_res = timer_duty_resolution[0];
int32_t timer = 0;
int32_t res = timer0_res;
if (pin < 0) {
@ -233,7 +233,7 @@ void analogWriteFreqRange(int32_t freq, int32_t range, int32_t pin) {
if (timer != 0) {
ledcSetTimer(chan, 0);
timer = 0;
}
}
// else nothing to change
} else {
// specific (non-global) values, require a specific timer
@ -293,7 +293,7 @@ int32_t analogAttach(uint32_t pin, bool output_invert) { // returns ledc chan
AddLog(LOG_LEVEL_INFO, "PWM: no more PWM (ledc) channel for GPIO %i", pin);
return -1;
}
// new channel attached to pin
pin_to_channel[pin] = chan + 1;