try to correct random restart of ESP8266 when clone HM10 are connected
#112
This commit is contained in:
1 parent
ed014b3a0b
commit
7dbfa6f9ce
1 file changed
+7
-3
+7
-3
@@ -51,6 +51,9 @@ void setupBT() {
|
|||||||
|
|
||||||
boolean BTtoMQTT() {
|
boolean BTtoMQTT() {
|
||||||
while (softserial.available() > 0) {
|
while (softserial.available() > 0) {
|
||||||
|
#ifdef ESP8266
|
||||||
|
yield();
|
||||||
|
#endif
|
||||||
String discResult = softserial.readString();
|
String discResult = softserial.readString();
|
||||||
if (discResult.indexOf(STRING_MSG)>=0){
|
if (discResult.indexOf(STRING_MSG)>=0){
|
||||||
discResult.replace(RESPONSE_MSG,"");
|
discResult.replace(RESPONSE_MSG,"");
|
||||||
@@ -73,9 +76,6 @@ boolean BTtoMQTT() {
|
|||||||
trc(mactopic + " " + rssi);
|
trc(mactopic + " " + rssi);
|
||||||
client.publish((char *)mactopic.c_str(),(char *)rssi.c_str());
|
client.publish((char *)mactopic.c_str(),(char *)rssi.c_str());
|
||||||
discResult = discResult.substring(78);
|
discResult = discResult.substring(78);
|
||||||
#ifdef ESP8266
|
|
||||||
yield();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,11 @@ boolean BTtoMQTT() {
|
|||||||
}
|
}
|
||||||
if (millis() > (timebt + TimeBtw_Read)) {//retriving value of adresses and rssi
|
if (millis() > (timebt + TimeBtw_Read)) {//retriving value of adresses and rssi
|
||||||
timebt = millis();
|
timebt = millis();
|
||||||
|
#ifdef ESP8266
|
||||||
|
yield();
|
||||||
|
#endif
|
||||||
softserial.print(F(QUESTION_MSG));
|
softserial.print(F(QUESTION_MSG));
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user