Skip to content

Commit b3d83fd

Browse files
authored
Merge pull request #115 from SmartThingsCommunity/develop_rel_1_7_5
Develop rel 1 7 5
2 parents ef1f813 + 46abc9c commit b3d83fd

File tree

19 files changed

+2595
-433
lines changed

19 files changed

+2595
-433
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ Install the toolchain defined in the chipset SDK you use according to the direct
2929

3030
#### For ESP8266 (Ubuntu/Debian Quickstart):
3131
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).
32-
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.
32+
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.
3333

3434
> 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.
3535
3636
#### For ESP32:
37-
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.
37+
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.
3838
2. Set up the ESP32 toolchain with `setup.py`
3939

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

8787
> If you want to use the default build configuration, you can skip this step.
8888
89-
- ESP8266 Example:
89+
- ESP32 Example:
9090
> Note that the `menuconfig` option is only supported on the Espressif chipset.
9191
```sh
9292
# python build.py {app_path} {option}
@@ -120,7 +120,7 @@ Flashing can be done according to the method outlined by the applicable chipset
120120
121121
You can flash the executables into a target device via `build.py` with additional options.
122122
123-
> 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.
123+
> 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.
124124
125125
Available Options:
126126

apps/esp32/light_example/main/iot_cli_cmd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#include "st_dev.h"
2727

28-
extern IOT_CTX *ctx;
28+
extern IOT_CTX *iot_ctx;
2929

3030
static int _cli_copy_nth_arg(char* dest, char* src, int size, int n)
3131
{
@@ -66,7 +66,7 @@ static int _cli_copy_nth_arg(char* dest, char* src, int size, int n)
6666
static void _cli_cmd_cleanup(char *string)
6767
{
6868
printf("clean-up data with reboot option");
69-
st_conn_cleanup(ctx, true);
69+
st_conn_cleanup(iot_ctx, true);
7070
}
7171

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

8888
printf("button_event : count %d, type %d\n", count, type);
89-
button_event(ctx, type, count);
89+
button_event(iot_ctx, type, count);
9090
}
9191

9292
extern int monitor_enable;

apps/esp32/light_example/main/main.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extern const uint8_t device_info_end[] asm("_binary_device_info_json_end"
4646
static iot_status_t g_iot_status = IOT_STATUS_IDLE;
4747
static iot_stat_lv_t g_iot_stat_lv;
4848

49-
IOT_CTX* ctx = NULL;
49+
IOT_CTX* iot_ctx = NULL;
5050

5151
//#define SET_PIN_NUMBER_CONFRIM
5252

@@ -126,7 +126,7 @@ static void cap_lightMode_cmd_cb(struct caps_activityLightingMode_data *caps_dat
126126

127127
static void capability_init()
128128
{
129-
cap_switch_data = caps_switch_initialize(ctx, "main", NULL, NULL);
129+
cap_switch_data = caps_switch_initialize(iot_ctx, "main", NULL, NULL);
130130
if (cap_switch_data) {
131131
const char *switch_init_value = caps_helper_switch.attr_switch.value_on;
132132

@@ -136,7 +136,7 @@ static void capability_init()
136136
cap_switch_data->set_switch_value(cap_switch_data, switch_init_value);
137137
}
138138

139-
cap_switchLevel_data = caps_switchLevel_initialize(ctx, "main", NULL, NULL);
139+
cap_switchLevel_data = caps_switchLevel_initialize(iot_ctx, "main", NULL, NULL);
140140
if (cap_switchLevel_data) {
141141
int switch_init_level = 50;
142142

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

149-
cap_colorTemp_data = caps_colorTemperature_initialize(ctx, "main", NULL, NULL);
149+
cap_colorTemp_data = caps_colorTemperature_initialize(iot_ctx, "main", NULL, NULL);
150150
if (cap_colorTemp_data) {
151151
int colorTemp_init_value = 2000;
152152

@@ -155,15 +155,15 @@ static void capability_init()
155155
cap_colorTemp_data->set_colorTemperature_value(cap_colorTemp_data, colorTemp_init_value);
156156
}
157157

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

163163
cap_lightMode_data->cmd_setLightingMode_usr_cb = cap_lightMode_cmd_cb;
164164
}
165165

166-
cap_dustSensor_data = caps_dustSensor_initialize(ctx, "monitor", NULL, NULL);
166+
cap_dustSensor_data = caps_dustSensor_initialize(iot_ctx, "monitor", NULL, NULL);
167167
if (cap_dustSensor_data) {
168168
cap_dustSensor_data->set_dustLevel_value(cap_dustSensor_data, 0);
169169
cap_dustSensor_data->set_fineDustLevel_value(cap_dustSensor_data, 0);
@@ -222,7 +222,7 @@ static void connection_start(void)
222222
#endif
223223

224224
// process on-boarding procedure. There is nothing more to do on the app side than call the API.
225-
err = st_conn_start(ctx, (st_status_cb)&iot_status_cb, IOT_STATUS_ALL, NULL, pin_num);
225+
err = st_conn_start(iot_ctx, (st_status_cb)&iot_status_cb, IOT_STATUS_ALL, NULL, pin_num);
226226
if (err) {
227227
printf("fail to start connection. err:%d\n", err);
228228
}
@@ -256,7 +256,7 @@ void button_event(IOT_CAP_HANDLE *handle, int type, int count)
256256
switch(count) {
257257
case 1:
258258
if (g_iot_status == IOT_STATUS_NEED_INTERACT) {
259-
st_conn_ownership_confirm(ctx, true);
259+
st_conn_ownership_confirm(iot_ctx, true);
260260
noti_led_mode = LED_ANIMATION_MODE_IDLE;
261261
change_switch_state(get_switch_state());
262262
} else {
@@ -277,7 +277,7 @@ void button_event(IOT_CAP_HANDLE *handle, int type, int count)
277277
break;
278278
case 5:
279279
/* clean-up provisioning & registered data with reboot option*/
280-
st_conn_cleanup(ctx, true);
280+
st_conn_cleanup(iot_ctx, true);
281281
break;
282282
default:
283283
led_blink(get_switch_state(), 100, count);
@@ -286,7 +286,7 @@ void button_event(IOT_CAP_HANDLE *handle, int type, int count)
286286
} else if (type == BUTTON_LONG_PRESS) {
287287
printf("Button long press, iot_status: %d\n", g_iot_status);
288288
led_blink(get_switch_state(), 100, 3);
289-
st_conn_cleanup(ctx, false);
289+
st_conn_cleanup(iot_ctx, false);
290290
xTaskCreate(connection_start_task, "connection_task", 2048, NULL, 10, NULL);
291291
}
292292
}
@@ -361,9 +361,9 @@ void app_main(void)
361361
int iot_err;
362362

363363
// create a iot context
364-
ctx = st_conn_init(onboarding_config, onboarding_config_len, device_info, device_info_len);
365-
if (ctx != NULL) {
366-
iot_err = st_conn_set_noti_cb(ctx, iot_noti_cb, NULL);
364+
iot_ctx = st_conn_init(onboarding_config, onboarding_config_len, device_info, device_info_len);
365+
if (iot_ctx != NULL) {
366+
iot_err = st_conn_set_noti_cb(iot_ctx, iot_noti_cb, NULL);
367367
if (iot_err)
368368
printf("fail to set notification callback function\n");
369369
} else {

0 commit comments

Comments
 (0)