示例#1
0
/******************************************************************************
 * FunctionName : user_init
 * Description  : entry of user application, init user function here
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void ICACHE_FLASH_ATTR
    light_switch_action()
{
	extern void ieee80211_mesh_quick_init();
	ieee80211_mesh_quick_init();

	os_printf("ESPNOW ENABLE 6M TX RATE\r\n");
	wifi_enable_6m_rate(true);
    user_SwitchReact();
}
void user_system_init_done_cb() {
	io_init();
	led_init();
	//See why we booted.
	if (io_get_boot_inputs()&INPUT_CHRG) {
		//We're charging.
		os_printf("Charging...\n");
		os_timer_disarm(&chargeTimer);
		os_timer_setfn(&chargeTimer, chargeTimerCb, NULL);
		os_timer_arm(&chargeTimer, BUTTON_CHECK_INTERVAL_MS, 1);
		io_powerkeep_hold(); //charge power hold
	}
	buttonsPressedCum=io_get_boot_inputs();
	//Probably some button has been pressed.
	os_timer_disarm(&buttonTimer);
	os_timer_setfn(&buttonTimer, buttonTimerCb, NULL);
	os_timer_arm(&buttonTimer, BUTTON_CHECK_INTERVAL_MS, 0);

	ieee80211_mesh_quick_init();
	wifi_enable_6m_rate(true);
	switch_EspnowInit();
}