Skip to content

Commit

Permalink
Merge pull request #334 from cruise2018/iot_link
Browse files Browse the repository at this point in the history
fix:esp8266:fix the esp8266,
  • Loading branch information
cruise2018 authored Apr 2, 2020
2 parents 0d71cf7 + 14d10b5 commit 4edaa83
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion demos/oc_mqtt_demo/oc_mqtt_v5_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ static int task_reportmsg_entry(void *args)

connect_para.boostrap = CN_BOOT_MODE;
connect_para.device_id = CN_EP_DEVICEID;
connect_para.device_passwd = NULL;
connect_para.device_passwd = CN_EP_PASSWD;
connect_para.server_addr = CN_SERVER_IPV4;
connect_para.sevver_port = CN_SERVER_PORT;
connect_para.life_time = CN_LIFE_TIME;
Expand Down
9 changes: 8 additions & 1 deletion iot_link/network/tcpip/esp8266_socket/esp8266_socket_imp.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ int link_tcpip_imp_init(void)
at_oobregister("esp8266rcv",CN_ESP8266_RCVINDEX,strlen(CN_ESP8266_RCVINDEX),esp8266_rcvdeal,NULL);
ring_buffer_init(&s_esp8266_sock_cb.esp8266_rcvring,s_esp8266_sock_cb.esp8266_rcvbuf,CN_ESP8266_CACHELEN,0,0);

osal_task_sleep(1000);

esp8266_reset();
esp8266_echo_off();
Expand All @@ -573,7 +574,13 @@ int link_tcpip_imp_init(void)

while(false == esp8266_joinap(WIFI_SSID, WIFI_PASSWD))
{
LINK_LOG_DEBUG("connect ap failed, repeat...\r\n");
osal_task_sleep(1000);
esp8266_reset();
esp8266_echo_off();
esp8266_show_dinfo(0);
esp8266_set_mode(STA);
esp8266_set_mux(0);
LINK_LOG_DEBUG("connect ap failed, retry..\r\n");
}
//reach here means everything is ok, we can go now
ret = link_sal_install(&s_tcpip_socket);
Expand Down
3 changes: 3 additions & 0 deletions targets/GD32F303_BearPi/BearPi_IoT_GD.CFG
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface cmsis-dap
transport select swd
source [find target/stm32f3x.cfg]
21 changes: 11 additions & 10 deletions targets/GD32F303_BearPi/GCC/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ CONFIG_AT_ENABLE := y
########################INDEPENDENT SERVICE START#################################

#CONFIG_CJSON_ENABLE , we port the cJSON based on the osal,you could choose yes or no
CONFIG_CJSON_ENABLE := n
CONFIG_CJSON_ENABLE := y

########################INDEPENDENT SERVICE END#################################
CONFIG_LOG_ENABLE := y


########################NETWORK SERVICE START###################################
Expand All @@ -93,13 +94,13 @@ CONFIG_TCPIP_TYPE := "esp8266_socket"
#CONFIG_DTLS_ENABLE , we supply a DTLS AL (building),you could choose yes or no
#CONFIG_DTLS_TYPE, could be "mbeddtls_psk" "mbedtls_cert" "none"

CONFIG_DTLS_ENABLE := n
CONFIG_DTLS_TYPE := "mbedtls_psk"
CONFIG_DTLS_ENABLE := y
CONFIG_DTLS_TYPE := "mbedtls_cert"

#CONFIG_MQTT_ENABLE, we build a mqtt abstraction, which shield the difference of
#the implement of mqtt.
#CONFIG_MQTT_TYPE could be "paho_mqtt" "none"
CONFIG_MQTT_ENABLE := n
CONFIG_MQTT_ENABLE := y
CONFIG_MQTT_TYPE := "paho_mqtt"

#CONFIG_LWM2M_ENABLE, we build a lwm2m abstraction, which shield the difference of
Expand All @@ -111,7 +112,7 @@ CONFIG_LWM2M_TYPE := "wakaama_lwm2m"
#CONFIG_COAP_ENABLE, we build a coap abstraction, which shield the difference of
#the implement of coap.
#CONFIG_COAP_TYPE could be "lite_coap" "none"
CONFIG_COAP_ENABLE := y
CONFIG_COAP_ENABLE := n
CONFIG_COAP_TYPE := "lite_coap"
########################NETWORK SERVICE END#####################################

Expand All @@ -120,7 +121,7 @@ CONFIG_COAP_TYPE := "lite_coap"
#CONFIG_OC_COAP_ENABLE, we build a oc coap abstraction for huawei OceanConnect service,
#which shield the difference of the implement of oc coap.
#CONFIG_OC_MQTT_TYPE could be "soft" "none"
CONFIG_OC_COAP_ENABLE := y
CONFIG_OC_COAP_ENABLE := n
CONFIG_OC_COAP_TYPE := "soft"

#CONFIG_OC_MQTT_ENABLE, we build a oc mqtt abstraction for huawei OceanConnect service,
Expand All @@ -129,10 +130,10 @@ CONFIG_OC_COAP_TYPE := "soft"
#CONFIG_OC_MQTT_VERSION could be "V5" "V1",use this to select the used interface
#CONFIG_OCMQTT_DEMO_ENABLE could be y or n, use this to enable the oc mqtt demo
#CONFIG_OCMQTT_DEMO_BSENABLE could be y or n, use this to enable the bootstrap or not
CONFIG_OC_MQTT_ENABLE := n
CONFIG_OC_MQTT_ENABLE := y
CONFIG_OC_MQTT_TYPE := "soft"
CONFIG_OC_MQTT_VERSION := "V1"
CONFIG_OC_MQTTDEMO_ENABLE := n
CONFIG_OC_MQTT_VERSION := "V5"
CONFIG_OC_MQTTDEMO_ENABLE := y
CONFIG_OC_MQTTDEMO_BSENABLE := y


Expand Down Expand Up @@ -169,7 +170,7 @@ CONFIG_PCP_ENABLE := n
#"oc_lwm2m_bs_demo" "oc_lwm2m_demo" "oc_lwm2m_ota_demo" "stimer_demo"

CONFIG_DEMO_ENABLE := y
CONFIG_DEMO_TYPE := "oc_coap_demo"
CONFIG_DEMO_TYPE := ""

#########################STANDARD DEMO END######################################
include $(TOP_DIR)/iot_link/iot.mk
Expand Down
3 changes: 2 additions & 1 deletion targets/GD32F303_BearPi/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static int link_test()

int main(void)
{
UINT32 uwRet = LOS_OK;
UINT32 uwRet;

HardWare_Init();

Expand All @@ -126,4 +126,5 @@ int main(void)

LOS_Start();

return uwRet;
}
1 change: 1 addition & 0 deletions targets/GD32F303_BearPi/uart_at/uart_at.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "gd32f30x.h"
#include "BearPi-IoT_gd32f303.h"
#include <string.h>
#include <stdint.h>
#include <stddef.h>
#include <osal.h>
Expand Down

0 comments on commit 4edaa83

Please sign in to comment.