Example #1
0
void user_init()
{
    struct station_config conf;

    // This is used to setup the serial communication
    uart_div_modify(0, UART_CLK_FREQ / 115200);

    wifi_set_opmode(STATION_MODE);

    // os_bzero ( &conf, sizeof(struct station_config) );
    os_memset ( &conf, 0, sizeof(struct station_config) );
    os_memcpy (&conf.ssid, ssid, 32);
    os_memcpy (&conf.password, pass, 64 );
    wifi_station_set_config (&conf);

    // And this is used to print some information
    os_printf("\n");
    os_printf("SDK version:%s\n", system_get_sdk_version());
    system_print_meminfo();
    os_delay_us ( 1 );
    os_printf ( "CPU Hz = %d\n", system_get_cpu_freq() );

    show_mac ();
    show_ip ();

    /* set a callback for wifi events */
    wifi_set_event_handler_cb ( wifi_event );
}
Example #2
0
static void
print_stuff() {
	printf("tmr now = %ss\n", time_now_f());

	printf("SDK version: %s\n", system_get_sdk_version());
	printf("APP version: %s built: %s %s\n", BUILD_DATE, __DATE__, __TIME__);

	printf("CPU freq was %d\n", system_get_cpu_freq());
	printf("CPU freq = %d\n", set_cpu_freq(160));
	printf("tmr now = %ss\n", time_now_f());

	printf("tout    = %sV\n", ffp(3, read_tout(0)*123/10));
	printf("vdd     = %sV\n", ffp(3, read_vdd()));

	print_mac(STATION_IF);
	print_mac(SOFTAP_IF);

	print_ip_info(SOFTAP_IF);
	print_ip_info(STATION_IF);

	printf("tmr now = %ss\n", time_now_f());
	printf("sleeping 2s\n");
	system_deep_sleep(2*1000000);
	vTaskDelete(NULL);
}
Example #3
0
void ShowInfo() {
    Serial.printf("\r\nSDK: v%s\r\n", system_get_sdk_version());
    Serial.printf("Free Heap: %d\r\n", system_get_free_heap_size());
    Serial.printf("CPU Frequency: %d MHz\r\n", system_get_cpu_freq());
    Serial.printf("System Chip ID: %x\r\n", system_get_chip_id());
    Serial.printf("SPI Flash ID: %x\r\n", spi_flash_get_id());
    //Serial.printf("SPI Flash Size: %d\r\n", (1 << ((spi_flash_get_id() >> 16) & 0xff)));
}
Example #4
0
/*JSON{
  "type"     : "staticmethod",
  "class"    : "ESP8266WiFi",
  "name"     : "getState",
  "generate" : "jswrap_ESP8266WiFi_getState",
  "return"   : ["JsVar","The state of the ESP8266"],
  "return_object" : "ESP8266State"
}*/
JsVar *jswrap_ESP8266WiFi_getState() {
  // Create a new variable and populate it with the properties of the ESP8266 that we
  // wish to return.
  JsVar *esp8266State = jspNewObject(NULL, "ESP8266State");
  jsvUnLock(jsvObjectSetChild(esp8266State, "sdkVersion",   jsvNewFromString(system_get_sdk_version())));
  jsvUnLock(jsvObjectSetChild(esp8266State, "cpuFrequency", jsvNewFromInteger(system_get_cpu_freq())));
  jsvUnLock(jsvObjectSetChild(esp8266State, "freeHeap",     jsvNewFromInteger(system_get_free_heap_size())));
  jsvUnLock(jsvObjectSetChild(esp8266State, "maxCon",       jsvNewFromInteger(espconn_tcp_get_max_con())));
  return esp8266State;
}
Example #5
0
STATIC mp_obj_t machine_freq(mp_uint_t n_args, const mp_obj_t *args) {
    if (n_args == 0) {
        // get
        return mp_obj_new_int(system_get_cpu_freq() * 1000000);
    } else {
        // set
        mp_int_t freq = mp_obj_get_int(args[0]) / 1000000;
        if (freq != 80 && freq != 160) {
            nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
                    "frequency can only be either 80Mhz or 160MHz"));
        }
        system_update_cpu_freq(freq);
        return mp_const_none;
    }
}
Example #6
0
// Handle system information variables and print their value, returns the number of
// characters appended to buff
int ICACHE_FLASH_ATTR printGlobalInfo(char *buff, int buflen, char *token) {
  if (TOKEN("si_chip_id")) {
    return os_sprintf(buff, "0x%x", system_get_chip_id());
  } else if (TOKEN("si_freeheap")) {
    return os_sprintf(buff, "%dKB", system_get_free_heap_size()/1024);
  } else if (TOKEN("si_uptime")) {
    uint32 t = system_get_time() / 1000000; // in seconds
    return os_sprintf(buff, "%dd%dh%dm%ds", t/(24*3600), (t/(3600))%24, (t/60)%60, t%60);
  } else if (TOKEN("si_boot_version")) {
    return os_sprintf(buff, "%d", system_get_boot_version());
  } else if (TOKEN("si_boot_address")) {
    return os_sprintf(buff, "0x%x", system_get_userbin_addr());
  } else if (TOKEN("si_cpu_freq")) {
    return os_sprintf(buff, "%dMhz", system_get_cpu_freq());
  } else {
    return 0;
  }
}
Example #7
0
void ShowInfo() {
	Serial.printf("\r\nSDK: v%s\r\n", system_get_sdk_version());
	Serial.printf("Free Heap: %d\r\n", system_get_free_heap_size());
	Serial.printf("CPU Frequency: %d MHz\r\n", system_get_cpu_freq());
	Serial.printf("System Chip ID: %x\r\n", system_get_chip_id());
	Serial.printf("SPI Flash ID: %x\r\n", spi_flash_get_id());
	//Serial.printf("SPI Flash Size: %d\r\n", (1 << ((spi_flash_get_id() >> 16) & 0xff)));

	Vector<String> files = fileList();
	if (files.count() > 0) {
		Serial.println("\n\rSpiff files:");
		Serial.println("----------------------------");
		{
			for (int i = 0; i < files.count(); i++) {
				Serial.println(files[i]);
			}
		}
		Serial.println("----------------------------");
	} else {
		Serial.println("Empty spiffs!");
	}

}
Example #8
0
void user_init(void)
{
	// Configure the UART
	uart_init(BIT_RATE_115200, BIT_RATE_115200);
	// Enable system messages
	system_set_os_print(1);
	DHT22_DEBUG("\n==== System info: ====\n");
	DHT22_DEBUG("SDK version:%s rom %d\n", system_get_sdk_version(), system_upgrade_userbin_check());
	DHT22_DEBUG("Time = %ld\n", system_get_time());
	DHT22_DEBUG("Chip id = 0x%x\n", system_get_chip_id());
	DHT22_DEBUG("CPU freq = %d MHz\n", system_get_cpu_freq());
	DHT22_DEBUG("Flash size map = %s\n", FlashSizeMap[system_get_flash_size_map()]);
	DHT22_DEBUG("Free heap size = %d\n", system_get_free_heap_size());
	DHT22_DEBUG("==== End System info ====\n");
	os_delay_us(10000);
	DHT22_DEBUG("System init...\r\n");

	if(wifi_get_opmode() != STATION_MODE)
	{
		DHT22_DEBUG("ESP8266 is %s mode, restarting in %s mode...\r\n", WiFiMode[wifi_get_opmode()], WiFiMode[STATION_MODE]);
		setup_wifi_st_mode();
	}
	if(wifi_get_phy_mode() != PHY_MODE_11N)
		wifi_set_phy_mode(PHY_MODE_11N);
	if(wifi_station_get_auto_connect() == 0)
		wifi_station_set_auto_connect(1);


	// Wait for Wi-Fi connection
	os_timer_disarm(&WiFiLinker);
	os_timer_setfn(&WiFiLinker, (os_timer_func_t *)wifi_check_ip, NULL);
	os_timer_arm(&WiFiLinker, WIFI_CHECK_DELAY, 0);

	UDP_Init();

	DHT22_DEBUG("System init done.\n");
}
irom void stats_generate(uint16_t size, char *dst)
{
	const struct rst_info *rst_info;
	struct station_config sc_default, sc_current;
	uint32_t system_time;

	system_time = system_get_time();
	rst_info = system_get_rst_info();

	wifi_station_get_config_default(&sc_default);
	wifi_station_get_config(&sc_current);

	snprintf(dst, size,
			"> firmware version date: %s\n"
			"> system id: %u\n"
			"> spi flash id: %u\n"
			"> cpu frequency: %u\n"
			"> flash map: %s\n"
			"> reset cause: %s\n"
			">\n"
			"> heap free: %u bytes\n"
			"> system clock: %u.%06u s\n"
			"> uptime: %u %02d:%02d:%02d\n"
			"> real time: %u %02d:%02d:%02d\n"
			"> size of config: %u\n"
			">\n"
			"> int uart rx: %u\n"
			"> int uart tx: %u\n"
			"> timer_fast fired: %u\n"
			"> timer_slow fired: %u\n"
			"> timer_second fired: %u\n"
			"> background task: %u\n"
			">\n"
			"> default ssid: %s, passwd: %s\n"
			"> current ssid: %s, passwd: %s\n"
			"> phy mode: %s\n"
			"> sleep mode: %s\n"
			"> channel: %u\n"
			"> signal strength: %d dB\n",
			__DATE__ " " __TIME__,
			system_get_chip_id(),
			spi_flash_get_id(),
			system_get_cpu_freq(),
			flash_map[system_get_flash_size_map()],
			reset_map[rst_info->reason],
			system_get_free_heap_size(),
			system_time / 1000000,
			system_time % 1000000,
			ut_days, ut_hours, ut_mins, ut_secs,
			rt_days, rt_hours, rt_mins, rt_secs,
			sizeof(config_t),
			stat_uart_rx_interrupts,
			stat_uart_tx_interrupts,
			stat_timer_fast,
			stat_timer_slow,
			stat_timer_second,
			stat_background_task,
			sc_default.ssid, sc_default.password,
			sc_current.ssid, sc_current.password,
			phy[wifi_get_phy_mode()],
			slp[wifi_get_sleep_type()],
			wifi_get_channel(),
			wifi_station_get_rssi());
}
Example #10
0
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
void CApplication::cmdOnInfo(String commandLine, CommandOutput* pOut)
{
  char str0[16], str1[16], str2[16], str3[16];

  pOut->printf("\r\n");
    
  pOut->printf("wiControl v%s, topology=%s\r\n", szAPP_VERSION, szAPP_TOPOLOGY);
  pOut->printf(" Build time         : %s\r\n", build_time);
  pOut->printf(" Build version      : %s\r\n", build_git_sha);
  pOut->printf(" Sming Version      : %s\r\n", SMING_VERSION);
  pOut->printf(" ESP SDK version    : %s\r\n", system_get_sdk_version());
  pOut->printf(" System Time        : %s\r\n", SystemClock.getSystemTimeString().c_str());
  pOut->printf(" Free Heap          : %d\r\n", system_get_free_heap_size());
  pOut->printf(" CPU Frequency      : %d MHz\r\n", system_get_cpu_freq());
  pOut->printf(" System Chip ID     : %x\r\n", system_get_chip_id());
//pOut->printf(" SPI Flash ID       : %x\r\n", spi_flash_get_id());
//pOut->printf(" SPI Flash Size     : %d\r\n", (1 << ((spi_flash_get_id() >> 16) & 0xff)));
  pOut->printf(" Debug              : 0x%08X\r\n", Debug.logClsLevels(DEBUG_CLS_0));        
  pOut->printf("\r\n");

  pOut->printf("App\r\n");
  pOut->printf(" Emulation          : %s\r\n", (m_gpiodEmul    == CGPIOD_EMUL_SHUTTER) ? "shutter"  : "output");
  pOut->printf(" Mode               : %s\r\n", (m_gpiodMode    == CGPIOD_MODE_LOCAL)   ? "local"    :
                                               (m_gpiodMode    == CGPIOD_MODE_MQTT)    ? "MQTT"     : "both");
  pOut->printf(" Configuration cmds : %s\r\n", (m_gpiodLock    == CGPIOD_LOCK_TRUE)    ? "disabled" : "enabled");
  pOut->printf(" Operational cmds   : %s\r\n", (m_gpiodDisable == CGPIOD_DISABLE_TRUE) ? "disabled" : "enabled");

  pOut->printf(" Input states       : %s/%s/%s/%s\r\n",
               g_gpiod.PrintObjSta2String(str0, CGPIOD_OBJ_CLS_INPUT | 0, g_gpiod.GetState(CGPIOD_OBJ_CLS_INPUT | 0)),
               g_gpiod.PrintObjSta2String(str1, CGPIOD_OBJ_CLS_INPUT | 1, g_gpiod.GetState(CGPIOD_OBJ_CLS_INPUT | 1)),
               g_gpiod.PrintObjSta2String(str2, CGPIOD_OBJ_CLS_INPUT | 2, g_gpiod.GetState(CGPIOD_OBJ_CLS_INPUT | 2)),
               g_gpiod.PrintObjSta2String(str3, CGPIOD_OBJ_CLS_INPUT | 3, g_gpiod.GetState(CGPIOD_OBJ_CLS_INPUT | 3)));

  if (m_gpiodEmul == CGPIOD_EMUL_OUTPUT)
    pOut->printf(" Output states      : %s/%s/%s/%s\r\n",
                 g_gpiod.PrintObjSta2String(str0, CGPIOD_OBJ_CLS_OUTPUT | 0, g_gpiod.GetState(CGPIOD_OBJ_CLS_OUTPUT | 0)),
                 g_gpiod.PrintObjSta2String(str1, CGPIOD_OBJ_CLS_OUTPUT | 1, g_gpiod.GetState(CGPIOD_OBJ_CLS_OUTPUT | 1)),
                 g_gpiod.PrintObjSta2String(str2, CGPIOD_OBJ_CLS_OUTPUT | 2, g_gpiod.GetState(CGPIOD_OBJ_CLS_OUTPUT | 2)),
                 g_gpiod.PrintObjSta2String(str3, CGPIOD_OBJ_CLS_OUTPUT | 3, g_gpiod.GetState(CGPIOD_OBJ_CLS_OUTPUT | 3)));
  else
    pOut->printf(" Shutter states     : %s/%s\r\n",
                 g_gpiod.PrintObjSta2String(str0, CGPIOD_OBJ_CLS_SHUTTER | 0, g_gpiod.GetState(CGPIOD_OBJ_CLS_SHUTTER | 0)),
                 g_gpiod.PrintObjSta2String(str1, CGPIOD_OBJ_CLS_SHUTTER | 1, g_gpiod.GetState(CGPIOD_OBJ_CLS_SHUTTER | 1)));

  pOut->printf("\r\n");

  pOut->printf("MQTT\r\n");
  pOut->printf(" Broker             : %s:%d\r\n", g_mqtt.GetStrAttr("mqttHost"), g_mqtt.GetNumAttr("mqttPort"));
  pOut->printf(" User/pswd          : %s:%s\r\n", g_mqtt.GetStrAttr("mqttUser"), g_mqtt.GetStrAttr("mqttPswd"));
  pOut->printf(" NodeId             : %s\r\n",    g_mqtt.GetStrAttr("mqttNodeId"));
  pOut->printf(" Connected          : %s\r\n",    g_mqtt.IsConnected() ? "yes" : "no");
  pOut->printf("\r\n");

  pOut->printf("Network\r\n");
  pOut->printf(" Station connected  : %s\r\n", g_network.staConnected() ? "yes" : "no");
  pOut->printf(" Station SSID       : %s\r\n", g_network.GetStrAttr("staSSID"));
  pOut->printf(" Station DHCP       : %s\r\n", g_network.GetNumAttr("staDHCP") ? "enabled" : "disabled");
  pOut->printf(" Station IP@        : %s\r\n", g_network.GetStrAttr("staAddr"));

  String apModeStr;
  if      (g_network.GetNumAttr("apMode") == CNETWORK_AP_MODE_ALWAYS_ON)
    apModeStr = "always";
  else if (g_network.GetNumAttr("apMode") == CNETWORK_AP_MODE_ALWAYS_OFF)
    apModeStr = "never";
  else
    apModeStr = "whenDisconnected";

  pOut->printf(" AccessPoint mode   : %s\r\n", apModeStr.c_str());
  pOut->printf(" AccessPoint enabled: %s\r\n", WifiAccessPoint.isEnabled() ? "yes" : "no");
  pOut->printf("\r\n");
  } // cmdOnInfo
