예제 #1
0
void ICACHE_FLASH_ATTR user_btn_long_press()
{
	os_printf("ON LONG PRESS\n");
	rw_info rw;

	read_cfg_flash(&rw);
	rw.run_mode = MODE_SOFTAP;
	write_rw_hash(&rw);
	write_cfg_flash(&rw);
	system_restart();
}
예제 #2
0
파일: cgiwifi.c 프로젝트: matigumma/esp8266
//This routine is ran some time after a connection attempt to an access point. If
//the connect succeeds, this gets the module in STA-only mode.
static void ICACHE_FLASH_ATTR resetTimerCb(void *arg) {
	int x=wifi_station_get_connect_status();
	if (x==STATION_GOT_IP) {
		//Go to STA mode. This needs a reset, so do that.
		os_printf("Got IP. Going into STA mode..\n");
		system_restart();
	} else {
		os_printf("Connect fail. Not going into STA-only mode.\n");
		//Maybe also pass this through on the webpage?
	}
}
void ICACHE_FLASH_ATTR dhserial_commands_configure(const char *args) {
	if(os_strcmp(args, "--clear") == 0) {
		if(dhsettings_clear()) {
			uart_send_line("Settings was cleared, rebooting...");
			system_restart();
		} else {
			uart_send_line("Error while cleaning settings");
		}
	} else {
		dhserial_configure_start();
	}
}
void ICACHE_FLASH_ATTR dhterminal_commands_configure(const char *args) {
	int force = (os_strcmp(args, "--force-clear") == 0) ? 1 : 0;
	if(force || os_strcmp(args, "--clear") == 0) {
		if(dhsettings_clear(force)) {
			dhuart_send_line("Settings was cleared, rebooting...");
			system_restart();
		} else {
			dhuart_send_line("Error while cleaning settings.");
		}
	} else {
		dhterminal_configure_start();
	}
}
LOCAL void ICACHE_FLASH_ATTR get_devicekey_cb(const char *key) {
	if(*key)
		dhsettings_set_devicehive_devicekey(key);
	dhuart_send_str("Configuring complete, store settings...");
	if(dhsettings_commit()) {
		dhuart_send_line("OK");
		dhuart_send_line("Rebooting...");
		system_restart();
	} else {
		dhuart_send_line("ERROR. Not saved. Check debug output.");
	}
	dhterminal_set_mode(SM_NORMAL_MODE, 0, 0, 0, 0);
}
예제 #6
0
파일: io.c 프로젝트: bacl/WiFiPhot0
static void ICACHE_FLASH_ATTR resetBtnTimerCb(void *arg) {
	static int resetCnt=0;
	if (!GPIO_INPUT_GET(BTNGPIO)) {
		resetCnt++;
	} else {
		if (resetCnt>=6) { //3 sec pressed
			wifi_station_disconnect();
			wifi_set_opmode(0x3); //reset to AP+STA mode
			os_printf("Reset to AP mode. Restarting system...\n");
			system_restart();
		}
		resetCnt=0;
	}
}
예제 #7
0
//This routine is ran some time after a connection attempt to an access point. If
//the connect succeeds, this gets the module in STA-only mode.
static void ICACHE_FLASH_ATTR resetTimerCb(void *arg) {
	int x=wifi_station_get_connect_status();
	if (x==STATION_GOT_IP) {
		//Go to STA mode. This needs a reset, so do that.
		os_printf("Got IP. Going to restart and connect to the Access Point..\n"); //---NOT i will just hide SSID
		//os_printf("Connecting to the broker MQTT..");
		wifi_set_opmode(1);
		
		system_restart();
	} else {
		os_printf("Connect fail. Not going into STA-only mode.\n");
		//Maybe also pass this through on the webpage?
	}
}
예제 #8
0
/******************************************************************************
 * FunctionName : user_plug_long_press
 * Description  : key's long press function, needed to be installed
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
LOCAL void  
user_key_long_press(void)
{
    int boot_flag=12345;
 //   user_esp_platform_set_active(0);
    system_restore();
    
    system_rtc_mem_write(70, &boot_flag, sizeof(boot_flag));
    system_rtc_mem_read(70, &boot_flag, sizeof(boot_flag));

#if RESTORE_KEEP_TIMER
    user_platform_timer_bkup();
#endif 

    system_restart();
}
예제 #9
0
파일: io.c 프로젝트: otzy/esp8266-sensor
static void ICACHE_FLASH_ATTR resetBtnTimerCb(void *arg) {
	static int resetCnt=0;
	if (!GPIO_INPUT_GET(BTNGPIO)) {
		resetCnt++;
	} else {
		if (resetCnt>=6) { //3 sec pressed
			wifi_station_disconnect();
			wifi_set_opmode(0x3); //reset to AP+STA mode
			os_printf("Reset to AP mode. Restarting system...\n");
			system_restart();
		} else if (resetCnt>=2) { //1 sec pressed
			//print rtc_time to comport
			os_printf("rtc_time: %d", system_get_rtc_time() * system_rtc_clock_cali_proc());
		}
		resetCnt=0;
	}
}
예제 #10
0
void nodemcu_init(void)
{
    NODE_ERR("\n");
    // Initialize platform first for lua modules.
    if( platform_init() != PLATFORM_OK )
    {
        // This should never happen
        NODE_DBG("Can not init platform for modules.\n");
        return;
    }

#if defined(FLASH_SAFE_API)
    if( flash_safe_get_size_byte() != flash_rom_get_size_byte()) {
        NODE_ERR("Self adjust flash size.\n");
        // Fit hardware real flash size.
        flash_rom_set_size_byte(flash_safe_get_size_byte());

        if( !fs_format() )
        {
            NODE_ERR( "\ni*** ERROR ***: unable to format. FS might be compromised.\n" );
            NODE_ERR( "It is advised to re-flash the NodeMCU image.\n" );
        }
        else {
            NODE_ERR( "format done.\n" );
        }
        fs_unmount();   // mounted by format.

        // Reboot to get SDK to use (or write) init data at new location
        system_restart ();

        // Don't post the start_lua task, we're about to reboot...
        return;
    }
#endif // defined(FLASH_SAFE_API)

#if defined ( BUILD_SPIFFS )
    fs_mount();
    // test_spiffs();
#endif
    // endpoint_setup();

    task_post_low(task_get_id(start_lua),'s');
}
void nodemcu_init(void)
{
    NODE_DBG("Hello World!.\n");

    NODE_ERR("\n");
    // Initialize platform first for lua modules.
    if( platform_init() != PLATFORM_OK )
    {
        // This should never happen
        NODE_DBG("Can not init platform for modules.\n");
        return;
    }

#if defined(FLASH_SAFE_API)
    if( flash_safe_get_size_byte() != flash_rom_get_size_byte()) {
        NODE_ERR("Self adjust flash size.\n");
        // Fit hardware real flash size.
        flash_rom_set_size_byte(flash_safe_get_size_byte());
        // Write out init data at real location.
        no_init_data = true;
    }
#endif // defined(FLASH_SAFE_API)

    NODE_DBG("Yoink 1.\n");

    if (no_init_data)
    {
        NODE_ERR("Restore init data.\n");
        // Flash init data at FLASHSIZE - 0x04000 Byte.
        flash_init_data_default();
        // Flash blank data at FLASHSIZE - 0x02000 Byte.
        flash_init_data_blank();
        // Reboot to make the new data come into effect
        system_restart ();
    }

    NODE_DBG("Yoink 2.\n");
    tcp_random_port_init ();

    NODE_DBG("Yoink 3.\n");

    system_os_post(LUA_TASK_PRIO, 0, 0);
}
예제 #12
0
파일: cgiwifi.c 프로젝트: jkent/libesphttpd
//This cgi uses the routines above to connect to a specific access point with the
//given ESSID using the given password.
CgiStatus ICACHE_FLASH_ATTR cgiWiFiSetMode(HttpdConnData *connData) {
	int len;
	char buff[1024];

	if (connData->isConnectionClosed) {
		//Connection aborted. Clean up.
		return HTTPD_CGI_DONE;
	}

	len=httpdFindArg(connData->getArgs, "mode", buff, sizeof(buff));
	if (len!=0) {
#ifndef DEMO_MODE
		wifi_set_opmode(atoi(buff));
		system_restart();
#endif
	}
	httpdRedirect(connData, "/wifi");
	return HTTPD_CGI_DONE;
}
예제 #13
0
파일: user_main.c 프로젝트: Jeija/huhnix
void ap_init(void) {
	// Check if configuration is ok already (compare SSID)
	struct softap_config netcfg;

	wifi_softap_get_config(&netcfg);
	if (os_strcmp(WIFI_SSID, netcfg.ssid) == 0) return;

	// Configuration is not good, change config and reboot
	system_restore();
	os_memcpy(netcfg.ssid, WIFI_SSID, os_strlen(WIFI_SSID));
	netcfg.ssid[os_strlen(WIFI_SSID)] = 0x00;
	netcfg.ssid_len = os_strlen(WIFI_SSID);
	netcfg.channel = 1;
	netcfg.authmode = AUTH_OPEN;
	netcfg.beacon_interval = 100;

	wifi_softap_set_config(&netcfg);
	wifi_set_opmode(0x02);
	system_restart();
}
void ICACHE_FLASH_ATTR mqttDataCb(uint32_t *args, const char* topic,
		uint32_t topic_len, const char *data, uint32_t data_len) {
	char *topicBuf = (char*) os_zalloc(topic_len + 1), *dataBuf =
			(char*) os_zalloc(data_len + 1);

	MQTT_Client* client = (MQTT_Client*) args;

	os_memcpy(topicBuf, topic, topic_len);
	topicBuf[topic_len] = 0;

	os_memcpy(dataBuf, data, data_len);
	dataBuf[data_len] = 0;
#ifdef MENJINDEBUG
	os_printf("Receive topic: %s, data: %s \r\n", topicBuf, dataBuf);
#endif
#ifdef ESP8266DOOR
	if (!strcoll(topicBuf, "/tc503/door")) {
		struct jsontree_context js;
		jsontree_setup(&js, (struct jsontree_value *) &open_door_info_tree,
				json_putchar);
		json_parse(&js, dataBuf);
	}
#endif
	if (!strcoll(topicBuf, "/tc503/reset")) {
		if (!strcoll(dataBuf, "1")){
			system_restart();
		}
	}
	os_free(topicBuf);
	os_free(dataBuf);
//#ifdef ESP8266OLED
//	if (!strcoll(topicBuf, "/tc503/time")) {
//		struct jsontree_context js;
//		jsontree_setup(&js, (struct jsontree_value *) &time_info_tree,
//				json_putchar);
//		json_parse(&js, dataBuf);
//	}
//	os_free(topicBuf);
//	os_free(dataBuf);
//#endif
}
예제 #15
0
//This cgi uses the routines above to connect to a specific access point with the
//given ESSID using the given password.
int ICACHE_FLASH_ATTR cgiWiFiConnect(HttpdConnData *connData) {
	char essid[128];
	char passwd[128];
	char mqtt_host_ip[64];

	static ETSTimer reassTimer;
	
	if (connData->conn==NULL) {
		//Connection aborted. Clean up.
		return HTTPD_CGI_DONE;
	}
	
	httpdFindArg(connData->postBuff, "essid", essid, sizeof(essid));
	httpdFindArg(connData->postBuff, "passwd", passwd, sizeof(passwd));
	httpdFindArg(connData->postBuff, "mqtthost", mqtt_host_ip, sizeof(mqtt_host_ip));

	os_sprintf(ModuleSettings.ssid, "%s", essid);
	os_sprintf(ModuleSettings.sta_pwd, "%s", passwd);
	//os_sprintf(ModuleSettings.mqtt_host, "%s", mqtt_host_ip);
	os_sprintf(ModuleSettings.configured, "%s", "NO");
	
	WriteFlash();
	system_restart();

	os_strncpy((char*)stconf.ssid, essid, 32);
	os_strncpy((char*)stconf.password, passwd, 64);
	os_printf("Try to connect to AP %s pw %s\n", essid, passwd);

	//Schedule disconnect/connect
	os_timer_disarm(&reassTimer);
	os_timer_setfn(&reassTimer, reassTimerCb, NULL);

//Set to 0 if you want to disable the actual reconnecting bit
#ifdef DEMO_MODE
	httpdRedirect(connData, "/wifi");
#else
	os_timer_arm(&reassTimer, 1000, 0);
	httpdRedirect(connData, "connecting.html");
#endif
	return HTTPD_CGI_DONE;
}
예제 #16
0
void default_short_press(void *arg) {
  system_restart();
}
예제 #17
0
STATIC mp_obj_t machine_reset(void) {
    system_restart();
    return mp_const_none;
}
예제 #18
0
파일: esp_config.c 프로젝트: ifzz/smart.js
void device_reboot(void) {
  system_restart();
}
예제 #19
0
/******************************************************************************
 * FunctionName : udp_test_port_recv
 * Returns      : none
*******************************************************************************/
LOCAL void ICACHE_FLASH_ATTR
udp_test_port_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr, u16_t port)
{
	uint8 usrdata[32];
    if (p == NULL)  return;
    if(p->tot_len < 2) {
        pbuf_free(p);
    	return;
    }
    uint16 length = mMIN(p->tot_len, sizeof(usrdata)-1);
#if DEBUGSOO > 0
    os_printf("udp " IPSTR ":%u [%d]\n", IP2STR(addr), port, p->tot_len);
#endif
    length = pbuf_copy_partial(p, usrdata, length, 0);
    pbuf_free(p);

    uint8 *pudpbuf = (uint8 *)os_zalloc(udpbufsize+1);
    if(pudpbuf == NULL) return;
    uint16 udpbuflen = 0;
    int x = 0;
    if(length>2) x = atoi((char *)&usrdata[2]);
    if ((length>1)&&(usrdata[1]=='?')) switch(usrdata[0])
    {
      case 'M':
          system_print_meminfo();
      case 'A':
        {
          udp_puts("\nChip_id: %08x Flash_id: %08x\nsys_time:%08x ADC:%d\n", system_get_chip_id(), spi_flash_get_id(), system_get_time(), system_adc_read());
          struct softap_config wiconfig;
          wifi_softap_get_config(&wiconfig);
          udp_puts("OPMode:%u SSID:'%s' Pwd:'%s' Ch:%u Authmode:%u MaxCon:%u Phu:%u ACon:%u\n", wifi_get_opmode(), wiconfig.ssid, wiconfig.password, wiconfig.channel, wiconfig.authmode, wiconfig.max_connection, wifi_get_phy_mode(), wifi_station_get_auto_connect());
          udp_puts("Connect status:%u\n", wifi_station_get_connect_status());
        };
      case 'I':
          udp_puts("heapsize: %d\n", system_get_free_heap_size() + udpbufsize);
          udpbuflen += print_udp_psc(pudpbuf+udpbuflen, udpbufsize-udpbuflen);
          udpbuflen += print_tcp_psc(pudpbuf+udpbuflen, udpbufsize-udpbuflen);
          udpbuflen += chow_tcp_connection_info(pudpbuf+udpbuflen, udpbufsize-udpbuflen);
          break;
      case 'H':
          udp_puts("heapsize: %d\n", system_get_free_heap_size() + udpbufsize);
          break;
      case 'U':
          udp_puts("heapsize: %d\n", system_get_free_heap_size() + udpbufsize);
          udpbuflen += print_udp_psc(pudpbuf+udpbuflen, udpbufsize-udpbuflen);
          break;
      case 'T':
          udp_puts("heapsize: %d\n", system_get_free_heap_size() + udpbufsize);
          udpbuflen += print_tcp_psc(pudpbuf+udpbuflen, udpbufsize-udpbuflen);
          break;
#ifdef USE_SRV_WEB_PORT
      case 'S':
          udp_puts("heapsize: %d\n", system_get_free_heap_size() + udpbufsize);
          udpbuflen += chow_tcp_connection_info(pudpbuf+udpbuflen, udpbufsize-udpbuflen);
          break;
#endif
      case 'R':
          system_restart();
          break;
      case 'P':
          udp_puts("system_set_os_print(%u)\n", x);
          system_set_os_print(x);
          break;
      case 'O':
          udp_puts("wifi_set_opmode(%u):%u\n", x, wifi_set_opmode(x));
          break;
      case 'B':
          udp_puts("wifi_station_set_auto_connect(%u):%u\n", x, wifi_station_set_auto_connect(x));
          break;
      case 'D':
          switch(x) {
          case 0:
              udp_puts("wifi_station_dhcpc_start:%u\n", wifi_station_dhcpc_start());
              break;
          case 1:
              udp_puts("wifi_station_dhcpc_stop:%u\n", wifi_station_dhcpc_stop());
              break;
          case 2:
              udp_puts("wifi_softap_dhcps_start:%u\n",wifi_softap_dhcps_start());
              break;
          case 3:
              udp_puts("wifi_softap_dhcps_stop:%u\n", wifi_softap_dhcps_stop());
              break;
          default:
              udp_puts("D(%u)?\n", x);
          }
          break;
          case 'F':
        	  if(flashchip != NULL) {
        		  udp_puts("FlashID: 0x%08x\nChip size: %d\nBlock size: %d\nSector size: %d\nPage size: %d\nStatus mask: 0x%08x\n", flashchip->deviceId, flashchip->chip_size, flashchip->block_size, flashchip->sector_size, flashchip->page_size, flashchip->status_mask );
        		  udp_puts("Real Flash size: %u\n", spi_flash_real_size());
        	  }
        	  else udp_puts("Unknown Flash type!\n");
              break;
          case 'E':
        	  udp_puts("wifi_set_sleep_type(%d):%u\n", x, wifi_set_sleep_type(x));
        	  break;
          case 'G':
        	  udp_puts("g_ic = %p\n", &g_ic);
        	  break;
      default:
          udp_puts("???\n");
    }
    if(udpbuflen) {
    	struct pbuf *z = pbuf_alloc(PBUF_TRANSPORT, udpbuflen, PBUF_RAM);
    	if(z != NULL) {
        	err_t err = pbuf_take(z, pudpbuf, udpbuflen);
        	os_free(pudpbuf);
        	if(err == ERR_OK) {
        	    udp_sendto(upcb, z, addr, port);
        	}
      	    pbuf_free(z);
        	return;
    	}
    }
    os_free(pudpbuf);
}
예제 #20
0
파일: System.cpp 프로젝트: Hukuma23/WS
void SystemClass::restart()
{
	system_restart();
}
/******************************************************************************
 * FunctionName : user_sensor_long_press
 * Description  : sensor key's function, needed to be installed
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
LOCAL void ICACHE_FLASH_ATTR user_sensor_long_press(void) {
    user_esp_platform_set_active(0);
    system_restore();
    system_restart();
}
예제 #22
0
void ICACHE_FLASH_ATTR dhserial_commands_reboot(const char *args) {
	uart_send_line("Rebooting...");
	system_restart();
}
예제 #23
0
파일: http.c 프로젝트: Daven005/ESP8266
static void ICACHE_FLASH_ATTR tcp_disconnect_cb(void *arg) {
	struct espconn *conn = (struct espconn*) arg;
	TESTP("Disconnected %s\n", reboot ? "rebooting" : "");
	ets_delay_us(5000);
	if (reboot) system_restart();
}
예제 #24
0
/*JSON{
  "type"     : "staticmethod",
  "class"    : "ESP8266WiFi",
  "name"     : "restart",
  "generate" : "jswrap_ESP8266WiFi_restart"
}
 * Ask the physical ESP8266 device to restart itself.
 */
