Skip to content

Commit

Permalink
Merge branch 'espressif:release/v2.x' into release/v2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored May 3, 2023
2 parents fb94d7d + 3670e2b commit a4889ba
Show file tree
Hide file tree
Showing 17 changed files with 212 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/Issue-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ body:
options:
- latest master (checkout manually)
- latest development Release Candidate (RC-X)
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
Expand Down
35 changes: 35 additions & 0 deletions .github/scripts/find_all_boards.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# Get all boards
boards_array=()

for line in `grep '.tarch=' boards.txt`; do
board_name=$(echo "$line" | cut -d '.' -f1 | cut -d '#' -f1)
boards_array+=("espressif:esp32:$board_name")
echo "Added 'espressif:esp32:$board_name' to array"
done

# Create JSON like string with all boards found and pass it to env variable
board_count=${#boards_array[@]}
echo "Boards found: $board_count"
echo "BOARD-COUNT=$board_count" >> $GITHUB_ENV

if [ $board_count -gt 0 ]
then
json_matrix='['
for board in ${boards_array[@]}
do
json_matrix+='"'$board'"'
if [ $board_count -gt 1 ]
then
json_matrix+=","
fi
board_count=$(($board_count - 1))
done
json_matrix+=']'

echo $json_matrix
echo "FQBNS=${json_matrix}" >> $GITHUB_ENV
else
echo "FQBNS=" >> $GITHUB_ENV
fi
86 changes: 86 additions & 0 deletions .github/workflows/allboards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Boards Test - Remote trigger

# The workflow will run on remote dispath with event-type set to "test-boards"
on:
repository_dispatch:
types: [test-boards]

jobs:
find-boards:
runs-on: ubuntu-latest

outputs:
fqbns: ${{ env.FQBNS }}
board-count: ${{ env.BOARD-COUNT }}

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.branch }}

- name: Get boards fqbns
run:
bash .github/scripts/find_all_boards.sh

setup-chunks:
needs: find-boards
runs-on: ubuntu-latest
if: needs.find-boards.outputs.fqbns != ''

outputs:
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }}

steps:
- uses: actions/checkout@v3
- run: npm install
- name: Setup jq
uses: dcarbone/[email protected]

- id: set-test-chunks
name: Set Chunks
run:
echo "test-chunks<<EOF" >> $GITHUB_OUTPUT

echo "$( jq -nc '${{ needs.find-boards.outputs.fqbns }} | [_nwise( ${{ needs.find-boards.outputs.board-count }}/15 | ceil)]')" >> $GITHUB_OUTPUT

echo "EOF" >> $GITHUB_OUTPUT

test-boards:
needs: setup-chunks
runs-on: ubuntu-latest

env:
REPOSITORY: |
- source-path: '.'
name: "espressif:esp32"
strategy:
fail-fast: false
matrix:
chunk: ${{ fromJSON(needs.setup-chunks.outputs['test-chunks']) }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Echo FQBNS to file
run:
echo "$FQBN" > fqbns.json
env:
FQBN: ${{ toJSON(matrix.chunk) }}

- name: Compile sketch
uses: P-R-O-C-H-Y/compile-sketches@main
with:
platforms: |
${{ env.REPOSITORY }}
multiple-fqbn: true
multiple-fqbn-path: "fqbns.json"
use-json-file: false
enable-deltas-report: false
enable-warnings-report: false
cli-compile-flags: |
- --warnings="all"
sketch-paths:
"- ./libraries/ESP32/examples/CI/CIBoardsTest/CIBoardsTest.ino"
17 changes: 14 additions & 3 deletions .github/workflows/lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
"name": "ESP32Servo",
"exclude_targets": [],
"sketch_path": [
"~/Arduino/libraries/ESP32Servo/examples/Knob/Knob.ino",
"~/Arduino/libraries/ESP32Servo/examples/Sweep/Sweep.ino",
"~/Arduino/libraries/ESP32Servo/examples/PWMExample/PWMExample.ino",
"~/Arduino/libraries/ESP32Servo/examples/Multiple-Servo-Example-Arduino/Multiple-Servo-Example-Arduino.ino"
]
},
Expand Down Expand Up @@ -51,5 +48,19 @@
"sketch_path": [
"~/Arduino/libraries/IRremote/examples/SendDemo/SendDemo.ino"
]
},
{
"name": "MFRC522",
"exclude_targets": [],
"sketch_path": [
"~/Arduino/libraries/MFRC522/examples/ReadUidMultiReader/ReadUidMultiReader.ino"
]
},
{
"name": "WS2812FX",
"exclude_targets": [],
"sketch_path": [
"~/Arduino/libraries/WS2812FX/examples/ws2812fx_spi/ws2812fx_spi.ino"
]
}
]
2 changes: 2 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7314,6 +7314,7 @@ dfrobot_beetle_esp32c3.menu.EraseFlash.all.upload.erase_cmd=-e
dfrobot_firebeetle2_esp32e.name=FireBeetle 2 ESP32-E

