/****************************************************************************** * FunctionName : user_init * Description : entry of user application, init user function here * Parameters : none * Returns : none *******************************************************************************/ void ICACHE_FLASH_ATTR user_init(void) { sys_read_cfg(); if(!syscfg.cfg.b.debug_print_enable) system_set_os_print(0); uart_init(); #if USE_TMP2NET_PORT GPIO0_MUX = 0; #else GPIO0_MUX = VAL_MUX_GPIO0_SDK_DEF; #endif GPIO4_MUX = VAL_MUX_GPIO4_SDK_DEF; GPIO5_MUX = VAL_MUX_GPIO5_SDK_DEF; GPIO12_MUX = VAL_MUX_GPIO12_SDK_DEF; GPIO14_MUX = VAL_MUX_GPIO14_SDK_DEF; system_timer_reinit(); #if DEBUGSOO > 0 os_printf("\nSimple WEB version: " WEB_SVERSION "\nOpenLoaderSDK v1.2\n"); #endif if(syscfg.cfg.b.pin_clear_cfg_enable) test_pin_clr_wifi_config(); set_cpu_clk(); // select cpu frequency 80 or 160 MHz #if DEBUGSOO > 0 if(eraminfo.size > 0) os_printf("Found free IRAM: base: %p, size: %d bytes\n", eraminfo.base, eraminfo.size); os_printf("System memory:\n"); system_print_meminfo(); os_printf("Start 'heap' size: %d bytes\n", system_get_free_heap_size()); #endif #if DEBUGSOO > 0 os_printf("Set CPU CLK: %u MHz\n", ets_get_cpu_frequency()); #endif Setup_WiFi(); #if USE_TMP2NET_PORT tpm2net_init(); #endif #ifdef USE_NETBIOS if(syscfg.cfg.b.netbios_ena) netbios_init(); #endif /* #ifdef USE_SNTP if(syscfg.cfg.b.sntp_ena) sntp_init(); #endif */ #ifdef UDP_TEST_PORT if(syscfg.udp_port) udp_test_port_init(syscfg.udp_port); #endif // инициализация и запуск tcp серверa(ов) #ifdef USE_SRV_WEB_PORT if(syscfg.web_port) webserver_init(syscfg.web_port); #endif /// if(syscfg.tcp2uart_port) tcp2uart_init(syscfg.tcp2uart_port); #ifdef USE_MODBUS mdb_tcp_init(502); #endif #ifdef USE_WDRV init_wdrv(); #endif system_deep_sleep_set_option(0); system_init_done_cb(init_done_cb); }
/****************************************************************************** * FunctionName : user_init * Description : entry of user application, init user function here * Parameters : none * Returns : none *******************************************************************************/ void ICACHE_FLASH_ATTR user_init(void) { sys_read_cfg(); if(!syscfg.cfg.b.debug_print_enable) system_set_os_print(0); GPIO0_MUX = VAL_MUX_GPIO0_SDK_DEF; GPIO4_MUX = VAL_MUX_GPIO4_SDK_DEF; GPIO5_MUX = VAL_MUX_GPIO5_SDK_DEF; GPIO12_MUX = VAL_MUX_GPIO12_SDK_DEF; GPIO13_MUX = VAL_MUX_GPIO13_SDK_DEF; GPIO14_MUX = VAL_MUX_GPIO14_SDK_DEF; GPIO15_MUX = VAL_MUX_GPIO15_SDK_DEF; // vad7 //power_meter_init(); // //uart_init(); // in tcp2uart.h system_timer_reinit(); #if (DEBUGSOO > 0 && defined(USE_WEB)) os_printf("\nSimple WEB version: " WEB_SVERSION "\n"); #endif //if(syscfg.cfg.b.pin_clear_cfg_enable) test_pin_clr_wifi_config(); // сброс настроек, если замкнут пин RX set_cpu_clk(); // select cpu frequency 80 or 160 MHz #ifdef USE_GDBSTUB extern void gdbstub_init(void); gdbstub_init(); #endif #if DEBUGSOO > 0 if(eraminfo.size > 0) os_printf("Found free IRAM: base: %p, size: %d bytes\n", eraminfo.base, eraminfo.size); os_printf("System memory:\n"); system_print_meminfo(); os_printf("bssi : 0x%x ~ 0x%x, len: %d\n", &_lit4_start, &_lit4_end, (uint32)(&_lit4_end) - (uint32)(&_lit4_start)); os_printf("free : 0x%x ~ 0x%x, len: %d\n", (uint32)(&_lit4_end), (uint32)(eraminfo.base) + eraminfo.size, (uint32)(eraminfo.base) + eraminfo.size - (uint32)(&_lit4_end)); os_printf("Start 'heap' size: %d bytes\n", system_get_free_heap_size()); #endif #if DEBUGSOO > 0 os_printf("Set CPU CLK: %u MHz\n", ets_get_cpu_frequency()); #endif Setup_WiFi(); WEBFSInit(); // файловая система system_deep_sleep_set_option(0); system_init_done_cb(init_done_cb); }
/****************************************************************************** * FunctionName : user_init * Description : entry of user application, init user function here * Parameters : none * Returns : none *******************************************************************************/ void ICACHE_FLASH_ATTR user_init(void) { sys_read_cfg(); if(!syscfg.cfg.b.debug_print_enable) system_set_os_print(0); uart_init(); GPIO0_MUX = VAL_MUX_GPIO0_SDK_DEF; GPIO4_MUX = VAL_MUX_GPIO4_SDK_DEF; GPIO5_MUX = VAL_MUX_GPIO5_SDK_DEF; GPIO12_MUX = VAL_MUX_GPIO12_SDK_DEF; GPIO14_MUX = VAL_MUX_GPIO14_SDK_DEF; system_timer_reinit(); #if (DEBUGSOO > 0 && defined(USE_WEB)) os_printf("\nSimple WEB version: " WEB_SVERSION "\nOpenLoaderSDK v1.2\n"); #endif if(syscfg.cfg.b.pin_clear_cfg_enable) test_pin_clr_wifi_config(); set_cpu_clk(); // select cpu frequency 80 or 160 MHz #ifdef USE_GDBSTUB extern void gdbstub_init(void); gdbstub_init(); #endif #if DEBUGSOO > 0 if(eraminfo.size > 0) os_printf("Found free IRAM: base: %p, size: %d bytes\n", eraminfo.base, eraminfo.size); os_printf("System memory:\n"); system_print_meminfo(); os_printf("Start 'heap' size: %d bytes\n", system_get_free_heap_size()); #endif #if DEBUGSOO > 0 os_printf("Set CPU CLK: %u MHz\n", ets_get_cpu_frequency()); #endif Setup_WiFi(); #ifdef USE_WDRV init_wdrv(); #endif Set_WiFi(&wificonfig, Cmp_WiFi_chg(&wificonfig) & (WIFI_MASK_SLEEP|WIFI_MASK_STDHCP|WIFI_MASK_APIPDHCP)); WEBFSInit(); // файловая система system_deep_sleep_set_option(0); system_init_done_cb(init_done_cb); }