void jswrap_ESP8266WiFi_restart() {
  os_printf("> jswrap_ESP8266WiFi_restart\n");
  system_restart();
}
예제 #25
0
void EspClass::restart(void)
{
    system_restart();
}
예제 #26
0
// Lua: restart()
static int node_restart( lua_State* L )
{
  system_restart();
  return 0;
}
예제 #27
0
void sj_system_restart() {
  system_restart();
}
예제 #28
0
/******************************************************************************
 * FunctionName : gm_state_run
 * Description  : 
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
LOCAL void ICACHE_FLASH_ATTR
gm_state_run(greemon_state_t gm_run_state){
	switch (gm_run_state) {

// --------------------------------------------------------------------------

		case (_STATE_STARTUP):
		/* Initialize UART, 
		 * Register Callback for lwip
		 * set wifi handler
		 * do not connect to wifi at this point
		 */
			gm_error_counter = 0;
			if ( !gm_startup() ) gm_state_set(_STATE_ERROR);
			INFO("Waiting for init callback");
		break;

// --------------------------------------------------------------------------

		case (_STATE_INIT):	
		/* Fired after LWIP callback,
		 * Register interrupt for reset
		 * Load Configuration
		 */
			INFO("System initialized. Greemon startup...");
			if ( !gm_init() ) gm_state_set(_STATE_ERROR);
		break;

