Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
67301e9e
Commit
67301e9e
authored
Feb 08, 2022
by
Eric Duminil
Browse files
Merge branch 'refactor/dependencies' into develop
parents
649d7fdf
6149cce2
Pipeline
#5749
failed with stage
Changes
24
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/web_server.h
View file @
67301e9e
#ifndef WEB_SERVER_H_
#define WEB_SERVER_H_
#if defined(ESP8266)
# include <ESP8266WebServer.h>
#elif defined(ESP32)
# include <WebServer.h>
#endif
#include "config.h"
#include "util.h"
#include "wifi_util.h"
#include "co2_sensor.h"
#include "sensor_console.h"
#ifdef AMPEL_CSV
# include "csv_writer.h"
#endif
#ifdef AMPEL_MQTT
# include "mqtt.h"
#endif
#ifdef AMPEL_LORAWAN
# include "lorawan.h"
#endif
namespace
web_server
{
void
initialize
();
void
update
();
...
...
ampel-firmware/wifi_util.cpp
View file @
67301e9e
#include "wifi_util.h"
#include "config.h"
#include "util.h"
#include "ntp.h"
#include "led_effects.h"
#include "sensor_console.h"
#if defined(ESP8266)
# include <ESP8266WiFi.h>
#elif defined(ESP32)
# include <WiFi.h>
#endif
namespace
config
{
// WiFi config. See 'config.h' if you want to modify those values.
const
char
*
wifi_ssid
=
WIFI_SSID
;
...
...
@@ -8,7 +20,7 @@ namespace config {
#ifdef WIFI_TIMEOUT
const
uint8_t
wifi_timeout
=
WIFI_TIMEOUT
;
// [s] Will try to connect during wifi_timeout seconds before failing.
#else
const
uint8_t
wifi_timeout
=
60
;
// [s] Will try to connect during wifi_timeout seconds before failing.
const
uint8_t
wifi_timeout
=
60
;
// [s] Will try to connect during wifi_timeout seconds before failing.
#endif
}
...
...
@@ -40,6 +52,10 @@ namespace wifi {
Serial
.
println
(
WIFI_SSID
);
}
bool
connected
()
{
return
WiFi
.
status
()
==
WL_CONNECTED
;
}
// Initialize Wi-Fi
void
connect
(
const
char
*
hostname
)
{
...
...
@@ -64,7 +80,7 @@ namespace wifi {
led_effects
::
showRainbowWheel
();
Serial
.
print
(
"."
);
}
if
(
WiFi
.
status
()
==
WL_CONNECTED
)
{
if
(
connected
()
)
{
led_effects
::
showKITTWheel
(
color
::
green
);
Serial
.
println
();
Serial
.
print
(
F
(
"WiFi - Connected! IP address: "
));
...
...
@@ -74,7 +90,8 @@ namespace wifi {
}
else
{
//TODO: Allow sensor to work as an Access Point, in order to define SSID & password?
led_effects
::
showKITTWheel
(
color
::
red
);
Serial
.
println
(
F
(
"Connection to WiFi failed"
));
Serial
.
print
(
F
(
"Connection to WiFi failed! Status : "
));
Serial
.
println
(
WiFi
.
status
());
}
}
}
ampel-firmware/wifi_util.h
View file @
67301e9e
#ifndef WIFI_UTIL_H_INCLUDED
#define WIFI_UTIL_H_INCLUDED
#include "config.h"
#include "util.h"
#include "led_effects.h"
namespace
wifi
{
extern
char
local_ip
[];
void
connect
(
const
char
*
hostname
);
bool
connected
();
}
#endif
platformio.ini
View file @
67301e9e
...
...
@@ -24,8 +24,3 @@ monitor_speed = 115200
lib_deps
=
MCCI
LoRaWAN
LMIC
library
build_flags
=
-D
ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS
-D
CFG_eu868
=
1
-D
CFG_sx1276_radio
=
1
Prev
1
2
Next
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