Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8004a81

Browse filesBrowse files
Rainmaker Example Changes (espressif#7591)
* Changed OTA type in Rainmaker examples * fix: Added patch in Rainmaker examples to prevent crashes during provisioning
1 parent c2caad9 commit 8004a81
Copy full SHA for 8004a81

File tree

Expand file treeCollapse file tree

4 files changed

+53
-27
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+53
-27
lines changed

‎libraries/RainMaker/examples/RMakerCustom/RMakerCustom.ino

Copy file name to clipboardExpand all lines: libraries/RainMaker/examples/RMakerCustom/RMakerCustom.ino
+12-6Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,19 @@ void sysProvEvent(arduino_event_t *sys_event)
2929
switch (sys_event->event_id) {
3030
case ARDUINO_EVENT_PROV_START:
3131
#if CONFIG_IDF_TARGET_ESP32S2
32-
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
33-
printQR(service_name, pop, "softap");
32+
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
33+
printQR(service_name, pop, "softap");
3434
#else
35-
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
36-
printQR(service_name, pop, "ble");
35+
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
36+
printQR(service_name, pop, "ble");
3737
#endif
38-
break;
38+
break;
39+
case ARDUINO_EVENT_PROV_INIT:
40+
wifi_prov_mgr_disable_auto_stop(10000);
41+
break;
42+
case ARDUINO_EVENT_PROV_CRED_SUCCESS:
43+
wifi_prov_mgr_stop_provisioning();
44+
break;
3945
default:;
4046
}
4147
}
@@ -83,7 +89,7 @@ void setup()
8389
my_node.addDevice(my_device);
8490

8591
//This is optional
86-
RMaker.enableOTA(OTA_USING_PARAMS);
92+
RMaker.enableOTA(OTA_USING_TOPICS);
8793
//If you want to enable scheduling, set time zone for your region using setTimeZone().
8894
//The list of available values are provided here https://rainmaker.espressif.com/docs/time-service.html
8995
// RMaker.setTimeZone("Asia/Shanghai");

‎libraries/RainMaker/examples/RMakerCustomAirCooler/RMakerCustomAirCooler.ino

Copy file name to clipboardExpand all lines: libraries/RainMaker/examples/RMakerCustomAirCooler/RMakerCustomAirCooler.ino
+12-6Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,19 @@ void sysProvEvent(arduino_event_t *sys_event)
4646
switch (sys_event->event_id) {
4747
case ARDUINO_EVENT_PROV_START:
4848
#if CONFIG_IDF_TARGET_ESP32S2
49-
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
50-
printQR(service_name, pop, "softap");
49+
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
50+
printQR(service_name, pop, "softap");
5151
#else
52-
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
53-
printQR(service_name, pop, "ble");
52+
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
53+
printQR(service_name, pop, "ble");
5454
#endif
55-
break;
55+
break;
56+
case ARDUINO_EVENT_PROV_INIT:
57+
wifi_prov_mgr_disable_auto_stop(10000);
58+
break;
59+
case ARDUINO_EVENT_PROV_CRED_SUCCESS:
60+
wifi_prov_mgr_stop_provisioning();
61+
break;
5662
default:;
5763
}
5864
}
@@ -143,7 +149,7 @@ void setup()
143149
my_node.addDevice(my_device);
144150

145151
//This is optional
146-
// RMaker.enableOTA(OTA_USING_PARAMS);
152+
// RMaker.enableOTA(OTA_USING_TOPICS);
147153
//If you want to enable scheduling, set time zone for your region using setTimeZone().
148154
//The list of available values are provided here https://rainmaker.espressif.com/docs/time-service.html
149155
// RMaker.setTimeZone("Asia/Shanghai");

‎libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino

Copy file name to clipboardExpand all lines: libraries/RainMaker/examples/RMakerSonoffDualR3/RMakerSonoffDualR3.ino
+17-9Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,29 @@ void sysProvEvent(arduino_event_t *sys_event)
3939
switch (sys_event->event_id) {
4040
case ARDUINO_EVENT_PROV_START:
4141
#if CONFIG_IDF_TARGET_ESP32
42-
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
43-
printQR(service_name, pop, "ble");
42+
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
43+
printQR(service_name, pop, "ble");
4444
#else
45-
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
46-
printQR(service_name, pop, "softap");
45+
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
46+
printQR(service_name, pop, "softap");
4747
#endif
48-
break;
48+
break;
4949
case ARDUINO_EVENT_WIFI_STA_CONNECTED:
50-
Serial.printf("\nConnected to Wi-Fi!\n");
51-
digitalWrite(gpio_led, true);
52-
break;
50+
Serial.printf("\nConnected to Wi-Fi!\n");
51+
digitalWrite(gpio_led, true);
52+
break;
53+
case ARDUINO_EVENT_PROV_INIT:
54+
wifi_prov_mgr_disable_auto_stop(10000);
55+
break;
56+
case ARDUINO_EVENT_PROV_CRED_SUCCESS:
57+
wifi_prov_mgr_stop_provisioning();
58+
break;
5359
default:;
5460
}
5561
}
5662

63+
64+
5765
void write_callback(Device *device, Param *param, const param_val_t val, void *priv_data, write_ctx_t *ctx)
5866
{
5967
const char *device_name = device->getDeviceName();
@@ -129,7 +137,7 @@ void setup()
129137
my_node.addDevice(my_switch2);
130138

131139
//This is optional
132-
RMaker.enableOTA(OTA_USING_PARAMS);
140+
RMaker.enableOTA(OTA_USING_TOPICS);
133141
//If you want to enable scheduling, set time zone for your region using setTimeZone().
134142
//The list of available values are provided here https://rainmaker.espressif.com/docs/time-service.html
135143
// RMaker.setTimeZone("Asia/Shanghai");

‎libraries/RainMaker/examples/RMakerSwitch/RMakerSwitch.ino

Copy file name to clipboardExpand all lines: libraries/RainMaker/examples/RMakerSwitch/RMakerSwitch.ino
+12-6Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,19 @@ void sysProvEvent(arduino_event_t *sys_event)
2828
switch (sys_event->event_id) {
2929
case ARDUINO_EVENT_PROV_START:
3030
#if CONFIG_IDF_TARGET_ESP32S2
31-
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
32-
printQR(service_name, pop, "softap");
31+
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on SoftAP\n", service_name, pop);
32+
printQR(service_name, pop, "softap");
3333
#else
34-
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
35-
printQR(service_name, pop, "ble");
34+
Serial.printf("\nProvisioning Started with name \"%s\" and PoP \"%s\" on BLE\n", service_name, pop);
35+
printQR(service_name, pop, "ble");
3636
#endif
37-
break;
37+
break;
38+
case ARDUINO_EVENT_PROV_INIT:
39+
wifi_prov_mgr_disable_auto_stop(10000);
40+
break;
41+
case ARDUINO_EVENT_PROV_CRED_SUCCESS:
42+
wifi_prov_mgr_stop_provisioning();
43+
break;
3844
default:;
3945
}
4046
}
@@ -72,7 +78,7 @@ void setup()
7278
my_node.addDevice(my_switch);
7379

7480
//This is optional
75-
RMaker.enableOTA(OTA_USING_PARAMS);
81+
RMaker.enableOTA(OTA_USING_TOPICS);
7682
//If you want to enable scheduling, set time zone for your region using setTimeZone().
7783
//The list of available values are provided here https://rainmaker.espressif.com/docs/time-service.html
7884
// RMaker.setTimeZone("Asia/Shanghai");

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.