// --------------------------------------------------------------------------

		case (_STATE_RESET):

		break;

// --------------------------------------------------------------------------

		case (_STATE_ERROR):
		/* 
		 * this state only happens if there was an error
		 */
			INFO("Wooooooops... there was an ERROR.");
			INFO("restart is the only exit")
		break;

// --------------------------------------------------------------------------

		case (_STATE_INITIALIZED):
			/* System is initialized,
			 * we can load the config before we startup our greemon system
			*/
			if ( !gm_load_config() ) gm_state_set(_STATE_ERROR);
		break;

// --------------------------------------------------------------------------

		case (_STATE_CONFIG_USER):
		/*	magic word has been found in the flash data,
		 *	we start with the user configuration
		 *	but first read sensor data
		 */
			INFO("user config has been loaded");
			if ( !gm_read_sensors() ) gm_state_set(_STATE_ERROR);
			gm_state_set(_STATE_SENSOR_DATA_SAVED);
		break;

// --------------------------------------------------------------------------

		case (_STATE_CONFIG_DEFAULT):
		/*	magic word has not been found in the flash data,
		 *	we start with the default configuration
		 */
			INFO("loaded standard configuration");
			INFO("webserver starting");
			if ( !gm_webserver_start() ) gm_state_set(_STATE_ERROR);
			gm_state_set(_STATE_WEBSERVER_RUNNING);
		break;

