diff --git a/devices/esp8266_tencent_firmware/esp8266_tencent_firmware.c b/devices/esp8266_tencent_firmware/esp8266_tencent_firmware.c index 14924571..d356e527 100644 --- a/devices/esp8266_tencent_firmware/esp8266_tencent_firmware.c +++ b/devices/esp8266_tencent_firmware/esp8266_tencent_firmware.c @@ -60,13 +60,15 @@ int esp8266_tencent_firmware_module_mqtt_publ(const char *topic, qos_t qos, char at_echo_t echo; tos_at_echo_create(&echo, NULL, 0, ">"); + + strcat(payload, "\r\n"); tos_at_cmd_exec_until(&echo, 1000, "AT+TCMQTTPUBL=\"%s\",%d,%d\r\n", topic, qos, strlen(payload)-2); if (echo.status != AT_ECHO_STATUS_EXPECT) { return -1; } - tos_at_echo_create(&echo, NULL, 0, "+TCMQTTPUB:OK"); + tos_at_echo_create(&echo, NULL, 0, "+TCMQTTPUBL:OK"); tos_at_raw_data_send_until(&echo, 1000, (uint8_t *)payload, strlen(payload)); if (echo.status != AT_ECHO_STATUS_EXPECT) { return -1; @@ -165,10 +167,11 @@ int esp8266_tencent_firmware_join_ap(const char *ssid, const char *pwd) tos_at_echo_create(&echo, NULL, 0, NULL); while (try++ < 10) { - tos_at_cmd_exec(&echo, 15000, "AT+CWJAP=\"%s\",\"%s\"\r\n", ssid, pwd); + tos_at_cmd_exec(&echo, 30000, "AT+CWJAP=\"%s\",\"%s\"\r\n", ssid, pwd); if (echo.status == AT_ECHO_STATUS_OK) { return 0; } + tos_sleep_ms(2000); } return -1; } diff --git a/net/tencent_firmware_module_wrapper/tencent_firmware_module_wrapper.h b/net/tencent_firmware_module_wrapper/tencent_firmware_module_wrapper.h index 00dfa3d9..db873546 100644 --- a/net/tencent_firmware_module_wrapper/tencent_firmware_module_wrapper.h +++ b/net/tencent_firmware_module_wrapper/tencent_firmware_module_wrapper.h @@ -93,7 +93,7 @@ typedef struct mqtt_message_handlers_st { extern k_mail_q_t mqtt_message_mail; -#define DEFAULT_MQTT_PARAMS { TLS_MODE_PSK, MQTT_COMMAND_TIMEOUT, 240, 1, 1 } +#define DEFAULT_MQTT_PARAMS { TLS_MODE_PSK, MQTT_COMMAND_TIMEOUT, 240, 1, 0 } typedef struct device_info_st { char product_id[PRODUCT_ID_MAX_SIZE + 1];