dfrobot_firebeetle2_esp32e.upload.tool=esptool_py
dfrobot_firebeetle2_esp32e.upload.tool.default=esptool_py
dfrobot_firebeetle2_esp32e.upload.maximum_size=1310720
dfrobot_firebeetle2_esp32e.upload.maximum_data_size=327680
dfrobot_firebeetle2_esp32e.upload.flags=
Expand Down Expand Up @@ -22259,6 +22260,7 @@ esp32c3m1IKit.menu.EraseFlash.all.upload.erase_cmd=-e
roboheart_hercules.name=RoboHeart Hercules

roboheart_hercules.upload.tool=esptool_py
roboheart_hercules.upload.tool.default=esptool_py
roboheart_hercules.upload.maximum_size=1310720
roboheart_hercules.upload.maximum_data_size=327680
roboheart_hercules.upload.wait_for_upload_port=true
Expand Down
4 changes: 2 additions & 2 deletions cores/esp32/WString.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
// A pure abstract class forward used as a means to proide a unique pointer type
// but really is never defined.
class __FlashStringHelper;
#define FPSTR(pstr_pointer) (pstr_pointer)
#define F(string_literal) (string_literal)
#define FPSTR(str_pointer) (reinterpret_cast<const __FlashStringHelper *>(str_pointer))
#define F(string_literal) (FPSTR(PSTR(string_literal)))

