add better control for disabling flags on the screen for esp8266 wifi configuration
This commit is contained in:
parent
577a0e2d36
commit
f844317327
7 changed files with 66 additions and 40 deletions
|
@ -316,6 +316,7 @@ int ICACHE_FLASH_ATTR issue_command(char * buffer, int retsize, char *pusrdata,
|
|||
else
|
||||
{
|
||||
struct station_config sc;
|
||||
ets_memset( &sc, 0, sizeof( sc ) );
|
||||
wifi_station_get_config( &sc );
|
||||
if( sc.bssid_set )
|
||||
ets_sprintf( macmap, MACSTR, MAC2STR( sc.bssid ) );
|
||||
|
@ -326,8 +327,18 @@ int ICACHE_FLASH_ATTR issue_command(char * buffer, int retsize, char *pusrdata,
|
|||
}
|
||||
break;
|
||||
case 'X': case 'x':
|
||||
buffend += ets_sprintf( buffend, "WX%d", wifi_station_get_rssi() );
|
||||
{
|
||||
int rssi = wifi_station_get_rssi();
|
||||
if( rssi >= 0 )
|
||||
{
|
||||
buffend += ets_sprintf( buffend, "WX-" );
|
||||
}
|
||||
else
|
||||
{
|
||||
buffend += ets_sprintf( buffend, "WX%d", wifi_station_get_rssi() );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'S': case 's':
|
||||
{
|
||||
int i, r;
|
||||
|
@ -449,6 +460,33 @@ void ICACHE_FLASH_ATTR issue_command_udp(void *arg, char *pusrdata, unsigned sho
|
|||
}
|
||||
}
|
||||
|
||||
void ICACHE_FLASH_ATTR CSPreInit()
|
||||
{
|
||||
int opmode = wifi_get_opmode();
|
||||
printf( "Opmode: %d\n", opmode );
|
||||
if( opmode == 1 )
|
||||
{
|
||||
struct station_config sc;
|
||||
wifi_station_get_config(&sc);
|
||||
printf( "Station mode: \"%s\":\"%s\" (bssid_set:%d)\n", sc.ssid, sc.password, sc.bssid_set );
|
||||
if( sc.ssid[0] == 0 && !sc.bssid_set )
|
||||
{
|
||||
wifi_set_opmode( 2 );
|
||||
opmode = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
wifi_station_connect();
|
||||
}
|
||||
}
|
||||
if( opmode == 2 )
|
||||
{
|
||||
struct softap_config sc;
|
||||
wifi_softap_get_config(&sc);
|
||||
printf( "SoftAP mode: \"%s\":\"%s\"\n", sc.ssid, sc.password );
|
||||
}
|
||||
}
|
||||
|
||||
void ICACHE_FLASH_ATTR CSInit()
|
||||
{
|
||||
pUdpServer = (struct espconn *)os_zalloc(sizeof(struct espconn));
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
int ICACHE_FLASH_ATTR issue_command(char * retdata, int retsize, char *pusrdata, unsigned short len);
|
||||
|
||||
//Includes UDP Control + HTTP Interfaces
|
||||
void ICACHE_FLASH_ATTR CSPreInit();
|
||||
void ICACHE_FLASH_ATTR CSInit();
|
||||
void ICACHE_FLASH_ATTR CSTick( int slowtick );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue