Ejemplo n.º 1
0
LOCAL void ICACHE_FLASH_ATTR wifi_check_ip(void *arg) {
	struct ip_info ipConfig;
	uint8_t wifiStatus = STATION_IDLE;

	os_timer_disarm(&wiFiLinker);

	wifi_get_ip_info(STATION_IF, &ipConfig);

	wifiStatus = wifi_station_get_connect_status();

	if (wifiStatus == STATION_GOT_IP && ipConfig.ip.addr != 0) {

		DEBUG("[NETWORK] Connected to network (IP: "IPSTR")\r\n", IP2STR(&ipConfig.ip));

		os_timer_setfn(&wiFiLinker, (os_timer_func_t *) wifi_check_ip, NULL);
		os_timer_arm(&wiFiLinker, 2000, 0);

	} else {

		if (wifi_station_get_connect_status() == STATION_WRONG_PASSWORD) {
			DEBUG("[NETWORK] error: STATION_WRONG_PASSWORD\r\n");
			station_connect();
		} else if (wifi_station_get_connect_status() == STATION_NO_AP_FOUND) {
			DEBUG("[NETWORK] error: STATION_NO_AP_FOUND\r\n");
			station_connect();
		} else if (wifi_station_get_connect_status() == STATION_CONNECT_FAIL) {
			DEBUG("[NETWORK] error: STATION_CONNECT_FAIL\r\n");
			station_connect();
		} else {
			//DEBUG("[NETWORK] error: STATION_IDLE\r\n");
		}

		if(state == USER_STATION_MODE){
			os_timer_setfn(&wiFiLinker, (os_timer_func_t *) wifi_check_ip, NULL);
			os_timer_arm(&wiFiLinker, 500, 0);
		}

	}

	if (wifiStatus != lastWifiStatus) {

		lastWifiStatus = wifiStatus;
		if (wifiCb)
			wifiCb(wifiStatus);

	}
}
Ejemplo n.º 2
0
void ICACHE_FLASH_ATTR otb_ds18b20_initialize(uint8_t bus)
{
  bool rc;
  void *vTask;
  int ii;
  uint32_t timer_int;

  DEBUG("DS18B20: otb_ds18b20_initialize entry");

  DEBUG("DS18B20: Initialize one wire bus on GPIO pin %d", bus);

  otb_ds18b20_init(bus);

  INFO("DS18B20: One Wire bus initialized");
  
  rc = otb_ds18b20_get_devices();

  INFO("DS18B20: DS18B20 device count %u", otb_ds18b20_count);
  if (rc)
  {
    WARN("DS18B20: More than %d DS18B20 devices - only reading from first %d",
         OTB_DS18B20_MAX_DS18B20S,
         OTB_DS18B20_MAX_DS18B20S);
  }

  for (ii = 0; ii < otb_ds18b20_count; ii++)
  {
    // Stagger timer for each temperature sensor
    INFO("DS18B20: Index %d Address %s", ii, otb_ds18b20_addresses[ii].friendly);
    timer_int = OTB_DS18B20_REPORT_INTERVAL * (ii + 1) / otb_ds18b20_count;
    otb_ds18b20_addresses[ii].timer_int = timer_int;
    os_timer_disarm((os_timer_t*)(otb_ds18b20_timer + ii));
    os_timer_setfn((os_timer_t*)(otb_ds18b20_timer + ii), (os_timer_func_t *)otb_ds18b20_callback, otb_ds18b20_addresses + ii);
    if (timer_int != OTB_DS18B20_REPORT_INTERVAL)
    {
      os_timer_arm((os_timer_t*)(otb_ds18b20_timer + ii), timer_int, 0);
    }
    else
    {
      os_timer_arm((os_timer_t*)(otb_ds18b20_timer + ii), timer_int, 1);
    }
  }
  
  DEBUG("DS18B20: otb_ds18b20_initialize entry");
  
  return;
}
Ejemplo n.º 3
0
/******************************************************************************
 * FunctionName : esponn_server_err
 * Description  : The pcb had an error and is already deallocated.
 *                The argument might still be valid (if != NULL).
 * Parameters   : arg -- Additional argument to pass to the callback function
 *                err -- Error code to indicate why the pcb has been closed
 * Returns      : none
*******************************************************************************/
static void ICACHE_FLASH_ATTR
esponn_server_err(void *arg, err_t err)
{
	espconn_msg *pserr_cb = arg;
	struct tcp_pcb *pcb = NULL;
    if (pserr_cb != NULL) {
    	os_timer_disarm(&pserr_cb->pcommon.ptimer);
    	pcb = pserr_cb->pcommon.pcb;
    	pserr_cb->pespconn->state = ESPCONN_CLOSE;

		/*remove the node from the server's active connection list*/
		espconn_list_delete(&plink_active, pserr_cb);

		if (err == ERR_ABRT) {
			switch (pcb->state) {
				case SYN_RCVD:
					if (pcb->nrtx == TCP_SYNMAXRTX) {
						pserr_cb->pcommon.err = ESPCONN_CONN;
					} else {
						pserr_cb->pcommon.err = err;
					}

					break;

				case ESTABLISHED:
					if (pcb->nrtx == TCP_MAXRTX) {
						pserr_cb->pcommon.err = ESPCONN_TIMEOUT;
					} else {
						pserr_cb->pcommon.err = err;
					}

					break;

				case CLOSE_WAIT:
					if (pcb->nrtx == TCP_MAXRTX) {
						pserr_cb->pcommon.err = ESPCONN_CLSD;
					} else {
						pserr_cb->pcommon.err = err;
					}
					break;
				case LAST_ACK:
					pserr_cb->pcommon.err = ESPCONN_CLSD;
					break;

				case CLOSED:
					pserr_cb->pcommon.err = ESPCONN_CONN;
					break;
				default :
					break;
			}
		} else {
			pserr_cb->pcommon.err = err;
		}

		os_timer_setfn(&pserr_cb->pcommon.ptimer,
				(os_timer_func_t *) espconn_tcp_reconnect, pserr_cb);
		os_timer_arm(&pserr_cb->pcommon.ptimer, 10, 0);
    }
}
Ejemplo n.º 4
0
void init(void) {
    gpio_init();
    
    _millis = 0L;
    os_timer_disarm(&millis_timer);
    os_timer_setfn(&millis_timer, (os_timer_func_t *)millis_func, NULL);
    os_timer_arm(&millis_timer, 1, 1);
}
void ICACHE_FLASH_ATTR
light_ShowDevLevel(uint32 mlevel,uint32 delay_ms)
{
    os_timer_disarm(&show_level_delay_t);
	os_timer_setfn(&show_level_delay_t,light_ShowDevLevel_t,mlevel);
	os_timer_arm(&show_level_delay_t,delay_ms,0);

}
Ejemplo n.º 6
0
/*
 * 定时检查是否连接到云端,若未连接到云端则定时器开启,若已连接则关闭
 * 从云端断开时,定时器将重新开启。
 * station 模式使用
 */
void ICACHE_FLASH_ATTR restart_init_station_chk_timer(int interval)
{
	os_printf("启动计时器\n");
    os_timer_disarm(&station_chk_timer);
    os_timer_setfn(&station_chk_timer, station_connect_status_check_timercb, &station_chk_timer);
    os_timer_arm(&station_chk_timer, interval, 1);// 重复,每秒检查一次,若连上后取消,连接断开或其他事件重启此 timer
    os_printf("station checker timer start completed\n");
}
void ICACHE_FLASH_ATTR network_init() 
{
  //uart0_tx_buffer("net init",8);
  
  os_timer_disarm(&network_timer);
  os_timer_setfn(&network_timer, (os_timer_func_t *)network_check_ip, NULL);
  os_timer_arm(&network_timer, 1000, 0);
}
Ejemplo n.º 8
0
void supla_ds18b20_start(void)
{
	supla_ds18b20_last_temp = -275;

	os_timer_disarm(&supla_ds18b20_timer1);
	os_timer_setfn(&supla_ds18b20_timer1, supla_ds18b20_read_temperatureA, NULL);
	os_timer_arm (&supla_ds18b20_timer1, 5000, 1);
}
Ejemplo n.º 9
0
void mg_cb2(struct mg_connection *nc, int ev, void *ev_data) {
  DBG(("%p %d %p", nc, ev, ev_data));
  if (ev == MG_EV_CONNECT) {
    DBG(("got http reply"));
    nc->flags |= MG_F_CLOSE_IMMEDIATELY;
    os_timer_arm(&tmr, 2000, 0);
  }
}
Ejemplo n.º 10
0
void mg_resume() {
  if (!s_suspended) {
    return;
  }

  s_suspended = 0;
  os_timer_arm(&s_poll_tmr, MG_POLL_INTERVAL_MS, 0 /* no repeat */);
}
Ejemplo n.º 11
0
static void ICACHE_FLASH_ATTR test_timer_cb()
{
	int32_t cs = sntp_get_current_timestamp();

	os_printf("Current timestamp: %d\r\n", cs);
	os_printf("Current Time: %s\r\n\r\n", sntp_get_real_time(cs));
	os_timer_arm(&test_timer, 3000, 0);
}
void ICACHE_FLASH_ATTR
wifi_RestartMeshScan(uint32 t)
{
	INFO("RE-SEARCH MESH NETWORK,in %ds \r\n",t/1000);
	os_timer_disarm(&mesh_scan_t);
	os_timer_setfn(&mesh_scan_t,user_MeshStart,NULL);
	os_timer_arm(&mesh_scan_t,t,0);
}
void ICACHE_FLASH_ATTR user_link_led_timer_init(void) {
    link_start_time = system_get_time();
    os_timer_disarm(&link_led_timer);
    os_timer_setfn(&link_led_timer, (os_timer_func_t *)user_link_led_timer_cb, NULL);
    os_timer_arm(&link_led_timer, 50, 1);
    link_led_level = 0;
    GPIO_OUTPUT_SET(GPIO_ID_PIN(SENSOR_LINK_LED_IO_NUM), link_led_level);
}
Ejemplo n.º 14
0
void slave_sendalive() {
	struct ip_addr ipSend;
	os_timer_disarm(&watchdog_slave);
	IP4_ADDR(&ipSend, 255, 255, 255, 255);
	os_printf("Sending out ACK \r\n");
	SendBroadcastSlave("ALIVE", &ipSend, 8000);
	os_timer_arm(&watchdog_slave, 2000, 0);
}
Ejemplo n.º 15
0
void user_init(void)
{
	uart_init(BIT_RATE_230400, BIT_RATE_230400);
	system_set_os_print(1); // enable/disable operating system printout

	os_sprintf(topic_temp, MQTT_TOPICTEMP, system_get_chip_id());
	os_sprintf(topic_hum, MQTT_TOPICHUM, system_get_chip_id());

	PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_GPIO13);


	   ETS_GPIO_INTR_DISABLE(); // Disable gpio interrupts
	   ETS_GPIO_INTR_ATTACH(interrupt_test, 4);
	   PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO4_U, FUNC_GPIO4);
	   gpio_output_set(0, 0, 0, GPIO_ID_PIN(4)); // Set GPIO12 as input
	   GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, BIT(4));
	   gpio_pin_intr_state_set(GPIO_ID_PIN(4), GPIO_PIN_INTR_ANYEDGE);
	   ETS_GPIO_INTR_ENABLE(); // Enable gpio interrupts

	config_load();

	DHTInit(DHT11);

	MQTT_InitConnection(&mqttClient, config.mqtt_host, config.mqtt_port, config.security);
	MQTT_InitClient(&mqttClient, config.device_id, config.mqtt_user, config.mqtt_pass, config.mqtt_keepalive, 1);
	MQTT_InitLWT(&mqttClient, "lwt/", "offline", 0, 0);
	MQTT_OnConnected(&mqttClient, mqtt_connected_cb);
	MQTT_OnDisconnected(&mqttClient, mqtt_disconnected_cb);
	MQTT_OnPublished(&mqttClient, mqtt_published_cb);
	MQTT_OnData(&mqttClient, mqtt_data_cb);

	WIFI_Connect(config.sta_ssid, config.sta_pwd, wifi_connect_cb);

	os_timer_disarm(&dhtTimer);
	os_timer_setfn(&dhtTimer, (os_timer_func_t *)dhtCb, (void *)0);
	os_timer_arm(&dhtTimer, DELAY, 1);

	os_timer_disarm(&hbTimer);
	os_timer_setfn(&hbTimer, (os_timer_func_t *)application_heartbeat, (void *)0);
	os_timer_arm(&hbTimer, 60000, 1);



	INFO("\r\nSystem started ...\r\n");
}
Ejemplo n.º 16
0
static void ICACHE_FLASH_ATTR wifi_check_ip(void *arg)
{
	struct ip_info ipConfig;

	os_timer_disarm(&WiFiLinker);
	wifi_get_ip_info(STATION_IF, &ipConfig);
	wifiStatus = wifi_station_get_connect_status();
	if (wifiStatus == STATION_GOT_IP && ipConfig.ip.addr != 0)
	{
		os_timer_setfn(&WiFiLinker, (os_timer_func_t *)wifi_check_ip, NULL);
		os_timer_arm(&WiFiLinker, 2000, 0);	
	}
	else
	{
		if(wifi_station_get_connect_status() == STATION_WRONG_PASSWORD)
		{
			INFO("STATION_WRONG_PASSWORD\r\n");
			wifi_station_connect();
		}
		else if(wifi_station_get_connect_status() == STATION_NO_AP_FOUND)
		{

			INFO("STATION_NO_AP_FOUND\r\n");
			wifi_station_connect();
		}
		else if(wifi_station_get_connect_status() == STATION_CONNECT_FAIL)
		{

			INFO("STATION_CONNECT_FAIL\r\n");
			wifi_station_connect();
		}
		else
		{
			//INFO("STATION_IDLE\r\n");
		}

		os_timer_setfn(&WiFiLinker, (os_timer_func_t *)wifi_check_ip, NULL);
		os_timer_arm(&WiFiLinker, 500, 0);
	}
	if(wifiStatus != lastWifiStatus){
		lastWifiStatus = wifiStatus;
		if(wifiCb)
			wifiCb(wifiStatus);
	}
}
Ejemplo n.º 17
0
// Change special settings
int ICACHE_FLASH_ATTR cgiWiFiSpecial(HttpdConnData *connData) {
  char dhcp[8];
  char staticip[20];
  char netmask[20];
  char gateway[20];

  if (connData->conn==NULL) return HTTPD_CGI_DONE;

  // get args and their string lengths
  int dl = httpdFindArg(connData->getArgs, "dhcp", dhcp, sizeof(dhcp));
  int sl = httpdFindArg(connData->getArgs, "staticip", staticip, sizeof(staticip));
  int nl = httpdFindArg(connData->getArgs, "netmask", netmask, sizeof(netmask));
  int gl = httpdFindArg(connData->getArgs, "gateway", gateway, sizeof(gateway));

  if (!(dl > 0 && sl >= 0 && nl >= 0 && gl >= 0)) {
    jsonHeader(connData, 400);
    httpdSend(connData, "Request is missing fields", -1);
    return HTTPD_CGI_DONE;
  }

  char url[64]; // redirect URL
  if (os_strcmp(dhcp, "off") == 0) {
    // parse static IP params
    struct ip_info ipi;
    bool ok = parse_ip(staticip, &ipi.ip);
    if (nl > 0) ok = ok && parse_ip(netmask, &ipi.netmask);
    else IP4_ADDR(&ipi.netmask, 255, 255, 255, 0);
    if (gl > 0) ok = ok && parse_ip(gateway, &ipi.gw);
    else ipi.gw.addr = 0;
    if (!ok) {
      jsonHeader(connData, 400);
      httpdSend(connData, "Cannot parse static IP config", -1);
      return HTTPD_CGI_DONE;
    }
    // save the params in flash
    flashConfig.staticip = ipi.ip.addr;
    flashConfig.netmask = ipi.netmask.addr;
    flashConfig.gateway = ipi.gw.addr;
    // construct redirect URL
    os_sprintf(url, "{\"url\": \"http://%d.%d.%d.%d\"}", IP2STR(&ipi.ip));

  } else {
    // dynamic IP
    flashConfig.staticip = 0;
    os_sprintf(url, "{\"url\": \"http://%s\"}", flashConfig.hostname);
  }

  configSave(); // ignore error...
  // schedule change-over
  os_timer_disarm(&reassTimer);
  os_timer_setfn(&reassTimer, configWifiIP, NULL);
  os_timer_arm(&reassTimer, 1000, 0); // 1 second for the response of this request to make it
  // return redirect info
  jsonHeader(connData, 200);
  httpdSend(connData, url, -1);
  return HTTPD_CGI_DONE;
}
Ejemplo n.º 18
0
void ICACHE_FLASH_ATTR
user_link_led_timer_init(void)
{
    os_timer_disarm(&link_led_timer);
    os_timer_setfn(&link_led_timer, (os_timer_func_t *)user_link_led_timer_cb, NULL);
    os_timer_arm(&link_led_timer, 50, 1);
    link_led_level = 0;
    GPIO_OUTPUT_SET(GPIO_ID_PIN(PLUG_LINK_LED_IO_NUM), link_led_level);
}
Ejemplo n.º 19
0
// osready
// starts checking to see if the wifi is connected
// arg1 callback [ void readyfunc(int success) ]
// arg2 verbose/silent true/false
void osready(void (*rf)(int ready),int v)
{
	readyfunc = rf;
	verbose = v;
	os_timer_disarm(&wifi_timer);
	os_timer_setfn(&wifi_timer, (os_timer_func_t *)checkready, (void *)0);
	os_timer_arm(&wifi_timer, 1000, 1);

}
Ejemplo n.º 20
0
void  
user_link_led_timer_init(int time)
{
    os_timer_disarm(&link_led_timer);
    os_timer_setfn(&link_led_timer, (os_timer_func_t *)user_link_led_timer_cb, NULL);
    os_timer_arm(&link_led_timer, time, 1);
    link_led_level = 0;
    GPIO_OUTPUT_SET(GPIO_ID_PIN(PLUG_LINK_LED_IO_NUM), link_led_level);
}
Ejemplo n.º 21
0
void ICACHE_FLASH_ATTR user_init()
{
    uart_init(BIT_RATE_9600, BIT_RATE_9600);
    wifi_station_set_hostname( "Threatbutt IoT Protector" ); 
    system_init_done_cb(initDone);
      
    os_timer_setfn(&myTimer, timerCallback, NULL);
    os_timer_arm(&myTimer, 10000, 1); 
}
Ejemplo n.º 22
0
/******************************************************************************
 * FunctionName : user_esp_platform_sent_cb
 * Description  : Data has been sent successfully and acknowledged by the remote host.
 * Parameters   : arg -- Additional argument to pass to the callback function
 * Returns      : none
*******************************************************************************/
LOCAL void ICACHE_FLASH_ATTR
at_upDate_sent_cb(void *arg)
{
  struct espconn *pespconn = arg;
  os_timer_disarm(&at_delayChack);
  os_timer_setfn(&at_delayChack, (os_timer_func_t *)at_upDate_wait, pespconn);
  os_timer_arm(&at_delayChack, 5000, 0);
  os_printf("at_upDate_sent_cb\r\n");
}
Ejemplo n.º 23
0
void ICACHE_FLASH_ATTR initFlowMonitor(void) {
	easygpio_pinMode(FLOW_SENSOR, EASYGPIO_NOPULL, EASYGPIO_INPUT);
	oneSecFlowCount = 0;
	flowAverage = 0;
	resetFlowReadings();
	os_timer_disarm(&flow_timer);
	os_timer_setfn(&flow_timer, (os_timer_func_t *)flowTimerCb, NULL);
	os_timer_arm(&flow_timer, 1000, true); // 1 second
}
Ejemplo n.º 24
0
void ICACHE_FLASH_ATTR led_glint_control(led_glint* led)
{
	os_printf("TIMER INIT\n");
	ETSTimer* timer = (ETSTimer*)os_zalloc(sizeof(ETSTimer));
	led->ptimer = timer;
	os_timer_disarm(timer);
	os_timer_setfn(timer, _gpio_high, (void*)led);
	os_timer_arm(timer, led->interval, 0);
}
Ejemplo n.º 25
0
void
supla_esp_gpio_led_blinking(int led, int time) {

	supla_esp_gpio_set_led(0, 0, 0);

	os_timer_setfn(&supla_gpio_timer1, supla_esp_gpio_led_blinking_func, (void*)led);
	os_timer_arm (&supla_gpio_timer1, time, true);

}
Ejemplo n.º 26
0
/******************************************************************************
 * FunctionName : espconn_client_err
 * Description  : The pcb had an error and is already deallocated.
 *                The argument might still be valid (if != NULL).
 * Parameters   : arg -- Additional argument to pass to the callback function
 *                err -- Error code to indicate why the pcb has been closed
 * Returns      : none
*******************************************************************************/
static void ICACHE_FLASH_ATTR
espconn_client_err(void *arg, err_t err)
{
	espconn_msg *perr_cb = arg;
	struct tcp_pcb *pcb = NULL;
    LWIP_UNUSED_ARG(err);

    if (perr_cb != NULL) {
    	os_timer_disarm(&perr_cb->pcommon.ptimer);
        pcb = perr_cb->pcommon.pcb;
        perr_cb->pespconn->state = ESPCONN_CLOSE;
        espconn_printf("espconn_client_err %d %d %d\n", pcb->state, pcb->nrtx, err);

        /*remove the node from the client's active connection list*/
        espconn_list_delete(&plink_active, perr_cb);

        if (err == ERR_ABRT) {
        	switch (pcb->state) {
					case SYN_SENT:
						if (pcb->nrtx == TCP_SYNMAXRTX) {
							perr_cb->pcommon.err = ESPCONN_CONN;
						} else {
							perr_cb->pcommon.err = err;
						}

						break;

					case ESTABLISHED:
						if (pcb->nrtx == TCP_MAXRTX) {
							perr_cb->pcommon.err = ESPCONN_TIMEOUT;
						} else {
							perr_cb->pcommon.err = err;
						}
						break;

					case FIN_WAIT_1:
						if (pcb->nrtx == TCP_MAXRTX) {
							perr_cb->pcommon.err = ESPCONN_CLSD;
						} else {
							perr_cb->pcommon.err = err;
						}
						break;
					case FIN_WAIT_2:
						perr_cb->pcommon.err = ESPCONN_CLSD;
						break;
					case CLOSED:
						perr_cb->pcommon.err = ESPCONN_CONN;
						break;
				}
			} else {
				perr_cb->pcommon.err = err;
			}
			os_timer_setfn(&perr_cb->pcommon.ptimer,
					(os_timer_func_t *) espconn_tcp_reconnect, perr_cb);
			os_timer_arm(&perr_cb->pcommon.ptimer, 10, 0);
		}
}
void ICACHE_FLASH_ATTR door_switch_init() {
	easygpio_pinMode(JIDIANQI_IO, EASYGPIO_NOPULL, EASYGPIO_OUTPUT);
	easygpio_pinMode(DOOR_STATUS_IO, EASYGPIO_NOPULL, EASYGPIO_INPUT);
	easygpio_outputSet(JIDIANQI_IO, 1);
	os_timer_disarm(&check_door_status_timer);
	os_timer_setfn(&check_door_status_timer,
			(os_timer_func_t *) check_door_status_cb, (void *) 0);
	os_timer_arm(&check_door_status_timer, CHECK_DOOR_DELAY, 1);
}
void ICACHE_FLASH_ATTR oled_init() {
	OLED_Init();
	OLED_ON();
	OLED_Print(0, 0, " WXIT Smart Lab", 2);
	os_timer_disarm(&clean_oled_timer);
	os_timer_setfn(&clean_oled_timer, (os_timer_func_t *) clean_oled_cb,
			(void *) 0);
	os_timer_arm(&clean_oled_timer, CLEAN_OLED_DELAY, 1);
}
Ejemplo n.º 29
0
static void ICACHE_FLASH_ATTR poll_http_callback(char* response, int http_status, char* full_response) {
  os_printf("GET response has status %d and body \"%s\"\n", http_status, response);
  if (http_status == 200) {
    os_printf("Turning on EL\n");
    gpio_output_set((1<<ELGPIO), 0, (1<<ELGPIO), 0);
    os_timer_disarm(&el_timer);
    os_timer_arm(&el_timer, 10000, 0);
  }
}
void ICACHE_FLASH_ATTR
user_MeshStart()
{
    os_printf("test: %s\n", __func__);
    //user_MeshSetInfo();
    espconn_mesh_enable(mesh_EnableCb, MESH_ONLINE);
    wifi_ClrReconnProcessAck();
	#if MESH_INIT_TIMEOUT_SET
    if(LightMeshProc.mesh_init_tout_cb){
        os_timer_disarm(&mesh_tout_t);
        os_timer_setfn(&mesh_tout_t,LightMeshProc.mesh_init_tout_cb,NULL);
        os_timer_arm(&mesh_tout_t,MESH_TIME_OUT_MS,0);
    }
	#endif
    os_timer_disarm(&mesh_check_t);
    os_timer_setfn(&mesh_check_t,mesh_InitStatusCheck,NULL);
    os_timer_arm(&mesh_check_t,MESH_STATUS_CHECK_MS,0);
}