// An inherited class for holding the result of a concatenation. These
// result objects are assumed to be writable by subsequent concatenations.
Expand Down
38 changes: 22 additions & 16 deletions cores/esp32/esp32-hal-ledc.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,26 +215,32 @@ static int cnt_channel = LEDC_CHANNELS;
static uint8_t analog_resolution = 8;
static int analog_frequency = 1000;
void analogWrite(uint8_t pin, int value) {
// Use ledc hardware for internal pins
if (pin < SOC_GPIO_PIN_COUNT) {
if (pin_to_channel[pin] == 0) {
if (!cnt_channel) {
log_e("No more analogWrite channels available! You can have maximum %u", LEDC_CHANNELS);
return;
}
if(ledcSetup(cnt_channel - 1, analog_frequency, analog_resolution) == 0){
log_e("analogWrite setup failed (freq = %u, resolution = %u). Try setting different resolution or frequency");
return;
}
ledcAttachPin(pin, cnt_channel - 1);
pin_to_channel[pin] = cnt_channel--;
// Use ledc hardware for internal pins
if (pin < SOC_GPIO_PIN_COUNT) {
int8_t channel = -1;
if (pin_to_channel[pin] == 0) {
if (!cnt_channel) {
log_e("No more analogWrite channels available! You can have maximum %u", LEDC_CHANNELS);
return;
}
cnt_channel--;
channel = cnt_channel;
} else {
channel = analogGetChannel(pin);
}
log_v("GPIO %d - Using Channel %d, Value = %d", pin, channel, value);
if(ledcSetup(channel, analog_frequency, analog_resolution) == 0){
log_e("analogWrite setup failed (freq = %u, resolution = %u). Try setting different resolution or frequency");
return;
}
ledcAttachPin(pin, channel);
pin_to_channel[pin] = channel;
ledcWrite(channel, value);
}
ledcWrite(pin_to_channel[pin] - 1, value);
}
}

int8_t analogGetChannel(uint8_t pin) {
return pin_to_channel[pin] - 1;
return pin_to_channel[pin];
}

void analogWriteFrequency(uint32_t freq) {
Expand Down
2 changes: 1 addition & 1 deletion cores/esp32/esp_arduino_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern "C" {
/** Minor version number (x.X.x) */
#define ESP_ARDUINO_VERSION_MINOR 0
/** Patch version number (x.x.X) */
#define ESP_ARDUINO_VERSION_PATCH 8
#define ESP_ARDUINO_VERSION_PATCH 9

/**
* Macro to convert ARDUINO version number into an integer
Expand Down
18 changes: 15 additions & 3 deletions docs/source/api/timer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ This function is used to end timer.
* ``timer`` timer struct.

timerSetConfig
timerGetConfig
**************

This function is used to configure initialized timer (timerBegin() called).
This function is used to get configuration of initialized timer (timerBegin() called).

.. code-block:: arduino
Expand All @@ -62,6 +62,18 @@ This function is used to configure initialized timer (timerBegin() called).
This function will return ``configuration`` as uint32_t number.
This can be translated by inserting it to struct ``timer_cfg_t.val``.

timerSetConfig
**************

This function is used to configure initialized timer (timerBegin() called).

.. code-block:: arduino
void timerSetConfig(hw_timer_t *timer, uint32_t config);
* ``timer`` timer struct.
* ``config`` configuration as uint32_t number. Use configuration struct ``timer_cfg_t`` and pass ``timer_cfg_t.val`` as ``config`` paramater.

timerAttachInterrupt
********************

Expand Down Expand Up @@ -372,4 +384,4 @@ Repeat timer example:
Watchdog timer example:

.. literalinclude:: ../../../libraries/ESP32/examples/Timer/WatchdogTimer/WatchdogTimer.ino
:language: arduino
:language: arduino
1 change: 1 addition & 0 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ in the examples menu or inside each library folder.

https://github.com/espressif/arduino-esp32/tree/master/libraries

There is also a `list of examples <https://techtutorialsx.com/category/esp32/>`_ managed outside of Espressif, so check them out.

.. include:: common/datasheet.inc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ void setup() {
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_sccb_sda = SIOD_GPIO_NUM;
config.pin_sccb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
Expand Down
4 changes: 2 additions & 2 deletions libraries/ESPmDNS/src/ESPmDNS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ MDNSResponder::~MDNSResponder() {
end();
}

bool MDNSResponder::begin(const char* hostName){
bool MDNSResponder::begin(const String& hostName){
if(mdns_init()){
log_e("Failed starting MDNS");
return false;
}
//WiFi.onEvent(_on_sys_event);
_hostname = hostName;
_hostname.toLowerCase();
if(mdns_hostname_set(hostName)) {
if(mdns_hostname_set(hostName.c_str())) {
log_e("Failed setting MDNS hostname");
return false;
}
Expand Down
5 changes: 4 additions & 1 deletion libraries/ESPmDNS/src/ESPmDNS.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ class MDNSResponder {
public:
MDNSResponder();
~MDNSResponder();
bool begin(const char* hostName);
bool begin(const String& hostName);
bool begin(const char* hostName){
return begin(String(hostName));
}
void end();

void setInstanceName(String name);
Expand Down
16 changes: 16 additions & 0 deletions libraries/WiFi/src/WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,22 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
return false;
}

/**
* @brief Reset WiFi settings in NVS to default values.
* @return true if erase succeeded
* @note: Resets SSID, password, protocol, mode, etc.
* These settings are maintained by WiFi driver in IDF.
* WiFi driver must be initialized.
*/
bool WiFiSTAClass::eraseAP(void) {
if(WiFi.getMode()==WIFI_MODE_NULL) {
if(!WiFi.enableSTA(true))
return false;
}

return esp_wifi_restore()==ESP_OK;
}

/**
* Change IP configuration settings disabling the dhcp client
* @param local_ip Static ip configuration
Expand Down
7 changes: 7 additions & 0 deletions libraries/WiFi/src/WiFiSTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,21 @@ class WiFiSTAClass
public:

wl_status_t begin(const char* wpa2_ssid, wpa2_auth_method_t method, const char* wpa2_identity=NULL, const char* wpa2_username=NULL, const char *wpa2_password=NULL, const char* ca_pem=NULL, const char* client_crt=NULL, const char* client_key=NULL, int32_t channel=0, const uint8_t* bssid=0, bool connect=true);
wl_status_t begin(const String& wpa2_ssid, wpa2_auth_method_t method, const String& wpa2_identity = (const char*)NULL, const String& wpa2_username = (const char*)NULL, const String& wpa2_password = (const char*)NULL, const String& ca_pem = (const char*)NULL, const String& client_crt = (const char*)NULL, const String& client_key = (const char*)NULL, int32_t channel=0, const uint8_t* bssid=0, bool connect=true) {
return begin(wpa2_ssid.c_str(), method, wpa2_identity.c_str(), wpa2_username.c_str(), wpa2_password.c_str(), ca_pem.c_str(), client_crt.c_str(), client_key.c_str(), channel, bssid, connect);
}
wl_status_t begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
wl_status_t begin(const String& ssid, const String& passphrase = (const char*)NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true) {
return begin(ssid.c_str(), passphrase.c_str(), channel, bssid, connect);
}
wl_status_t begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
wl_status_t begin();

bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = (uint32_t)0x00000000, IPAddress dns2 = (uint32_t)0x00000000);

bool reconnect();
bool disconnect(bool wifioff = false, bool eraseap = false);
bool eraseAP(void);

bool isConnected();

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "framework-arduinoespressif32",
"version": "2.0.8",
"version": "2.0.9",
"description": "Arduino Wiring-based Framework for the Espressif ESP32, ESP32-S and ESP32-C series of SoCs",
"keywords": [
"framework",
Expand Down
2 changes: 1 addition & 1 deletion platform.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP32 Arduino
version=2.0.8
version=2.0.9

tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf
tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf
Expand Down

0 comments on commit a4889ba

Please sign in to comment.