Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ Install the toolchain defined in the chipset SDK you use according to the direct

#### For ESP8266 (Ubuntu/Debian Quickstart):
1. Set up the ESP8266 Toolchain for Linux according to the [Espressif documentation](https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/linux-setup.html).
2. In order to use the pre-supplied SDK build script `build.py`, extract [the toolchain](https://dl.espressif.com/dl/xtensa-lx106-elf-linux64-1.22.0-100-ge567ec7-5.2.0.tar.gz) into the `~/esp/xtensa-lx106-elf/` directory as directed in the Expressif documentation linked above.
2. In order to use the pre-supplied SDK build script `build.py`, extract [the toolchain](https://dl.espressif.com/dl/xtensa-lx106-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz) into the `~/esp/xtensa-lx106-elf/` directory as directed in the Expressif documentation linked above.

> The Espressif documentation linked above directs you to add the toochain path to your `PATH` environment variable in your `~/.profile`. This step *not* necessary if you use the pre-supplied build script `build.py` - the path is automatically exported when using the build script.

#### For ESP32:
1. Install [Prerequisites](https://docs.espressif.com/projects/esp-idf/en/stable/get-started/index.html#step-1-install-prerequisites) for your build system OS.
1. Install [Prerequisites](https://docs.espressif.com/projects/esp-idf/en/release-v4.3/esp32/get-started/index.html#step-1-install-prerequisites) for your build system OS.
2. Set up the ESP32 toolchain with `setup.py`

#### For ESP32_v3.3 (Legacy - Ubuntu/Debian Quickstart):
Expand Down Expand Up @@ -86,7 +86,7 @@ For Windows systems:

> If you want to use the default build configuration, you can skip this step.

- ESP8266 Example:
- ESP32 Example:
> Note that the `menuconfig` option is only supported on the Espressif chipset.
```sh
# python build.py {app_path} {option}
Expand Down Expand Up @@ -120,7 +120,7 @@ Flashing can be done according to the method outlined by the applicable chipset

You can flash the executables into a target device via `build.py` with additional options.

> You do not need to run `python build.py esp8266 st_switch` before running `python build.py esp8266 st_switch flash`; this will automatically rebuild anything which needs it.
> You do not need to run `python build.py esp32 st_switch` before running `python build.py esp32 st_switch flash`; this will automatically rebuild anything which needs it.

Available Options:

Expand Down
6 changes: 3 additions & 3 deletions apps/esp32/light_example/main/iot_cli_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "st_dev.h"

extern IOT_CTX *ctx;
extern IOT_CTX *iot_ctx;

static int _cli_copy_nth_arg(char* dest, char* src, int size, int n)
{
Expand Down Expand Up @@ -66,7 +66,7 @@ static int _cli_copy_nth_arg(char* dest, char* src, int size, int n)
static void _cli_cmd_cleanup(char *string)
{
printf("clean-up data with reboot option");
st_conn_cleanup(ctx, true);
st_conn_cleanup(iot_ctx, true);
}

extern void button_event(IOT_CAP_HANDLE *handle, int type, int count);
Expand All @@ -86,7 +86,7 @@ static void _cli_cmd_butten_event(char *string)
}

printf("button_event : count %d, type %d\n", count, type);
button_event(ctx, type, count);
button_event(iot_ctx, type, count);
}

extern int monitor_enable;
Expand Down
26 changes: 13 additions & 13 deletions apps/esp32/light_example/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extern const uint8_t device_info_end[] asm("_binary_device_info_json_end"
static iot_status_t g_iot_status = IOT_STATUS_IDLE;
static iot_stat_lv_t g_iot_stat_lv;

IOT_CTX* ctx = NULL;
IOT_CTX* iot_ctx = NULL;

//#define SET_PIN_NUMBER_CONFRIM

Expand Down Expand Up @@ -126,7 +126,7 @@ static void cap_lightMode_cmd_cb(struct caps_activityLightingMode_data *caps_dat

static void capability_init()
{
cap_switch_data = caps_switch_initialize(ctx, "main", NULL, NULL);
cap_switch_data = caps_switch_initialize(iot_ctx, "main", NULL, NULL);
if (cap_switch_data) {
const char *switch_init_value = caps_helper_switch.attr_switch.value_on;

Expand All @@ -136,7 +136,7 @@ static void capability_init()
cap_switch_data->set_switch_value(cap_switch_data, switch_init_value);
}

cap_switchLevel_data = caps_switchLevel_initialize(ctx, "main", NULL, NULL);
cap_switchLevel_data = caps_switchLevel_initialize(iot_ctx, "main", NULL, NULL);
if (cap_switchLevel_data) {
int switch_init_level = 50;

Expand All @@ -146,7 +146,7 @@ static void capability_init()
cap_switchLevel_data->set_level_unit(cap_switchLevel_data, caps_helper_switchLevel.attr_level.unit_percent);
}

cap_colorTemp_data = caps_colorTemperature_initialize(ctx, "main", NULL, NULL);
cap_colorTemp_data = caps_colorTemperature_initialize(iot_ctx, "main", NULL, NULL);
if (cap_colorTemp_data) {
int colorTemp_init_value = 2000;

Expand All @@ -155,15 +155,15 @@ static void capability_init()
cap_colorTemp_data->set_colorTemperature_value(cap_colorTemp_data, colorTemp_init_value);
}

cap_lightMode_data = caps_activityLightingMode_initialize(ctx, "main", NULL, NULL);
cap_lightMode_data = caps_activityLightingMode_initialize(iot_ctx, "main", NULL, NULL);
if (cap_lightMode_data) {
const char *init_lightMode = caps_helper_activityLightingMode.attr_lightingMode.value_cozy;
cap_lightMode_data->set_lightingMode_value(cap_lightMode_data, init_lightMode);

cap_lightMode_data->cmd_setLightingMode_usr_cb = cap_lightMode_cmd_cb;
}

cap_dustSensor_data = caps_dustSensor_initialize(ctx, "monitor", NULL, NULL);
cap_dustSensor_data = caps_dustSensor_initialize(iot_ctx, "monitor", NULL, NULL);
if (cap_dustSensor_data) {
cap_dustSensor_data->set_dustLevel_value(cap_dustSensor_data, 0);
cap_dustSensor_data->set_fineDustLevel_value(cap_dustSensor_data, 0);
Expand Down Expand Up @@ -222,7 +222,7 @@ static void connection_start(void)
#endif

// process on-boarding procedure. There is nothing more to do on the app side than call the API.
err = st_conn_start(ctx, (st_status_cb)&iot_status_cb, IOT_STATUS_ALL, NULL, pin_num);
err = st_conn_start(iot_ctx, (st_status_cb)&iot_status_cb, IOT_STATUS_ALL, NULL, pin_num);
if (err) {
printf("fail to start connection. err:%d\n", err);
}
Expand Down Expand Up @@ -256,7 +256,7 @@ void button_event(IOT_CAP_HANDLE *handle, int type, int count)
switch(count) {
case 1:
if (g_iot_status == IOT_STATUS_NEED_INTERACT) {
st_conn_ownership_confirm(ctx, true);
st_conn_ownership_confirm(iot_ctx, true);
noti_led_mode = LED_ANIMATION_MODE_IDLE;
change_switch_state(get_switch_state());
} else {
Expand All @@ -277,7 +277,7 @@ void button_event(IOT_CAP_HANDLE *handle, int type, int count)
break;
case 5:
/* clean-up provisioning & registered data with reboot option*/
st_conn_cleanup(ctx, true);
st_conn_cleanup(iot_ctx, true);
break;
default:
led_blink(get_switch_state(), 100, count);
Expand All @@ -286,7 +286,7 @@ void button_event(IOT_CAP_HANDLE *handle, int type, int count)
} else if (type == BUTTON_LONG_PRESS) {
printf("Button long press, iot_status: %d\n", g_iot_status);
led_blink(get_switch_state(), 100, 3);
st_conn_cleanup(ctx, false);
st_conn_cleanup(iot_ctx, false);
xTaskCreate(connection_start_task, "connection_task", 2048, NULL, 10, NULL);
}
}
Expand Down Expand Up @@ -361,9 +361,9 @@ void app_main(void)
int iot_err;

// create a iot context
ctx = st_conn_init(onboarding_config, onboarding_config_len, device_info, device_info_len);
if (ctx != NULL) {
iot_err = st_conn_set_noti_cb(ctx, iot_noti_cb, NULL);
iot_ctx = st_conn_init(onboarding_config, onboarding_config_len, device_info, device_info_len);
if (iot_ctx != NULL) {
iot_err = st_conn_set_noti_cb(iot_ctx, iot_noti_cb, NULL);
if (iot_err)
printf("fail to set notification callback function\n");
} else {
Expand Down
Loading