Skip to content

Commit 07533b8

Browse files
authored
Merge branch 'espressif:master' into master
2 parents f1cbb8c + 677a244 commit 07533b8

33 files changed

+232
-213
lines changed

.github/workflows/upload_components.yml

-21
This file was deleted.

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,7 @@ docs/docusaurus/website/node_modules
7979

8080
# cli logs
8181
**/logs
82+
83+
# IDF package manager
84+
**/managed_components/
85+
*.lock

.gitlab-ci.yml

+59-156
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ stages:
55
variables:
66
V: "0"
77
MAKEFLAGS: "-j8 --no-keep-going"
8-
IDF_PATH: "$CI_PROJECT_DIR/esp-idf"
98
APP_BUILD: "all"
109
GIT_SUBMODULE_STRATEGY: recursive
1110

@@ -20,173 +19,77 @@ before_script:
2019
# Create esp-rainmaker-bins-${CI_JOB_ID}/ dir (to copy binaries into for artifacts)
2120
- mkdir -p $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}
2221

23-
.setup_idf: &setup_idf
24-
# Checking git version
25-
- echo Checking git version
26-
- git --version
27-
# Cloning esp-idf - Started
28-
- echo Cloning esp-idf - Started
29-
- git clone --recursive --branch ${IDF_GIT_BRANCH} --depth 1 ${IDF_GIT_PATH}/esp-idf.git
30-
- cd esp-idf
31-
- echo Cloning esp-idf - Done
32-
# Cloning esp-idf - Done
33-
# Running install.sh - Started
34-
- echo Running install.sh - Started
35-
- ./install.sh
36-
- echo Running install.sh - Done
37-
# Running install.sh - Done
38-
# Running export.sh - Started
39-
- echo Running export.sh - Started
40-
- . export.sh
41-
- echo Running export.sh - Done
42-
# Running export.sh - Done
43-
44-
.build_switch: &build_switch
45-
# Building switch app - Started
46-
- echo Building switch app - Started
47-
- ls
48-
- cd $CI_PROJECT_DIR/examples/switch
49-
- echo Building for esp32
50-
- idf.py set-target esp32
51-
- idf.py build
52-
- rm -rf build/ sdkconfig
53-
- echo Building for esp32s2
54-
- idf.py set-target esp32s2
55-
- idf.py build
56-
- rm -rf build/ sdkconfig
57-
- echo Building for esp32c3
58-
- idf.py set-target esp32c3
59-
- idf.py build
60-
- rm -rf build/ sdkconfig
61-
- echo Building for esp32s3
62-
- idf.py set-target esp32s3
63-
- idf.py build
64-
- echo Building switch app - Done
65-
# Building switch app - Done
66-
# Copying switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
67-
- echo Copy switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
68-
- cp $CI_PROJECT_DIR/examples/switch/build/switch.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
69-
70-
.build_led_light: &build_led_light
71-
# Building led_light app - Started
72-
- echo Building led_light app - Started
73-
- echo Running idf.py
74-
- cd $CI_PROJECT_DIR/examples/led_light
75-
- idf.py build
76-
- echo Building led_light app - Done
77-
# Building led_light app - Done
78-
# Copying led_light.bin to esp-rainmaker-bins-${CI_JOB_ID}/
79-
- echo Copy led_light.bin to esp-rainmaker-bins-${CI_JOB_ID}/
80-
- cp $CI_PROJECT_DIR/examples/led_light/build/led_light.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
81-
82-
.build_fan: &build_fan
83-
# Building fan app - Started
84-
- echo Building fan app - Started
85-
- echo Running idf.py
86-
- cd $CI_PROJECT_DIR/examples/fan
87-
- idf.py build
88-
- echo Building fan app - Done
89-
# Building fan app - Done
90-
# Copying fan.bin to esp-rainmaker-bins-${CI_JOB_ID}/
91-
- echo Copy fan.bin to esp-rainmaker-bins-${CI_JOB_ID}/
92-
- cp $CI_PROJECT_DIR/examples/fan/build/fan.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
93-
94-
.build_temperature_sensor: &build_temperature_sensor
95-
# Building temperature_sensor app - Started
96-
- echo Building temperature_sensor app - Started
97-
- echo Running idf.py
98-
- cd $CI_PROJECT_DIR/examples/temperature_sensor
99-
- idf.py build
100-
- echo Building temperature_sensor app - Done
101-
# Building temperature_sensor app - Done
102-
# Copying temperature_sensor.bin to esp-rainmaker-bins-${CI_JOB_ID}/
103-
- echo Copy temperature_sensor.bin to esp-rainmaker-bins-${CI_JOB_ID}/
104-
- cp $CI_PROJECT_DIR/examples/temperature_sensor/build/temperature_sensor.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
105-
106-
.build_multi_device: &build_multi_device
107-
# Building multi_device app - Started
108-
- echo Building multi_device app - Started
109-
- echo Running idf.py
110-
- cd $CI_PROJECT_DIR/examples/multi_device
111-
- idf.py build
112-
- echo Building multi_device app - Done
113-
# Building multi_device app - Done
114-
# Copying multi_device.bin to esp-rainmaker-bins-${CI_JOB_ID}/
115-
- echo Copy multi_device.bin to esp-rainmaker-bins-${CI_JOB_ID}/
116-
- cp $CI_PROJECT_DIR/examples/multi_device/build/multi_device.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
117-
118-
.build_gpio: &build_gpio
119-
# Building gpio app - Started
120-
- echo Building gpio app - Started
121-
- echo Running idf.py
122-
- cd $CI_PROJECT_DIR/examples/gpio
123-
- idf.py build
124-
- echo Building gpio app - Done
125-
# Building gpio app - Done
126-
# Copying gpio.bin to esp-rainmaker-bins-${CI_JOB_ID}/
127-
- echo Copy gpio.bin to esp-rainmaker-bins-${CI_JOB_ID}/
128-
- cp $CI_PROJECT_DIR/examples/gpio/build/gpio.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
129-
130-
.build_homekit_switch: &build_homekit_switch
131-
# Building homekit_switch app - Started
132-
- cd $CI_PROJECT_DIR/examples/homekit_switch
22+
.build_all_examples: &build_all_examples
23+
- pip install --upgrade idf-component-manager
24+
- for EXAMPLE in $EXAMPLES; do
25+
- cd $CI_PROJECT_DIR/examples/$EXAMPLE
26+
- echo Building $EXAMPLE
27+
- if [[ "$EXAMPLE" == "homekit_switch" ]]; then
13328
- cd components
13429
- echo Cloning esp-homekit-sdk
13530
- git clone --recursive --branch master --depth 1 https://github.com/espressif/esp-homekit-sdk.git
13631
- cd ..
13732
- export HOMEKIT_PATH=$PWD/components/esp-homekit-sdk
138-
- echo Building homekit_switch app - Started
139-
- echo Running idf.py
33+
- fi
34+
- for TARGET in $EXAMPLE_TARGETS; do
35+
- echo Building for $TARGET
36+
- idf.py set-target $TARGET
14037
- idf.py build
141-
- echo Building homekit_switch app - Done
142-
# Building homekit_switch app - Done
143-
# Copying homekit_switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
144-
- echo Copy homekit_switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
145-
- cp $CI_PROJECT_DIR/examples/homekit_switch/build/homekit_switch.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
38+
- mkdir -p $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/$EXAMPLE/$TARGET/
39+
- cp $CI_PROJECT_DIR/examples/$EXAMPLE/build/*.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/$EXAMPLE/$TARGET/
40+
- done
41+
- echo Build Complete for $EXAMPLE
42+
- done
43+
# Generating zip file for binaries generated
44+
- cd $CI_PROJECT_DIR
45+
- echo Generating zip file for binaries generated
46+
- tar -zcvf esp-rainmaker-bins-${CI_JOB_ID}.zip esp-rainmaker-bins-${CI_JOB_ID}/
14647

147-
build_app:
48+
.build_template:
14849
stage: build
149-
image: $CI_DOCKER_REGISTRY/esp32-ci-env:rainmaker
50+
image: espressif/idf:latest
15051
tags:
15152
- build
152-
artifacts:
153-
paths:
154-
- $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}.zip
155-
expire_in: 6 mos
53+
variables:
54+
PEDANTIC_FLAGS: "-Werror -Werror=deprecated-declarations -Wno-error=cpp -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
55+
EXTRA_CFLAGS: "${PEDANTIC_FLAGS}"
56+
EXTRA_CXXFLAGS: "${PEDANTIC_FLAGS}"
57+
EXAMPLE_TARGETS: "esp32"
58+
EXAMPLES: "switch led_light fan temperature_sensor multi_device gpio homekit_switch"
15659
script:
157-
- *setup_idf
158-
- for APP in $APP_BUILD; do
159-
- if [[ "$APP_BUILD" == "all" || "$APP" == "switch" ]]; then
160-
- *build_switch
161-
- fi
162-
- if [[ "$APP_BUILD" == "all" || "$APP" == "led_light" ]]; then
163-
- *build_led_light
164-
- fi
165-
- if [[ "$APP_BUILD" == "all" || "$APP" == "fan" ]]; then
166-
- *build_fan
167-
- fi
168-
- if [[ "$APP_BUILD" == "all" || "$APP" == "temperature_sensor" ]]; then
169-
- *build_temperature_sensor
170-
- fi
171-
- if [[ "$APP_BUILD" == "all" || "$APP" == "multi_device" ]]; then
172-
- *build_multi_device
173-
- fi
174-
- if [[ "$APP_BUILD" == "all" || "$APP" == "gpio" ]]; then
175-
- *build_gpio
176-
- fi
177-
- if [[ "$APP_BUILD" == "all" || "$APP" == "homekit_switch" ]]; then
178-
- *build_homekit_switch
179-
- fi
180-
- done
181-
- echo Build Complete for $APP_BUILD
182-
# Generating zip file for binaries generated
183-
- cd $CI_PROJECT_DIR
184-
- echo Generating zip file for binaries generated
185-
- tar -zcvf esp-rainmaker-bins-${CI_JOB_ID}.zip esp-rainmaker-bins-${CI_JOB_ID}/
186-
60+
- *build_all_examples
61+
62+
build_idf_v4.1:
63+
extends: .build_template
64+
image: espressif/idf:release-v4.1
65+
66+
build_idf_v4.2:
67+
extends: .build_template
68+
image: espressif/idf:release-v4.2
69+
variables:
70+
EXAMPLE_TARGETS: "esp32 esp32s2"
71+
72+
build_idf_v4.3:
73+
extends: .build_template
74+
image: espressif/idf:release-v4.3
75+
variables:
76+
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3"
77+
78+
build_idf_v4.4:
79+
extends: .build_template
80+
image: espressif/idf:release-v4.4
81+
variables:
82+
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3"
83+
84+
build_idf_master:
85+
extends: .build_template
86+
image: espressif/idf:latest
87+
variables:
88+
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3"
89+
18790
build_docs:
18891
stage: build
189-
image: $CI_DOCKER_REGISTRY/esp32-ci-env:rainmaker
92+
image: $CI_DOCKER_REGISTRY/esp32-ci-env
19093
tags:
19194
- build
19295
artifacts:
@@ -213,7 +116,7 @@ build_docs:
213116

214117
push_master_to_github:
215118
stage: deploy
216-
image: $CI_DOCKER_REGISTRY/esp32-ci-env:rainmaker
119+
image: espressif/idf:latest
217120
tags:
218121
- build
219122
when: on_success

CHANGES.md

+27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# Changes
22

3+
## 26-May-2022 (claiming and ota)
4+
5+
- claiming: Make self claiming as the default for esp32s3 and esp32c3
6+
- ota: Make "OTA using Topics" as default and provide a simplified API for that
7+
8+
Self claiming is much more convenient and fast since the node directly gets the
9+
credentials from the claiming service over HTTPS, instead of using the slower BLE based
10+
Assisted claiming, wherein the phone app acts as a proxy between the node and the
11+
claiming service. However, with self claiming, there was no concept of
12+
[Admin Role](https://rainmaker.espressif.com/docs/user-roles.html#admin-users) and so, it was
13+
not possible to access the node via the RainMaker or Insights dashboards. This was one
14+
reason why Assisted Claiming was kept as a default for esp32c3 and esp32s3 even though
15+
they support self claiming.
16+
17+
With recent changes in the Public RainMaker backend, the primary user (the user who performs the [user-node
18+
mapping](https://rainmaker.espressif.com/docs/user-node-mapping.html)) for a self claimed
19+
node is now made as the admin. This gives the primary user the access to the node for OTA and Insights.
20+
So, self claiming has now been made as the default for all chips (except esp32) and the OTA Using Topics
21+
has also been made as the default, since it is convenient and also the correct option for
22+
production devices. A simpler API `esp_rmaker_ota_enable_default()` as also been added in esp_rmaker_core.h.
23+
24+
Note: Nodes that are already claimed via Assisted/Host Claiming will not have any effect, even if the
25+
new firmware is enabled with self claiming. The self claiming will take effect only if the flash is
26+
erased. **This will result in a change of node_id, since mac address is the node_id for self claimed nodes.**
27+
If you want to contine using Assisted Claiming (probably because there is quite some data associated
28+
with the node_id), please set is explicitly in your sdkconfig.
29+
330
## 25-Jan-2022 (app_wifi: Minor feature additions to provisioning workflow)
431

532
Added a 30 minute timeout for Wi-Fi provisioning as a security measure. A device reboot will be

components/esp-insights

components/esp_rainmaker/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ set(core_srcs "src/core/esp_rmaker_core.c"
1212
"src/core/esp_rmaker_schedule.c"
1313
"src/core/esp_rmaker_scenes.c")
1414

15-
set(priv_req protobuf-c json_parser json_generator wifi_provisioning nvs_flash esp_http_client app_update esp-tls mbedtls esp_https_ota console esp_local_ctrl esp_https_server mdns esp_schedule)
16-
15+
set(priv_req protobuf-c json_parser json_generator wifi_provisioning nvs_flash esp_http_client app_update esp-tls mbedtls esp_https_ota console esp_local_ctrl esp_https_server mdns esp_schedule efuse)
1716

1817
if(CONFIG_ESP_RMAKER_ASSISTED_CLAIM)
1918
list(APPEND core_srcs

components/esp_rainmaker/Kconfig.projbuild

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ menu "ESP RainMaker Config"
22

33
choice ESP_RMAKER_CLAIM_TYPE
44
bool "Claiming Type"
5-
default ESP_RMAKER_SELF_CLAIM if IDF_TARGET_ESP32S2
6-
default ESP_RMAKER_ASSISTED_CLAIM if !IDF_TARGET_ESP32S2
5+
default ESP_RMAKER_SELF_CLAIM
6+
default ESP_RMAKER_ASSISTED_CLAIM if IDF_TARGET_ESP32
77
help
88
Claiming type to be used.
99

@@ -79,6 +79,14 @@ menu "ESP RainMaker Config"
7979
can take appropriate action w.r.t user permissions. It is recommended to enable this option
8080
for security reasons.
8181

82+
config RMAKER_NAME_PARAM_CB
83+
bool "Call device callback for Name param"
84+
default n
85+
help
86+
By default, the "Name" parameter (esp.param.name) changes are handled internally. If Applications
87+
want to handle this themselves, this config option can be enabled. Please ensure that you update
88+
and report the name parameter in your callback so that it reflects correctly everywhere.
89+
If no device callback is registered, the name paramater will be handled internally.
8290

8391
config ESP_RMAKER_LOCAL_CTRL_ENABLE
8492
bool "ESP RainMaker Local Control"

components/esp_rainmaker/include/esp_rmaker_core.h

+14
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,20 @@ esp_err_t esp_rmaker_system_service_enable(esp_rmaker_system_serv_config_t *conf
917917
*/
918918
bool esp_rmaker_local_ctrl_service_started(void);
919919

