Skip to content

Commit daddd36

Browse files
committed
Merge branch 'v4.2' into add-custom-board-partition-bootloader
2 parents f14276e + 5b5b61c commit daddd36

File tree

556 files changed

+3272
-561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

556 files changed

+3272
-561
lines changed

cores/esp32/esp32-hal-adc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ uint32_t __analogReadMilliVolts(uint8_t pin){
183183
__analogVRef = DEFAULT_VREF;
184184
if(__analogVRefPin){
185185
esp_adc_cal_characteristics_t chars;
186-
if(adc2_vref_to_gpio(__analogVRefPin) == ESP_OK){
186+
if(adc_vref_to_gpio(ADC_UNIT_2, __analogVRefPin) == ESP_OK){
187187
__analogVRef = __analogRead(__analogVRefPin);
188188
esp_adc_cal_characterize(1, __analogAttenuation, __analogWidth, DEFAULT_VREF, &chars);
189189
__analogVRef = esp_adc_cal_raw_to_voltage(__analogVRef, &chars);

cores/esp32/esp32-hal-psram.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ bool psramInit(){
5151
log_w("PSRAM not supported!");
5252
return false;
5353
}
54+
#elif CONFIG_IDF_TARGET_ESP32S2
55+
extern void esp_config_data_cache_mode(void);
56+
esp_config_data_cache_mode();
57+
Cache_Enable_DCache(0);
58+
#endif
5459
if (esp_spiram_init() != ESP_OK) {
5560
spiramFailed = true;
5661
log_w("PSRAM init failed!");
@@ -61,11 +66,6 @@ bool psramInit(){
6166
return false;
6267
}
6368
esp_spiram_init_cache();
64-
#elif CONFIG_IDF_TARGET_ESP32S2
65-
extern void esp_config_data_cache_mode(void);
66-
esp_config_data_cache_mode();
67-
Cache_Enable_DCache(0);
68-
#endif
6969
if (!esp_spiram_test()) {
7070
spiramFailed = true;
7171
log_e("PSRAM test failed!");

cores/esp32/esp32-hal-tinyusb.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include "esp32-hal-tinyusb.h"
3232
#include "esp32s2/rom/usb/usb_persist.h"
33+
#include "esp32s2/rom/usb/usb_dc.h"
34+
#include "esp32s2/rom/usb/chip_usb_dw_wrapper.h"
3335

3436
typedef char tusb_str_t[127];
3537

@@ -457,27 +459,22 @@ static void IRAM_ATTR usb_persist_shutdown_handler(void)
457459
{
458460
if(usb_persist_mode != RESTART_NO_PERSIST){
459461
if (usb_persist_enabled) {
460-
REG_SET_BIT(RTC_CNTL_USB_CONF_REG, RTC_CNTL_IO_MUX_RESET_DISABLE);
461-
REG_SET_BIT(RTC_CNTL_USB_CONF_REG, RTC_CNTL_USB_RESET_DISABLE);
462+
usb_dc_prepare_persist();
462463
}
463464
if (usb_persist_mode == RESTART_BOOTLOADER) {
464465
//USB CDC Download
465466
if (usb_persist_enabled) {
466-
USB_WRAP.date.val = USBDC_PERSIST_ENA;
467+
chip_usb_set_persist_flags(USBDC_PERSIST_ENA);
467468
}
468469
REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
469-
periph_module_disable(PERIPH_TIMG1_MODULE);
470470
} else if (usb_persist_mode == RESTART_BOOTLOADER_DFU) {
471471
//DFU Download
472-
USB_WRAP.date.val = USBDC_BOOT_DFU;
472+
chip_usb_set_persist_flags(USBDC_BOOT_DFU);
473473
REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
474-
periph_module_disable(PERIPH_TIMG0_MODULE);
475-
periph_module_disable(PERIPH_TIMG1_MODULE);
476474
} else if (usb_persist_enabled) {
477475
//USB Persist reboot
478-
USB_WRAP.date.val = USBDC_PERSIST_ENA;
476+
chip_usb_set_persist_flags(USBDC_PERSIST_ENA);
479477
}
480-
SET_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_SW_PROCPU_RST);
481478
}
482479
}
483480

@@ -531,7 +528,7 @@ esp_err_t tinyusb_init(tinyusb_device_config_t *config) {
531528
periph_module_enable(PERIPH_USB_MODULE);
532529
}
533530

534-
if (usb_persist_enabled && esp_register_shutdown_handler(usb_persist_shutdown_handler) != ESP_OK) {
531+
if (esp_register_shutdown_handler(usb_persist_shutdown_handler) != ESP_OK) {
535532
initialized = false;
536533
return ESP_FAIL;
537534
}
@@ -550,11 +547,9 @@ esp_err_t tinyusb_init(tinyusb_device_config_t *config) {
550547

551548
void usb_persist_restart(restart_type_t mode)
552549
{
553-
if (usb_persist_enabled && mode < RESTART_TYPE_MAX) {
550+
if (mode < RESTART_TYPE_MAX) {
554551
usb_persist_mode = mode;
555552
esp_restart();
556-
} else {
557-
log_e("Persistence is not enabled");
558553
}
559554
}
560555

libraries/FFat/src/FFat.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,21 @@ size_t F_Fat::totalBytes()
135135
return tot_sect * sect_size;
136136
}
137137

138+
size_t F_Fat::usedBytes()
139+
{
140+
FATFS *fs;
141+
DWORD free_clust, used_sect, sect_size;
142+
143+
BYTE pdrv = ff_diskio_get_pdrv_wl(_wl_handle);
144+
char drv[3] = {(char)(48+pdrv), ':', 0};
145+
if ( f_getfree(drv, &free_clust, &fs) != FR_OK){
146+
return 0;
147+
}
148+
used_sect = (fs->n_fatent - 2 - free_clust) * fs->csize;
149+
sect_size = CONFIG_WL_SECTOR_SIZE;
150+
return used_sect * sect_size;
151+
}
152+
138153
size_t F_Fat::freeBytes()
139154
{
140155

libraries/FFat/src/FFat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class F_Fat : public FS
3131
bool begin(bool formatOnFail=false, const char * basePath="/ffat", uint8_t maxOpenFiles=10, const char * partitionLabel = (char*)FFAT_PARTITION_LABEL);
3232
bool format(bool full_wipe = FFAT_WIPE_QUICK, char* partitionLabel = (char*)FFAT_PARTITION_LABEL);
3333
size_t totalBytes();
34+
size_t usedBytes();
3435
size_t freeBytes();
3536
void end();
3637
bool exists(const char* path);

libraries/SD_MMC/src/SD_MMC.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,21 @@ bool SDMMCFS::begin(const char * mountpoint, bool mode1bit)
4343
}
4444
//mount
4545
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
46-
sdmmc_host_t host = {
47-
.flags = SDMMC_HOST_FLAG_4BIT,
48-
.slot = SDMMC_HOST_SLOT_1,
49-
.max_freq_khz = SDMMC_FREQ_DEFAULT,
50-
.io_voltage = 3.3f,
51-
.init = &sdmmc_host_init,
52-
.set_bus_width = &sdmmc_host_set_bus_width,
53-
.get_bus_width = &sdmmc_host_get_slot_width,
54-
.set_bus_ddr_mode = &sdmmc_host_set_bus_ddr_mode,
55-
.set_card_clk = &sdmmc_host_set_card_clk,
56-
.do_transaction = &sdmmc_host_do_transaction,
57-
.deinit = &sdmmc_host_deinit,
58-
.io_int_enable = &sdmmc_host_io_int_enable,
59-
.io_int_wait = &sdmmc_host_io_int_wait,
60-
.command_timeout_ms = 0
61-
};
46+
sdmmc_host_t host;
47+
host.flags = SDMMC_HOST_FLAG_4BIT;
48+
host.slot = SDMMC_HOST_SLOT_1;
49+
host.max_freq_khz = SDMMC_FREQ_DEFAULT;
50+
host.io_voltage = 3.3f;
51+
host.init = &sdmmc_host_init;
52+
host.set_bus_width = &sdmmc_host_set_bus_width;
53+
host.get_bus_width = &sdmmc_host_get_slot_width;
54+
host.set_bus_ddr_mode = &sdmmc_host_set_bus_ddr_mode;
55+
host.set_card_clk = &sdmmc_host_set_card_clk;
56+
host.do_transaction = &sdmmc_host_do_transaction;
57+
host.deinit_p = &sdspi_host_remove_device;
58+
host.io_int_enable = &sdmmc_host_io_int_enable;
59+
host.io_int_wait = &sdmmc_host_io_int_wait;
60+
host.command_timeout_ms = 0;
6261
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
6362
#ifdef BOARD_HAS_1BIT_SDMMC
6463
mode1bit = true;

libraries/WebServer/src/WebServer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,12 @@ void WebServer::handleClient() {
313313
_contentLength = CONTENT_LENGTH_NOT_SET;
314314
_handleRequest();
315315

316-
if (_currentClient.connected()) {
317-
_currentStatus = HC_WAIT_CLOSE;
318-
_statusChange = millis();
319-
keepCurrentClient = true;
320-
}
316+
// Fix for issue with Chrome based browsers: https://github.com/espressif/arduino-esp32/issues/3652
317+
// if (_currentClient.connected()) {
318+
// _currentStatus = HC_WAIT_CLOSE;
319+
// _statusChange = millis();
320+
// keepCurrentClient = true;
321+
// }
321322
}
322323
} else { // !_currentClient.available()
323324
if (millis() - _statusChange <= HTTP_MAX_DATA_WAIT) {

libraries/WiFi/examples/WiFiProv/WiFiProv.ino

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ void setup() {
4545
/* uint8_t uuid[16] = {0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf,
4646
0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02 };*/
4747
WiFi.onEvent(SysProvEvent);
48-
//WiFi.beginProvision(WIFI_PROV_SCHEME_BLE, WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, "abcd1234");
49-
WiFi.beginProvision(WIFI_PROV_SCHEME_SOFTAP, WIFI_PROV_SCHEME_HANDLER_NONE, WIFI_PROV_SECURITY_1, "abcd1234");
48+
#if CONFIG_IDF_TARGET_ESP32 && CONFIG_BLUEDROID_ENABLED
49+
WiFi.beginProvision(WIFI_PROV_SCHEME_BLE, WIFI_PROV_SCHEME_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, "abcd1234", "Prov_123");
50+
#else
51+
WiFi.beginProvision(WIFI_PROV_SCHEME_SOFTAP, WIFI_PROV_SCHEME_HANDLER_NONE, WIFI_PROV_SECURITY_1, "abcd1234", "Prov_123");
52+
#endif
5053
}
5154

5255
void loop() {

libraries/WiFi/src/WiFiProv.cpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#include <wifi_provisioning/manager.h>
3636
#undef IPADDR_NONE
3737
#include "WiFi.h"
38+
#if CONFIG_IDF_TARGET_ESP32
39+
#include "SimpleBLE.h"
40+
#endif
3841

3942
bool wifiLowLevelInit(bool persistent);
4043

@@ -114,7 +117,8 @@ void WiFiProvClass :: beginProvision(prov_scheme_t prov_scheme, scheme_handler_t
114117
return;
115118
}
116119
#endif
117-
120+
config.app_event_handler.event_cb = NULL;
121+
config.app_event_handler.user_data = NULL;
118122
wifiLowLevelInit(true);
119123
if(wifi_prov_mgr_init(config) != ESP_OK){
120124
log_e("wifi_prov_mgr_init failed!");
@@ -154,28 +158,19 @@ void WiFiProvClass :: beginProvision(prov_scheme_t prov_scheme, scheme_handler_t
154158
#if CONFIG_BLUEDROID_ENABLED
155159
}
156160
#endif
157-
158-
if(wifi_prov_mgr_endpoint_create("custom-data") != ESP_OK){
159-
log_e("wifi_prov_mgr_endpoint_create failed!");
160-
return;
161-
}
162161
if(wifi_prov_mgr_start_provisioning(security, pop, service_name, service_key) != ESP_OK){
163162
log_e("wifi_prov_mgr_start_provisioning failed!");
164163
return;
165164
}
166-
if(wifi_prov_mgr_endpoint_register("custom-data", custom_prov_data_handler, NULL) != ESP_OK){
167-
log_e("wifi_prov_mgr_endpoint_register failed!");
168-
return;
169-
}
170165
} else {
171-
wifi_prov_mgr_deinit();
172-
log_i("Aleardy Provisioned");
166+
log_i("Already Provisioned");
173167
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
174168
static wifi_config_t conf;
175169
esp_wifi_get_config(WIFI_IF_STA,&conf);
176170
log_i("Attempting connect to AP: %s\n",conf.sta.ssid);
177171
#endif
178-
esp_wifi_start();
172+
esp_wifi_start();
173+
wifi_prov_mgr_deinit();
179174
WiFi.begin();
180175
}
181176
}

package/package_esp32_index.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
{
4242
"packager": "esp32",
4343
"name": "esptool_py",
44-
"version": "2.6.1"
44+
"version": "3.0.0"
4545
},
4646
{
4747
"packager": "esp32",

0 commit comments

Comments
 (0)