Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
nexboot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
nexboot
Commits
db97d370
Commit
db97d370
authored
May 17, 2018
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Web server now working
parent
857abc55
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
nexboot.c
main/nexboot.c
+14
-4
No files found.
main/nexboot.c
View file @
db97d370
...
@@ -31,6 +31,7 @@ static EventGroupHandle_t wifi_event_group;
...
@@ -31,6 +31,7 @@ static EventGroupHandle_t wifi_event_group;
but we only care about one event - are we connected
but we only care about one event - are we connected
to the AP with an IP? */
to the AP with an IP? */
const
int
WIFI_CONNECTED_BIT
=
BIT0
;
const
int
WIFI_CONNECTED_BIT
=
BIT0
;
bool
HTTPD_RUNNING
=
0
;
static
const
char
*
TAG
=
"Nexboot"
;
static
const
char
*
TAG
=
"Nexboot"
;
...
@@ -61,7 +62,11 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
...
@@ -61,7 +62,11 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
ESP_LOGI
(
TAG
,
"got ip:%s"
,
ESP_LOGI
(
TAG
,
"got ip:%s"
,
ip4addr_ntoa
(
&
event
->
event_info
.
got_ip
.
ip_info
.
ip
));
ip4addr_ntoa
(
&
event
->
event_info
.
got_ip
.
ip_info
.
ip
));
xEventGroupSetBits
(
wifi_event_group
,
WIFI_CONNECTED_BIT
);
xEventGroupSetBits
(
wifi_event_group
,
WIFI_CONNECTED_BIT
);
if
(
!
HTTPD_RUNNING
)
{
ESP_ERROR_CHECK
(
httpd_start
());
ESP_ERROR_CHECK
(
httpd_start
());
HTTPD_RUNNING
=
1
;
}
break
;
break
;
case
SYSTEM_EVENT_AP_STACONNECTED
:
case
SYSTEM_EVENT_AP_STACONNECTED
:
ESP_LOGI
(
TAG
,
"station:"
MACSTR
" join, AID=%d"
,
ESP_LOGI
(
TAG
,
"station:"
MACSTR
" join, AID=%d"
,
...
@@ -74,9 +79,13 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
...
@@ -74,9 +79,13 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
event
->
event_info
.
sta_disconnected
.
aid
);
event
->
event_info
.
sta_disconnected
.
aid
);
break
;
break
;
case
SYSTEM_EVENT_STA_DISCONNECTED
:
case
SYSTEM_EVENT_STA_DISCONNECTED
:
if
(
HTTPD_RUNNING
)
{
ESP_LOGI
(
TAG
,
"Stopping HTTPD"
);
ESP_LOGI
(
TAG
,
"Stopping HTTPD"
);
ESP_ERROR_CHECK
(
http_server_stop
(
server
));
ESP_ERROR_CHECK
(
http_server_stop
(
server
));
HTTPD_RUNNING
=
0
;
ESP_LOGI
(
TAG
,
"HTTPD Stopped"
);
ESP_LOGI
(
TAG
,
"HTTPD Stopped"
);
}
esp_wifi_connect
();
esp_wifi_connect
();
xEventGroupClearBits
(
wifi_event_group
,
WIFI_CONNECTED_BIT
);
xEventGroupClearBits
(
wifi_event_group
,
WIFI_CONNECTED_BIT
);
break
;
break
;
...
@@ -116,6 +125,7 @@ void wifi_init_softap()
...
@@ -116,6 +125,7 @@ void wifi_init_softap()
ESP_LOGI
(
TAG
,
"wifi_init_softap finished.SSID:%s password:%s"
,
ESP_LOGI
(
TAG
,
"wifi_init_softap finished.SSID:%s password:%s"
,
ESP_WIFI_SSID
,
ESP_WIFI_PASS
);
ESP_WIFI_SSID
,
ESP_WIFI_PASS
);
ESP_ERROR_CHECK
(
httpd_start
());
ESP_ERROR_CHECK
(
httpd_start
());
HTTPD_RUNNING
=
1
;
}
}
#else // if ESP_WIFI_MODE_AP
#else // if ESP_WIFI_MODE_AP
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment