Ejemplo n.º 1
0
void ICACHE_FLASH_ATTR node_group_init(void)
{
	int ret = 0;

	if (esp_now_init() == 0) {
		os_printf("esp_now init ok\n");
		esp_now_register_recv_cb(simple_cb);

		u8 ch = wifi_get_channel();
		os_printf("current channel is: %d\n", ch);

		esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER);
		esp_now_add_peer(ctrl_mac, ESP_NOW_ROLE_CONTROLLER, ch, key, 16);
		esp_now_add_peer(slave_mac, ESP_NOW_ROLE_SLAVE, ch, key, 16);

	} else {
		os_printf("esp_now init failed\n");
	}
}
Ejemplo n.º 2
0
void ESP8266WiFiClass::printDiag(Print& p)
{
    const char* modes[] = {"NULL", "STA", "AP", "STA+AP"};
    p.print("Mode: ");
    p.println(modes[wifi_get_opmode()]);

    const char* phymodes[] = {"", "B", "G", "N"};
    p.print("PHY mode: ");
    p.println(phymodes[(int) wifi_get_phy_mode()]);

    p.print("Channel: ");
    p.println(wifi_get_channel());

    p.print("AP id: ");
    p.println(wifi_station_get_current_ap_id());

    p.print("Status: ");
    p.println(wifi_station_get_connect_status());

    p.print("Auto connect: ");
    p.println(wifi_station_get_auto_connect());

    static struct station_config conf;
    wifi_station_get_config(&conf);

    const char* ssid = reinterpret_cast<const char*>(conf.ssid);
    p.print("SSID (");
    p.print(strlen(ssid));
    p.print("): ");
    p.println(ssid);

    const char* passphrase = reinterpret_cast<const char*>(conf.password);
    p.print("Passphrase (");
    p.print(strlen(passphrase));
    p.print("): ");
    p.println(passphrase);

    p.print("BSSID set: ");
    p.println(conf.bssid_set);

}
Ejemplo n.º 3
0
// print various Wifi information into json buffer
int ICACHE_FLASH_ATTR printWifiInfo(char *buff) {
  int len;

  struct station_config stconf;
  wifi_station_get_config(&stconf);

  uint8_t op = wifi_get_opmode() & 0x3;
  char *mode = wifiMode[op];
  char *status = "unknown";
  int st = wifi_station_get_connect_status();
  if (st >= 0 && st < sizeof(connStatuses)) status = connStatuses[st];
  int p = wifi_get_phy_mode();
  char *phy = wifiPhy[p&3];
  char *warn = wifiWarn[op];
  sint8 rssi = wifi_station_get_rssi();
  if (rssi > 0) rssi = 0;
  uint8 mac_addr[6];
  wifi_get_macaddr(0, mac_addr);
  uint8_t chan = wifi_get_channel();

  len = os_sprintf(buff,
    "\"mode\": \"%s\", \"modechange\": \"%s\", \"ssid\": \"%s\", \"status\": \"%s\", \"phy\": \"%s\", "
    "\"rssi\": \"%ddB\", \"warn\": \"%s\", \"mac\":\"%02x:%02x:%02x:%02x:%02x:%02x\", \"chan\":%d",
    mode, MODECHANGE, (char*)stconf.ssid, status, phy, rssi, warn,
    mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5], chan);

  struct ip_info info;
  if (wifi_get_ip_info(0, &info)) {
    len += os_sprintf(buff+len, ", \"ip\": \"%d.%d.%d.%d\"", IP2STR(&info.ip.addr));
    len += os_sprintf(buff+len, ", \"netmask\": \"%d.%d.%d.%d\"", IP2STR(&info.netmask.addr));
    len += os_sprintf(buff+len, ", \"gateway\": \"%d.%d.%d.%d\"", IP2STR(&info.gw.addr));
    len += os_sprintf(buff+len, ", \"hostname\": \"%s\"", flashConfig.hostname);
  } else {
    len += os_sprintf(buff+len, ", \"ip\": \"-none-\"");
  }
  len += os_sprintf(buff+len, ", \"staticip\": \"%d.%d.%d.%d\"", IP2STR(&flashConfig.staticip));
  len += os_sprintf(buff+len, ", \"dhcp\": \"%s\"", flashConfig.staticip > 0 ? "off" : "on");

  return len;
}
/**
 * Return the current channel associated with the network
 * @return channel (1-13)
 */
int32_t ESP8266WiFiGenericClass::channel(void) {
    return wifi_get_channel();
}
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());
}
Ejemplo n.º 6
0
int http_wifi_api_get_info(http_connection *c)
{
    CGI_WIFI_DBG("http_wifi_api_get_info\n");

    //wait for whole body
    if(c->state <HTTPD_STATE_BODY_END) {
        return HTTPD_CGI_MORE;
    }

    api_cgi_status * status = c->cgi.data;

    if(status==NULL) { //first call, send headers

        status = (api_cgi_status*)os_malloc(sizeof(api_cgi_status));
        status->state=1;
        c->cgi.data=status;

        http_SET_HEADER(c,HTTP_CONTENT_TYPE,JSON_CONTENT_TYPE);
        http_response_OK(c);

        return HTTPD_CGI_MORE;
    }
    else if(status->state==1)
    {
        //json data
        char mac[20];
        wifi_station_get_config(&wifi_status.station_config);
        char *wifistatus = "unknown";
        uint8_t c_status = wifi_station_get_connect_status();
        if (c_status >= 0 && c_status < sizeof(connStatuses)) wifistatus = connStatuses[c_status];
        int p = wifi_get_phy_mode();
        char *phy = wifiPhy[p&3];
        sint8 rssi = wifi_station_get_rssi();
        if (rssi > 0) rssi = 0;
        uint8_t op = wifi_get_opmode() & 0x3;
        char *warn = wifiWarn[op];
        uint8 mac_addr[6];
        wifi_get_macaddr(0, mac_addr);
        uint8_t chan = wifi_get_channel();

        char *hostname = wifi_station_get_hostname();
        os_sprintf(mac,"%02x:%02x:%02x:%02x:%02x:%02x", mac_addr[0], mac_addr[1],
                   mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);

        cJSON *root = cJSON_CreateObject();
        cJSON_AddNumberToObject(root,"mode",wifi_get_opmode());
        cJSON_AddStringToObject(root,"modechange", MODECHANGE);
        cJSON_AddStringToObject(root,"ssid", (const char *)wifi_status.station_config.ssid);
        cJSON_AddStringToObject(root,"status", (const char *)wifistatus);
        cJSON_AddStringToObject(root,"phy", (const char *)phy);
        cJSON_AddNumberToObject(root,"rssi", rssi);
        cJSON_AddStringToObject(root,"warn", (const char *)warn);
        cJSON_AddStringToObject(root,"mac", (const char *)mac);
        cJSON_AddNumberToObject(root,"chan", chan);
        cJSON_AddStringToObject(root,"hostname", (const char *)hostname);
        cJSON_AddStringToObject(root,"domain", (const char *)INTERFACE_DOMAIN);

        // got ip
        if(c_status==5)
        {
            struct ip_info ip;
            wifi_get_ip_info(0x0,&ip);
            char *ip_str = (char*)ipaddr_ntoa(&ip.ip);
            cJSON_AddStringToObject(root,"ip",ip_str);
        }
        else {
            cJSON_AddStringToObject(root,"ip","");
        }

        http_write_json(c,root);
        cJSON_Delete(root);

        status->state=99;
        return HTTPD_CGI_MORE;
    }
    else
    {
        os_free(c->cgi.data);
        return HTTPD_CGI_DONE;
    }
}
Ejemplo n.º 7
0
void ICACHE_FLASH_ATTR
sp_LightPairState(void)
{

#if 1
    switch(light_state){
        case (SP_LIGHT_IDLE):
            os_printf("status:SP_LIGHT_IDLE\n");
			//pair start command, correct
            if(USER_PBULIC_BUTTON_INFO==buttonPairingInfo.simple_pair_state){
                os_printf("statue:Get button Info,next wait button request\n");
				sp_LightPairTimerStart();
                sp_LightPairAccept();
                light_state=SP_LIGHT_WAIT_BUTTON_REQUEST;
				light_shadeStart(HINT_WHITE,500,3,1,NULL);
            }
			//exception
            else{
                light_state=SP_LIGHT_ERROR_HANDLE;
				light_hint_stop(HINT_RED);
                os_printf("buttonPairingInfo.simple_pair_state=%d\n",buttonPairingInfo.simple_pair_state);
				sp_LightPairState();
            }
            break;
        case (SP_LIGHT_WAIT_BUTTON_REQUEST):
            os_printf("status:SP_LIGHT_WAIT_BUTTON_REQUEST\n");
			light_shadeStart(HINT_GREEN,500,3,0,NULL);
			
			//receive button pair request, send req to phone
            if(LIGHT_RECV_BUTTON_REQUSET==buttonPairingInfo.simple_pair_state){
                os_printf("statue:Get button request,next wait user permit or refuse\n"); 
                sp_LightPairRequestPermission();
                light_state=SP_LIGHT_WAIT_USER_INDICATE_PERMIT;
            }
			//receive pair start command again before timeout , right now, restart state machine
			else if(USER_PBULIC_BUTTON_INFO==buttonPairingInfo.simple_pair_state){
                os_printf("statue:Get button Info,restart state machine,wait button request\n");
				sp_LightPairTimerStart();
                sp_LightPairAccept();
                light_state=SP_LIGHT_WAIT_BUTTON_REQUEST;
            }
			//error if other states
			else{
                //simple_pair_deinit();
                light_state=SP_LIGHT_ERROR_HANDLE;
				light_hint_stop(HINT_RED);
                os_printf("err in SP_LIGHT_WAIT_BUTTON_REQUEST ;simple_pair_state=%d\n",buttonPairingInfo.simple_pair_state);
				sp_LightPairState();
            }
            break;
        case (SP_LIGHT_WAIT_USER_INDICATE_PERMIT):
			light_shadeStart(HINT_BLUE,500,3,0,NULL);
            os_printf("status:SP_LIGHT_WAIT_USER_INDICATE_PERMIT\n");
			//phone user permit pairing
            if(USER_PERMIT_SIMPLE_PAIR==buttonPairingInfo.simple_pair_state){
                os_printf("statue:User permit simple pair,next wait simple result\n"); 
				sp_PairedDevRmAll(&PairedDev);//
                sp_LightPairStart();
                light_state=SP_LIGHT_WAIT_SIMPLE_PAIR_RESULT;
            }
			//phone user refuse pairing, END
			else if(USER_REFUSE_SIMPLE_PAIR==buttonPairingInfo.simple_pair_state){
                os_printf("statue:User refuse simple pair,state clear\n");
                //check state
                sp_LightPairRefuse();
                //light_state=SP_LIGHT_IDLE;
                //buttonPairingInfo.simple_pair_state=LIGHT_PAIR_IDLE;
                light_state = SP_LIGHT_END;
				light_shadeStart(HINT_RED,500,2,0,NULL);
				sp_LightPairState();
				
            }
			//exceptions
			else{
                //simple_pair_deinit();
                light_state=SP_LIGHT_ERROR_HANDLE;
				light_hint_stop(HINT_RED);
                os_printf("buttonPairingInfo.simple_pair_state=%d\n",buttonPairingInfo.simple_pair_state);
				sp_LightPairState();
            }
            break;
        case (SP_LIGHT_WAIT_SIMPLE_PAIR_RESULT):
            os_printf("status:SP_LIGHT_WAIT_SIMPLE_PAIR_RESULT\n");
			//pairing finished , END
            if(LIGHT_SIMPLE_PAIR_SUCCED==buttonPairingInfo.simple_pair_state){
                os_printf("status:sp_LightPairSucced\n");  
				light_shadeStart(HINT_WHITE,500,2,0,NULL);

				//1.get key
				//buttonPairingInfo.espnowKey
				//2.add peer and save
            	int res = esp_now_add_peer((uint8*)(buttonPairingInfo.button_mac), (uint8)ESP_NOW_ROLE_CONTROLLER,(uint8)wifi_get_channel(), (uint8*)(buttonPairingInfo.espnowKey), (uint8)ESPNOW_KEY_LEN);
            	os_printf("INIT RES: %d ; MAC:"MACSTR"\r\n",res,MAC2STR(((uint8*)(buttonPairingInfo.button_mac))));
				//3.save
                sp_AddPairedDev(&PairedDev,buttonPairingInfo.button_mac,buttonPairingInfo.espnowKey,wifi_get_channel());
                sp_DispPairedDev(&PairedDev);

                //simple_pair_deinit();//check
                //light_state=SP_LIGHT_IDLE;
                //buttonPairingInfo.simple_pair_state=LIGHT_PAIR_IDLE;
                sp_LightPairReportResult(true);
				light_state = SP_LIGHT_END;
				sp_LightPairState();
            }
			//pairing failed , END
			else if(LIGHT_SIMPLE_PAIR_FAIL==buttonPairingInfo.simple_pair_state){
                os_printf("status:sp_LightPairFail\n");
                //simple_pair_deinit();//check
                //light_state=SP_LIGHT_IDLE;
                //buttonPairingInfo.simple_pair_state=LIGHT_PAIR_IDLE;
                sp_LightPairReportResult(false);
				light_state = SP_LIGHT_END;
				light_hint_stop(HINT_RED);
				sp_LightPairState();
            }
			//exception
			else{
                simple_pair_deinit();
				light_hint_stop(HINT_RED);
                light_state=SP_LIGHT_ERROR_HANDLE;
                os_printf("buttonPairingInfo.simple_pair_state=%d\n",buttonPairingInfo.simple_pair_state);
				sp_LightPairState();
            }
            break; 
			
		case (SP_LIGHT_ERROR_HANDLE):
			os_printf("status:simpaire in Err!!!\r\nBACK TO IDLE\r\n"); 
			light_hint_stop(HINT_RED);
        case (SP_LIGHT_END):
			//reset state, deinit simplepair, stop tout timer
			sp_LightPairTimerStop();
			simple_pair_deinit();
			light_state=SP_LIGHT_IDLE;
			buttonPairingInfo.simple_pair_state=LIGHT_PAIR_IDLE;
			sp_PairedDevLoadAll(&PairedDev);
			break;
			  
        default:
            os_printf("status:unsafe param: %d\n",light_state);
            break;
    }

#endif
}
Ejemplo n.º 8
0
/**
 @brief test task
  Runs corrected cube demo from Sem
  Optionally wireframe Earh viewer
 @return void
*/
LOCAL void user_task(void)
{
	uint32_t time1,time2;
	uint8_t red, blue,green;
	long timer = 0;
	uint16 system_adc_read(void);
	extern uint8_t ip_msg[];
	time_t sec;
	char buffer[256];


	

#ifdef WIRECUBE
	V.x = degree;
	V.y = degree;
	V.z = degree;
// Cube points were defined with sides of 1.0 
// We want a scale of +/- w/2
	wire_draw(windemo, cube_points, cube_edges, &V, windemo->w/2, windemo->h/2, dscale, 0);
	//wire_draw(windemo, cube_points, cube_edges, &V, windemo->w/2, windemo->h/2, dscale, 0);
#endif

#ifdef CIRCLE
	rad = dscale; // +/- 90
    tft_drawCircle(windemo, windemo->w/2, windemo->h/2, rad ,0);
	Display bounding circle that changes color around the cube
	if(dscale_inc < 0.0)
	{
		red = 255;
		blue = 0;
		green = 0;
	}
	else
	{
		red = 0;
		blue = 255;
		green = 0;
	}
	// RGB - YELLOW
    tft_drawCircle(windemo, windemo->w/2, windemo->h/2, dscale, tft_color565(red,green,blue));
#endif

    degree += deg_inc;
    dscale += dscale_inc;

	if(degree <= -360)
		deg_inc = 4;
	if(degree >= 360)
		deg_inc = -4;

    if(dscale < dscale_max/2)
	{
	   dscale_inc = -dscale_inc;
	}
    if(dscale > dscale_max)
	{
	   dscale_inc = -dscale_inc;
	}


#ifdef WIRECUBE
	V.x = degree;
	V.y = degree;
	V.z = degree;
	//time1 = system_get_time();
	wire_draw(windemo, cube_points, cube_edges, &V, windemo->w/2, windemo->h/2, dscale, ILI9341_WHITE);
	//wire_draw(windemo, cube_points, cube_edges, &V, windemo->w/2, windemo->h/2, dscale, ILI9341_WHITE);
	//time2 = system_get_time();
#endif


// Get system voltage 33 = 3.3 volts
	adc_sum += system_adc_read();
	//adc_sum += system_get_vdd33();

	// FIXME atomic access
	if(++adc_count == 10)
	{
		voltage = ((double) adc_sum / 100.0); 
		adc_count = 0;
		adc_sum = 0;
	}

	// DEBUG_PRINTF("Degree: %d \r\n",(int)degree);
	// cube redraw count
	count += 1;
	tft_set_font(winstats,0);
	tft_setpos(winstats,ip_xpos,ip_ypos);
	tft_printf(winstats,"%-26s\n", ip_msg);
	if(!signal_loop--)
	{
		signal_loop = 100;
		tft_printf(winstats,"CH:%02d, DB:-%02d\n", 
			wifi_get_channel(),
			wifi_station_get_rssi());
		signal_loop = 0;
	}
	tft_setpos(winstats,xpos,ypos);
	tft_printf(winstats,"Heap: %d\n", system_get_free_heap_size());
	tft_printf(winstats,"Iter:% 9ld, %+7.2f\n", count, degree);
	
	// NTP state machine
	ntp_setup();

	// get current time
	time(&sec);

	tft_printf(winstats,"Volt:%2.2f\n%s\n", (float)voltage, ctime(&sec));
	
#ifdef NETWORK_TEST
	poll_network_message(wintest);
#endif

// Buffered get line uses interrupts and queues
	if(uart0_gets(buffer,255))
	{
		DEBUG_PRINTF("Command:%s\n",buffer);
		if(!fatfs_tests(buffer))
		{
			if(!user_tests(buffer))
			{
				DEBUG_PRINTF("unknow command: %s\n", buffer);
			}
		}
	}
}
Ejemplo n.º 9
0
// main task loop called by yield code
void user_loop(void)
{
	extern int connections;
	uint32_t time1,time2;
	long t;
#ifdef DISPLAY
	char time_tmp[32];
	uint8_t red, blue,green;
	int touched;
	uint16_t X,Y;
#endif

	// getinfo.ip.addr, getinfo.gw.addr, getinfo.netmask.addr
	struct ip_info getinfo;
	char *ptr;

	// ========================================================
	// Run all remaining tasks once every 1mS
	t = ms_read();
	if((t - last_time10) < 1U)
		return;
	last_time10 = t;
	// ========================================================
// Tasks that must run very fast , once every millisecond should be at the top

#ifdef ADF4351
	ADF4351_task();
#endif
#ifdef XPT2046
	XPT2046_task();
#endif

	// ========================================================
	// Only run every 50mS
	t = ms_read();
	if((t - last_time50) < 50U)
		return;
	last_time50 = t;
	// ========================================================

	user_tasks();

	// NTP state machine
	ntp_setup();


#ifdef DISPLAY
	#ifdef XPT2046
		if(tft_is_calibrated)
		{
			touched = tft_touch_key(master,(uint16_t *)&X, (uint16_t *)&Y);
			#if XPT2046_DEBUG
				if(touched)
					tft_printf(winmsg,"X:%d,Y:%d\n",(int)X,(int)Y);
			#endif
		}
	#endif

	#ifdef NETWORK_TEST
		servertest_message(winmsg);
	#endif

	#ifdef DEBUG_STATS
		#ifdef VOLTAGE_TEST
			#ifdef DEBUG_STATS
				// Do NOT run adc_read() every millisecond as system_adc_read() blocks WIFI 
				tft_set_textpos(wintop, 0,2);
				tft_printf(wintop,"Volt:%2.2f\n", (float)adc_read());
			#endif
		#endif // VOLTAGE_TEST

		count += 1;
		tft_set_textpos(wintop, 0,0);
		tft_set_font(wintop,0);
		tft_font_fixed(wintop);
		tft_printf(wintop,"Iter:% 10ld, %+7.2f\n", count, degree);
	#endif

	#ifdef CIRCLE
		rad = dscale; // +/- 90
		tft_drawCircle(wincube, wincube->w/2, wincube->h/2, rad ,wincube->bg);
		// RGB 
	#endif

	// reset cube to background
	#ifdef WIRECUBE
		V.x = degree;
		V.y = degree;
		V.z = degree;
		// Cube points were defined with sides of 1.0 
		// We want a scale of +/- w/2
		wire_draw(wincube, cube_points, cube_edges, &V, wincube->w/2, wincube->h/2, dscale, wincube->bg);
	#endif

	degree += deg_inc;
	dscale += dscale_inc;

	if(degree <= -360)
		deg_inc = 4;
	if(degree >= 360)
		deg_inc = -4;

	if(dscale < dscale_max/2)
	{
	   dscale_inc = -dscale_inc;
	}
	if(dscale > dscale_max)
	{
	   dscale_inc = -dscale_inc;
	}

	#ifdef WIRECUBE
		V.x = degree;
		V.y = degree;
		V.z = degree;
		wire_draw(wincube, cube_points, cube_edges, &V, wincube->w/2, wincube->h/2, dscale, ILI9341_WHITE);
	#endif

	#ifdef CIRCLE
		// Display bounding circle that changes color around the cube
		if(dscale_inc < 0.0)
		{
			red = 255;
			blue = 0;
			green = 0;
		}
		else
		{
			red = 0;
			blue = 0;
			green = 255;
		}
		rad = dscale; // +/- 90
		tft_drawCircle(wincube, wincube->w/2, wincube->h/2, rad, tft_RGBto565(red,green,blue));
	#endif
#endif	// DISPLAY

	// ========================================================
	// Tasks run only once every second go after this
	time(&sec);
	if(sec == seconds)
		return;
	seconds=sec;
	// ========================================================

#ifdef DISPLAY
	// ========================================================
	// TIME
	tft_set_textpos(winbottom, 0,0);
	//Tue May 17 18:56:01 2016
	strncpy(time_tmp,ctime(&sec),31);
	time_tmp[19] = 0;
	tft_printf(winbottom," %s", time_tmp);
	tft_cleareol(winbottom);
	tft_set_textpos(winbottom, 0,1);

	// ========================================================
	// CONNECTION status
	//tft_printf(winbottom," %s", ip_msg);
	// IP and disconnected connection state only
	if(wifi_get_ip_info(0, &getinfo))
		tft_printf(winbottom," %s", ipv4_2str(getinfo.ip.addr));
	else
		tft_printf(winbottom," Disconnected");
	tft_cleareol(winbottom);

	#ifdef DEBUG_STATS
		// ========================================================
		// HEAP size
		tft_set_textpos(wintop, 0,1);
		tft_printf(wintop,"Heap: %d, Conn:%d\n", 
		system_get_free_heap_size(), connections);
		
		// ========================================================
		// WIFI status
		tft_set_textpos(wintop, 0,3);
		tft_printf(wintop,"CH:%02d, DB:%+02d\n", 
		wifi_get_channel(),
		wifi_station_get_rssi());
	#endif	// DEBUG_STATS
#endif	//DISPLAY

}
Ejemplo n.º 10
0
int rthw_wifi_channel_get(void)
{
    int channel;
    wifi_get_channel(&channel);
    return channel;
}