Example #11
0
uint8_t EspClass::getCpuFreqMHz(void)
{
    return system_get_cpu_freq();
}
void ICACHE_FLASH_ATTR user_init(void){
	DBG("user_init() started\n");
	//
	//prepare test vars and buffers
	wlcd_text_draw_settings_struct S;
	//
	char* Str = os_malloc(256);
	uint8_t* ImgData = os_malloc(11000); //arrays allocated by os_malloc() are also always 4-bytes aligned (at least on ESP8266 SDK). Make sure that the buffer is big enough
	if((Str==NULL)||(ImgData==NULL)) return; //os_malloc() failed => abort
	uint16_t W, H;
	uint32_t t, t2;
	uint16_t i;
	uint16_t DoneXOffs;
	uint16_t DoneYOffs;
	//
	//init display
	wlcd_init();
	//
#if(WLCD_BPP==WLCD_16BPP)
	wfof_get_file_data_fast(WFOF_IDX_WLCD_DEMO_16BPP, (uint32_t*)ImgData, 0, WFOF_SIZE_WLCD_DEMO_16BPP);
#else
	wfof_get_file_data_fast(WFOF_IDX_WLCD_DEMO_24BPP, (uint32_t*)ImgData, 0, WFOF_SIZE_WLCD_DEMO_24BPP);
#endif
	//
	while(1){
		//
		//---- WLCD test / demo intro (countdown)
		//
		//clear whole display (black)
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		//demo image
		wlcd_img_draw(ImgData, (WLCD_WIDTH-wlcd_img_get_width(ImgData))/2, ((WLCD_HEIGHT-wlcd_img_get_height(ImgData))/2)-10);
		//
		//test countdown
		S.X = 10;
		S.Y = 10;
		S.Color.u32t = WLCD_RGB_TO_COLOR(0xFF, 0x5C, 0x20);
		S.FontIdx = 2;
		S.FontZoomAdd = 0;
		S.BoldAdd = 0;
		S.HSpc = 0;
		S.VSpc = 0;
		S.MaxW = WLCD_WIDTH-20;
		S.MaxH = 40;
		S.WrapStyle = WLCD_WRAP_NONE;
		//
		wlcd_text_measure("DONE", &S, &W, &H);
		DoneXOffs = (WLCD_WIDTH-W)/2;
		DoneYOffs = (WLCD_HEIGHT-H)/2;
		//
#if(WLCD_DISPLAY==WLCD_ILI9341)
		ets_sprintf(Str, "WLCD %s, ILI9341, %d bpp", wlcd_get_version(), WLCD_BPP);
#elif(WLCD_DISPLAY==WLCD_ILI9488_KDv4_HACK)
		ets_sprintf(Str, "WLCD %s, ILI9488_KDv4_HACK, %d bpp", wlcd_get_version(), WLCD_BPP);
#elif(WLCD_DISPLAY==WLCD_ILI9488)
		ets_sprintf(Str, "WLCD %s, ILI9488, %d bpp", wlcd_get_version(), WLCD_BPP);
#endif
		wlcd_text_draw(Str, &S);
		//
		S.X = 10;
		S.Y = 25;
#ifdef WLCD_USE_HSPI
		ets_sprintf(Str, "HW mode, HSPI CLK = %d kHz", ((uint32_t)system_get_cpu_freq()*1000) / WLCD_SPI_CLK_PREDIV / WLCD_SPI_CLK_CNTDIV);
#else
		ets_sprintf(Str, "SW mode");
#endif
		wlcd_text_draw(Str, &S);
		//
		S.X = 10;
		S.Y = WLCD_HEIGHT - 10 - wlcd_text_nrows_height(1, &S) - 3;
		ets_sprintf(Str, "Test starts in ");
		wlcd_text_measure(Str, &S, &W, &H);
		wlcd_text_draw(Str, &S);
		//wlcd_text_draw_or_measure(Str, &S, 0, &W, &H); //this is also possible instead of two lines above
		//
		S.FontZoomAdd = 1;
		S.X = 10 + W;
		S.Y = WLCD_HEIGHT - 10 - wlcd_text_nrows_height(1, &S);
		S.MaxW = WLCD_WIDTH - 10 - S.X;
		S.Color.u32t = WLCD_RGB_TO_COLOR(0xFF, 0xFF, 0xFF);
		for(i=50;i>0;i--){
			wlcd_rect_fill(S.X, S.Y, wlcd_text_nchars_width(5, &S), wlcd_text_nrows_height(1, &S), 0);
			//
			ets_sprintf(Str, "%d.%d s", i/10, i%10);
			wlcd_text_draw(Str, &S);
			//
			OS_DELAY_MS(100);
		}
		S.FontZoomAdd = 0;
		//
		//---- random lines / line speed test
		//
		//clear whole display (black)
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		//draw 1000 random lines
		t = system_get_time();
		for(i=0;i<1000;i++){
			wlcd_line_draw(
				RAND_0_TO_X(WLCD_WIDTH-1), RAND_0_TO_X(WLCD_HEIGHT-1),
				RAND_0_TO_X(WLCD_WIDTH-1), RAND_0_TO_X(WLCD_HEIGHT-1),
				WLCD_RGB_TO_COLOR(0b00111000, 0b00111100, 0b01111000));
			//
			if(i%50==0) system_soft_wdt_feed(); //prevent rebooting if this loop takes too long
		}
		t = system_get_time() - t;
		//
		//compensate for "rand()" calculation
		t2 = system_get_time();
		volatile uint16_t Tmp;
		for(i=0;i<1000;i++){
			Tmp = RAND_0_TO_X(WLCD_WIDTH-1);
			Tmp = RAND_0_TO_X(WLCD_HEIGHT-1);
			Tmp = RAND_0_TO_X(WLCD_WIDTH-1);
			Tmp = RAND_0_TO_X(WLCD_HEIGHT-1);
		}
		t2 = system_get_time() - t2;
		//
		S.Color.u32t = WLCD_RGB_TO_COLOR(0xFF, 0xFF, 0xFF);
		S.X = DoneXOffs;
		S.Y = DoneYOffs;
		wlcd_text_draw("DONE", &S);
		//
		OS_DELAY_MS(1000);
		//
		//clear whole display (black) and show stats
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		S.Color.u32t = WLCD_RGB_TO_COLOR(0b01111000, 0b01111100, 0b11111000);
		S.X = 10;
		S.Y = 10;
		S.MaxW = WLCD_WIDTH-20;
		S.MaxH = WLCD_HEIGHT-20;
		S.WrapStyle = WLCD_WRAP_WORDS;
		ets_sprintf(Str, "1000 random lines on display %dx%d took %d ms (compensated for \"rand()\" calculation)", WLCD_WIDTH, WLCD_HEIGHT, (t-t2)/1000);
		wlcd_text_draw(Str, &S);
		OS_DELAY_MS(5000);
		//
		//---- image draw / image speed test
		//
#if(WLCD_BPP==WLCD_16BPP)
		wfof_get_file_data_fast(WFOF_IDX_SMILEY_50X50_U16BPP, (uint32_t*)ImgData, 0, WFOF_SIZE_SMILEY_50X50_U16BPP);
#else
		wfof_get_file_data_fast(WFOF_IDX_SMILEY_50X50_U24BPP, (uint32_t*)ImgData, 0, WFOF_SIZE_SMILEY_50X50_U24BPP);
#endif
		//
		//clear whole display (black)
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		t = system_get_time();
		for(i=0;i<1000;i++){
			wlcd_img_draw(ImgData, RAND_0_TO_X(WLCD_WIDTH-1-50), RAND_0_TO_X(WLCD_HEIGHT-1-50));
			//
			if(i%50==0) system_soft_wdt_feed(); //prevent rebooting if this loop takes too long
		}
		t = system_get_time() - t;
		//
		S.Color.u32t = 0;
		S.X = DoneXOffs;
		S.Y = DoneYOffs;
		wlcd_text_draw("DONE", &S);
		//
		OS_DELAY_MS(1000);
		//
		//clear whole display (black) and show stats
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		S.Color.u32t = WLCD_RGB_TO_COLOR(0b11111000, 0b01111100, 0b01111000);
		S.X = 10;
		S.Y = 10;
		S.MaxW = WLCD_WIDTH-20;
		S.MaxH = WLCD_HEIGHT-20;
		S.WrapStyle = WLCD_WRAP_WORDS;
		ets_sprintf(Str, "1000 images (50x50 pixels, uncompressed image) took %d ms", t/1000);
		wlcd_text_draw(Str, &S);
		OS_DELAY_MS(5000);
		//
		//---- text draw / text speed test
		//
		//clear whole display (black)
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		ets_sprintf(Str, "This is a test of text drawing of 60 chars and with wrapping");
		t = system_get_time();
		for(i=0;i<100;i++){
			S.X = 10 + RAND_0_TO_X(10);
			S.Y = 10 + RAND_0_TO_X(100);
			S.MaxW = WLCD_WIDTH - 10 - S.X;
			S.MaxH = WLCD_HEIGHT - 10 - S.Y;
			S.Color.u32t = RAND_0_TO_X(0xFFFFFF);
			wlcd_text_draw(Str, &S);
			//
			if(i%50==0) system_soft_wdt_feed(); //prevent rebooting if this loop takes too long
		}
		t = system_get_time() - t;
		//
		S.Color.u32t = 0;
		S.X = DoneXOffs;
		S.Y = DoneYOffs;
		wlcd_text_draw("DONE", &S);
		//
		OS_DELAY_MS(1000);
		//
		//clear whole display (black) and show stats
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		S.Color.u32t = WLCD_RGB_TO_COLOR(0b11111000, 0b01111100, 0b11111000);
		S.X = 10;
		S.Y = 10;
		S.MaxW = WLCD_WIDTH-20;
		S.MaxH = WLCD_HEIGHT-20;
		S.WrapStyle = WLCD_WRAP_WORDS;
		ets_sprintf(Str, "100 text sentences of 60 letters with word wrapping took %d ms", t/1000);
		wlcd_text_draw(Str, &S);
		OS_DELAY_MS(5000);
		//
		//---- text / font test - code page 1250 test
		//
		//clear whole display (black)
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		S.Color.u32t = WLCD_RGB_TO_COLOR(0xFF, 0x5C, 0x20);
		S.X = 10;
		S.Y = 10;
		S.MaxW = WLCD_WIDTH-20;
		S.MaxH = WLCD_HEIGHT-20;
		S.WrapStyle = WLCD_WRAP_WORDS;
		wlcd_text_draw("This is a test of code page 1250 font text output:\n\nP°эЪernь ЮluЭouшk¤ k∙Є ·pьl ясbelskщ єdy.", &S);
		//
		OS_DELAY_MS(4000);
		//
		//clear whole display (black)
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		S.Color.u32t = WLCD_RGB_TO_COLOR(0xFF, 0xFF, 0x00);
		S.FontZoomAdd = 1;
		wlcd_text_draw("P°эЪernь ЮluЭouшk¤ k∙Є ·pьl ясbelskщ єdy.", &S);
		//
		OS_DELAY_MS(3000);
		//
		//clear whole display (black)
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		S.Y = 10;
		S.Color.u32t = WLCD_RGB_TO_COLOR(0x00, 0xFF, 0);
		S.FontZoomAdd = 0;
		S.FontIdx = 0;
		wlcd_text_draw("This is some text.", &S);
		//
		S.Y = 30;
		S.Color.u32t = WLCD_RGB_TO_COLOR(0x00, 0xFF, 0xFF);
		S.BoldAdd = 1;
		wlcd_text_draw("And this is the same font bolder.", &S);
		//
		S.Y = 50;
		S.Color.u32t = WLCD_RGB_TO_COLOR(0b11000000, 0b00111100, 0b11111000);
		S.HSpc = 5;
		wlcd_text_draw("We can also add horiz./vert. spacing.", &S);
		//
		S.Y = 75;
		S.Color.u32t = WLCD_RGB_TO_COLOR(0b11111000, 0b00111100, 0b01111000);
		S.FontZoomAdd = 1;
		S.BoldAdd = 0;
		S.HSpc = 0;
		wlcd_text_draw("Or zoom ...", &S);
		//
		S.Y = 105;
		S.Color.u32t = WLCD_RGB_TO_COLOR(0b10010000, 0b11111100, 0b01111000);
		S.FontZoomAdd = 2;
		S.HSpc = 0;
		wlcd_text_draw("ZOOM", &S);
		//
		S.Y = 140;
		S.Color.u32t = WLCD_RGB_TO_COLOR(0b01000000, 0b10000000, 0b11111000);
		S.FontZoomAdd = 0;
		S.FontIdx = 3;
		wlcd_text_draw("Different font\n0123456789", &S);
		//
		S.Y = 180;
		S.Color.u32t = WLCD_RGB_TO_COLOR(0xFF, 0xFF, 0x00);
		S.FontIdx = 2;
		wlcd_text_draw("And another different font (you can generate your own fonts)", &S);
		//
		OS_DELAY_MS(6000);
		//
		//---- read display data RAM back into buffer as WLCD image and use it to draw many copies of that image
		//
#ifndef WLCD_NO_READ
		//clear whole display (black)
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		for(i=0;i<50;i++){
			wlcd_line_draw(
				RAND_0_TO_X(WLCD_WIDTH-1), RAND_0_TO_X(WLCD_HEIGHT-1),
				RAND_0_TO_X(WLCD_WIDTH-1), RAND_0_TO_X(WLCD_HEIGHT-1),
				WLCD_RGB_TO_COLOR(0b01111000, 0b01111100, 0b01111000));
		}
		//
		S.Color.u32t = WLCD_RGB_TO_COLOR(0b00001000, 0b11110100, 0b01111000);
		S.X = 10;
		S.Y = 10;
		S.MaxW = WLCD_WIDTH-20;
		S.MaxH = WLCD_HEIGHT-20;
		S.WrapStyle = WLCD_WRAP_WORDS;
		wlcd_text_draw("It's also possible to read LCD memory into buffer - creating a WLCD image (uncompressed stream of pixels) and re-use this image", &S);
		//
		wlcd_line_draw(10   , 10   , 10+29, 10   , 0xFFFFFF);
		wlcd_line_draw(10+29, 10   , 10+29, 10+29, 0xFFFFFF);
		wlcd_line_draw(10+29, 10+29, 10   , 10+29, 0xFFFFFF);
		wlcd_line_draw(10   , 10+29, 10   , 10   , 0xFFFFFF);
		//
		uint32_t Ret = wlcd_img_get((uint32_t*)ImgData, 10, 10, 30, 30);
		for(i=0;i<WLCD_WIDTH-30;i+=35){
			wlcd_img_draw(ImgData, i, 100);
		}
		//
		OS_DELAY_MS(8000);
#endif
		//
		//---- logo, github address
		//
		//clear whole display (black)
		wlcd_rect_fill(0,0, WLCD_WIDTH, WLCD_HEIGHT, 0);
		//
		//demo image
#if(WLCD_BPP==WLCD_16BPP)
		wfof_get_file_data_fast(WFOF_IDX_WLCD_DEMO_16BPP, (uint32_t*)ImgData, 0, WFOF_SIZE_WLCD_DEMO_16BPP);
#else
		wfof_get_file_data_fast(WFOF_IDX_WLCD_DEMO_24BPP, (uint32_t*)ImgData, 0, WFOF_SIZE_WLCD_DEMO_24BPP);
#endif
		wlcd_img_draw(ImgData, (WLCD_WIDTH-wlcd_img_get_width(ImgData))/2, ((WLCD_HEIGHT-wlcd_img_get_height(ImgData))/2)-20);
		//
		S.Color.u32t = WLCD_RGB_TO_COLOR(0xFF, 0x5C, 0x58);
		S.FontIdx = 1;
		S.X = 10;
		S.Y = WLCD_HEIGHT-40;
		S.MaxW = WLCD_WIDTH-20;
		S.MaxH = 40;
		S.VSpc = 4;
		S.WrapStyle = WLCD_WRAP_WORDS;
		wlcd_text_draw("https://github.com/wdim0/esp8266_fast_lcd_driver_hspi", &S);
		//
		OS_DELAY_MS(6000);
		//
		//----
		//
	}
	//
	//clean-up (yes, we never get here .. but it's always good to keep things structured)
	os_free(Str);
	os_free(ImgData);
}