Merge branch 'espressif:master' into master

This commit is contained in:
sivar2311
2022-06-09 09:10:58 +02:00
committed by GitHub
33 changed files with 232 additions and 213 deletions

View File

@@ -1,21 +0,0 @@
name: Push components to Espressif Component Service
on:
push:
branches:
- master
jobs:
upload_components:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
submodules: "recursive"
- name: Upload components to compoent service
uses: espressif/github-actions/upload_components@master
with:
directories: "components/json_generator;components/json_parser"
namespace: "espressif"
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}

4
.gitignore vendored
View File

@@ -79,3 +79,7 @@ docs/docusaurus/website/node_modules
# cli logs
**/logs
# IDF package manager
**/managed_components/
*.lock

View File

@@ -5,7 +5,6 @@ stages:
variables:
V: "0"
MAKEFLAGS: "-j8 --no-keep-going"
IDF_PATH: "$CI_PROJECT_DIR/esp-idf"
APP_BUILD: "all"
GIT_SUBMODULE_STRATEGY: recursive
@@ -20,173 +19,77 @@ before_script:
# Create esp-rainmaker-bins-${CI_JOB_ID}/ dir (to copy binaries into for artifacts)
- mkdir -p $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}
.setup_idf: &setup_idf
# Checking git version
- echo Checking git version
- git --version
# Cloning esp-idf - Started
- echo Cloning esp-idf - Started
- git clone --recursive --branch ${IDF_GIT_BRANCH} --depth 1 ${IDF_GIT_PATH}/esp-idf.git
- cd esp-idf
- echo Cloning esp-idf - Done
# Cloning esp-idf - Done
# Running install.sh - Started
- echo Running install.sh - Started
- ./install.sh
- echo Running install.sh - Done
# Running install.sh - Done
# Running export.sh - Started
- echo Running export.sh - Started
- . export.sh
- echo Running export.sh - Done
# Running export.sh - Done
.build_switch: &build_switch
# Building switch app - Started
- echo Building switch app - Started
- ls
- cd $CI_PROJECT_DIR/examples/switch
- echo Building for esp32
- idf.py set-target esp32
- idf.py build
- rm -rf build/ sdkconfig
- echo Building for esp32s2
- idf.py set-target esp32s2
- idf.py build
- rm -rf build/ sdkconfig
- echo Building for esp32c3
- idf.py set-target esp32c3
- idf.py build
- rm -rf build/ sdkconfig
- echo Building for esp32s3
- idf.py set-target esp32s3
- idf.py build
- echo Building switch app - Done
# Building switch app - Done
# Copying switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- echo Copy switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- cp $CI_PROJECT_DIR/examples/switch/build/switch.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
.build_led_light: &build_led_light
# Building led_light app - Started
- echo Building led_light app - Started
- echo Running idf.py
- cd $CI_PROJECT_DIR/examples/led_light
- idf.py build
- echo Building led_light app - Done
# Building led_light app - Done
# Copying led_light.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- echo Copy led_light.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- cp $CI_PROJECT_DIR/examples/led_light/build/led_light.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
.build_fan: &build_fan
# Building fan app - Started
- echo Building fan app - Started
- echo Running idf.py
- cd $CI_PROJECT_DIR/examples/fan
- idf.py build
- echo Building fan app - Done
# Building fan app - Done
# Copying fan.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- echo Copy fan.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- cp $CI_PROJECT_DIR/examples/fan/build/fan.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
.build_temperature_sensor: &build_temperature_sensor
# Building temperature_sensor app - Started
- echo Building temperature_sensor app - Started
- echo Running idf.py
- cd $CI_PROJECT_DIR/examples/temperature_sensor
- idf.py build
- echo Building temperature_sensor app - Done
# Building temperature_sensor app - Done
# Copying temperature_sensor.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- echo Copy temperature_sensor.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- cp $CI_PROJECT_DIR/examples/temperature_sensor/build/temperature_sensor.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
.build_multi_device: &build_multi_device
# Building multi_device app - Started
- echo Building multi_device app - Started
- echo Running idf.py
- cd $CI_PROJECT_DIR/examples/multi_device
- idf.py build
- echo Building multi_device app - Done
# Building multi_device app - Done
# Copying multi_device.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- echo Copy multi_device.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- cp $CI_PROJECT_DIR/examples/multi_device/build/multi_device.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
.build_gpio: &build_gpio
# Building gpio app - Started
- echo Building gpio app - Started
- echo Running idf.py
- cd $CI_PROJECT_DIR/examples/gpio
- idf.py build
- echo Building gpio app - Done
# Building gpio app - Done
# Copying gpio.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- echo Copy gpio.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- cp $CI_PROJECT_DIR/examples/gpio/build/gpio.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
.build_homekit_switch: &build_homekit_switch
# Building homekit_switch app - Started
- cd $CI_PROJECT_DIR/examples/homekit_switch
.build_all_examples: &build_all_examples
- pip install --upgrade idf-component-manager
- for EXAMPLE in $EXAMPLES; do
- cd $CI_PROJECT_DIR/examples/$EXAMPLE
- echo Building $EXAMPLE
- if [[ "$EXAMPLE" == "homekit_switch" ]]; then
- cd components
- echo Cloning esp-homekit-sdk
- git clone --recursive --branch master --depth 1 https://github.com/espressif/esp-homekit-sdk.git
- cd ..
- export HOMEKIT_PATH=$PWD/components/esp-homekit-sdk
- echo Building homekit_switch app - Started
- echo Running idf.py
- fi
- for TARGET in $EXAMPLE_TARGETS; do
- echo Building for $TARGET
- idf.py set-target $TARGET
- idf.py build
- echo Building homekit_switch app - Done
# Building homekit_switch app - Done
# Copying homekit_switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- echo Copy homekit_switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
- cp $CI_PROJECT_DIR/examples/homekit_switch/build/homekit_switch.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
- mkdir -p $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/$EXAMPLE/$TARGET/
- cp $CI_PROJECT_DIR/examples/$EXAMPLE/build/*.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/$EXAMPLE/$TARGET/
- done
- echo Build Complete for $EXAMPLE
- done
# Generating zip file for binaries generated
- cd $CI_PROJECT_DIR
- echo Generating zip file for binaries generated
- tar -zcvf esp-rainmaker-bins-${CI_JOB_ID}.zip esp-rainmaker-bins-${CI_JOB_ID}/
build_app:
.build_template:
stage: build
image: $CI_DOCKER_REGISTRY/esp32-ci-env:rainmaker
image: espressif/idf:latest
tags:
- build
artifacts:
paths:
- $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}.zip
expire_in: 6 mos
variables:
PEDANTIC_FLAGS: "-Werror -Werror=deprecated-declarations -Wno-error=cpp -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
EXTRA_CFLAGS: "${PEDANTIC_FLAGS}"
EXTRA_CXXFLAGS: "${PEDANTIC_FLAGS}"
EXAMPLE_TARGETS: "esp32"
EXAMPLES: "switch led_light fan temperature_sensor multi_device gpio homekit_switch"
script:
- *setup_idf
- for APP in $APP_BUILD; do
- if [[ "$APP_BUILD" == "all" || "$APP" == "switch" ]]; then
- *build_switch
- fi
- if [[ "$APP_BUILD" == "all" || "$APP" == "led_light" ]]; then
- *build_led_light
- fi
- if [[ "$APP_BUILD" == "all" || "$APP" == "fan" ]]; then
- *build_fan
- fi
- if [[ "$APP_BUILD" == "all" || "$APP" == "temperature_sensor" ]]; then
- *build_temperature_sensor
- fi
- if [[ "$APP_BUILD" == "all" || "$APP" == "multi_device" ]]; then
- *build_multi_device
- fi
- if [[ "$APP_BUILD" == "all" || "$APP" == "gpio" ]]; then
- *build_gpio
- fi
- if [[ "$APP_BUILD" == "all" || "$APP" == "homekit_switch" ]]; then
- *build_homekit_switch
- fi
- done
- echo Build Complete for $APP_BUILD
# Generating zip file for binaries generated
- cd $CI_PROJECT_DIR
- echo Generating zip file for binaries generated
- tar -zcvf esp-rainmaker-bins-${CI_JOB_ID}.zip esp-rainmaker-bins-${CI_JOB_ID}/
- *build_all_examples
build_idf_v4.1:
extends: .build_template
image: espressif/idf:release-v4.1
build_idf_v4.2:
extends: .build_template
image: espressif/idf:release-v4.2
variables:
EXAMPLE_TARGETS: "esp32 esp32s2"
build_idf_v4.3:
extends: .build_template
image: espressif/idf:release-v4.3
variables:
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3"
build_idf_v4.4:
extends: .build_template
image: espressif/idf:release-v4.4
variables:
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3"
build_idf_master:
extends: .build_template
image: espressif/idf:latest
variables:
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3"
build_docs:
stage: build
image: $CI_DOCKER_REGISTRY/esp32-ci-env:rainmaker
image: $CI_DOCKER_REGISTRY/esp32-ci-env
tags:
- build
artifacts:
@@ -213,7 +116,7 @@ build_docs:
push_master_to_github:
stage: deploy
image: $CI_DOCKER_REGISTRY/esp32-ci-env:rainmaker
image: espressif/idf:latest
tags:
- build
when: on_success

View File

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

View File

@@ -12,8 +12,7 @@ set(core_srcs "src/core/esp_rmaker_core.c"
"src/core/esp_rmaker_schedule.c"
"src/core/esp_rmaker_scenes.c")
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)
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)
if(CONFIG_ESP_RMAKER_ASSISTED_CLAIM)
list(APPEND core_srcs

View File

@@ -2,8 +2,8 @@ menu "ESP RainMaker Config"
choice ESP_RMAKER_CLAIM_TYPE
bool "Claiming Type"
default ESP_RMAKER_SELF_CLAIM if IDF_TARGET_ESP32S2
default ESP_RMAKER_ASSISTED_CLAIM if !IDF_TARGET_ESP32S2
default ESP_RMAKER_SELF_CLAIM
default ESP_RMAKER_ASSISTED_CLAIM if IDF_TARGET_ESP32
help
Claiming type to be used.
@@ -79,6 +79,14 @@ menu "ESP RainMaker Config"
can take appropriate action w.r.t user permissions. It is recommended to enable this option
for security reasons.
config RMAKER_NAME_PARAM_CB
bool "Call device callback for Name param"
default n
help
By default, the "Name" parameter (esp.param.name) changes are handled internally. If Applications
want to handle this themselves, this config option can be enabled. Please ensure that you update
and report the name parameter in your callback so that it reflects correctly everywhere.
If no device callback is registered, the name paramater will be handled internally.
config ESP_RMAKER_LOCAL_CTRL_ENABLE
bool "ESP RainMaker Local Control"

View File

@@ -917,6 +917,20 @@ esp_err_t esp_rmaker_system_service_enable(esp_rmaker_system_serv_config_t *conf
*/
bool esp_rmaker_local_ctrl_service_started(void);
/**
* Enable Default RainMaker OTA Firmware Upgrade
*
* This enables the default recommended RainMaker OTA Firmware Upgrade, which is
* "Using the Topics", which allows performing OTA from Dashboard.
* This OTA can be triggered by Admin Users only.
* On Public RainMaker deployment, for nodes using "Self Claiming", since there
* is no associated admin user, the Primary user will automatically become the admin
* and can perform OTA from dashboard.
*
* @return ESP_OK on success
* @return error on failure
*/
esp_err_t esp_rmaker_ota_enable_default(void);
#ifdef __cplusplus
}
#endif

