From f8c731241d279f054683d612312170de74f870e8 Mon Sep 17 00:00:00 2001 From: pvvx Date: Thu, 11 May 2017 21:21:23 +0300 Subject: [PATCH] update --- project/inc/lwipopts.h | 4 ++++ project/inc/platform_autoconf.h | 3 +++ project/inc/user_config.h | 2 ++ project/src/web/web_int_callbacks.c | 17 ++++++++++------- project/src/web/web_websocket.c | 1 + sdkset.mk | 9 +++++++-- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/project/inc/lwipopts.h b/project/inc/lwipopts.h index 54c7783..d6a6b53 100644 --- a/project/inc/lwipopts.h +++ b/project/inc/lwipopts.h @@ -163,6 +163,10 @@ a lot of data that needs to be copied, this should be set high. */ /* ---------- ARP options ----------- */ #define LWIP_ARP 1 +/** + * LWIP_AUTOIP==1: Enable AUTOIP module. + */ +#define LWIP_AUTOIP 0 //Realtek modified (0->1) /* ---------- DHCP options ---------- */ /* Define LWIP_DHCP to 1 if you want DHCP configuration of diff --git a/project/inc/platform_autoconf.h b/project/inc/platform_autoconf.h index 7377ec5..cb64cae 100644 --- a/project/inc/platform_autoconf.h +++ b/project/inc/platform_autoconf.h @@ -12,6 +12,9 @@ /* * Target Platform Selection */ +#define CONFIG_USE_TCM_HEAP 1 +#define configUSE_STACK_TCM_HEAP 5 // min priority use tcm ? + #define CONFIG_WITHOUT_MONITOR 1 #undef CONFIG_RTL8195A diff --git a/project/inc/user_config.h b/project/inc/user_config.h index 2560380..d3587ce 100644 --- a/project/inc/user_config.h +++ b/project/inc/user_config.h @@ -11,6 +11,8 @@ #define WEB_DEBUG_FUNCTIONS 1 // =1 - включить в WEB отладочные функции, =0 отключить (остается только конфигурация WiFi) +#define WEB_INA219_DRV 1 + #endif // _user_config_h_ diff --git a/project/src/web/web_int_callbacks.c b/project/src/web/web_int_callbacks.c index e91f55f..4ce4f51 100644 --- a/project/src/web/web_int_callbacks.c +++ b/project/src/web/web_int_callbacks.c @@ -405,13 +405,6 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr) else ifcmp("clkcpu") tcp_puts("%u", HalGetCpuClk()); else ifcmp("debug") tcp_put('1' - (print_off & 1)); // rtl_print on/off #if WEB_DEBUG_FUNCTIONS -#if 1 // WEB_INA219_DRV - else ifcmp("ina219") { - if(CheckSCB(SCB_WEBSOC)) { - ina219_ws(val); - } - } -#endif else ifcmp("restart") { #if USE_WEB_AUTH_LEVEL if(web_conn->auth_level < WEB_AUTH_LEVEL_USER) return; @@ -433,6 +426,16 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr) #endif else tcp_put('?'); } +#ifdef WEB_INA219_DRV + else ifcmp("ina219") { + if(CheckSCB(SCB_WEBSOC)) { +extern int ina219_ws(TCP_SERV_CONN *ts_conn, char cmd); + int x = ina219_ws(ts_conn, cstr[6]); + if(x < 0) SetSCB(SCB_FCLOSE|SCB_DISCONNECT); + else tcp_puts("%d", x); + } + } +#endif else ifcmp("cfg_") { cstr += 4; ifcmp("web_") { diff --git a/project/src/web/web_websocket.c b/project/src/web/web_websocket.c index 78296bb..a749b8f 100644 --- a/project/src/web/web_websocket.c +++ b/project/src/web/web_websocket.c @@ -155,6 +155,7 @@ websock_rx_data(TCP_SERV_CONN *ts_conn) SetSCB(SCB_FCLOSE|SCB_DISCONNECT); return false; } + web_conn->msgbufsize -= 16; if(ws->frame_len == (sizeof(txt_wsping)-1) && rom_xstrcmp(pstr, txt_wsping) != 0){ copy_s4d1(pstr, (void *)txt_wspong, sizeof(txt_wspong) - 1); if(websock_tx_frame(ts_conn, WS_OPCODE_TEXT | WS_FRAGMENT_FIN, pstr, sizeof(txt_wspong) - 1) != ERR_OK) { diff --git a/sdkset.mk b/sdkset.mk index 444932c..7c7433f 100644 --- a/sdkset.mk +++ b/sdkset.mk @@ -1,3 +1,5 @@ +WEB_INA219_DRV = 1 + #USE_AT = 1 #USE_FATFS = 1 #USE_SDIOH = 1 @@ -436,8 +438,11 @@ ADD_SRC_C += project/src/console/wifi_console.c #ADD_SRC_C += project/src/console/pwm_tst.c #ADD_SRC_C += project/src/console/wlan_tst.c #ADD_SRC_C += project/src/ina219/ina219drv.c -##ADD_SRC_C += project/src/driver/i2c_drv.c -##ADD_SRC_C += project/src/ina219/ina219drv.c +ifdef WEB_INA219_DRV +ADD_SRC_C += project/src/driver/i2c_drv.c +ADD_SRC_C += project/src/ina219/ina219drv.c +CFLAGS += -DWEB_INA219_DRV=1 +endif #Web-свалка INCLUDES += project/inc/web