920+
/**
921+
* Enable Default RainMaker OTA Firmware Upgrade
922+
*
923+
* This enables the default recommended RainMaker OTA Firmware Upgrade, which is
924+
* "Using the Topics", which allows performing OTA from Dashboard.
925+
* This OTA can be triggered by Admin Users only.
926+
* On Public RainMaker deployment, for nodes using "Self Claiming", since there
927+
* is no associated admin user, the Primary user will automatically become the admin
928+
* and can perform OTA from dashboard.
929+
*
930+
* @return ESP_OK on success
931+
* @return error on failure
932+
*/
933+
esp_err_t esp_rmaker_ota_enable_default(void);
920934
#ifdef __cplusplus
921935
}
922936
#endif

components/esp_rainmaker/src/core/esp_rmaker_node_config.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static esp_err_t esp_rmaker_report_info(json_gen_str_t *jptr)
3838
}
3939
json_gen_obj_set_string(jptr, "model", info->model);
4040
const esp_app_desc_t *app_desc = esp_ota_get_app_description();
41-
json_gen_obj_set_string(jptr, "project_name", app_desc->project_name);
41+
json_gen_obj_set_string(jptr, "project_name", (char *)app_desc->project_name);
4242
json_gen_obj_set_string(jptr, "platform", CONFIG_IDF_TARGET);
4343
json_gen_pop_object(jptr);
4444
return ESP_OK;

0 commit comments

Comments
 (0)