// --------------------------------------------------------------------------

		case (_STATE_CONFIG_RECIEVED):
		INFO("config recieved - please restart the controller");
		break;

// --------------------------------------------------------------------------

		case (_STATE_WEBSERVER_PARSING):
			
		break;

// --------------------------------------------------------------------------

		case (_STATE_WEBSERVER_RUNNING):
		/* Webserver is running as long as 
		 * we did not recieve a new configuration
		 */
			INFO("webserver running");
			INFO("waiting for HTTP requests");

// TEST FOR BH1750
//TODO: DELETEME
//		i2ctest();	


		break;

// --------------------------------------------------------------------------

		case (_STATE_SAVED_CONFIGURATION):
			INFO("configuration has been saved");
			wifi_station_disconnect();
			gm_webserver_stop();
			INFO("restarting");
			system_restart();
			while(1) os_delay_us(100);
		break;

// --------------------------------------------------------------------------

		case (_STATE_TIME_RECIEVED):
			INFO("start connecting with server");
			if ( !gm_server_connect() ) gm_state_set(_STATE_DEEP_SLEEP);
		break;

// --------------------------------------------------------------------------

		case (_STATE_SENSOR_DATA_SAVED):
			INFO("Sensor data saved");
			if ( !gm_connect_ap() ) gm_state_set(_STATE_ERROR);
			INFO("connecting.. waiting for wifi-handler");
		break;

