Skip to content

Commit

Permalink
Tasmota changes
Browse files Browse the repository at this point in the history
* Fix wdt OTA update

* Fix ESP32-Solo WDT on HTTP OTA update

Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>

* Fix ESP32-Solo WDT on HTTP OTA update

* Fix ESP32-Solo WDT on HTTP OTA update

Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>

* IDF master c69f0ec32

* Fix WDT only for solo core

* IDF master 58022f859

* IDF master 606557b48

* IDF master 8131d6f46

* IDF master 59aa60d52

* IDF master 83956ebba

* IDF master 83956ebbae

* IDF master b1c3ee71c5

* IDF master 2c49af9e75

* IDF master eb1a66e7c9

* IDF master a20df743f1

* Fix build compilation due to changes in the HW_TIMER's structs

* Fix compilation warnings and errors with USB

* Update USBCDC.cpp

* Update CMakeLists.txt

* IDF master b63ec47238

* Update libarduino_tinyusb.a

* Update HWCDC.cpp

* IDF master 5f38b766a8

* IDF master b1f851b8f8

* IDF master 61299f879e

* Delete tools/sdk/esp32/include/coap directory

* Delete tools/sdk/esp32c3/include/coap directory

* Delete tools/sdk/esp32s2/include/coap directory

* solve conflicts

* force Dynamic Buffer instead of Static ones

* Remove debug if

* Resolve conflicts

* Revert espressif#5861

* add GPIO defines for C3

* Edit sd_diskio to check card status

* Update CMakeLists.txt

* Delete libraries/RainMaker directory

* Update README.md

* Update README.md

* Revert "RMT refactor"

* Fixes Lib Builder compiling errors

* Fixes Lib Builder compiling errors

* Revert "Revert "RMT refactor""

* Update esp32-hal-rmt.c

* Update esp32-hal-rmt.c

* Update esp32-hal-rmt.c

* Update esp32-hal-rmt.c

* Update esp32-hal-gpio.c

* Bugfix of ff_sd_status

* Fix I2C Slave Compile

I2C Slave currently doesn't compile for projects where Arduino is an IDF component.  This adds missing conditionals.

* add missing c3 define

when disable HAL lock is set

* add ESP32C3 `esp32_adc2gpio`

* Fixes UART MODBUS and Loopback issue

* Update esp32-hal-uart.c

* Revert "Fixing interrupts in LEDC (espressif#6160)"

This reverts commit a593206.

* Update esp32-hal.h

* use Tasmota github

* Use Tasmota platform for CI

* tasmota eaptool v3.2

* add missing c3 define

* enable SPI hal for S3

* revert enable spi for S3

* Update Esp.cpp

* Update Esp.cpp

* fix S3 uart gpios

* Update HardwareSerial.cpp

* Update Esp.cpp

* Update Esp.cpp

* Bootloader is at 0x0000 for S3

* Update esp32-hal-cpu.c

* Update esp32-hal-spi.c

* Update install-platformio-esp32.sh

* Fix replace() failing

* Update CMakeLists.txt

* remove Rainmaker

* Update CMakeLists.txt

* try to find lib builder fail

* Update CMakeLists.txt

* Update idf_component.yml

* Update esp32-hal-ledc.c

* Update esp32-hal-gpio.c

* Update esp32-hal-gpio.h

* Update boards.txt

* Update idf_component.yml

* Update esp32-hal-gpio.c

* Update esp32-hal-ledc.c

* Update idf_component.yml

* Add files via upload

* Update HTTPClient.cpp

* Update HTTPClient.h

* Fixes RMT examples and adds ESP32-S3 config

* Fixes RMT examples and adds ESP32-S3 config

* fix compile

* fix compile 2

* fix compile 3

* revert cookie changes

* revert cookie jar support

* cookie jar

* cookie jar

* Support mbedtls 2.28.x

* Update esp32c3.rom.ld

* GPIO refactoring

GPIO now using ESP-IDF API on all chips.
LEDC interrupt fix removed - no longer needed.
Edited pins_arduino.h in variants according to changes in gpio.

* Update esp32-hal-gpio.c

* Update esp32-hal-ledc.c

* Update HTTPClient.cpp

* Update ssl_client.cpp

* Update boards.txt

* Update esp32-hal-gpio.c

* Update esp32-hal-ledc.c

* Edited analog channels functions

* Update esp32-hal-gpio.c

* Update esp32-hal-gpio.h

* Update esp32-hal-ledc.c

* Fix CDC+JTAG is disabled when WiFi is used on ESP32-C3

