Exemplo n.º 1
0
/**
 * \brief Perform the main loop processing.
 * This is where work is performed
 * as often as possible.
 */
static void mainLoop() {
	if (suspendMainLoopFlag == true) {
		return;
	}
	jsiLoop();

#ifdef EPS8266_BOARD_HEARTBEAT
	if (system_get_time() - lastTime > 1000 * 1000 * 5) {
		lastTime = system_get_time();
		os_printf("tick: %d\n", jshGetSystemTime());
	}
#endif

	// Setup for another callback
	queueTaskMainLoop();
}
Exemplo n.º 2
0
/**
 * The ESP8266 provides a mechanism to register a callback that is invoked when initialization
 * of the ESP8266 is complete.  This is the implementation of that callback.  At this point
 * we can assume that the ESP8266 is fully ready to do work for us.
 */
static void initDone() {
	os_printf("initDone invoked\n");

	// Discard any junk data in the input as this is a boot.
	//uart_rx_discard();

	jshInit(); // Initialize the hardware
	jsvInit(); // Initialize the variables
	jsiInit(false); // Initialize the interactive subsystem

	// Register the event handlers.
	system_os_task(eventHandler, TASK_APP_QUEUE, taskAppQueue, TASK_QUEUE_LENGTH);

	// At this point, our JavaScript environment should be up and running.

	// Initialize the networking subsystem.
	jswrap_ESP8266WiFi_init();

	// Post the first event to get us going.
	queueTaskMainLoop();

	return;
}
Exemplo n.º 3
0
/**
 * The ESP8266 provides a mechanism to register a callback that is invoked when initialization
 * of the ESP8266 is complete.  This is the implementation of that callback.  At this point
 * we can assume that the ESP8266 is fully ready to do work for us.
 */
static void initDone() {
  os_printf("> initDone\n");
  otaInit(88);

  // Discard any junk data in the input as this is a boot.
  //uart_rx_discard();

  jshInit(); // Initialize the hardware
  jsvInit(); // Initialize the variables
  jsiInit(true); // Initialize the interactive subsystem
  jswrap_ESP8266WiFi_init(); // Initialize the networking subsystem

  // Register the event handlers.
  system_os_task(eventHandler, TASK_APP_QUEUE, taskAppQueue, TASK_QUEUE_LENGTH);

  // At this point, our JavaScript environment should be up and running.

  // Register the idle callback handler to run the main loop
  //ets_set_idle_cb(idle_cb, NULL); //
  queueTaskMainLoop(); // get things going without idle callback

  os_printf("< initDone\n");
  return;
}
Exemplo n.º 4
0
/**
 * Enable main loop processing.
 */
static void enableMainLoop() {
  suspendMainLoopFlag = false;
  queueTaskMainLoop();
}