View File

@@ -38,7 +38,7 @@ static esp_err_t esp_rmaker_report_info(json_gen_str_t *jptr)
}
json_gen_obj_set_string(jptr, "model", info->model);
const esp_app_desc_t *app_desc = esp_ota_get_app_description();
json_gen_obj_set_string(jptr, "project_name", app_desc->project_name);
json_gen_obj_set_string(jptr, "project_name", (char *)app_desc->project_name);
json_gen_obj_set_string(jptr, "platform", CONFIG_IDF_TARGET);
json_gen_pop_object(jptr);
return ESP_OK;

View File

@@ -357,7 +357,19 @@ static esp_err_t esp_rmaker_device_set_params(_esp_rmaker_device_t *device, jpar
* of calling the registered callback.
*/
if (param->type && (strcmp(param->type, ESP_RMAKER_PARAM_NAME) == 0)) {
#ifdef CONFIG_RMAKER_NAME_PARAM_CB
if (device->write_cb) {
esp_rmaker_write_ctx_t ctx = {
.src = src,
};
device->write_cb((esp_rmaker_device_t *)device, (esp_rmaker_param_t *)param,
new_val, device->priv_data, &ctx);
} else {
esp_rmaker_param_update_and_report((esp_rmaker_param_t *)param, new_val);
}
#else
esp_rmaker_param_update_and_report((esp_rmaker_param_t *)param, new_val);
#endif
} else if (device->write_cb) {
esp_rmaker_write_ctx_t ctx = {
.src = src,

View File

@@ -161,7 +161,7 @@ esp_err_t esp_rmaker_ota_default_cb(esp_rmaker_ota_handle_t ota_handle, esp_rmak
esp_err_t ota_finish_err = ESP_OK;
esp_http_client_config_t config = {
.url = ota_data->url,
#ifdef CONFIG_ESP_RMAKER_USE_CERT_BUNDLE
#ifdef ESP_RMAKER_USE_CERT_BUNDLE
.crt_bundle_attach = esp_crt_bundle_attach,
#else
.cert_pem = ota_data->server_cert,
@@ -284,10 +284,16 @@ ota_end:
return ESP_FAIL;
}
static const esp_rmaker_ota_config_t ota_default_config = {
.server_cert = esp_rmaker_ota_def_cert,
};
/* Enable the ESP RainMaker specific OTA */
esp_err_t esp_rmaker_ota_enable(esp_rmaker_ota_config_t *ota_config, esp_rmaker_ota_type_t type)
{
if (!ota_config || ((type != OTA_USING_PARAMS) && (type != OTA_USING_TOPICS))) {
if (ota_config == NULL) {
ota_config = (esp_rmaker_ota_config_t *)&ota_default_config;
}
if ((type != OTA_USING_PARAMS) && (type != OTA_USING_TOPICS)) {
ESP_LOGE(TAG,"Invalid arguments for esp_rmaker_ota_enable()");
return ESP_ERR_INVALID_ARG;
}
@@ -343,3 +349,8 @@ esp_err_t esp_rmaker_ota_enable(esp_rmaker_ota_config_t *ota_config, esp_rmaker_
}
return err;
}
esp_err_t esp_rmaker_ota_enable_default(void)
{
return esp_rmaker_ota_enable(NULL, OTA_USING_TOPICS);
}

View File

@@ -115,6 +115,9 @@ esp_rmaker_param_t *esp_rmaker_temperature_param_create(const char *param_name,
{
esp_rmaker_param_t *param = esp_rmaker_param_create(param_name, ESP_RMAKER_PARAM_TEMPERATURE,
esp_rmaker_float(val), PROP_FLAG_READ);
if (param) {
esp_rmaker_param_add_ui_type(param, ESP_RMAKER_UI_TEXT);
}
return param;
}

View File

@@ -227,7 +227,27 @@ esp_schedule_handle_t *esp_schedule_nvs_get_all(uint8_t *schedule_count)
return NULL;
}
int handle_count = 0;
nvs_entry_info_t nvs_entry;
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
nvs_iterator_t nvs_iterator = NULL;
esp_err_t err = nvs_entry_find(esp_schedule_nvs_partition, ESP_SCHEDULE_NVS_NAMESPACE, NVS_TYPE_BLOB, &nvs_iterator);
if (err != ESP_OK) {
ESP_LOGE(TAG, "No entry found in NVS");
return NULL;;
}
while (err == ESP_OK) {
nvs_entry_info(nvs_iterator, &nvs_entry);
ESP_LOGI(TAG, "Found schedule in NVS with key: %s", nvs_entry.key);
handle_list[handle_count] = esp_schedule_nvs_get(nvs_entry.key);
if (handle_list[handle_count] != NULL) {
/* Increase count only if nvs_get was successful */
handle_count++;
}
err = nvs_entry_next(&nvs_iterator);
}
nvs_release_iterator(nvs_iterator);
#else
nvs_iterator_t nvs_iterator = nvs_entry_find(esp_schedule_nvs_partition, ESP_SCHEDULE_NVS_NAMESPACE, NVS_TYPE_BLOB);
if (nvs_iterator == NULL) {
ESP_LOGE(TAG, "No entry found in NVS");
@@ -243,6 +263,7 @@ esp_schedule_handle_t *esp_schedule_nvs_get_all(uint8_t *schedule_count)
}
nvs_iterator = nvs_entry_next(nvs_iterator);
}
#endif
*schedule_count = handle_count;
ESP_LOGI(TAG, "Found %d schedules in NVS", *schedule_count);
return handle_list;

View File

@@ -21,8 +21,6 @@
/* This is the button that is used for toggling the power */
#define BUTTON_GPIO CONFIG_EXAMPLE_BOARD_BUTTON_GPIO
#define BUTTON_ACTIVE_LEVEL 0
/* This is the GPIO on which the power will be set */
#define OUTPUT_GPIO 19
#define DEFAULT_HUE 180
#define DEFAULT_SATURATION 100

View File

@@ -91,6 +91,9 @@ void app_main()
esp_rmaker_device_add_param(fan_device, esp_rmaker_speed_param_create(ESP_RMAKER_DEF_SPEED_NAME, DEFAULT_SPEED));
esp_rmaker_node_add_device(node, fan_device);
/* Enable OTA */
esp_rmaker_ota_enable_default();
/* Enable timezone service which will be require for setting appropriate timezone
* from the phone apps for scheduling to work correctly.
* For more information on the various ways of setting timezone, please check

View File

@@ -8,4 +8,22 @@ menu "Example Configuration"
GPIO number on which the "Boot" button is connected. This is generally used
by the application for custom operations like toggling states, resetting to defaults, etc.
config EXAMPLE_OUTPUT_GPIO_RED
int "Red GPIO"
default 2
help
Control digital RGB LEDs. Need to connect this GPIO to the red pin of the LED.
config EXAMPLE_OUTPUT_GPIO_GREEN
int "Green GPIO"
default 4
help
Control digital RGB LEDs. Need to connect this GPIO to the green pin of the LED.
config EXAMPLE_OUTPUT_GPIO_BLUE
int "Blue GPIO"
default 5
help
Control digital RGB LEDs. Need to connect this GPIO to the blue pin of the LED.
endmenu

View File

@@ -20,9 +20,9 @@
#define BUTTON_ACTIVE_LEVEL 0
/* This is the GPIO on which the power will be set */
#define OUTPUT_GPIO_RED 16ULL
#define OUTPUT_GPIO_GREEN 14ULL
#define OUTPUT_GPIO_BLUE 15ULL
#define OUTPUT_GPIO_RED CONFIG_EXAMPLE_OUTPUT_GPIO_RED
#define OUTPUT_GPIO_GREEN CONFIG_EXAMPLE_OUTPUT_GPIO_GREEN
#define OUTPUT_GPIO_BLUE CONFIG_EXAMPLE_OUTPUT_GPIO_BLUE
#define WIFI_RESET_BUTTON_TIMEOUT 3
#define FACTORY_RESET_BUTTON_TIMEOUT 10

View File

@@ -86,6 +86,9 @@ void app_main()
esp_rmaker_node_add_device(node, gpio_device);
/* Enable OTA */
esp_rmaker_ota_enable_default();
/* Enable Insights. Requires CONFIG_ESP_INSIGHTS_ENABLED=y */
app_insights_enable();

View File

@@ -13,7 +13,7 @@ else()
endif(DEFINED ENV{RMAKER_PATH})
# Add RainMaker components and other common application components
set(EXTRA_COMPONENT_DIRS $ENV{HOMEKIT_PATH}/components/homekit ${RMAKER_PATH}/components/esp-insights/components ${RMAKER_PATH}/components ${RMAKER_PATH}/examples/common)
set(EXTRA_COMPONENT_DIRS $ENV{HOMEKIT_PATH}/components/homekit ${RMAKER_PATH}/components/esp-insights/components ${RMAKER_PATH}/components ${RMAKER_PATH}/examples/common components)
set(PROJECT_VER "1.0")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)

View File

@@ -32,4 +32,11 @@ menu "Example Configuration"
GPIO number on which the "Boot" button is connected. This is generally used
by the application for custom operations like toggling states, resetting to defaults, etc.
config EXAMPLE_OUTPUT_GPIO
int "Output GPIO"
default 19
help
This is an output GPIO that will be connected to a relay or other driver circuit in most cases.
If the power changes, this GPIO output level will also change.
endmenu

View File

@@ -22,7 +22,7 @@
#define BUTTON_ACTIVE_LEVEL 0
/* This is the GPIO on which the power will be set */
#define OUTPUT_GPIO 19
#define OUTPUT_GPIO CONFIG_EXAMPLE_OUTPUT_GPIO
static bool g_power_state = DEFAULT_POWER;
/* These values correspoind to H,S,V = 120,100,10 */

View File

@@ -11,7 +11,7 @@
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <esp_log.h>
#include <esp_netif_types.h>
#include <esp_netif.h>
#include <esp_rmaker_core.h>
#include <esp_rmaker_standard_params.h>

View File

@@ -49,7 +49,7 @@ static esp_err_t write_cb(const esp_rmaker_device_t *device, const esp_rmaker_pa
}
/* Event handler for catching RainMaker events */
static void event_handler(void* arg, esp_event_base_t event_base,
int event_id, void* event_data)
int32_t event_id, void* event_data)
{
if (event_base == RMAKER_EVENT) {
switch (event_id) {
@@ -182,10 +182,7 @@ void app_main()
esp_rmaker_node_add_device(node, switch_device);
/* Enable OTA */
esp_rmaker_ota_config_t ota_config = {
.server_cert = ESP_RMAKER_OTA_DEFAULT_SERVER_CERT,
};
esp_rmaker_ota_enable(&ota_config, OTA_USING_PARAMS);
esp_rmaker_ota_enable_default();
/* Enable Insights. Requires CONFIG_ESP_INSIGHTS_ENABLED=y */
app_insights_enable();

View File

@@ -16,7 +16,6 @@
#include <esp_rmaker_core.h>
#include <esp_rmaker_standard_params.h>
#include <esp_rmaker_standard_devices.h>
#include <esp_rmaker_ota.h>
#include <esp_rmaker_schedule.h>
#include <esp_rmaker_scenes.h>
@@ -105,10 +104,7 @@ void app_main()
esp_rmaker_node_add_device(node, light_device);
/* Enable OTA */
esp_rmaker_ota_config_t ota_config = {
.server_cert = ESP_RMAKER_OTA_DEFAULT_SERVER_CERT,
};
esp_rmaker_ota_enable(&ota_config, OTA_USING_PARAMS);
esp_rmaker_ota_enable_default();
/* Enable timezone service which will be require for setting appropriate timezone
* from the phone apps for scheduling to work correctly.

View File

@@ -8,4 +8,11 @@ menu "Example Configuration"
GPIO number on which the "Boot" button is connected. This is generally used
by the application for custom operations like toggling states, resetting to defaults, etc.
config EXAMPLE_OUTPUT_GPIO
int "Output GPIO"
default 19
help
This is an output GPIO that will be connected to a relay or other driver circuit in most cases.
If the power changes, this GPIO output level will also change.
endmenu

View File

@@ -23,7 +23,7 @@
#define BUTTON_GPIO CONFIG_EXAMPLE_BOARD_BUTTON_GPIO
#define BUTTON_ACTIVE_LEVEL 0
/* This is the GPIO on which the power will be set */
#define OUTPUT_GPIO 19
#define OUTPUT_GPIO CONFIG_EXAMPLE_OUTPUT_GPIO
/* These values correspoind to H,S,V = 120,100,10 */
#define DEFAULT_RED 0
@@ -37,7 +37,7 @@ static bool g_power_state = DEFAULT_SWITCH_POWER;
static float g_temperature = DEFAULT_TEMPERATURE;
static TimerHandle_t sensor_timer;
static void app_sensor_update(void *priv)
static void app_sensor_update(TimerHandle_t handle)
{
static float delta = 0.5;
g_temperature += delta;

View File

@@ -120,6 +120,9 @@ void app_main()
temp_sensor_device = esp_rmaker_temp_sensor_device_create("Temperature Sensor", NULL, app_get_current_temperature());
esp_rmaker_node_add_device(node, temp_sensor_device);
/* Enable OTA */
esp_rmaker_ota_enable_default();
/* Enable timezone service which will be require for setting appropriate timezone
* from the phone apps for scheduling to work correctly.
* For more information on the various ways of setting timezone, please check

View File

@@ -15,5 +15,12 @@ menu "Example Configuration"
Enable this option to test mobile push notifications. When enabled, turning on the switch using
push button will trigger a parameter notification {"Switch":{"Power":true}} and turning off will
trigger an alert "Switch was turned off".
config EXAMPLE_OUTPUT_GPIO
int "Output GPIO"
default 19
help
This is an output GPIO that will be connected to a relay or other driver circuit in most cases.
If the power changes, this GPIO output level will also change.
endmenu

View File

@@ -22,7 +22,7 @@
#define BUTTON_ACTIVE_LEVEL 0
/* This is the GPIO on which the power will be set */
#define OUTPUT_GPIO 19
#define OUTPUT_GPIO CONFIG_EXAMPLE_OUTPUT_GPIO
static bool g_power_state = DEFAULT_POWER;
/* These values correspoind to H,S,V = 120,100,10 */

View File

@@ -18,7 +18,6 @@
#include <esp_rmaker_standard_types.h>
#include <esp_rmaker_standard_params.h>
#include <esp_rmaker_standard_devices.h>
#include <esp_rmaker_ota.h>
#include <esp_rmaker_schedule.h>
#include <esp_rmaker_scenes.h>
#include <esp_rmaker_console.h>
@@ -184,10 +183,7 @@ void app_main()
esp_rmaker_node_add_device(node, switch_device);
/* Enable OTA */
esp_rmaker_ota_config_t ota_config = {
.server_cert = ESP_RMAKER_OTA_DEFAULT_SERVER_CERT,
};
esp_rmaker_ota_enable(&ota_config, OTA_USING_PARAMS);
esp_rmaker_ota_enable_default();
/* Enable timezone service which will be require for setting appropriate timezone
* from the phone apps for scheduling to work correctly.

View File

@@ -62,6 +62,9 @@ void app_main()
temp_sensor_device = esp_rmaker_temp_sensor_device_create("Temperature Sensor", NULL, app_get_current_temperature());
esp_rmaker_node_add_device(node, temp_sensor_device);
/* Enable OTA */
esp_rmaker_ota_enable_default();
/* Enable Insights. Requires CONFIG_ESP_INSIGHTS_ENABLED=y */
app_insights_enable();