Fixes: espressif#6264
Thanks @Spritetm

* ADC esp32s2 attenuation fix for DAC pins

* Revert "ADC esp32s2 attenuation fix for DAC pins"

* revert6134

espressif#6134

* revert2

* revert3

* revert

* Update HardwareSerial.cpp

* Update HardwareSerial.h

* Update esp32-hal-uart.c

* Update esp32-hal-uart.h

* S3

* Update esp32-hal-adc.c

* Fix ethenet

* align with arduino upstream

* Adds C++ std::function to Serial.onReceive() PR6364 upstream

* Update esp32-hal-uart.c

* Update HardwareSerial.cpp

* Update esp32-hal-uart.c

* Update boards.txt

* Update HardwareSerial.cpp

* Update HardwareSerial.h

* Update WiFiAP.cpp

* Update WiFiGeneric.cpp

* Update WiFiGeneric.h

* Update WiFiSTA.cpp

* Update WiFiSTA.h

* Update HardwareSerial.cpp

* Update HardwareSerial.h

* Delete libraries/RainMaker directory

* remove rainmaker

* Fixes USB CDC setRxBufferSize(), begin(), _onRX()

* Fixes SetRxBufferSize(0) with end()

* Fixes reset when 2x call to end()

* publish.yml: Limit the running scope of the publish Workflow. (espressif#6428)

1. Don't run the publish test result workflow on the master
branch.
2. Run only on Pull Requests to be able to publish the result as a PR comment.
3. Avoid running when the triggering workflow was skipped, this will
   cause a failure as no file will be uploaded.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>

* Add missing include in AsyncUDP.h (espressif#6412)

In my project I'm getting the error 
```
In file included from lib/Discovery/Discovery.cpp:2:
C:/Users/David/.platformio/packages/framework-arduinoespressif32/libraries/AsyncUDP/src/AsyncUDP.h:47:1: error: expected class-name before '{' token
```

Adding a reference to Stream.h fixes it.

* Some board variant fixes (espressif#6411)

* make work with rev C pcb

* use #define for easy testing

* Added another overloaded WiFiSTAClass::begin() function that provides… (espressif#6398)

Summary

The examples demonstrate how to create a WPA2 Enterprise connection, but it requires using various direct esp_idf functions. This patch is intended to create another overloaded version of the WiFi.begin() function that allows a user to create a WPA2 Enterprise connection in much the same way as different kinds of connections.

My only question for the core maintainers is whether I should leave those #ifdef's in there. I added them so that it was easy to disable all the code I added via defines from my platformio.ini file, but they technically aren't necessary.

Impact

This should make it easier for novice users to create WPA2 Enterprise connections. For my university, I didn't need a root certificate or the client certificate or client key, so I haven't been able to debug those scenarios, but I built the begin functions to allow any one of those to be used, if needed.

I can confirm that eduroam-style WPA2 Enterprise networks that only require authentication with a username and password works as expected.

* Fix boot freeze when trying to init PSRAM on Pico D4

* Revert "Added another overloaded WiFiSTAClass::begin() function that provides… (espressif#6398)"

This reverts commit d977359.

* fix rainmaker merge

Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>
Co-authored-by: me-no-dev <me-no-dev@users.noreply.github.com>
Co-authored-by: me-no-dev <hristo@espressif.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: Jason2866 <jason2866@github.com>
Co-authored-by: Rodrigo Garcia <Rodrigo.Garcia@espressif.com>
Co-authored-by: mrengineer7777 <44048235+mrengineer7777@users.noreply.github.com>
Co-authored-by: s-hadinger <49731213+s-hadinger@users.noreply.github.com>
Co-authored-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
Co-authored-by: Limor "Ladyada" Fried <limor@ladyada.net>
Co-authored-by: John P. Swensen <jpswensen@gmail.com>
Co-authored-by: Stephan Hadinger <stephan.hadinger@gmail.com>
  • Loading branch information
13 people committed Mar 16, 2022
1 parent 86b6635 commit f92be06
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/install-arduino-core-esp32.sh
Expand Up @@ -20,7 +20,7 @@ if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
ln -s $GITHUB_WORKSPACE esp32
else
echo "Cloning Core Repository..."
git clone https://github.com/espressif/arduino-esp32.git esp32 > /dev/null 2>&1
git clone https://github.com/tasmota/arduino-esp32.git esp32 > /dev/null 2>&1
fi

#echo "Updating Submodules ..."
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Expand Up @@ -3,6 +3,7 @@ name: Unit Test Results
on:
workflow_run:
workflows: [Run tests in hardware]
branches-ignore: [master]

types:
- completed
Expand All @@ -11,6 +12,9 @@ jobs:
unit-test-results:
name: Unit Test Results
runs-on: ubuntu-latest
if: |
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion != 'skipped'
steps:
- name: Download and Extract Artifacts
env:
Expand Down
2 changes: 1 addition & 1 deletion boards.txt
Expand Up @@ -13017,4 +13017,4 @@ deneyapkart1A.menu.DebugLevel.debug.build.code_debug=4
deneyapkart1A.menu.DebugLevel.verbose=Verbose
deneyapkart1A.menu.DebugLevel.verbose.build.code_debug=5

##############################################################
##############################################################
14 changes: 9 additions & 5 deletions cores/esp32/Esp.cpp
Expand Up @@ -47,7 +47,7 @@ extern "C" {
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/rom/spi_flash.h"
#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c3 is located at 0x0000
#else
#else
#error Target CONFIG_IDF_TARGET is not supported
#endif
#else // ESP32 Before IDF 4.0
Expand Down Expand Up @@ -192,7 +192,7 @@ static uint32_t sketchSize(sketchSize_t response) {
return data.image_len;
}
}

uint32_t EspClass::getSketchSize () {
return sketchSize(SKETCH_SIZE_TOTAL);
}
Expand Down Expand Up @@ -231,6 +231,10 @@ String EspClass::getSketchMD5()
md5.add(buf.get(), readBytes);
lengthLeft -= readBytes;
offset += readBytes;

#if CONFIG_FREERTOS_UNICORE
delay(1); // Fix solo WDT
#endif
}
md5.calculate();
result = md5.toString();
Expand Down Expand Up @@ -391,17 +395,17 @@ bool EspClass::flashRead(uint32_t offset, uint32_t *data, size_t size)
return spi_flash_read(offset, (uint32_t*) data, size) == ESP_OK;
}

bool EspClass::partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size)
bool EspClass::partitionEraseRange(const esp_partition_t *partition, uint32_t offset, size_t size)
{
return esp_partition_erase_range(partition, offset, size) == ESP_OK;
}

bool EspClass::partitionWrite(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size)
bool EspClass::partitionWrite(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size)
{
return esp_partition_write(partition, offset, data, size) == ESP_OK;
}

bool EspClass::partitionRead(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size)
bool EspClass::partitionRead(const esp_partition_t *partition, uint32_t offset, uint32_t *data, size_t size)
{
return esp_partition_read(partition, offset, data, size) == ESP_OK;
}
Expand Down
6 changes: 5 additions & 1 deletion cores/esp32/HardwareSerial.cpp
Expand Up @@ -37,7 +37,7 @@ void serialEvent(void) {}
#ifndef RX1
#if CONFIG_IDF_TARGET_ESP32
#define RX1 9
#elif CONFIG_IDF_TARGET_ESP32S2
#elif CONFIG_IDF_TARGET_ESP32S2
#define RX1 18
#elif CONFIG_IDF_TARGET_ESP32C3
#define RX1 18
Expand Down Expand Up @@ -86,6 +86,8 @@ void serialEvent2(void) {}
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
#if ARDUINO_USB_CDC_ON_BOOT //Serial used for USB CDC
HardwareSerial Serial0(0);
#elif ARDUINO_HW_CDC_ON_BOOT
HardwareSerial Serial0(0);
#else
HardwareSerial Serial(0);
#endif
Expand All @@ -100,6 +102,8 @@ void serialEventRun(void)
{
#if ARDUINO_USB_CDC_ON_BOOT //Serial used for USB CDC
if(Serial0.available()) serialEvent();
#elif ARDUINO_HW_CDC_ON_BOOT
if(Serial0.available()) serialEvent();
#else
if(Serial.available()) serialEvent();
#endif
Expand Down
4 changes: 2 additions & 2 deletions cores/esp32/HardwareSerial.h
Expand Up @@ -156,10 +156,10 @@ extern void serialEventRun(void) __attribute__((weak));
#define ARDUINO_USB_CDC_ON_BOOT 0
#endif
#if ARDUINO_USB_CDC_ON_BOOT //Serial used for USB CDC
#if !ARDUINO_USB_MODE
#include "USB.h"
#include "USBCDC.h"
#endif
extern HardwareSerial Serial0;
#elif ARDUINO_HW_CDC_ON_BOOT
extern HardwareSerial Serial0;
#else
extern HardwareSerial Serial;
Expand Down
36 changes: 27 additions & 9 deletions cores/esp32/USBCDC.cpp
Expand Up @@ -114,11 +114,14 @@ void USBCDC::onEvent(arduino_usb_cdc_event_t event, esp_event_handler_t callback
}

size_t USBCDC::setRxBufferSize(size_t rx_queue_len){
if(rx_queue){
if(!rx_queue_len){
size_t currentQueueSize = rx_queue ?
uxQueueSpacesAvailable(rx_queue) + uxQueueMessagesWaiting(rx_queue) : 0;

if (rx_queue && (!rx_queue_len || rx_queue_len != currentQueueSize)) {
vQueueDelete(rx_queue);
rx_queue = NULL;
}
}
if(!rx_queue_len || rx_queue_len == currentQueueSize){
return 0;
}
rx_queue = xQueueCreate(rx_queue_len, sizeof(uint8_t));
Expand All @@ -133,7 +136,8 @@ void USBCDC::begin(unsigned long baud)
if(tx_lock == NULL) {
tx_lock = xSemaphoreCreateMutex();
}
setRxBufferSize(256);//default if not preset
// if rx_queue was set before begin(), keep it
if (!rx_queue) setRxBufferSize(256); //default if not preset
devices[itf] = this;
}

Expand All @@ -144,6 +148,7 @@ void USBCDC::end()
setRxBufferSize(0);
if(tx_lock != NULL) {
vSemaphoreDelete(tx_lock);
tx_lock = NULL;
}
}

Expand Down Expand Up @@ -246,14 +251,27 @@ void USBCDC::_onLineCoding(uint32_t _bit_rate, uint8_t _stop_bits, uint8_t _pari
void USBCDC::_onRX(){
uint8_t buf[CONFIG_TINYUSB_CDC_RX_BUFSIZE+1];
uint32_t count = tud_cdc_n_read(itf, buf, CONFIG_TINYUSB_CDC_RX_BUFSIZE);

if(rx_queue == NULL) {
return;
}
if (uxQueueSpacesAvailable(rx_queue) < count) {
//this VTaskDelay gives, to Arduino's task, time to the CPU do its processing
//without it, data may be lost when the number of bytes received is higher than CDC buffer size
vTaskDelay(10);
}
for(uint32_t i=0; i<count; i++){
if(rx_queue == NULL || !xQueueSend(rx_queue, buf+i, 0)){
return;
if(!xQueueSend(rx_queue, buf+i, 0)){
// rx_queue overflow - data will be lost
count = i;
break;
}
}
arduino_usb_cdc_event_data_t p;
p.rx.len = count;
arduino_usb_event_post(ARDUINO_USB_CDC_EVENTS, ARDUINO_USB_CDC_RX_EVENT, &p, sizeof(arduino_usb_cdc_event_data_t), portMAX_DELAY);
if (count) {
arduino_usb_cdc_event_data_t p;
p.rx.len = count;
arduino_usb_event_post(ARDUINO_USB_CDC_EVENTS, ARDUINO_USB_CDC_RX_EVENT, &p, sizeof(arduino_usb_cdc_event_data_t), portMAX_DELAY);
}
}

void USBCDC::_onTX(){
Expand Down
2 changes: 1 addition & 1 deletion cores/esp32/esp32-hal-psram.c
Expand Up @@ -56,7 +56,7 @@ bool psramInit(){
#if CONFIG_IDF_TARGET_ESP32
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
uint32_t pkg_ver = chip_ver & 0x7;
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) {
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
spiramFailed = true;
log_w("PSRAM not supported!");
return false;
Expand Down
1 change: 1 addition & 0 deletions libraries/AsyncUDP/src/AsyncUDP.h
Expand Up @@ -4,6 +4,7 @@
#include "IPAddress.h"
#include "IPv6Address.h"
#include "Print.h"
#include "Stream.h"
#include <functional>
extern "C" {
#include "lwip/ip_addr.h"
Expand Down
2 changes: 1 addition & 1 deletion libraries/ESP32/examples/RMT/RMTCallback/RMTCallback.ino
Expand Up @@ -64,4 +64,4 @@ void loop()
{
Serial.printf("GPIO 4: %08x 5: %08x 10: %08x\n", mp1.val(), mp2.val(), mp3.val());
delay(500);
}
}
3 changes: 0 additions & 3 deletions libraries/README.md
Expand Up @@ -67,9 +67,6 @@ arduino-esp32 includes libraries for Arduino compatibility along with some objec
### Preferences
Flash keystore using ESP32 NVS

### ESP RainMaker
End-to-end platform by Espressif that enables Makers to realize their IoT ideas faster

### SD
Secure Digital card filesystem using SPI access

Expand Down
4 changes: 3 additions & 1 deletion libraries/Update/src/Updater.cpp
Expand Up @@ -352,7 +352,7 @@ size_t UpdateClass::writeStream(Stream &data) {
bytesToRead = remaining();
}

/*
/*
Init read&timeout counters and try to read, if read failed, increase counter,
wait 100ms and try to read again. If counter > 300 (30 sec), give up/abort
*/
Expand All @@ -377,6 +377,8 @@ size_t UpdateClass::writeStream(Stream &data) {
if((_bufferLen == remaining() || _bufferLen == SPI_FLASH_SEC_SIZE) && !_writeBuffer())
return written;
written += toRead;

delay(1); // Fix solo WDT
}
return written;
}
Expand Down
3 changes: 2 additions & 1 deletion tools/sdk/esp32c3/ld/esp32c3.rom.ld
Expand Up @@ -1067,6 +1067,7 @@ r_lld_con_tx_prog = 0x40001140;
r_lld_conn_dynamic_pti_process = 0x40001144;
r_lld_continue_scan_rx_isr_end_process = 0x40001148;
r_lld_ext_scan_dynamic_pti_process = 0x4000114c;
r_lld_ext_adv_dynamic_aux_pti_process = 0x40001b44;
r_lld_hw_cca_end_isr = 0x40001150;
r_lld_hw_cca_evt_handler = 0x40001154;
r_lld_hw_cca_isr = 0x40001158;
Expand Down Expand Up @@ -1896,7 +1897,7 @@ rom_read_sar2_code = 0x40001aa4;
rom_get_sar2_vol = 0x40001aa8;
rom_get_pll_vol = 0x40001aac;
rom_get_phy_target_power = 0x40001ab0;
/* rom_temp_to_power = 0x40001ab4; */
rom_temp_to_power = 0x40001ab4;
rom_phy_track_pll_cap = 0x40001ab8;
rom_phy_pwdet_always_en = 0x40001abc;
rom_phy_pwdet_onetime_en = 0x40001ac0;
Expand Down
11 changes: 5 additions & 6 deletions variants/adafruit_feather_esp32_v2/pins_arduino.h
Expand Up @@ -42,20 +42,19 @@ static const uint8_t A9 = 33;
static const uint8_t A10 = 27;
static const uint8_t A11 = 12;
static const uint8_t A12 = 13;
static const uint8_t A13 = 35;

// vbat measure
static const uint8_t BATT_MONITOR = 35;
static const uint8_t A13 = 35;
#define BATT_MONITOR 35

// internal switch
static const uint8_t BUTTON = 38;
#define BUTTON = 38;

// Neopixel
static const uint8_t NEOPIXEL_PIN = 0;
static const uint8_t PIN_NEOPIXEL = 0;
#define PIN_NEOPIXEL 0

// Neopixel & I2C power
static const uint8_t NEOPIXEL_I2C_POWER = 2;
#define NEOPIXEL_I2C_POWER 2

static const uint8_t T0 = 4;
static const uint8_t T1 = 0;
Expand Down
9 changes: 5 additions & 4 deletions variants/adafruit_feather_esp32s2/variant.cpp
Expand Up @@ -36,10 +36,11 @@ void initVariant(void)
pinMode(NEOPIXEL_POWER, OUTPUT);
digitalWrite(NEOPIXEL_POWER, HIGH);

// This board has a power control pin, and we must set it to output and low
// in order to enable the I2C port.
// turn on the I2C power by setting pin to opposite of 'rest state'
pinMode(PIN_I2C_POWER, INPUT);
delay(1);
bool polarity = digitalRead(PIN_I2C_POWER);
pinMode(PIN_I2C_POWER, OUTPUT);
digitalWrite(PIN_I2C_POWER, LOW);
digitalWrite(PIN_I2C_POWER, !polarity);
}

}
4 changes: 2 additions & 2 deletions variants/adafruit_qtpy_esp32c3/pins_arduino.h
Expand Up @@ -11,8 +11,8 @@
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):-1)
#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS)

static const uint8_t SWITCH = 9;
static const uint8_t NEOPIXEL_PIN = 2;
#define BUTTON 9
#define PIN_NEOPIXEL 2

static const uint8_t TX = 21;
static const uint8_t RX = 20;
Expand Down

0 comments on commit f92be06

Please sign in to comment.