Arduino core 3.0.6 (#40)

* Update README.md

* esptool.py v4.8.0

* add cmake_utilities for C2

* add auto select "espidf" when pio var "custom_sdkconfig" is set

* Update main.py

* revert changes

* Update platformio.ini

* Update platformio.ini

* Update Zigbee_On_Off_Switch.ino

* Update Zigbee_On_Off_Light.ino

* Update examples.yml

* IDF v5.1.4.241008

* Arduino Core 3.0.6

* Update README.md
This commit is contained in:
Jason2866
2024-10-22 18:58:10 +02:00
committed by GitHub
parent 5e73fe06f4
commit c673965f58
9 changed files with 62 additions and 60 deletions
+2 -2
View File
@@ -18,8 +18,8 @@ jobs:
- "examples/arduino-rmt-blink" - "examples/arduino-rmt-blink"
- "examples/arduino-usb-keyboard" - "examples/arduino-usb-keyboard"
- "examples/arduino-wifiscan" - "examples/arduino-wifiscan"
#- "examples/arduino-zigbee-light" - "examples/arduino-zigbee-light"
#- "examples/arduino-zigbee-switch" - "examples/arduino-zigbee-switch"
- "examples/espidf-arduino-h2zero-BLE_scan" - "examples/espidf-arduino-h2zero-BLE_scan"
#- "examples/espidf-arduino-matter-light" # Windows compile fails -> Path length limit #- "examples/espidf-arduino-matter-light" # Windows compile fails -> Path length limit
- "examples/espidf-arduino-blink" - "examples/espidf-arduino-blink"
+2 -2
View File
@@ -35,13 +35,13 @@ ESP32 is a series of low-cost, low-power system on a chip microcontrollers with
1. Configure a platform option in [platformio.ini](https://docs.platformio.org/page/projectconf.html) file: 1. Configure a platform option in [platformio.ini](https://docs.platformio.org/page/projectconf.html) file:
### Stable version ### Stable version
espressif Arduino 3.0.5 and IDF 5.1.4+ espressif Arduino 3.0.6 and IDF 5.1.4+
See `platform` [documentation](https://docs.platformio.org/en/latest/projectconf/sections/env/options/platform/platform.html#projectconf-env-platform) for details. See `platform` [documentation](https://docs.platformio.org/en/latest/projectconf/sections/env/options/platform/platform.html#projectconf-env-platform) for details.
```ini ```ini
[env:stable] [env:stable]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.06/platform-espressif32.zip
board = ... board = ...
... ...
``` ```
+1 -1
View File
@@ -9,7 +9,7 @@
[env:esp32-h2-devkitm-1] [env:esp32-h2-devkitm-1]
platform = https://github.com/pioarduino/platform-espressif32.git#develop platform = espressif32
framework = arduino framework = arduino
board = esp32-h2-devkitm-1 board = esp32-h2-devkitm-1
monitor_speed = 115200 monitor_speed = 115200
@@ -22,7 +22,7 @@
* and also the correct partition scheme must be selected in Tools->Partition Scheme. * and also the correct partition scheme must be selected in Tools->Partition Scheme.
* *
* Please check the README.md for instructions and more detailed description. * Please check the README.md for instructions and more detailed description.
* *
* Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/) * Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/)
*/ */
@@ -33,27 +33,22 @@
#include "ZigbeeCore.h" #include "ZigbeeCore.h"
#include "ep/ZigbeeLight.h" #include "ep/ZigbeeLight.h"
#define LED_PIN RGB_BUILTIN #define LED_PIN RGB_BUILTIN
#define BUTTON_PIN 9 // C6/H2 Boot button #define BUTTON_PIN 9 // ESP32-C6/H2 Boot button
#define ZIGBEE_LIGHT_ENDPOINT 10 /* esp light bulb device endpoint, used to process light controlling commands */ #define ZIGBEE_LIGHT_ENDPOINT 10
class MyZigbeeLight : public ZigbeeLight { ZigbeeLight zbLight = ZigbeeLight(ZIGBEE_LIGHT_ENDPOINT);
public:
// Constructor that passes parameters to the base class constructor
MyZigbeeLight(uint8_t endpoint) : ZigbeeLight(endpoint) {}
// Override the set_on_off function /********************* RGB LED functions **************************/
void setOnOff(bool value) override { void setLED(bool value) {
rgbLedWrite(LED_PIN, 255 * value, 255 * value, 255 * value); // Toggle light digitalWrite(LED_PIN, value);
} }
};
MyZigbeeLight zbLight = MyZigbeeLight(ZIGBEE_LIGHT_ENDPOINT);
/********************* Arduino functions **************************/ /********************* Arduino functions **************************/
void setup() { void setup() {
// Init RMT and leave light OFF // Init LED and turn it OFF (if LED_PIN == RGB_BUILTIN, the rgbLedWrite() will be used under the hood)
rgbLedWrite(LED_PIN, 0, 0, 0); pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
// Init button for factory reset // Init button for factory reset
pinMode(BUTTON_PIN, INPUT); pinMode(BUTTON_PIN, INPUT);
@@ -61,29 +56,32 @@ void setup() {
//Optional: set Zigbee device name and model //Optional: set Zigbee device name and model
zbLight.setManufacturerAndModel("Espressif", "ZBLightBulb"); zbLight.setManufacturerAndModel("Espressif", "ZBLightBulb");
// Set callback function for light change
zbLight.onLightChange(setLED);
//Add endpoint to Zigbee Core //Add endpoint to Zigbee Core
log_d("Adding ZigbeeLight endpoint to Zigbee Core"); log_d("Adding ZigbeeLight endpoint to Zigbee Core");
Zigbee.addEndpoint(&zbLight); Zigbee.addEndpoint(&zbLight);
// When all EPs are registered, start Zigbee. By default acts as ZIGBEE_END_DEVICE // When all EPs are registered, start Zigbee. By default acts as ZIGBEE_END_DEVICE
log_d("Calling Zigbee.begin()"); log_d("Calling Zigbee.begin()");
Zigbee.begin(); Zigbee.begin();
} }
void loop() { void loop() {
// Cheking button for factory reset // Checking button for factory reset
if (digitalRead(BUTTON_PIN) == LOW) { // Push button pressed if (digitalRead(BUTTON_PIN) == LOW) { // Push button pressed
// Key debounce handling // Key debounce handling
delay(100); delay(100);
int startTime = millis(); int startTime = millis();
while (digitalRead(BUTTON_PIN) == LOW) { while (digitalRead(BUTTON_PIN) == LOW) {
delay(50); delay(50);
if((millis() - startTime) > 3000) { if ((millis() - startTime) > 3000) {
// If key pressed for more than 3secs, factory reset Zigbee and reboot // If key pressed for more than 3secs, factory reset Zigbee and reboot
Serial.printf("Reseting Zigbee to factory settings, reboot.\n"); Serial.printf("Resetting Zigbee to factory settings, reboot.\n");
Zigbee.factoryReset(); Zigbee.factoryReset();
} }
} }
} }
delay(100); delay(100);
} }
@@ -9,7 +9,7 @@
[env:esp32-c6-devkitc-1] [env:esp32-c6-devkitc-1]
platform = https://github.com/pioarduino/platform-espressif32.git#develop platform = espressif32
framework = arduino framework = arduino
board = esp32-c6-devkitc-1 board = esp32-c6-devkitc-1
monitor_speed = 115200 monitor_speed = 115200
@@ -23,7 +23,7 @@
* and also the correct partition scheme must be selected in Tools->Partition Scheme. * and also the correct partition scheme must be selected in Tools->Partition Scheme.
* *
* Please check the README.md for instructions and more detailed description. * Please check the README.md for instructions and more detailed description.
* *
* Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/) * Created by Jan Procházka (https://github.com/P-R-O-C-H-Y/)
*/ */
@@ -65,24 +65,7 @@ typedef enum {
static SwitchData buttonFunctionPair[] = {{GPIO_INPUT_IO_TOGGLE_SWITCH, SWITCH_ONOFF_TOGGLE_CONTROL}}; static SwitchData buttonFunctionPair[] = {{GPIO_INPUT_IO_TOGGLE_SWITCH, SWITCH_ONOFF_TOGGLE_CONTROL}};
/* Zigbee switch */ ZigbeeSwitch zbSwitch = ZigbeeSwitch(SWITCH_ENDPOINT_NUMBER);
class MyZigbeeSwitch : public ZigbeeSwitch {
public:
// Constructor that passes parameters to the base class constructor
MyZigbeeSwitch(uint8_t endpoint) : ZigbeeSwitch(endpoint) {}
// Override the set_on_off function
void readManufacturer(char* manufacturer) override {
//Do what you want with the manufacturer string
Serial.printf("Manufacturer: %s\n", manufacturer);
}
void readModel(char* model) override {
//Do what you want with the model string
Serial.printf("Model: %s\n", model);
}
};
MyZigbeeSwitch zbSwitch = MyZigbeeSwitch(SWITCH_ENDPOINT_NUMBER);
/********************* Zigbee functions **************************/ /********************* Zigbee functions **************************/
static void onZbButton(SwitchData *button_func_pair) { static void onZbButton(SwitchData *button_func_pair) {
@@ -111,8 +94,11 @@ static void enableGpioInterrupt(bool enabled) {
/********************* Arduino functions **************************/ /********************* Arduino functions **************************/
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
while (!Serial) {
delay(10);
}
//Optional: set Zigbee device name and model //Optional: set Zigbee device name and model
zbSwitch.setManufacturerAndModel("Espressif", "ZigbeeSwitch"); zbSwitch.setManufacturerAndModel("Espressif", "ZigbeeSwitch");
@@ -126,7 +112,6 @@ void setup() {
//Open network for 180 seconds after boot //Open network for 180 seconds after boot
Zigbee.setRebootOpenNetwork(180); Zigbee.setRebootOpenNetwork(180);
// Init button switch // Init button switch
for (int i = 0; i < PAIR_SIZE(buttonFunctionPair); i++) { for (int i = 0; i < PAIR_SIZE(buttonFunctionPair); i++) {
@@ -143,14 +128,27 @@ void setup() {
// When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR mode // When all EPs are registered, start Zigbee with ZIGBEE_COORDINATOR mode
log_d("Calling Zigbee.begin()"); log_d("Calling Zigbee.begin()");
Zigbee.begin(ZIGBEE_COORDINATOR); Zigbee.begin(ZIGBEE_COORDINATOR);
Serial.println("Waiting for Light to bound to the switch"); Serial.println("Waiting for Light to bound to the switch");
//Wait for switch to bound to a light: //Wait for switch to bound to a light:
while(!zbSwitch.isBound()) while (!zbSwitch.isBound()) {
{
Serial.printf("."); Serial.printf(".");
delay(500); delay(500);
} }
// Optional: read manufacturer and model name from the bound light
std::list<zb_device_params_t *> boundLights = zbSwitch.getBoundDevices();
//List all bound lights
for (const auto &device : boundLights) {
Serial.printf("Device on endpoint %d, short address: 0x%x\n", device->endpoint, device->short_addr);
Serial.printf(
"IEEE Address: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\n", device->ieee_addr[0], device->ieee_addr[1], device->ieee_addr[2], device->ieee_addr[3],
device->ieee_addr[4], device->ieee_addr[5], device->ieee_addr[6], device->ieee_addr[7]
);
Serial.printf("Light manufacturer: %s", zbSwitch.readManufacturer(device->endpoint, device->short_addr));
Serial.printf("Light model: %s", zbSwitch.readModel(device->endpoint, device->short_addr));
}
Serial.println(); Serial.println();
} }
@@ -160,7 +158,6 @@ void loop() {
SwitchData buttonSwitch; SwitchData buttonSwitch;
static SwitchState buttonState = SWITCH_IDLE; static SwitchState buttonState = SWITCH_IDLE;
bool eventFlag = false; bool eventFlag = false;
/* check if there is any queue received, if yes read out the buttonSwitch */ /* check if there is any queue received, if yes read out the buttonSwitch */
if (xQueueReceive(gpio_evt_queue, &buttonSwitch, portMAX_DELAY)) { if (xQueueReceive(gpio_evt_queue, &buttonSwitch, portMAX_DELAY)) {
@@ -1,3 +1,7 @@
dependencies: dependencies:
espressif/esp_matter: espressif/esp_matter:
version: "^1.3.0" version: "^1.3.0"
espressif/cmake_utilities:
version: "0.*"
rules:
- if: "target in [esp32c2]"
+6 -6
View File
@@ -12,13 +12,13 @@
"RISC-V" "RISC-V"
], ],
"engines": { "engines": {
"platformio": ">=6.1.15" "platformio": ">=6.1.16"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/pioarduino/platform-espressif32.git" "url": "https://github.com/pioarduino/platform-espressif32.git"
}, },
"version": "51.03.05", "version": "51.03.06",
"frameworks": { "frameworks": {
"arduino": { "arduino": {
"script": "builder/frameworks/arduino.py" "script": "builder/frameworks/arduino.py"
@@ -33,19 +33,19 @@
"type": "framework", "type": "framework",
"optional": true, "optional": true,
"owner": "espressif", "owner": "espressif",
"version": "https://github.com/espressif/arduino-esp32/releases/download/3.0.5/esp32-3.0.5.zip" "version": "https://github.com/espressif/arduino-esp32/releases/download/3.0.6/esp32-3.0.6.zip"
}, },
"framework-arduinoespressif32-libs": { "framework-arduinoespressif32-libs": {
"type": "framework", "type": "framework",
"optional": true, "optional": true,
"owner": "espressif", "owner": "espressif",
"version": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip" "version": "https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-632e0c2a.zip"
}, },
"framework-espidf": { "framework-espidf": {
"type": "framework", "type": "framework",
"optional": true, "optional": true,
"owner": "pioarduino", "owner": "pioarduino",
"version": "https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.240801/esp-idf-v5.1.4.zip" "version": "https://github.com/pioarduino/esp-idf/releases/download/v5.1.4.241008/esp-idf-v5.1.4.zip"
}, },
"toolchain-xtensa-esp32": { "toolchain-xtensa-esp32": {
"type": "toolchain", "type": "toolchain",
@@ -92,7 +92,7 @@
"tool-esptoolpy": { "tool-esptoolpy": {
"type": "uploader", "type": "uploader",
"owner": "pioarduino", "owner": "pioarduino",
"version": "https://github.com/pioarduino/esptool/releases/download/v4.7.5/esptool.zip" "version": "https://github.com/pioarduino/esptool/releases/download/v4.8.1/esptool.zip"
}, },
"tool-dfuutil-arduino": { "tool-dfuutil-arduino": {
"type": "uploader", "type": "uploader",
+3
View File
@@ -39,6 +39,9 @@ class Espressif32Platform(PlatformBase):
mcu = variables.get("board_build.mcu", board_config.get("build.mcu", "esp32")) mcu = variables.get("board_build.mcu", board_config.get("build.mcu", "esp32"))
frameworks = variables.get("pioframework", []) frameworks = variables.get("pioframework", [])
if variables.get("custom_sdkconfig") is not None:
frameworks.append("espidf")
if "arduino" in frameworks: if "arduino" in frameworks:
self.packages["framework-arduinoespressif32"]["optional"] = False self.packages["framework-arduinoespressif32"]["optional"] = False
self.packages["framework-arduinoespressif32-libs"]["optional"] = False self.packages["framework-arduinoespressif32-libs"]["optional"] = False