Skip to content

Commit 4144c13

Browse files
committed
pushing changes for first release
1 parent 6c6cd32 commit 4144c13

File tree

4 files changed

+35
-27
lines changed

4 files changed

+35
-27
lines changed

wifi_manager/main/code.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ $(function() {
5454

5555
function performConnect(){
5656

57-
$("#loadingButton").prop("disabled",true);
57+
$( "#loadingButton" ).prop("disabled",true);
58+
$( "#buttons" ).slideUp( "fast", function() {});
59+
$( "#login-data" ).slideUp( "fast", function() {});
60+
$( "#loading" ).slideDown( "fast", function() {});
61+
$( "#app h2" ).text("Connecting to " + selectedSSID + "...");
5862

5963
//stop refreshing wifi list
6064
if(refreshAPInterval != null){
@@ -82,19 +86,7 @@ $(function() {
8286
}
8387

8488
$(document).on("click", "#join", function() {
85-
86-
//disable buttons
87-
//$("#join").prop("disabled", true);
88-
//$("#join").prop("disabled", true);
89-
$( "#buttons" ).slideUp( "fast", function() {});
90-
$( "#login-data" ).slideUp( "fast", function() {});
91-
$( "#loading" ).slideDown( "fast", function() {});
92-
$( "#app h2" ).text("Connecting to " + selectedSSID + "...");
93-
9489
performConnect();
95-
96-
97-
9890
});
9991

10092

@@ -108,9 +100,15 @@ $(function() {
108100
function check_if_connected(){
109101
$.getJSON( "/status", function( data ) {
110102
if(data.ip.length > 0){
111-
//alert(data.ip);
112103

113-
$("#loadingButton").prop("disabled",false);
104+
$( "#app h2" ).text("Connected to " + selectedSSID + "!");
105+
$( "#ip").html(data.ip);
106+
$( "#netmask").html(data.netmask);
107+
$( "#gw").html(data.gw);
108+
109+
$( "#status-wrap").slideDown( "fast", function() {});
110+
$( "#loading" ).slideUp( "fast", function() {});
111+
$( "#loadingButton").prop("disabled",false);
114112
if(checkStatusInterval != null){
115113
clearInterval(checkStatusInterval);
116114
checkStatusInterval = null;

wifi_manager/main/index.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,23 @@ <h2>Choose a network...</h2>
1919
</div>
2020

2121
<div id="status">
22-
<div id="ip" style="text-align:center">
22+
<div id="status-wrap">
2323
<strong>
24-
IP Address: 192.168.1.47<br />
25-
Subnet Mask: 192.168.1.47<br />
26-
Gateway: 192.168.1.47<br />
24+
IP Address: <span id="ip"></span><br />
25+
Subnet Mask: <span id="netmask"></span><br />
26+
Gateway: <span id="gw"></span><br />
2727
</strong>
28+
<div class="b1w">
29+
<input id="loadingButton" type="button" value="OK" />
30+
</div>
2831
</div>
2932
<div id="loading">
3033
<div class="spinner"><div class="double-bounce1"></div><div class="double-bounce2"></div></div>
3134
</div>
32-
<input id="loadingButton" type="button" value="OK" />
3335
</div>
3436

3537

36-
<div id="buttons">
38+
<div id="buttons" class="b1w">
3739
<input id="join" type="button" value="Join" />
3840
<input id="cancel" type="button" value="Cancel"/>
3941
</div>

wifi_manager/main/style.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ label{
7070
input[type="button"]{
7171
width:100px;
7272
padding:5px;
73-
margin:15px;
7473
text-align:center;
7574
display:block;
7675
}
@@ -82,9 +81,11 @@ input[type="button"]{
8281
margin: 0 auto;
8382
}
8483

85-
#buttons{
84+
.b1w{
8685
border:1px solid #fff;
86+
padding:15px;
8787
}
88+
8889
#join{
8990
float:right;
9091
}
@@ -94,6 +95,11 @@ input[type="button"]{
9495
display:none;
9596
}
9697

98+
#status-wrap{
99+
display:none;
100+
text-align:center
101+
}
102+
97103
#credits{
98104
display:none;
99105
background-color:#fff;

wifi_manager/main/wifi_manager.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ void wifi_manager_generate_ip_info_json(){
138138
ip4addr_ntoa(&ip_info.ip),
139139
ip4addr_ntoa(&ip_info.netmask),
140140
ip4addr_ntoa(&ip_info.gw));
141+
printf("%s", ip_info_json);
141142
}
142143
else{
143144
strcpy(ip_info_json, "{}\n");
@@ -381,6 +382,7 @@ void wifi_manager( void * pvParameters ){
381382
xEventGroupWaitBits(wifi_manager_event_group, WIFI_MANAGER_AP_STARTED, pdFALSE, pdTRUE, portMAX_DELAY );
382383

383384

385+
/*
384386
wifi_config_t sta_config = {
385387
.sta = {
386388
.ssid = "a0308",
@@ -398,7 +400,7 @@ void wifi_manager( void * pvParameters ){
398400
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
399401
printf("IP Address: %s\n", ip4addr_ntoa(&ip_info.ip));
400402
printf("Subnet mask: %s\n", ip4addr_ntoa(&ip_info.netmask));
401-
printf("Gateway: %s\n", ip4addr_ntoa(&ip_info.gw));
403+
printf("Gateway: %s\n", ip4addr_ntoa(&ip_info.gw));*/
402404

403405

404406

@@ -409,7 +411,7 @@ void wifi_manager( void * pvParameters ){
409411
//keep scanning wifis until someone tries to connect to an AP
410412
EventBits_t uxBits;
411413
uint8_t tick = 0;
412-
while(1){
414+
for(;;){
413415

414416
/* someone tries to make a connection? if so: connect! */
415417
uxBits = xEventGroupWaitBits(wifi_manager_event_group, WIFI_MANAGER_REQUEST_STA_CONNECT_BIT, pdFALSE, pdTRUE, 100 / portTICK_PERIOD_MS );
@@ -465,13 +467,13 @@ void wifi_manager( void * pvParameters ){
465467

466468
/* perform wifi scan */
467469
if(tick == 0){
468-
//safe guard against overflow
470+
/* safe guard against overflow */
469471
if(ap_num > MAX_AP_NUM) ap_num = MAX_AP_NUM;
470472

471473
ESP_ERROR_CHECK(esp_wifi_scan_start(&scan_config, true));
472474
ESP_ERROR_CHECK(esp_wifi_scan_get_ap_records(&ap_num, accessp_records));
473475

474-
//make sure the http server isn't trying to access the list while it gets refreshed
476+
/* make sure the http server isn't trying to access the list while it gets refreshed */
475477
if(wifi_manager_lock_json_buffer( ( TickType_t ) 10 )){
476478
wifi_manager_generate_acess_points_json();
477479
wifi_manager_unlock_json_buffer();

0 commit comments

Comments
 (0)