Skip to content

Commit

Permalink
Tasmota Arduino ESP32 2.0.1 rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 committed Nov 8, 2021
1 parent 145986c commit 5f30bab
Show file tree
Hide file tree
Showing 343 changed files with 6,083 additions and 365 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ set(LIBRARY_SRCS
libraries/DNSServer/src/DNSServer.cpp
libraries/EEPROM/src/EEPROM.cpp
libraries/ESPmDNS/src/ESPmDNS.cpp
libraries/Ethernet/src/ETH.cpp
libraries/FFat/src/FFat.cpp
libraries/FS/src/FS.cpp
libraries/FS/src/vfs_api.cpp
Expand Down Expand Up @@ -91,7 +92,6 @@ set(LIBRARY_SRCS
libraries/WebServer/src/detail/mimetable.cpp
libraries/WiFiClientSecure/src/ssl_client.cpp
libraries/WiFiClientSecure/src/WiFiClientSecure.cpp
libraries/WiFi/src/ETH.cpp
libraries/WiFi/src/WiFiAP.cpp
libraries/WiFi/src/WiFiClient.cpp
libraries/WiFi/src/WiFi.cpp
Expand Down
19 changes: 11 additions & 8 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2571,6 +2571,9 @@ esp32micromod.upload.extra_flags=
esp32micromod.serial.disableDTR=true
esp32micromod.serial.disableRTS=true

esp32micromod.build.tarch=xtensa
esp32micromod.build.bootloader_addr=0x1000
esp32micromod.build.target=esp32
esp32micromod.build.mcu=esp32
esp32micromod.build.core=esp32
esp32micromod.build.variant=esp32micromod
Expand Down Expand Up @@ -4373,7 +4376,7 @@ adafruit_funhouse_esp32s2.menu.DebugLevel.verbose.build.code_debug=5

##############################################################

adafruit_feather_esp32s2_nopsram.name=Adafruit Feather ESP32-S2 (no PSRAM)
adafruit_feather_esp32s2_nopsram.name=Adafruit Feather ESP32-S2
adafruit_feather_esp32s2_nopsram.vid.0=0x239A
adafruit_feather_esp32s2_nopsram.pid.0=0x80EB
adafruit_feather_esp32s2_nopsram.vid.1=0x239A
Expand All @@ -4398,7 +4401,7 @@ adafruit_feather_esp32s2_nopsram.build.target=esp32s2
adafruit_feather_esp32s2_nopsram.build.mcu=esp32s2
adafruit_feather_esp32s2_nopsram.build.core=esp32
adafruit_feather_esp32s2_nopsram.build.variant=adafruit_feather_esp32s2
adafruit_feather_esp32s2_nopsram.build.board=ADAFRUIT_FEATHER_ESP32S2_NOPSRAM
adafruit_feather_esp32s2_nopsram.build.board=ADAFRUIT_FEATHER_ESP32S2

adafruit_feather_esp32s2_nopsram.build.cdc_on_boot=0
adafruit_feather_esp32s2_nopsram.build.msc_on_boot=0
Expand Down Expand Up @@ -4426,10 +4429,10 @@ adafruit_feather_esp32s2_nopsram.menu.DFUOnBoot.default.build.dfu_on_boot=0
adafruit_feather_esp32s2_nopsram.menu.DFUOnBoot.dfu=Enabled
adafruit_feather_esp32s2_nopsram.menu.DFUOnBoot.dfu.build.dfu_on_boot=1

adafruit_feather_esp32s2_nopsram.menu.PSRAM.disabled=Disabled
adafruit_feather_esp32s2_nopsram.menu.PSRAM.disabled.build.defines=
adafruit_feather_esp32s2_nopsram.menu.PSRAM.enabled=Enabled
adafruit_feather_esp32s2_nopsram.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM
adafruit_feather_esp32s2_nopsram.menu.PSRAM.disabled=Disabled
adafruit_feather_esp32s2_nopsram.menu.PSRAM.disabled.build.defines=

adafruit_feather_esp32s2_nopsram.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
adafruit_feather_esp32s2_nopsram.menu.PartitionScheme.default.build.partitions=default
Expand Down Expand Up @@ -9687,10 +9690,10 @@ deneyapmini.build.boot=qio
deneyapmini.build.partitions=default
deneyapmini.build.defines=

deneyapmini.menu.SerialMode.default=USB_CDC
deneyapmini.menu.SerialMode.default.build.serial=1
deneyapmini.menu.SerialMode.uart=UART0
deneyapmini.menu.SerialMode.uart.build.serial=0
deneyapmini.menu.CDCOnBoot.default=Disabled
deneyapmini.menu.CDCOnBoot.default.build.cdc_on_boot=0
deneyapmini.menu.CDCOnBoot.cdc=Enabled
deneyapmini.menu.CDCOnBoot.cdc.build.cdc_on_boot=1

deneyapmini.menu.PSRAM.disabled=Disabled
deneyapmini.menu.PSRAM.disabled.build.defines=
Expand Down
2 changes: 1 addition & 1 deletion cores/esp32/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ float Stream::parseFloat(char skipChar)
} else if(c >= '0' && c <= '9') { // is c a digit?
value = value * 10 + c - '0';
if(isFraction) {
fraction *= 0.1;
fraction *= 0.1f;
}
}
read(); // consume the character we got with peek
Expand Down
6 changes: 3 additions & 3 deletions cores/esp32/core_version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define ARDUINO_ESP32_GIT_VER 0xa443b816
#define ARDUINO_ESP32_GIT_DESC 2.0.1.rc1
#define ARDUINO_ESP32_RELEASE_2_0_1_rc1
#define ARDUINO_ESP32_RELEASE "2_0_1_rc1"
#define ARDUINO_ESP32_GIT_DESC 2.0.1.rc2
#define ARDUINO_ESP32_RELEASE_2_0_1_rc2
#define ARDUINO_ESP32_RELEASE "2_0_1_rc2"
27 changes: 19 additions & 8 deletions cores/esp32/esp32-hal-adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,23 @@ static uint8_t __analogVRefPin = 0;
#endif

static uint8_t __analogAttenuation = 3;//11db
#if CONFIG_IDF_TARGET_ESP32S2
static uint8_t __analogWidth = 4; // 13 bits
#else
static uint8_t __analogWidth = 3; // 12 bits
#endif
static uint8_t __analogWidth = ADC_WIDTH_MAX - 1; //3 for ESP32/ESP32C3; 4 for ESP32S2
static uint8_t __analogReturnedWidth = SOC_ADC_MAX_BITWIDTH; //12 for ESP32/ESP32C3; 13 for ESP32S2
static uint8_t __analogClockDiv = 1;
static adc_attenuation_t __pin_attenuation[SOC_GPIO_PIN_COUNT];

static inline uint16_t mapResolution(uint16_t value)
{
uint8_t from = __analogWidth + 9;
if (from == __analogReturnedWidth) {
return value;
}
if (from > __analogReturnedWidth) {
return value >> (from - __analogReturnedWidth);
}
return value << (__analogReturnedWidth - from);
}

void __analogSetClockDiv(uint8_t clockDiv){
if(!clockDiv){
clockDiv = 1;
Expand Down Expand Up @@ -150,6 +159,7 @@ void __analogReadResolution(uint8_t bits)
if(!bits || bits > 16){
return;
}
__analogReturnedWidth = bits;
#if CONFIG_IDF_TARGET_ESP32
__analogSetWidth(bits); // hadware from 9 to 12
#endif
Expand All @@ -169,7 +179,7 @@ uint16_t __analogRead(uint8_t pin)
channel -= 10;
r = adc2_get_raw( channel, __analogWidth, &value);
if ( r == ESP_OK ) {
return value;
return mapResolution(value);
} else if ( r == ESP_ERR_INVALID_STATE ) {
log_e("GPIO%u: %s: ADC2 not initialized yet.", pin, esp_err_to_name(r));
} else if ( r == ESP_ERR_TIMEOUT ) {
Expand All @@ -178,9 +188,10 @@ uint16_t __analogRead(uint8_t pin)
log_e("GPIO%u: %s", pin, esp_err_to_name(r));
}
} else {
return adc1_get_raw(channel);
value = adc1_get_raw(channel);
return mapResolution(value);
}
return value;
return mapResolution(value);
}

uint32_t __analogReadMilliVolts(uint8_t pin){
Expand Down
36 changes: 18 additions & 18 deletions cores/esp32/esp32-hal-log.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ void log_print_buf(const uint8_t *b, size_t len);
#define log_buf_v(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_VERBOSE);}while(0)
#endif
#else
#define log_v(format, ...)
#define isr_log_v(format, ...)
#define log_buf_v(b,l)
#define log_v(format, ...) do {} while(0)
#define isr_log_v(format, ...) do {} while(0)
#define log_buf_v(b,l) do {} while(0)
#endif

#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
Expand All @@ -115,9 +115,9 @@ void log_print_buf(const uint8_t *b, size_t len);
#define log_buf_d(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_DEBUG);}while(0)
#endif
#else
#define log_d(format, ...)
#define isr_log_d(format, ...)
#define log_buf_d(b,l)
#define log_d(format, ...) do {} while(0)
#define isr_log_d(format, ...) do {} while(0)
#define log_buf_d(b,l) do {} while(0)
#endif

#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
Expand All @@ -131,9 +131,9 @@ void log_print_buf(const uint8_t *b, size_t len);
#define log_buf_i(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_INFO);}while(0)
#endif
#else
#define log_i(format, ...)
#define isr_log_i(format, ...)
#define log_buf_i(b,l)
#define log_i(format, ...) do {} while(0)
#define isr_log_i(format, ...) do {} while(0)
#define log_buf_i(b,l) do {} while(0)
#endif

#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_WARN
Expand All @@ -147,9 +147,9 @@ void log_print_buf(const uint8_t *b, size_t len);
#define log_buf_w(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_WARN);}while(0)
#endif
#else
#define log_w(format, ...)
#define isr_log_w(format, ...)
#define log_buf_w(b,l)
#define log_w(format, ...) do {} while(0)
#define isr_log_w(format, ...) do {} while(0)
#define log_buf_w(b,l) do {} while(0)
#endif

#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
Expand All @@ -163,9 +163,9 @@ void log_print_buf(const uint8_t *b, size_t len);
#define log_buf_e(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_ERROR);}while(0)
#endif
#else
#define log_e(format, ...)
#define isr_log_e(format, ...)
#define log_buf_e(b,l)
#define log_e(format, ...) do {} while(0)
#define isr_log_e(format, ...) do {} while(0)
#define log_buf_e(b,l) do {} while(0)
#endif

#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_NONE
Expand All @@ -179,9 +179,9 @@ void log_print_buf(const uint8_t *b, size_t len);
#define log_buf_n(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_ERROR);}while(0)
#endif
#else
#define log_n(format, ...)
#define isr_log_n(format, ...)
#define log_buf_n(b,l)
#define log_n(format, ...) do {} while(0)
#define isr_log_n(format, ...) do {} while(0)
#define log_buf_n(b,l) do {} while(0)
#endif

#include "esp_log.h"
Expand Down
10 changes: 5 additions & 5 deletions cores/esp32/esp32-hal-rmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,16 +546,16 @@ float rmtSetTick(rmt_obj_t* rmt, float tick)
size_t channel = rmt->channel;

#if CONFIG_IDF_TARGET_ESP32C3
int apb_div = _LIMIT(tick/25.0, 256);
float apb_tick = 25.0 * apb_div;
int apb_div = _LIMIT(tick/25.0f, 256);
float apb_tick = 25.0f * apb_div;
RMT.tx_conf[channel].div_cnt = apb_div & 0xFF;
RMT.tx_conf[channel].conf_update = 1;
return apb_tick;
#else
int apb_div = _LIMIT(tick/12.5, 256);
int apb_div = _LIMIT(tick/12.5f, 256);
int ref_div = _LIMIT(tick/1000, 256);
float apb_tick = 12.5 * apb_div;
float ref_tick = 1000.0 * ref_div;
float apb_tick = 12.5f * apb_div;
float ref_tick = 1000.0f * ref_div;
if (_ABS(apb_tick - tick) < _ABS(ref_tick - tick)) {
RMT.conf_ch[channel].conf0.div_cnt = apb_div & 0xFF;
RMT.conf_ch[channel].conf1.ref_always_on = 1;
Expand Down
12 changes: 6 additions & 6 deletions libraries/EEPROM/examples/eeprom_class/eeprom_class.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@
#include "EEPROM.h"

// Instantiate eeprom objects with parameter/argument names and sizes
EEPROMClass NAMES("eeprom0", 0x500);
EEPROMClass HEIGHT("eeprom1", 0x200);
EEPROMClass AGE("eeprom2", 0x100);
EEPROMClass NAMES("eeprom0");
EEPROMClass HEIGHT("eeprom1");
EEPROMClass AGE("eeprom2");

void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("Testing EEPROMClass\n");
if (!NAMES.begin(NAMES.length())) {
if (!NAMES.begin(0x500)) {
Serial.println("Failed to initialise NAMES");
Serial.println("Restarting...");
delay(1000);
ESP.restart();
}
if (!HEIGHT.begin(HEIGHT.length())) {
if (!HEIGHT.begin(0x200)) {
Serial.println("Failed to initialise HEIGHT");
Serial.println("Restarting...");
delay(1000);
ESP.restart();
}
if (!AGE.begin(AGE.length())) {
if (!AGE.begin(0x100)) {
Serial.println("Failed to initialise AGE");
Serial.println("Restarting...");
delay(1000);
Expand Down
9 changes: 3 additions & 6 deletions libraries/EEPROM/src/EEPROM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ EEPROMClass::EEPROMClass(void)
, _size(0)
, _dirty(false)
, _name("eeprom")
, _user_defined_size(0)
{
}

Expand All @@ -45,17 +44,15 @@ EEPROMClass::EEPROMClass(uint32_t sector)
, _size(0)
, _dirty(false)
, _name("eeprom")
, _user_defined_size(0)
{
}

EEPROMClass::EEPROMClass(const char* name, uint32_t user_defined_size)
EEPROMClass::EEPROMClass(const char* name)
: _handle(0)
, _data(0)
, _size(0)
, _dirty(false)
, _name(name)
, _user_defined_size(user_defined_size)
{
}

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

_data = (uint8_t*) malloc(size);
if(!_data) {
log_e("Not enough memory for %d bytes in EEPROM");
log_e("Not enough memory for %d bytes in EEPROM", size);
return false;
}
_size = size;
Expand Down Expand Up @@ -215,7 +212,7 @@ uint8_t * EEPROMClass::getDataPtr() {
*/
uint16_t EEPROMClass::length ()
{
return _user_defined_size;
return _size;
}

/*
Expand Down
3 changes: 1 addition & 2 deletions libraries/EEPROM/src/EEPROM.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef uint32_t nvs_handle;
class EEPROMClass {
public:
EEPROMClass(uint32_t sector);
EEPROMClass(const char* name, uint32_t user_defined_size);
EEPROMClass(const char* name);
EEPROMClass(void);
~EEPROMClass(void);

Expand Down Expand Up @@ -112,7 +112,6 @@ class EEPROMClass {
size_t _size;
bool _dirty;
const char* _name;
uint32_t _user_defined_size;
};

#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_EEPROM)
Expand Down
9 changes: 9 additions & 0 deletions libraries/Ethernet/library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name=Ethernet
version=2.0.0
author=Hristo Gochkov
maintainer=Hristo Gochkov <hristo@espressif.com>
sentence=Enables network connection (local and Internet) using the ESP32 Ethernet.
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.
category=Communication
url=
architectures=esp32
6 changes: 0 additions & 6 deletions libraries/WiFi/src/ETH.cpp → libraries/Ethernet/src/ETH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,6 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
esp_netif_t *eth_netif = esp_netif_new(&cfg);

if(esp_eth_set_default_handlers(eth_netif) != ESP_OK){
log_e("esp_eth_set_default_handlers failed");
return false;
}


esp_eth_mac_t *eth_mac = NULL;
#if CONFIG_ETH_SPI_ETHERNET_DM9051
if(type == ETH_PHY_DM9051){
Expand Down
File renamed without changes.
15 changes: 14 additions & 1 deletion libraries/HTTPClient/src/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,17 @@ void HTTPClient::setAuthorization(const char * auth)
}
}

/**
* set the Authorization type for the http request
* @param authType const char *
*/
void HTTPClient::setAuthorizationType(const char * authType)
{
if(authType) {
_authorizationType = authType;
}
}

/**
* set the timeout (ms) for establishing a connection to the server
* @param connectTimeout int32_t
Expand Down Expand Up @@ -1178,7 +1189,9 @@ bool HTTPClient::sendHeader(const char * type)

if(_base64Authorization.length()) {
_base64Authorization.replace("\n", "");
header += F("Authorization: Basic ");
header += F("Authorization: ");
header += _authorizationType;
header += " ";
header += _base64Authorization;
header += "\r\n";
}
Expand Down
Loading

0 comments on commit 5f30bab

Please sign in to comment.