fix a bug in tcp_through_module example

This commit is contained in:
mculover666
2020-08-11 19:16:06 +08:00
parent e32fb2f04e
commit 5656dca3ad
3 changed files with 45 additions and 22 deletions

View File

@@ -2,18 +2,27 @@
#include "sal_module_wrapper.h"
#include "cmsis_os.h"
//#define USE_ESP8266
#define USE_SIM800A
#define USE_BC26
#define USE_ESP8266
//#define USE_SIM800A
//#define USE_BC26
//#define USE_EC20
#if defined(USE_ESP8266)
#ifdef USE_ESP8266
#include "esp8266.h"
#elif defined(USE_SIM800A)
#endif
#ifdef USE_SIM800A
#include "sim800a.h"
#elif defined(USE_BC26)
#endif
#ifdef USE_BC26
#include "bc26.h"
#endif
#ifdef USE_EC20
#include "ec20.h"
#endif
#define TCP_TEST_TASK0_STK_SIZE 4096
void tcp_test0(void);
osThreadDef(tcp_test0, osPriorityNormal, 1, TCP_TEST_TASK0_STK_SIZE);
@@ -74,21 +83,19 @@ void tcp_test1(void)
void application_entry(void *arg)
{
#ifdef USE_ESP8266
#if defined(USE_ESP8266)
esp8266_sal_init(HAL_UART_PORT_0);
esp8266_join_ap("SheldonDai", "srnr6x9xbhmb0");
#endif
#ifdef USE_SIM800A
#elif defined(USE_SIM800A)
sim800a_power_on();
sim800a_sal_init(HAL_UART_PORT_2);
#elif defined(USE_BC26)
bc26_sal_init(HAL_UART_PORT_2);
#elif defined(USE_EC20)
ec20_sal_deinit(HAL_PORT_0);
#endif
#ifdef USE_BC26
bc26_sal_init(HAL_UART_PORT_2);
#endif
socket_id_0 = tos_sal_module_connect("117.50.111.72", "8080", TOS_SAL_PROTO_TCP);
socket_id_0 = tos_sal_module_connect("117.50.111.72", "8080", TOS_SAL_PROTO_TCP);
if (socket_id_0 == -1) {
printf("TCP0 connect failed\r\n");
} else {