pubsubclient
pubsubclient copied to clipboard
large data trigger watchdog reset
use following code: if (pub.has_stream()) { uint8_t buf[BUFFER_SIZE]; int read;
while (read = pub.payload_stream()->read(buf, BUFFER_SIZE)) {
Serial.write(buf, read);
}
pub.payload_stream()->stop();
Soft WDT reset
ctx: cont sp: 3fff0340 end: 3fff0670 offset: 01b0
stack>>> 3fff04f0: 3ffef55c 00000165 00000165 4020bb50
3fff0500: 3ffef55c 0000015a 3ffef420 4020919a
3fff0510: 00000004 3ffef420 3ffef650 3ffef420
3fff0520: 00000004 00000005 4020b510 00000005
3fff0530: 00000004 3ffef420 3ffef420 402093f4
3fff0540: 0000004a 3ffef420 3fff1964 40209466
3fff0550: 00000030 3fff061c 00000000 00000001
3fff0560: 3ffef420 3fff05e0 00000001 40209551
3fff0570: 00000000 00000005 00000000 4020aaf7
3fff0580: 00000030 3fff061c 3fff0604 3ffef640
3fff0590: 3fff05e0 3ffef420 00000001 40209806
3fff05a0: 3ffeee00 3ffef4bc 3fff05e0 4020b448
3fff05b0: 3fffdad0 3ffef584 3fff061c 40208cdd
3fff05c0: 3ffe87d1 00000064 00000005 3ffef640
3fff05d0: 3fffdad0 3ffef584 00000005 402026d1
3fff05e0: 3ffe9008 00000003 0004f404 40202101
3fff05f0: 00000000 3ffeedd8 3ffef420 00000000
3fff0600: 4010527c 3fff17cc 0000001f 0000001e
3fff0610: 3fff1934 00000026 00000001 3fff1794
3fff0620: 0000002f 00000026 3fff176c 0000001f
3fff0630: 0000001e 00040410 00000001 3ffef640
3fff0640: 3fffdad0 00000000 3ffef638 4020272a
3fff0650: 3fffdad0 00000000 3ffef638 4020b55c
3fff0660: feefeffe feefeffe 3ffef650 40100718
<<<stack<<<
try:
if (pub.has_stream()) {
uint8_t buf[BUFFER_SIZE];
int read;
/*
* 尝试解决mqtt大数据包下,重启问题
*/
//wifi_set_sleep_type(NONE_SLEEP_T);
//cli(); //IRQ Disable
//wdt_disable();
while (read = pub.payload_stream()->read(buf, BUFFER_SIZE)) {
//delay(1);
yield();
wdt_reset();
while(!Serial.availableForWrite());
{
yield();
}
Serial.write(buf, read);
//delay(1);
}
pub.payload_stream()->stop();
can't solve the problem。