Skip to content

Commit

Permalink
fix: rst timeout when mqtt publish raw
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxwelltoo committed Dec 19, 2023
1 parent 9ee1169 commit 694b700
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions porting/himax/we2/el_network_we2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,23 @@ void NetworkWE2::init(status_cb_t cb) {
EL_LOGD("network_status_handler create error\n");
return;
}
at.state = AT_STATE_IDLE;
at.state = AT_STATE_PROCESS;
uint32_t t = 0;

memset((void*)at.tbuf, '0', 126);
memcpy((void*)at.tbuf + 126, AT_STR_CRLF, strlen(AT_STR_CRLF));
while (at.state == AT_STATE_PROCESS) {
at.port->uart_write(at.tbuf, strlen(at.tbuf));
if (t >= AT_SHORT_TIME_MS) {
EL_LOGD("AT FLUSH TIMEOUT\n");
return;
}
el_sleep(10);
t += 10;
}

t = 0;
sprintf(at.tbuf, AT_STR_HEADER AT_STR_RST AT_STR_CRLF);
uint32_t t = 0;
at.state = AT_STATE_PROCESS;
at.port->uart_write(at.tbuf, strlen(at.tbuf));
EL_LOGD(" %s\n", at.tbuf);
while (at.state != AT_STATE_READY) {
Expand Down

0 comments on commit 694b700

Please sign in to comment.