// --------------------------------------------------------------------------

		case (_STATE_WIFI_CONNECTED):
		/* Connected to AP and recieved an IP Adress
		 * Starting SNTP Client
		 */
			if ( !gm_sntp_start() ) gm_state_set(_STATE_ERROR);
			user_sntp_wait_valid_time();
			INFO("recieved time from server");
			// NEXT STATE ->_STATE_TIME_RECIEVED
			gm_state_set(_STATE_TIME_RECIEVED);
		break;

// --------------------------------------------------------------------------

		case (_STATE_CONNECTION_CLOSED):
		
		break;

// --------------------------------------------------------------------------

		case (_STATE_CONNECTION_OPEN):
			INFO("sending data..");
			if ( !gm_server_send_data() ) gm_state_set(_STATE_ERROR);
		break;

// --------------------------------------------------------------------------

		case (_STATE_CONNECTION_TRANSMITTED):
			INFO("transmitted data successfully")
			// A dataset has been transmitted. 
			// Remove from the flash happend automatically when we popped the data
			// Start 16 secs timer because ts only acceps data every 15 secs
			if ( 0 == global_cfg.storedData ) {
				INFO("all data has been sent");
				gm_state_set(_STATE_DEEP_SLEEP);
			} else {
				INFO("still data(%d) remaining, starting timer", global_cfg.storedData);
				os_timer_setfn(&timer_server_wait,timer_server_wait_cb,NULL);
				os_timer_arm(&timer_server_wait,GM_SERVER_TRANSMIT_INTERVAL,1);
			}
		break;

// --------------------------------------------------------------------------

		case (_STATE_DEEP_SLEEP):
			INFO("Finished work. Deep sleep, yay.");
			system_deep_sleep(60*1000*1000); // uint32_t time in us 
		break;

// --------------------------------------------------------------------------
	}
}
예제 #29
0
파일: main.c 프로젝트: aabella/atproto
void ICACHE_FLASH_ATTR target_dce_reset()
{
    system_restart();
}
예제 #30
0
void ICACHE_FLASH_ATTR config_restart(serverConnData *conn, uint8_t argc, char *argv[]) {
    espbuffsentstring(conn, MSG_OK);
    os_delay_us(1000);
    system_restart();
}