Skip to content

Commit f55c0cf

Browse files
committed
improve stability
1 parent a9e469c commit f55c0cf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ESP8266.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ namespace ESP8266_IoT {
9090
}
9191

9292
/**
93-
* Initialize ESP8266 module
93+
* Initialize ESP8266 module
9494
*/
9595
//% block="set ESP8266|RX %tx|TX %rx|Baud rate %baudrate"
9696
//% tx.defl=SerialPin.P8
@@ -146,7 +146,7 @@ namespace ESP8266_IoT {
146146
}
147147

148148
/**
149-
* Connect to ThingSpeak and set data.
149+
* Connect to ThingSpeak and set data.
150150
*/
151151
//% block="set data to send ThingSpeak | Write API key = %write_api_key|Field 1 = %n1||Field 2 = %n2|Field 3 = %n3|Field 4 = %n4|Field 5 = %n5|Field 6 = %n6|Field 7 = %n7|Field 8 = %n8"
152152
//% write_api_key.defl=your_write_api_key
@@ -273,7 +273,7 @@ namespace ESP8266_IoT {
273273
/**
274274
* Set MQTT client
275275
*/
276-
//% subcategory=MQTT weight=30
276+
//% subcategory=MQTT weight=30
277277
//% blockId=initMQTT block="Set MQTT client config|scheme: %scheme clientID: %clientID username: %username password: %password path: %path"
278278
export function setMQTT(scheme: SchemeList, clientID: string, username: string, password: string, path: string): void {
279279
sendAT(`AT+MQTTUSERCFG=0,${scheme},"${clientID}","${username}","${password}",0,0,"${path}"`, 1000)
@@ -306,7 +306,7 @@ namespace ESP8266_IoT {
306306
}
307307

308308
/**
309-
* send message
309+
* send message
310310
*/
311311
//% subcategory=MQTT weight=21
312312
//% blockId=sendMQTT block="publish %msg to Topic:%topic with Qos:%qos"
@@ -363,6 +363,7 @@ namespace ESP8266_IoT {
363363
*/
364364
serial.onDataReceived(serial.delimiters(Delimiters.NewLine), function() {
365365
recvString += serial.readString()
366+
pause(1)
366367

367368
// received kids iot data
368369
if (recvString.includes("switchoff")) {

0 commit comments

Comments
 (0)