diff --git a/ExampleHTM/dygraph/dygraph.css b/ExampleHTM/dygraph/dygraph.css index 75d5868..ff368d5 100644 --- a/ExampleHTM/dygraph/dygraph.css +++ b/ExampleHTM/dygraph/dygraph.css @@ -4,7 +4,7 @@ .dygraph-legend { position: absolute; - font-size: 14px; + font-size: 12px; z-index: 10; width: 250px; /* labelsDivWidth */ /* @@ -66,7 +66,7 @@ .dygraph-axis-label { /* position: absolute; */ - /* font-size: 14px; */ + font-size: 12px; z-index: 10; line-height: normal; overflow: hidden; diff --git a/ExampleHTM/dygraph/dygraph.js b/ExampleHTM/dygraph/dygraph.js index 4790b3f..1ca7ea0 100644 --- a/ExampleHTM/dygraph/dygraph.js +++ b/ExampleHTM/dygraph/dygraph.js @@ -10,83 +10,35 @@ var process = module.exports = {}; var cachedSetTimeout; var cachedClearTimeout; -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} (function () { try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } + cachedSetTimeout = setTimeout; } catch (e) { - cachedSetTimeout = defaultSetTimout; + cachedSetTimeout = function () { + throw new Error('setTimeout is not defined'); + } } try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } + cachedClearTimeout = clearTimeout; } catch (e) { - cachedClearTimeout = defaultClearTimeout; + cachedClearTimeout = function () { + throw new Error('clearTimeout is not defined'); + } } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations return setTimeout(fun, 0); + } else { + return cachedSetTimeout.call(null, fun, 0); } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); + clearTimeout(marker); + } else { + cachedClearTimeout.call(null, marker); } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - } var queue = []; var draining = false; diff --git a/ExampleHTM/dygraph/ws_test_ina219.html b/ExampleHTM/dygraph/ws_test_ina219.html index 69ecdd3..021f89f 100644 --- a/ExampleHTM/dygraph/ws_test_ina219.html +++ b/ExampleHTM/dygraph/ws_test_ina219.html @@ -26,7 +26,7 @@ var gu = new Dygraph( series : { 'U': { axis: 'y2' } } - , axes: { y2: {valueRange: [3000, 3500] }} +// , axes: { y2: {valueRange: [3000, 3500] }} // , axes: { y2: {valueRange: [3000, 3500] }, y: {valueRange: [0, 2] }} }); @@ -35,6 +35,7 @@ var rdnextflg = false; var cur_idx = 0; var sig = 10; var ttout = 100; +var wstt; function wsping() { ws.send('ina219'); wstt = setTimeout(wsping, ttout);}; ws = new WebSocket('ws://rtl871x0/web.cgi'); ws.binaryType = 'arraybuffer'; diff --git a/ExampleHTM/dygraph/ws_test_ina219d.html b/ExampleHTM/dygraph/ws_test_ina219d.html index e34f4f5..6e6e7f4 100644 --- a/ExampleHTM/dygraph/ws_test_ina219d.html +++ b/ExampleHTM/dygraph/ws_test_ina219d.html @@ -1,40 +1,55 @@ - + Get data INA219 - - + -

U & I (INA219)

-
- diff --git a/USDK/component/common/api/wifi/wifi_conf.c b/USDK/component/common/api/wifi/wifi_conf.c index a2a94b3..998e932 100644 --- a/USDK/component/common/api/wifi/wifi_conf.c +++ b/USDK/component/common/api/wifi/wifi_conf.c @@ -30,6 +30,7 @@ extern int inic_stop(void); #if CONFIG_DEBUG_LOG > 0 #undef printf +extern int rtl_printf(const char *fmt, ...); #define printf(...) rtl_printf(__VA_ARGS__) #else #undef printf @@ -832,13 +833,13 @@ int wifi_on(rtw_mode_t mode) { wifi_set_mib(); printf("Initializing WIFI ...\n"); for (idx = 0; idx < devnum; idx++) { - ret = rltk_wlan_init(idx, mode); + ret = rltk_wlan_init(idx, mode); // 56 if (ret < 0) return ret; } - for (idx = 0; idx < devnum; idx++) + for (idx = 0; idx < devnum; idx++) { rltk_wlan_start(idx); - + } while (1) { if (rltk_wlan_running(devnum - 1)) { printf("WIFI initialized\n"); diff --git a/USDK/component/common/api/wifi_interactive_mode.c b/USDK/component/common/api/wifi_interactive_mode.c index a0d0436..5bbf64c 100644 --- a/USDK/component/common/api/wifi_interactive_mode.c +++ b/USDK/component/common/api/wifi_interactive_mode.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -382,7 +383,7 @@ static void cmd_wifi_connect(int argc, char **argv) char *ssid; rtw_security_t security_type; char *password; - int ssid_len; +// int ssid_len; int password_len; int key_id; void *semaphore; @@ -411,21 +412,21 @@ static void cmd_wifi_connect(int argc, char **argv) if(argc == 2){ security_type = RTW_SECURITY_OPEN; password = NULL; - ssid_len = strlen((const char *)argv[1]); +// ssid_len = strlen((const char *)argv[1]); password_len = 0; key_id = 0; semaphore = NULL; }else if(argc ==3){ security_type = RTW_SECURITY_WPA2_AES_PSK; password = argv[2]; - ssid_len = strlen((const char *)argv[1]); +// ssid_len = strlen((const char *)argv[1]); password_len = strlen((const char *)argv[2]); key_id = 0; semaphore = NULL; }else{ security_type = RTW_SECURITY_WEP_PSK; password = argv[2]; - ssid_len = strlen((const char *)argv[1]); +// ssid_len = strlen((const char *)argv[1]); password_len = strlen((const char *)argv[2]); key_id = atoi(argv[3]); if(( password_len != 5) && (password_len != 13)) { diff --git a/USDK/component/common/mbed/common/wait_api.c b/USDK/component/common/mbed/common/wait_api.c index 969f675..faef6ad 100644 --- a/USDK/component/common/mbed/common/wait_api.c +++ b/USDK/component/common/mbed/common/wait_api.c @@ -96,12 +96,14 @@ void wait_ms(int ms) { // До 1073741 секунд? 298 часов void wait_us(int us) { // До 2.147483648 секунды! uint32_t start; #ifdef WAIT_US_USE_CYCCNT - if(us < 1) return; - if (us < 327) { // G-timer resolution is ~31 us (1/32K), use DWT->CYCCNT... + if((uint32_t)us < 1) return; + if ((uint32_t)us < 327) { // G-timer resolution is ~31 us (1/32K), use DWT->CYCCNT... if(!(DWT->CTRL & DWT_CTRL_CYCCNTENA_Msk)) { // уже включен? +// taskENTER_CRITICAL(); CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; // открыть доступ DWT->CYCCNT = 0; // обнулить и запустить DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk; // запустить счет +// taskEXIT_CRITICAL(); } start = DWT->CYCCNT + us * (PLATFORM_CLOCK / 1000000ul); while ((int32_t)(start - DWT->CYCCNT) > 0); diff --git a/USDK/component/common/mbed/targets/hal/rtl8195a/us_ticker.c b/USDK/component/common/mbed/targets/hal/rtl8195a/us_ticker.c index 985ad74..535e73d 100644 --- a/USDK/component/common/mbed/targets/hal/rtl8195a/us_ticker.c +++ b/USDK/component/common/mbed/targets/hal/rtl8195a/us_ticker.c @@ -28,7 +28,6 @@ void us_ticker_init(void) { if (us_ticker_inited) return; - us_ticker_inited = 1; // Initial a G-Timer Timer6Adapter.IrqDis = 1; // Disable Irq @@ -44,6 +43,7 @@ void us_ticker_init(void) HalTimerOp.HalTimerInit((VOID*) &Timer6Adapter); DBG_TIMER_INFO("%s: Timer_Id=%d\n", __FUNCTION__, APP_TIM_ID); + us_ticker_inited = 1; } #if (!TICK_READ_FROM_CPU) || !defined(PLATFORM_FREERTOS) @@ -56,9 +56,9 @@ uint32_t us_ticker_read() uint64_t us_tick; //1 Our G-timer resolution is ~31 us (1/32K), and is a countdown timer -// if (!us_ticker_inited) { -// us_ticker_init(); -// } + if (!us_ticker_inited) { + us_ticker_init(); + } tick_cnt = HalTimerOp.HalTimerReadCount(SYS_TIM_ID); tick_cnt = 0xffffffff - tick_cnt; // it's a down counter ticks_125ms = tick_cnt/(GTIMER_CLK_HZ/8); diff --git a/USDK/component/soc/realtek/8195a/fwlib/hal_misc.h b/USDK/component/soc/realtek/8195a/fwlib/hal_misc.h index cb64311..5107b85 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/hal_misc.h +++ b/USDK/component/soc/realtek/8195a/fwlib/hal_misc.h @@ -29,6 +29,7 @@ enum _HAL_RESET_REASON{ typedef u32 HAL_RESET_REASON; #ifdef CONFIG_TIMER_MODULE +/* Min Step 31 us ! */ extern _LONG_CALL_ unsigned int HalDelayUs(unsigned int us); #endif diff --git a/USDK/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c b/USDK/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c index d13c2ea..0caefa0 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c +++ b/USDK/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c @@ -291,7 +291,7 @@ LOCAL uint8 INFRA_START_SECTION _Get_ChipId() { LOCAL void INFRA_START_SECTION sdr_preinit(void) { HAL_SYS_CTRL_WRITE32(REG_SYS_REGU_CTRL0, - ((HAL_SYS_CTRL_READ32(REG_SYS_REGU_CTRL0) & 0xfffff) | BIT_SYS_REGU_LDO25M_ADJ(0x03))); // ROM: BIT_SYS_REGU_LDO25M_ADJ(0x0e)? HAL RAM BIT_SYS_REGU_LDO25M_ADJ(0x03) + ((HAL_SYS_CTRL_READ32(REG_SYS_REGU_CTRL0) & 0xfffff) | BIT_SYS_REGU_LDO25M_ADJ(0x03))); // ROM: BIT_SYS_REGU_LDO25M_ADJ(0x0e)? HAL RAM BIT_SYS_REGU_LDO25M_ADJ(0x03) L25EOUTVOLTAGE ? LDO25M_CTRL(ON); SRAM_MUX_CFG(0x2); SDR_CLK_SEL(SDR_CLOCK_SEL_VALUE); // REG_PESOC_CLK_SEL diff --git a/USDK/component/soc/realtek/8195a/fwlib/ram_lib/startup.c b/USDK/component/soc/realtek/8195a/fwlib/ram_lib/startup.c index 13621a3..ae0f164 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/ram_lib/startup.c +++ b/USDK/component/soc/realtek/8195a/fwlib/ram_lib/startup.c @@ -203,12 +203,12 @@ extern HAL_GPIO_ADAPTER gBoot_Gpio_Adapter; HalReInitPlatformTimer(); // HalInitPlatformTimerV02(); HalTimerOpInit_Patch((VOID*) (&HalTimerOp)); SystemCoreClockUpdate(); En32KCalibration(); - //---- Spic // _memset(SpicInitParaAllClk, 0, sizeof(SpicInitParaAllClk)); *(uint32 *)(&SpicInitParaAllClk[0][0].BaudRate) = 0x01310202; // patch *(uint32 *)(&SpicInitParaAllClk[1][0].BaudRate) = 0x11311301; // patch // *(uint32 *)(&SpicInitParaAllClk[2][0].BaudRate) = 0x21311301; // patch +#ifdef CONFIG_SDR_EN SPI_FLASH_PIN_FCTRL(ON); /* // uint8 SpicBaudRate = CPU_CLK_TYPE_NO - 1 - ((HAL_SYS_CTRL_READ32(REG_SYS_CLK_CTRL1) >> 4) & 7); @@ -224,7 +224,6 @@ extern HAL_GPIO_ADAPTER gBoot_Gpio_Adapter; }; */ // SpicFlashInitRtl8195A(SpicDualBitMode); // SpicReadIDRtl8195A(); SpicDualBitMode -#ifdef CONFIG_SDR_EN //---- SDRAM uint8 ChipId = HalGetChipId(); if (ChipId >= CHIP_ID_8195AM) { @@ -253,9 +252,9 @@ extern HAL_GPIO_ADAPTER gBoot_Gpio_Adapter; HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM Init or None #else HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) & (~BIT(21))); // Flag SDRAM Not Init -#endif // CONFIG_SDR_EN //----- Close Flash SPI_FLASH_PIN_FCTRL(OFF); +#endif // CONFIG_SDR_EN InitSoCPM(); VectorTableInitForOSRtl8195A(&vPortSVCHandler, &xPortPendSVHandler, diff --git a/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c b/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c index 3c50b36..2fd1d2f 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c +++ b/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c @@ -712,7 +712,8 @@ VOID HalSsiSetSclkRtl8195a(VOID *Adapter, u32 ClkRate) } ClockDivider &= 0xFFFE; // bit 0 always is 0 } - DBG_SSI_INFO("spi_frequency: Set SCLK Freq=%d\r\n", (ssi_clk/ClockDivider)); +// DBG_SSI_INFO("spi_frequency: Set SCLK Freq=%d\r\n", (ssi_clk/ClockDivider)); + DiagPrintf("spi_frequency: Set SCLK Freq=%d\r\n", (ssi_clk/ClockDivider)); pHalSsiAdapter->ClockDivider = ClockDivider; SsiEn = HAL_SSI_READ32(spi_idx, REG_DW_SSI_SSIENR); // Backup SSI_EN register diff --git a/USDK/component/soc/realtek/8195a/fwlib/src/hal_32k.c b/USDK/component/soc/realtek/8195a/fwlib/src/hal_32k.c index 4553915..d28b4ef 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/src/hal_32k.c +++ b/USDK/component/soc/realtek/8195a/fwlib/src/hal_32k.c @@ -67,7 +67,7 @@ En32KCalibration( DiagPrintf("Check lock: %d\n", Ttemp); DiagPrintf("0x278: %x\n", Rtemp); #endif - if (Ttemp > 100000) { /*Delay 100ms*/ + if (Ttemp > 100000/63) { /*Delay 100ms*/ DiagPrintf("32K Calibration Fail!\n", Ttemp); break; } diff --git a/USDK/component/soc/realtek/8195a/misc/bsp/lib/common/GCC/lib_wlan.a b/USDK/component/soc/realtek/8195a/misc/bsp/lib/common/GCC/lib_wlan.a index 6014689..68af0db 100644 Binary files a/USDK/component/soc/realtek/8195a/misc/bsp/lib/common/GCC/lib_wlan.a and b/USDK/component/soc/realtek/8195a/misc/bsp/lib/common/GCC/lib_wlan.a differ diff --git a/USDK/paths.mk b/USDK/paths.mk index 596887c..8f83cba 100644 --- a/USDK/paths.mk +++ b/USDK/paths.mk @@ -6,6 +6,7 @@ SDK_PATH ?= ../SDKRTLA/USDK/ OPENOCD_PATH = d:/MCU/OpenOCD/bin/ TOOLS_PATH ?= $(SDK_PATH)component/soc/realtek/8195a/misc/iar_utility/common/tools/ FLASHER_TYPE ?= Jlink +PYTHON27_PATH ?= c:/Python27/ #FLASHER_TYPE ?= OCD FLASHER_PATH ?= $(SDK_PATH)flasher/ JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/ @@ -38,6 +39,7 @@ endif PICK = $(TOOLS_PATH)pick$(EXE) PADDING = $(TOOLS_PATH)padding$(EXE) CHCKSUM = $(TOOLS_PATH)checksum$(EXE) +PYTHON = $(PYTHON27)python$(EXE) # openocd tools OPENOCD = $(OPENOCD_PATH)openocd diff --git a/WEBFiles/protect2/debug.htm b/WEBFiles/protect2/debug.htm index ddb5de3..5d529df 100644 --- a/WEBFiles/protect2/debug.htm +++ b/WEBFiles/protect2/debug.htm @@ -8,7 +8,7 @@

Debug and Tests

-Chart 'heap', ST-AP RSSI

+Chart 'heap', ST-AP RSSI, INA219

System Restart

Counter erase the last flash sector config: ~sys_rdec0x980FE000~

diff --git a/project.mk b/project.mk index dbb2492..143c511 100644 --- a/project.mk +++ b/project.mk @@ -48,6 +48,8 @@ DRAM_C += project/src/console/atcmd_user.c DRAM_C += project/src/console/wifi_console.c #DRAM_C += project/src/console/wlan_tst.c #ADD_SRC_C += project/src/console/pwm_tst.c +ADD_SRC_C += project/src/WS2812/ws2812_tst.c +ADD_SRC_C += project/src/WS2812/WS2812.c ifdef USE_SDCARD ADD_SRC_C += project/src/console/sd_fat.c @@ -81,10 +83,16 @@ endif INCLUDES += project/inc/web ADD_SRC_C += project/src/tcpsrv/tcp_srv_conn.c ADD_SRC_C += project/src/webfs/webfs.c + +ifdef COMPILE_SCI ADD_SRC_C += project/src/web/web_srv.c ADD_SRC_C += project/src/web/web_utils.c ADD_SRC_C += project/src/web/web_websocket.c ADD_SRC_C += project/src/web/websock.c +ADD_SRC_C += project/src/web/web_auth.c ADD_SRC_C += project/src/web/web_int_callbacks.c ADD_SRC_C += project/src/web/web_int_vars.c -ADD_SRC_C += project/src/web/web_auth.c +else +ADD_SRC_C += project/src/web/_sci_web.c +ADD_SRC_C += project/src/web/_sci_web_user.c +endif diff --git a/project/inc/tcpsrv/tcp_srv_conn.h b/project/inc/tcpsrv/tcp_srv_conn.h index c2126da..b0ba5eb 100644 --- a/project/inc/tcpsrv/tcp_srv_conn.h +++ b/project/inc/tcpsrv/tcp_srv_conn.h @@ -12,11 +12,6 @@ #include "lwip/err.h" -#undef mMIN -#define mMIN(a, b) ((a < b)? a : b) -#define mMAX(a, b) ((a>b)?a:b) - - enum srvconn_state { SRVCONN_NONE =0, SRVCONN_CLOSEWAIT, // ожидает закрытия @@ -35,9 +30,11 @@ enum srvconn_state { #define MAX_TIME_WAIT_PCB 10 #endif +#define _mMIN(a, b) ((a < b)? a : b) + // кол-во одновременно открытых соединений по умолчанию #ifndef TCP_SRV_MAX_CONNECTIONS - #define TCP_SRV_MAX_CONNECTIONS mMIN(MEMP_NUM_TCP_PCB, 10) + #define TCP_SRV_MAX_CONNECTIONS _mMIN(MEMP_NUM_TCP_PCB, 10) #endif // порт сервера по умолчанию diff --git a/project/src/console/atcmd_user.c b/project/src/console/atcmd_user.c index 1613fd6..d743a9d 100644 --- a/project/src/console/atcmd_user.c +++ b/project/src/console/atcmd_user.c @@ -320,6 +320,9 @@ LOCAL void fATDS(int argc, char *argv[]) uint32 sleep_ms = 10000; if(argc > 1) sleep_ms = atoi(argv[1]); #if 0 // WakeUp PB_1 +#include "gpio_api.h" + extern void HalInitLogUart(void); + extern void HalDeinitLogUart(void); if(argc > 2) { printf("%u ms waiting low level on PB_1 before launching Deep-Sleep...\n", sleep_ms); // turn off log uart diff --git a/project/src/ina219/ina219drv.c b/project/src/ina219/ina219drv.c index cfffa8d..bc56766 100644 --- a/project/src/ina219/ina219drv.c +++ b/project/src/ina219/ina219drv.c @@ -26,6 +26,11 @@ #include "hal_com_reg.h" +#undef mMIN +#define mMIN(a, b) ((a < b)? a : b) +#undef mMAX +#define mMAX(a, b) ((a > b)? a : b) + //#define ReadTSF_Lo32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR))) //#define ReadTSF_Hi32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR1))) @@ -44,7 +49,7 @@ INA219DRV ina219drv = { .i2c.status = DRV_I2C_OFF, .i2c.idx = 1, // I2C1 .i2c.io_sel = S0, // PC_4, PC_5 - .i2c.mode = DRV_I2C_FS_MODE // DRV_I2C_HS_MODE + .i2c.mode = DRV_I2C_FS_MODE // DRV_I2C_FS_MODE }; /* void ina219_write(unsigned char reg, unsigned short data) @@ -186,9 +191,6 @@ size_t ina219_getdata(void *pd, uint16 cnt) return cnt * sizeof(INA219DATA) + 4; } -//#define mMIN(a, b) ((ab)?a:b) - #include "web_srv.h" #include "websock.h" diff --git a/project/src/user/user_start.c b/project/src/user/user_start.c index df5fa5f..cd72d72 100644 --- a/project/src/user/user_start.c +++ b/project/src/user/user_start.c @@ -62,6 +62,9 @@ extern void console_init(void); void user_init_thrd(void) { + + /* Read system config*/ + if(syscfg.cfg.b.pin_clear_cfg_enable && 0) { // user_test_clear_pin() wifi_cfg.load_flg = 0; diff --git a/project/src/web/web_auth.c b/project/src/web/web_auth.c index b5f233b..29f67eb 100644 --- a/project/src/web/web_auth.c +++ b/project/src/web/web_auth.c @@ -4,7 +4,9 @@ * Created on: 23/04/2017. * Author: pvvx */ +#ifndef COMPILE_SCI // Use Single Compilation Unit "web" #include "autoconf.h" +#ifdef USE_WEB #include "FreeRTOS.h" #include "diag.h" #include "web_utils.h" @@ -12,8 +14,10 @@ #include "web_srv.h" #include "rtl8195a/rtl_libc.h" #include "esp_comp.h" +#endif // USE_WEB +#endif // COMPILE_SCI - +#ifdef USE_WEB /* ---------------------------------------------------------------------------------- * pbuf[77] = Username and password are combined into a string "username:password" * Return: Authorization Level @@ -46,3 +50,4 @@ uint8 UserAuthorization(uint8 *pbuf, size_t declen) } return 0; } +#endif // USE_WEB \ No newline at end of file diff --git a/project/src/web/web_int_callbacks.c b/project/src/web/web_int_callbacks.c index 7ca3fe7..6fb2a77 100644 --- a/project/src/web/web_int_callbacks.c +++ b/project/src/web/web_int_callbacks.c @@ -3,6 +3,7 @@ * Description: The web server inernal callbacks. *******************************************************************************/ +#ifndef COMPILE_SCI // Use Single Compilation Unit "web" #include "user_config.h" #ifdef USE_WEB #include "autoconf.h" @@ -53,16 +54,22 @@ #undef atoi #define atoi rom_atoi -//#define mMIN(a, b) ((a b)? a : b) + #define ifcmp(a) if(rom_xstrcmp(cstr, a)) +extern struct netif xnetif[NET_IF_NUM]; /* network interface structure */ + +#endif // USE_WEB +#endif // COMPILE_SCI + +#ifdef USE_WEB #define OpenFlash() { device_mutex_lock(RT_DEV_LOCK_FLASH); flash_turnon(); } #define CloseFlash() { SpicDisableRtl8195A(); device_mutex_unlock(RT_DEV_LOCK_FLASH); } - -extern struct netif xnetif[NET_IF_NUM]; /* network interface structure */ - - #if WEB_DEBUG_FUNCTIONS //#define TEST_SEND_WAVE #endif // #if WEB_DEBUG_FUNCTIONS diff --git a/project/src/web/web_int_vars.c b/project/src/web/web_int_vars.c index f92a9c1..d4c0cdd 100644 --- a/project/src/web/web_int_vars.c +++ b/project/src/web/web_int_vars.c @@ -2,7 +2,7 @@ * FileName: webserver.c * Description: The web server mode configuration. *******************************************************************************/ - +#ifndef COMPILE_SCI // Use Single Compilation Unit "web" #include "user_config.h" #ifdef USE_WEB #include "autoconf.h" @@ -23,6 +23,7 @@ #include "rtl8195a/rtl_libc.h" #include "user/sys_cfg.h" #include "wifi_api.h" +#include "sleep_ex_api.h" #include "sys_api.h" #include "esp_comp.h" @@ -67,6 +68,11 @@ extern int rom_atoi(const char *); #undef atoi #define atoi rom_atoi +#endif // USE_WEB +#endif // COMPILE_SCI + +#ifdef USE_WEB + typedef uint32 (* call_func)(uint32 a, uint32 b, uint32 c); extern QueueHandle_t xQueueWebSrv; diff --git a/project/src/web/web_srv.c b/project/src/web/web_srv.c index 337ac9a..42cf50d 100644 --- a/project/src/web/web_srv.c +++ b/project/src/web/web_srv.c @@ -6,6 +6,7 @@ * ver1.1 02/04/2015 SDK 1.0.0 * ver2.0 14/14/2017 RTL871x *******************************************************************************/ +#ifndef COMPILE_SCI // Use Single Compilation Unit "web" #include "user_config.h" #ifdef USE_WEB #include "autoconf.h" @@ -36,17 +37,23 @@ #include "overlay.h" #endif +//#define mMIN(a, b) ((ab)?a:b) +extern int rom_atoi(const char *); +#undef atoi +#define atoi(s) rom_atoi(s) + +#endif // USE_WEB +#endif // COMPILE_SCI + +#ifdef USE_WEB + #define USE_WEB_NAGLE // https://en.wikipedia.org/wiki/Nagle%27s_algorithm #define MIN_REQ_LEN 7 // Minimum length for a valid HTTP/0.9 request: "GET /\r\n" -> 7 bytes #define CRLF "\r\n" #define max_len_buf_write_flash 2048 // размер буфера при записи flash. Увеличение/уменньшение размера (до сектора 4096) ускорения не дает (1..2%) -//#define mMIN(a, b) ((ab)?a:b) -#undef atoi -#define atoi(s) rom_atoi(s) - LOCAL void web_print_headers(HTTP_CONN *CurHTTP, TCP_SERV_CONN *ts_conn) ICACHE_FLASH_ATTR ; //LOCAL void webserver_discon(void *arg) ICACHE_FLASH_ATTR; diff --git a/project/src/web/web_utils.c b/project/src/web/web_utils.c index a7700f7..5134132 100644 --- a/project/src/web/web_utils.c +++ b/project/src/web/web_utils.c @@ -4,6 +4,7 @@ * Created on: 25 дек. 2014 г. * Author: PV` */ +#ifndef COMPILE_SCI // Use Single Compilation Unit "web" #include "user_config.h" #include "autoconf.h" #include "FreeRTOS.h" @@ -18,7 +19,10 @@ #include "web_utils.h" #include "esp_comp.h" -#define mMIN(a, b) ((ab)?a:b) + +#endif // COMPILE_SCI /****************************************************************************** * xstrcpy() из сегментов flash и IRAM с возвратом размера строки: diff --git a/project/src/web/web_websocket.c b/project/src/web/web_websocket.c index 18ecf22..1014878 100644 --- a/project/src/web/web_websocket.c +++ b/project/src/web/web_websocket.c @@ -4,6 +4,7 @@ * Author: pvvx * 2016 *******************************************************************************/ +#ifndef COMPILE_SCI // Use Single Compilation Unit "web" #include "user_config.h" #ifdef WEBSOCKET_ENA #include "autoconf.h" @@ -21,6 +22,14 @@ #include "rtl8195a/rtl_libc.h" #include "esp_comp.h" + +//#define mMIN(a, b) ((a