form fieldset{background:#fff;border:0 none;border-radius:5px;box-shadow:0 0 15px 1px rgba(0,0,0,.4);padding:20px 30px;box-sizing:border-box}
form input{padding:15px;border:1px solid #ccc;border-radius:3px;margin-bottom:10px;width:100%;box-sizing:border-box;font-family:montserrat;color:#2C3E50;font-size:13px}
form .action-button{border:0 none;border-radius:3px;cursor:pointer;}
ENDUSER_SETUP_ERROR("enduser_setup_http_start failed. Couldn't create connection, already listening for that connection.",ENDUSER_SETUP_ERR_SOCKET_ALREADY_OPEN,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR("http_start failed. Couldn't create connection, already listening for that connection.",ENDUSER_SETUP_ERR_SOCKET_ALREADY_OPEN,ENDUSER_SETUP_ERR_FATAL);
}
}
elseif(err==ESPCONN_MEM)
elseif(err==ESPCONN_MEM)
{
{
ENDUSER_SETUP_ERROR("enduser_setup_http_start failed. Couldn't create connection, out of memory.",ENDUSER_SETUP_ERR_OUT_OF_MEMORY,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR("http_start failed. Couldn't create connection, out of memory.",ENDUSER_SETUP_ERR_OUT_OF_MEMORY,ENDUSER_SETUP_ERR_FATAL);
}
}
elseif(err==ESPCONN_ARG)
elseif(err==ESPCONN_ARG)
{
{
ENDUSER_SETUP_ERROR("enduser_setup_http_start failed. Can't find connection from espconn argument",ENDUSER_SETUP_ERR_CONNECTION_NOT_FOUND,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR("http_start failed. Can't find connection from espconn argument",ENDUSER_SETUP_ERR_CONNECTION_NOT_FOUND,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR("enduser_setup_http_start failed. Unable to set TCP timeout.",ENDUSER_SETUP_ERR_CONNECTION_NOT_FOUND,ENDUSER_SETUP_ERR_NONFATAL|ENDUSER_SETUP_ERR_NO_RETURN);
ENDUSER_SETUP_ERROR("http_start failed. Unable to set TCP timeout.",ENDUSER_SETUP_ERR_CONNECTION_NOT_FOUND,ENDUSER_SETUP_ERR_NONFATAL|ENDUSER_SETUP_ERR_NO_RETURN);
ENDUSER_SETUP_ERROR("enduser_setup_http_start failed. Unable to allocate memory for HTTP payload.",ENDUSER_SETUP_ERR_OUT_OF_MEMORY,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR("http_start failed. Unable to allocate memory for HTTP payload.",ENDUSER_SETUP_ERR_OUT_OF_MEMORY,ENDUSER_SETUP_ERR_FATAL);
}
}
return0;
return0;
...
@@ -618,7 +967,7 @@ static int enduser_setup_http_start(void)
...
@@ -618,7 +967,7 @@ static int enduser_setup_http_start(void)
ENDUSER_SETUP_ERROR_VOID("enduser_setup_dns_recv_callback failed. Unable to get interface IP.",ENDUSER_SETUP_ERR_UNKOWN_ERROR,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR_VOID("dns_recv_callback failed. Unable to get interface IP.",ENDUSER_SETUP_ERR_UNKOWN_ERROR,ENDUSER_SETUP_ERR_FATAL);
}
}
char*dns_reply=(char*)c_malloc(dns_reply_len);
char*dns_reply=(char*)c_malloc(dns_reply_len);
if(dns_reply==NULL)
if(dns_reply==NULL)
{
{
ENDUSER_SETUP_ERROR_VOID("enduser_setup_dns_recv_callback failed. Failed to allocate memory.",ENDUSER_SETUP_ERR_OUT_OF_MEMORY,ENDUSER_SETUP_ERR_NONFATAL);
ENDUSER_SETUP_ERROR_VOID("dns_recv_callback failed. Failed to allocate memory.",ENDUSER_SETUP_ERR_OUT_OF_MEMORY,ENDUSER_SETUP_ERR_NONFATAL);
ENDUSER_SETUP_ERROR_VOID("enduser_setup_dns_recv_callback failed. Unable to get IP of UDP sender.",ENDUSER_SETUP_ERR_CONNECTION_NOT_FOUND,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR_VOID("dns_recv_callback failed. Unable to get IP of UDP sender.",ENDUSER_SETUP_ERR_CONNECTION_NOT_FOUND,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR_VOID("enduser_setup_dns_recv_callback failed. Failed to allocate memory for send.",ENDUSER_SETUP_ERR_OUT_OF_MEMORY,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR_VOID("dns_recv_callback failed. Failed to allocate memory for send.",ENDUSER_SETUP_ERR_OUT_OF_MEMORY,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR("enduser_setup_dns_start failed. Appears to already be started (espconn_dns_udp != NULL).",ENDUSER_SETUP_ERR_UNKOWN_ERROR,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR("dns_start failed. Appears to already be started (espconn_dns_udp != NULL).",ENDUSER_SETUP_ERR_UNKOWN_ERROR,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR("enduser_setup_dns_start failed. Couldn't create connection, already listening for that connection.",ENDUSER_SETUP_ERR_SOCKET_ALREADY_OPEN,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR("dns_start failed. Couldn't create connection, already listening for that connection.",ENDUSER_SETUP_ERR_SOCKET_ALREADY_OPEN,ENDUSER_SETUP_ERR_FATAL);
}
}
elseif(err==ESPCONN_MEM)
elseif(err==ESPCONN_MEM)
{
{
ENDUSER_SETUP_ERROR("enduser_setup_dns_start failed. Couldn't create connection, out of memory.",ENDUSER_SETUP_ERR_OUT_OF_MEMORY,ENDUSER_SETUP_ERR_FATAL);
ENDUSER_SETUP_ERROR("dns_start failed. Couldn't create connection, out of memory.",ENDUSER_SETUP_ERR_OUT_OF_MEMORY,ENDUSER_SETUP_ERR_FATAL);
@@ -6,6 +6,23 @@ This module provides a simple way of configuring ESP8266 chips without using a s
...
@@ -6,6 +6,23 @@ This module provides a simple way of configuring ESP8266 chips without using a s
After running [`enduser_setup.start()`](#enduser_setupstart) a portal like the above can be accessed through a wireless network called SetupGadget_XXXXXX. The portal is used to submit the credentials for the WiFi of the enduser.
After running [`enduser_setup.start()`](#enduser_setupstart) a portal like the above can be accessed through a wireless network called SetupGadget_XXXXXX. The portal is used to submit the credentials for the WiFi of the enduser.
After an IP address has been successfully obtained this module will stop as if [`enduser_setup.stop()`](#enduser_setupstop) had been called.
After an IP address has been successfully obtained this module will stop as if [`enduser_setup.stop()`](#enduser_setupstop) had been called.
## enduser_setup.manual()
Controls whether manual AP configuration is used.
By default the `enduser_setup` module automatically configures an open access point when starting, and stops it when the device has been successfully joined to a WiFi network. If manual mode has been enabled, neither of this is done. The device must be manually configured for `wifi.SOFTAP` mode prior to calling `enduser_setup.start()`. Additionally, the portal is not stopped after the device has successfully joined to a WiFi network.
Most importantly, *the `onConfigured()` callback is not supported in manual mode*. This limitation may disappear in the future.
#### Syntax
`enduser_setup.manual([on_off])`
#### Parameters
-`on_off` a boolean value indicating whether to use manual mode; if not given, the function only returns the current setting.
#### Returns
The current setting, true if manual mode is enabled, false if it is not.