Commit 2fdaa9b1 authored by dnc40085's avatar dnc40085 Committed by Marcel Stör
Browse files

Moved call to set default wifi hostname (#1317)

Moved call from `luaopen_wifi (wifi.c)` to `user_rf_pre_init
(user_main.c)`
Note: This change adds ~440 us to boot time
parent 37411da0
......@@ -1309,7 +1309,7 @@ static const LUA_REG_TYPE wifi_map[] = {
{ LNILKEY, LNILVAL }
};
static void wifi_change_default_host_name(task_param_t param, uint8 priority)
void wifi_change_default_host_name(void)
{
#ifndef WIFI_STA_HOSTNAME
char temp[32];
......@@ -1344,7 +1344,6 @@ static void wifi_change_default_host_name(task_param_t param, uint8 priority)
int luaopen_wifi( lua_State *L )
{
task_post_low(task_get_id(wifi_change_default_host_name), FALSE);
#if defined(WIFI_SDK_EVENT_MONITOR_ENABLE)
wifi_eventmon_init();
#endif
......
......@@ -35,6 +35,8 @@ static inline void unregister_lua_cb(lua_State* L, int* cb_ref)
}
}
void wifi_change_default_host_name(void);
#ifdef NODE_DEBUG
#define EVENT_DBG(...) c_printf(__VA_ARGS__)
#else
......
......@@ -117,6 +117,16 @@ void nodemcu_init(void)
task_post_low(task_get_id(start_lua),'s');
}
#ifdef LUA_USE_MODULES_WIFI
#include "../modules/wifi_common.h"
void user_rf_pre_init(void)
{
//set WiFi hostname before RF initialization (adds ~440 us to boot time)
wifi_change_default_host_name();
}
#endif
/******************************************************************************
* FunctionName : user_init
* Description : entry of user application, init user function here
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment