Skip to content

Commit 726a4ab

Browse files
authored
Merge branch 'master' into fix_8108
2 parents 00800fb + 758b4eb commit 726a4ab

File tree

7 files changed

+47
-20
lines changed

7 files changed

+47
-20
lines changed

.github/workflows/lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"name": "WS2812FX",
6161
"exclude_targets": [],
6262
"sketch_path": [
63-
"~/Arduino/libraries/WS2812FX/examples/ws2812fx_matrix/ws2812fx_matrix.ino"
63+
"~/Arduino/libraries/WS2812FX/examples/ws2812fx_spi/ws2812fx_spi.ino"
6464
]
6565
}
6666
]

cores/esp32/WString.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
// but really is never defined.
3636
class __FlashStringHelper;
3737
#define FPSTR(str_pointer) (reinterpret_cast<const __FlashStringHelper *>(str_pointer))
38-
#define F(string_literal) (FPSTR(string_literal))
38+
#define F(string_literal) (FPSTR(PSTR(string_literal)))
3939

4040
// An inherited class for holding the result of a concatenation. These
4141
// result objects are assumed to be writable by subsequent concatenations.

cores/esp32/esp32-hal-ledc.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -215,26 +215,32 @@ static int cnt_channel = LEDC_CHANNELS;
215215
static uint8_t analog_resolution = 8;
216216
static int analog_frequency = 1000;
217217
void analogWrite(uint8_t pin, int value) {
218-
// Use ledc hardware for internal pins
219-
if (pin < SOC_GPIO_PIN_COUNT) {
220-
if (pin_to_channel[pin] == 0) {
221-
if (!cnt_channel) {
222-
log_e("No more analogWrite channels available! You can have maximum %u", LEDC_CHANNELS);
223-
return;
224-
}
225-
if(ledcSetup(cnt_channel - 1, analog_frequency, analog_resolution) == 0){
226-
log_e("analogWrite setup failed (freq = %u, resolution = %u). Try setting different resolution or frequency");
227-
return;
228-
}
229-
ledcAttachPin(pin, cnt_channel - 1);
230-
pin_to_channel[pin] = cnt_channel--;
218+
// Use ledc hardware for internal pins
219+
if (pin < SOC_GPIO_PIN_COUNT) {
220+
int8_t channel = -1;
221+
if (pin_to_channel[pin] == 0) {
222+
if (!cnt_channel) {
223+
log_e("No more analogWrite channels available! You can have maximum %u", LEDC_CHANNELS);
224+
return;
225+
}
226+
cnt_channel--;
227+
channel = cnt_channel;
228+
} else {
229+
channel = analogGetChannel(pin);
230+
}
231+
log_v("GPIO %d - Using Channel %d, Value = %d", pin, channel, value);
232+
if(ledcSetup(channel, analog_frequency, analog_resolution) == 0){
233+
log_e("analogWrite setup failed (freq = %u, resolution = %u). Try setting different resolution or frequency");
234+
return;
235+
}
236+
ledcAttachPin(pin, channel);
237+
pin_to_channel[pin] = channel;
238+
ledcWrite(channel, value);
231239
}
232-
ledcWrite(pin_to_channel[pin] - 1, value);
233-
}
234240
}
235241

236242
int8_t analogGetChannel(uint8_t pin) {
237-
return pin_to_channel[pin] - 1;
243+
return pin_to_channel[pin];
238244
}
239245

240246
void analogWriteFrequency(uint32_t freq) {

cores/esp32/esp32-hal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ extern "C" {
4444
#ifndef F_CPU
4545
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
4646
#define F_CPU (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000U)
47+
#elif CONFIG_IDF_TARGET_ESP32C3
48+
#define F_CPU (CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ * 1000000U)
4749
#elif CONFIG_IDF_TARGET_ESP32S2
4850
#define F_CPU (CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000U)
51+
#elif CONFIG_IDF_TARGET_ESP32S3
52+
#define F_CPU (CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000U)
4953
#endif
5054
#endif
5155

libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ void setup() {
6060
config.pin_pclk = PCLK_GPIO_NUM;
6161
config.pin_vsync = VSYNC_GPIO_NUM;
6262
config.pin_href = HREF_GPIO_NUM;
63-
config.pin_sscb_sda = SIOD_GPIO_NUM;
64-
config.pin_sscb_scl = SIOC_GPIO_NUM;
63+
config.pin_sccb_sda = SIOD_GPIO_NUM;
64+
config.pin_sccb_scl = SIOC_GPIO_NUM;
6565
config.pin_pwdn = PWDN_GPIO_NUM;
6666
config.pin_reset = RESET_GPIO_NUM;
6767
config.xclk_freq_hz = 20000000;

libraries/WiFi/src/WiFiSTA.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,22 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
366366
return false;
367367
}
368368

369+
/**
370+
* @brief Reset WiFi settings in NVS to default values.
371+
* @return true if erase succeeded
372+
* @note: Resets SSID, password, protocol, mode, etc.
373+
* These settings are maintained by WiFi driver in IDF.
374+
* WiFi driver must be initialized.
375+
*/
376+
bool WiFiSTAClass::eraseAP(void) {
377+
if(WiFi.getMode()==WIFI_MODE_NULL) {
378+
if(!WiFi.enableSTA(true))
379+
return false;
380+
}
381+
382+
return esp_wifi_restore()==ESP_OK;
383+
}
384+
369385
/**
370386
* Change IP configuration settings disabling the dhcp client
371387
* @param local_ip Static ip configuration

libraries/WiFi/src/WiFiSTA.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class WiFiSTAClass
5959

6060
bool reconnect();
6161
bool disconnect(bool wifioff = false, bool eraseap = false);
62+
bool eraseAP(void);
6263

6364
bool isConnected();
6465

0 commit comments

Comments
 (0)