Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
903ec7a9
Commit
903ec7a9
authored
Feb 12, 2022
by
Eric Duminil
Browse files
Slight refactor
parent
110a1a8a
Pipeline
#5801
passed with stage
in 2 minutes and 31 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/ampel-firmware.h
View file @
903ec7a9
...
...
@@ -5,17 +5,13 @@
*****************************************************************/
//NOTE: Too many headers. Move them to include/ folder?
// Needed for offline config too.
#include
"config.h"
//TODO: Replace with just web_config
#include
"web_config.h"
#include
"web_config.h"
// Needed for offline config too.
#include
"csv_writer.h"
#include
"wifi_util.h"
#include
"mqtt.h"
#if (AMPEL_HTTP==1) //TODO: Is it still needed?
# include "web_server.h"
#endif
#include
"web_server.h"
#include
"lorawan.h"
...
...
ampel-firmware/ampel-firmware.ino
View file @
903ec7a9
...
...
@@ -94,7 +94,7 @@ void setup() {
led_effects
::
setupOnBoardLED
();
led_effects
::
onBoardLEDOff
();
Serial
.
begin
(
BAUDS
);
Serial
.
begin
(
config
::
bauds
);
web_config
::
initialize
();
...
...
@@ -122,9 +122,7 @@ void setup() {
if
(
config
::
wifi_active
)
{
wifi
::
defineCommands
();
# if (AMPEL_HTTP==1)
web_server
::
definePages
();
# endif
}
#if defined(ESP32)
...
...
@@ -211,6 +209,7 @@ void checkFlashButton() {
if
(
digitalRead
(
0
))
{
Serial
.
println
(
F
(
"Flash has been pressed for a short time. Should toggle night mode."
));
led_effects
::
toggleNightMode
();
//NOTE: Start Access Point instead?
}
else
{
Serial
.
println
(
F
(
"Flash has been pressed for a long time. Keep it pressed for calibration."
));
if
(
led_effects
::
countdownToZero
())
{
...
...
ampel-firmware/config.public.h
View file @
903ec7a9
...
...
@@ -9,7 +9,6 @@
// Define the default for corresponding services. They can be enabled/disabled later in the web-config.
# define AMPEL_WIFI true // Should ESP connect to WiFi? It allows the Ampel to get time from an NTP server.
# define AMPEL_HTTP true // Should HTTP web server be started? (AMPEL_WIFI should be enabled too)
# define AMPEL_MQTT true // Should data be sent over MQTT? (AMPEL_WIFI should be enabled too)
# define AMPEL_CSV true // Should data be logged as CSV, on the ESP flash memory?
# define AMPEL_LORAWAN false // Should data be sent over LoRaWAN? (Requires ESP32 + LoRa modem, and "MCCI LoRaWAN LMIC library")
...
...
@@ -148,9 +147,4 @@
# define NTP_SERVER "pool.ntp.org"
# define UTC_OFFSET_IN_SECONDS 7200 // [s] 3600 for UTC+1, 7200 for UTC+1 and daylight saving time
/**
* Others
*/
# define BAUDS 115200 // Transmission rate
#endif
ampel-firmware/web_config.h
View file @
903ec7a9
...
...
@@ -10,7 +10,12 @@
#endif
namespace
config
{
void
save
();
// Save config to EEPROM
// WiFi
char
*
selected_ssid
();
extern
bool
&
wifi_active
;
// [true / false]
// Sensor
extern
uint16_t
&
measurement_timestep
;
// [s] Value between 2 and 1800 (range for SCD30 sensor).
extern
uint16_t
&
altitude_above_sea_level
;
// [m]
...
...
@@ -18,9 +23,6 @@ namespace config {
extern
bool
&
auto_calibrate_sensor
;
// [true / false]
extern
float
&
temperature_offset
;
// [K] Sign isn't relevant.
extern
bool
&
wifi_active
;
// [true / false]
void
save
();
// Save config to EEPROM
// LED
extern
uint8_t
&
max_brightness
;
extern
uint8_t
&
min_brightness
;
...
...
@@ -49,6 +51,9 @@ namespace config {
#if defined(ESP32)
bool
lorawan_active
();
// also defined for ESP8266, and set to false
#endif
// Transmission rate
constexpr
uint32_t
bauds
=
115200
;
}
namespace
web_config
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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