Skip to content

Commit 5f30bab

Browse files
author
Jason2866
committed
Tasmota Arduino ESP32 2.0.1 rc2
1 parent 145986c commit 5f30bab

File tree

343 files changed

+6083
-365
lines changed

Some content is hidden

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

343 files changed

+6083
-365
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ set(LIBRARY_SRCS
5555
libraries/DNSServer/src/DNSServer.cpp
5656
libraries/EEPROM/src/EEPROM.cpp
5757
libraries/ESPmDNS/src/ESPmDNS.cpp
58+
libraries/Ethernet/src/ETH.cpp
5859
libraries/FFat/src/FFat.cpp
5960
libraries/FS/src/FS.cpp
6061
libraries/FS/src/vfs_api.cpp
@@ -91,7 +92,6 @@ set(LIBRARY_SRCS
9192
libraries/WebServer/src/detail/mimetable.cpp
9293
libraries/WiFiClientSecure/src/ssl_client.cpp
9394
libraries/WiFiClientSecure/src/WiFiClientSecure.cpp
94-
libraries/WiFi/src/ETH.cpp
9595
libraries/WiFi/src/WiFiAP.cpp
9696
libraries/WiFi/src/WiFiClient.cpp
9797
libraries/WiFi/src/WiFi.cpp

boards.txt

+11-8
Original file line numberDiff line numberDiff line change
@@ -2571,6 +2571,9 @@ esp32micromod.upload.extra_flags=
25712571
esp32micromod.serial.disableDTR=true
25722572
esp32micromod.serial.disableRTS=true
25732573

2574+
esp32micromod.build.tarch=xtensa
2575+
esp32micromod.build.bootloader_addr=0x1000
2576+
esp32micromod.build.target=esp32
25742577
esp32micromod.build.mcu=esp32
25752578
esp32micromod.build.core=esp32
25762579
esp32micromod.build.variant=esp32micromod
@@ -4373,7 +4376,7 @@ adafruit_funhouse_esp32s2.menu.DebugLevel.verbose.build.code_debug=5
43734376

43744377
##############################################################
43754378

4376-
adafruit_feather_esp32s2_nopsram.name=Adafruit Feather ESP32-S2 (no PSRAM)
4379+
adafruit_feather_esp32s2_nopsram.name=Adafruit Feather ESP32-S2
43774380
adafruit_feather_esp32s2_nopsram.vid.0=0x239A
43784381
adafruit_feather_esp32s2_nopsram.pid.0=0x80EB
43794382
adafruit_feather_esp32s2_nopsram.vid.1=0x239A
@@ -4398,7 +4401,7 @@ adafruit_feather_esp32s2_nopsram.build.target=esp32s2
43984401
adafruit_feather_esp32s2_nopsram.build.mcu=esp32s2
43994402
adafruit_feather_esp32s2_nopsram.build.core=esp32
44004403
adafruit_feather_esp32s2_nopsram.build.variant=adafruit_feather_esp32s2
4401-
adafruit_feather_esp32s2_nopsram.build.board=ADAFRUIT_FEATHER_ESP32S2_NOPSRAM
4404+
adafruit_feather_esp32s2_nopsram.build.board=ADAFRUIT_FEATHER_ESP32S2
44024405

44034406
adafruit_feather_esp32s2_nopsram.build.cdc_on_boot=0
44044407
adafruit_feather_esp32s2_nopsram.build.msc_on_boot=0
@@ -4426,10 +4429,10 @@ adafruit_feather_esp32s2_nopsram.menu.DFUOnBoot.default.build.dfu_on_boot=0
44264429
adafruit_feather_esp32s2_nopsram.menu.DFUOnBoot.dfu=Enabled
44274430
adafruit_feather_esp32s2_nopsram.menu.DFUOnBoot.dfu.build.dfu_on_boot=1
44284431

4429-
adafruit_feather_esp32s2_nopsram.menu.PSRAM.disabled=Disabled
4430-
adafruit_feather_esp32s2_nopsram.menu.PSRAM.disabled.build.defines=
44314432
adafruit_feather_esp32s2_nopsram.menu.PSRAM.enabled=Enabled
44324433
adafruit_feather_esp32s2_nopsram.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM
4434+
adafruit_feather_esp32s2_nopsram.menu.PSRAM.disabled=Disabled
4435+
adafruit_feather_esp32s2_nopsram.menu.PSRAM.disabled.build.defines=
44334436

44344437
adafruit_feather_esp32s2_nopsram.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
44354438
adafruit_feather_esp32s2_nopsram.menu.PartitionScheme.default.build.partitions=default
@@ -9687,10 +9690,10 @@ deneyapmini.build.boot=qio
96879690
deneyapmini.build.partitions=default
96889691
deneyapmini.build.defines=
96899692

9690-
deneyapmini.menu.SerialMode.default=USB_CDC
9691-
deneyapmini.menu.SerialMode.default.build.serial=1
9692-
deneyapmini.menu.SerialMode.uart=UART0
9693-
deneyapmini.menu.SerialMode.uart.build.serial=0
9693+
deneyapmini.menu.CDCOnBoot.default=Disabled
9694+
deneyapmini.menu.CDCOnBoot.default.build.cdc_on_boot=0
9695+
deneyapmini.menu.CDCOnBoot.cdc=Enabled
9696+
deneyapmini.menu.CDCOnBoot.cdc.build.cdc_on_boot=1
96949697

96959698
deneyapmini.menu.PSRAM.disabled=Disabled
96969699
deneyapmini.menu.PSRAM.disabled.build.defines=

cores/esp32/Stream.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ float Stream::parseFloat(char skipChar)
256256
} else if(c >= '0' && c <= '9') { // is c a digit?
257257
value = value * 10 + c - '0';
258258
if(isFraction) {
259-
fraction *= 0.1;
259+
fraction *= 0.1f;
260260
}
261261
}
262262
read(); // consume the character we got with peek

cores/esp32/core_version.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#define ARDUINO_ESP32_GIT_VER 0xa443b816
2-
#define ARDUINO_ESP32_GIT_DESC 2.0.1.rc1
3-
#define ARDUINO_ESP32_RELEASE_2_0_1_rc1
4-
#define ARDUINO_ESP32_RELEASE "2_0_1_rc1"
2+
#define ARDUINO_ESP32_GIT_DESC 2.0.1.rc2
3+
#define ARDUINO_ESP32_RELEASE_2_0_1_rc2
4+
#define ARDUINO_ESP32_RELEASE "2_0_1_rc2"

cores/esp32/esp32-hal-adc.c

+19-8
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,23 @@ static uint8_t __analogVRefPin = 0;
4646
#endif
4747

4848
static uint8_t __analogAttenuation = 3;//11db
49-
#if CONFIG_IDF_TARGET_ESP32S2
50-
static uint8_t __analogWidth = 4; // 13 bits
51-
#else
52-
static uint8_t __analogWidth = 3; // 12 bits
53-
#endif
49+
static uint8_t __analogWidth = ADC_WIDTH_MAX - 1; //3 for ESP32/ESP32C3; 4 for ESP32S2
50+
static uint8_t __analogReturnedWidth = SOC_ADC_MAX_BITWIDTH; //12 for ESP32/ESP32C3; 13 for ESP32S2
5451
static uint8_t __analogClockDiv = 1;
5552
static adc_attenuation_t __pin_attenuation[SOC_GPIO_PIN_COUNT];
5653

54+
static inline uint16_t mapResolution(uint16_t value)
55+
{
56+
uint8_t from = __analogWidth + 9;
57+
if (from == __analogReturnedWidth) {
58+
return value;
59+
}
60+
if (from > __analogReturnedWidth) {
61+
return value >> (from - __analogReturnedWidth);
62+
}
63+
return value << (__analogReturnedWidth - from);
64+
}
65+
5766
void __analogSetClockDiv(uint8_t clockDiv){
5867
if(!clockDiv){
5968
clockDiv = 1;
@@ -150,6 +159,7 @@ void __analogReadResolution(uint8_t bits)
150159
if(!bits || bits > 16){
151160
return;
152161
}
162+
__analogReturnedWidth = bits;
153163
#if CONFIG_IDF_TARGET_ESP32
154164
__analogSetWidth(bits); // hadware from 9 to 12
155165
#endif
@@ -169,7 +179,7 @@ uint16_t __analogRead(uint8_t pin)
169179
channel -= 10;
170180
r = adc2_get_raw( channel, __analogWidth, &value);
171181
if ( r == ESP_OK ) {
172-
return value;
182+
return mapResolution(value);
173183
} else if ( r == ESP_ERR_INVALID_STATE ) {
174184
log_e("GPIO%u: %s: ADC2 not initialized yet.", pin, esp_err_to_name(r));
175185
} else if ( r == ESP_ERR_TIMEOUT ) {
@@ -178,9 +188,10 @@ uint16_t __analogRead(uint8_t pin)
178188
log_e("GPIO%u: %s", pin, esp_err_to_name(r));
179189
}
180190
} else {
181-
return adc1_get_raw(channel);
191+
value = adc1_get_raw(channel);
192+
return mapResolution(value);
182193
}
183-
return value;
194+
return mapResolution(value);
184195
}
185196

186197
uint32_t __analogReadMilliVolts(uint8_t pin){

cores/esp32/esp32-hal-log.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ void log_print_buf(const uint8_t *b, size_t len);
9999
#define log_buf_v(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_VERBOSE);}while(0)
100100
#endif
101101
#else
102-
#define log_v(format, ...)
103-
#define isr_log_v(format, ...)
104-
#define log_buf_v(b,l)
102+
#define log_v(format, ...) do {} while(0)
103+
#define isr_log_v(format, ...) do {} while(0)
104+
#define log_buf_v(b,l) do {} while(0)
105105
#endif
106106

107107
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
@@ -115,9 +115,9 @@ void log_print_buf(const uint8_t *b, size_t len);
115115
#define log_buf_d(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_DEBUG);}while(0)
116116
#endif
117117
#else
118-
#define log_d(format, ...)
119-
#define isr_log_d(format, ...)
120-
#define log_buf_d(b,l)
118+
#define log_d(format, ...) do {} while(0)
119+
#define isr_log_d(format, ...) do {} while(0)
120+
#define log_buf_d(b,l) do {} while(0)
121121
#endif
122122

123123
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
@@ -131,9 +131,9 @@ void log_print_buf(const uint8_t *b, size_t len);
131131
#define log_buf_i(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_INFO);}while(0)
132132
#endif
133133
#else
134-
#define log_i(format, ...)
135-
#define isr_log_i(format, ...)
136-
#define log_buf_i(b,l)
134+
#define log_i(format, ...) do {} while(0)
135+
#define isr_log_i(format, ...) do {} while(0)
136+
#define log_buf_i(b,l) do {} while(0)
137137
#endif
138138

139139
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_WARN
@@ -147,9 +147,9 @@ void log_print_buf(const uint8_t *b, size_t len);
147147
#define log_buf_w(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_WARN);}while(0)
148148
#endif
149149
#else
150-
#define log_w(format, ...)
151-
#define isr_log_w(format, ...)
152-
#define log_buf_w(b,l)
150+
#define log_w(format, ...) do {} while(0)
151+
#define isr_log_w(format, ...) do {} while(0)
152+
#define log_buf_w(b,l) do {} while(0)
153153
#endif
154154

155155
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
@@ -163,9 +163,9 @@ void log_print_buf(const uint8_t *b, size_t len);
163163
#define log_buf_e(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_ERROR);}while(0)
164164
#endif
165165
#else
166-
#define log_e(format, ...)
167-
#define isr_log_e(format, ...)
168-
#define log_buf_e(b,l)
166+
#define log_e(format, ...) do {} while(0)
167+
#define isr_log_e(format, ...) do {} while(0)
168+
#define log_buf_e(b,l) do {} while(0)
169169
#endif
170170

171171
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_NONE
@@ -179,9 +179,9 @@ void log_print_buf(const uint8_t *b, size_t len);
179179
#define log_buf_n(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_ERROR);}while(0)
180180
#endif
181181
#else
182-
#define log_n(format, ...)
183-
#define isr_log_n(format, ...)
184-
#define log_buf_n(b,l)
182+
#define log_n(format, ...) do {} while(0)
183+
#define isr_log_n(format, ...) do {} while(0)
184+
#define log_buf_n(b,l) do {} while(0)
185185
#endif
186186

187187
#include "esp_log.h"

cores/esp32/esp32-hal-rmt.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -546,16 +546,16 @@ float rmtSetTick(rmt_obj_t* rmt, float tick)
546546
size_t channel = rmt->channel;
547547

548548
#if CONFIG_IDF_TARGET_ESP32C3
549-
int apb_div = _LIMIT(tick/25.0, 256);
550-
float apb_tick = 25.0 * apb_div;
549+
int apb_div = _LIMIT(tick/25.0f, 256);
550+
float apb_tick = 25.0f * apb_div;
551551
RMT.tx_conf[channel].div_cnt = apb_div & 0xFF;
552552
RMT.tx_conf[channel].conf_update = 1;
553553
return apb_tick;
554554
#else
555-
int apb_div = _LIMIT(tick/12.5, 256);
555+
int apb_div = _LIMIT(tick/12.5f, 256);
556556
int ref_div = _LIMIT(tick/1000, 256);
557-
float apb_tick = 12.5 * apb_div;
558-
float ref_tick = 1000.0 * ref_div;
557+
float apb_tick = 12.5f * apb_div;
558+
float ref_tick = 1000.0f * ref_div;
559559
if (_ABS(apb_tick - tick) < _ABS(ref_tick - tick)) {
560560
RMT.conf_ch[channel].conf0.div_cnt = apb_div & 0xFF;
561561
RMT.conf_ch[channel].conf1.ref_always_on = 1;

libraries/EEPROM/examples/eeprom_class/eeprom_class.ino

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
1111
#include "EEPROM.h"
1212

1313
// Instantiate eeprom objects with parameter/argument names and sizes
14-
EEPROMClass NAMES("eeprom0", 0x500);
15-
EEPROMClass HEIGHT("eeprom1", 0x200);
16-
EEPROMClass AGE("eeprom2", 0x100);
14+
EEPROMClass NAMES("eeprom0");
15+
EEPROMClass HEIGHT("eeprom1");
16+
EEPROMClass AGE("eeprom2");
1717

1818
void setup() {
1919
Serial.begin(115200);
2020
delay(1000);
2121
Serial.println("Testing EEPROMClass\n");
22-
if (!NAMES.begin(NAMES.length())) {
22+
if (!NAMES.begin(0x500)) {
2323
Serial.println("Failed to initialise NAMES");
2424
Serial.println("Restarting...");
2525
delay(1000);
2626
ESP.restart();
2727
}
28-
if (!HEIGHT.begin(HEIGHT.length())) {
28+
if (!HEIGHT.begin(0x200)) {
2929
Serial.println("Failed to initialise HEIGHT");
3030
Serial.println("Restarting...");
3131
delay(1000);
3232
ESP.restart();
3333
}
34-
if (!AGE.begin(AGE.length())) {
34+
if (!AGE.begin(0x100)) {
3535
Serial.println("Failed to initialise AGE");
3636
Serial.println("Restarting...");
3737
delay(1000);

libraries/EEPROM/src/EEPROM.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ EEPROMClass::EEPROMClass(void)
3434
, _size(0)
3535
, _dirty(false)
3636
, _name("eeprom")
37-
, _user_defined_size(0)
3837
{
3938
}
4039

@@ -45,17 +44,15 @@ EEPROMClass::EEPROMClass(uint32_t sector)
4544
, _size(0)
4645
, _dirty(false)
4746
, _name("eeprom")
48-
, _user_defined_size(0)
4947
{
5048
}
5149

52-
EEPROMClass::EEPROMClass(const char* name, uint32_t user_defined_size)
50+
EEPROMClass::EEPROMClass(const char* name)
5351
: _handle(0)
5452
, _data(0)
5553
, _size(0)
5654
, _dirty(false)
5755
, _name(name)
58-
, _user_defined_size(user_defined_size)
5956
{
6057
}
6158

@@ -133,7 +130,7 @@ bool EEPROMClass::begin(size_t size) {
133130

134131
_data = (uint8_t*) malloc(size);
135132
if(!_data) {
136-
log_e("Not enough memory for %d bytes in EEPROM");
133+
log_e("Not enough memory for %d bytes in EEPROM", size);
137134
return false;
138135
}
139136
_size = size;
@@ -215,7 +212,7 @@ uint8_t * EEPROMClass::getDataPtr() {
215212
*/
216213
uint16_t EEPROMClass::length ()
217214
{
218-
return _user_defined_size;
215+
return _size;
219216
}
220217

221218
/*

libraries/EEPROM/src/EEPROM.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ typedef uint32_t nvs_handle;
3535
class EEPROMClass {
3636
public:
3737
EEPROMClass(uint32_t sector);
38-
EEPROMClass(const char* name, uint32_t user_defined_size);
38+
EEPROMClass(const char* name);
3939
EEPROMClass(void);
4040
~EEPROMClass(void);
4141

@@ -112,7 +112,6 @@ class EEPROMClass {
112112
size_t _size;
113113
bool _dirty;
114114
const char* _name;
115-
uint32_t _user_defined_size;
116115
};
117116

118117
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_EEPROM)

libraries/Ethernet/library.properties

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=Ethernet
2+
version=2.0.0
3+
author=Hristo Gochkov
4+
maintainer=Hristo Gochkov <hristo@espressif.com>
5+
sentence=Enables network connection (local and Internet) using the ESP32 Ethernet.
6+
paragraph=With this library you can instantiate Servers, Clients and send/receive UDP packets through Ethernet. The IP address can be assigned statically or through a DHCP. The library can also manage DNS.
7+
category=Communication
8+
url=
9+
architectures=esp32

libraries/WiFi/src/ETH.cpp renamed to libraries/Ethernet/src/ETH.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,6 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
237237
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
238238
esp_netif_t *eth_netif = esp_netif_new(&cfg);
239239

240-
if(esp_eth_set_default_handlers(eth_netif) != ESP_OK){
241-
log_e("esp_eth_set_default_handlers failed");
242-
return false;
243-
}
244-
245-
246240
esp_eth_mac_t *eth_mac = NULL;
247241
#if CONFIG_ETH_SPI_ETHERNET_DM9051
248242
if(type == ETH_PHY_DM9051){
File renamed without changes.

libraries/HTTPClient/src/HTTPClient.cpp

+14-1
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,17 @@ void HTTPClient::setAuthorization(const char * auth)
463463
}
464464
}
465465

466+
/**
467+
* set the Authorization type for the http request
468+
* @param authType const char *
469+
*/
470+
void HTTPClient::setAuthorizationType(const char * authType)
471+
{
472+
if(authType) {
473+
_authorizationType = authType;
474+
}
475+
}
476+
466477
/**
467478
* set the timeout (ms) for establishing a connection to the server
468479
* @param connectTimeout int32_t
@@ -1178,7 +1189,9 @@ bool HTTPClient::sendHeader(const char * type)
11781189

11791190
if(_base64Authorization.length()) {
11801191
_base64Authorization.replace("\n", "");
1181-
header += F("Authorization: Basic ");
1192+
header += F("Authorization: ");
1193+
header += _authorizationType;
1194+
header += " ";
11821195
header += _base64Authorization;
11831196
header += "\r\n";
11841197
}

0 commit comments

Comments
 (0)