diff --git a/.github/scripts/find_all_boards.sh b/.github/scripts/find_all_boards.sh new file mode 100755 index 00000000000..a2c53c212c5 --- /dev/null +++ b/.github/scripts/find_all_boards.sh @@ -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 diff --git a/.github/workflows/allboards.yml b/.github/workflows/allboards.yml new file mode 100644 index 00000000000..ddd631b1bf8 --- /dev/null +++ b/.github/workflows/allboards.yml @@ -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/install-jq-action@v1.0.1 + + - id: set-test-chunks + name: Set Chunks + run: + echo "test-chunks<> $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" diff --git a/boards.txt b/boards.txt index 7fef6d89647..f3ea5e1cc5b 100644 --- a/boards.txt +++ b/boards.txt @@ -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= @@ -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 diff --git a/cores/esp32/WString.h b/cores/esp32/WString.h index 4fbf3e3326e..6517109f29b 100644 --- a/cores/esp32/WString.h +++ b/cores/esp32/WString.h @@ -34,7 +34,7 @@ // 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) (reinterpret_cast(pstr_pointer)) +#define FPSTR(str_pointer) (reinterpret_cast(str_pointer)) #define F(string_literal) (FPSTR(PSTR(string_literal))) // An inherited class for holding the result of a concatenation. These diff --git a/docs/source/api/timer.rst b/docs/source/api/timer.rst index d253b6794f9..7a97feaabce 100644 --- a/docs/source/api/timer.rst +++ b/docs/source/api/timer.rst @@ -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 @@ -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 ******************** @@ -372,4 +384,4 @@ Repeat timer example: Watchdog timer example: .. literalinclude:: ../../../libraries/ESP32/examples/Timer/WatchdogTimer/WatchdogTimer.ino - :language: arduino \ No newline at end of file + :language: arduino diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index 0b4280d4b91..4093b415c07 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -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 `_ managed outside of Espressif, so check them out. .. include:: common/datasheet.inc diff --git a/libraries/ESPmDNS/src/ESPmDNS.cpp b/libraries/ESPmDNS/src/ESPmDNS.cpp index 77ab313a08f..cb2828716b1 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.cpp +++ b/libraries/ESPmDNS/src/ESPmDNS.cpp @@ -60,7 +60,7 @@ 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; @@ -68,7 +68,7 @@ bool MDNSResponder::begin(const char* hostName){ //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; } diff --git a/libraries/ESPmDNS/src/ESPmDNS.h b/libraries/ESPmDNS/src/ESPmDNS.h index 16c590d4a87..9a5e5c14184 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.h +++ b/libraries/ESPmDNS/src/ESPmDNS.h @@ -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); diff --git a/libraries/WiFi/src/WiFiSTA.h b/libraries/WiFi/src/WiFiSTA.h index 2cdea7667b8..0b8f9daf053 100644 --- a/libraries/WiFi/src/WiFiSTA.h +++ b/libraries/WiFi/src/WiFiSTA.h @@ -45,7 +45,13 @@ 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();