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
1a4864e4
Commit
1a4864e4
authored
Apr 20, 2021
by
Eric Duminil
Browse files
ampel.board
parent
9d1c951d
Changes
4
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/ampel-firmware.ino
View file @
1a4864e4
...
...
@@ -85,7 +85,7 @@ void setup() {
Serial
.
print
(
F
(
"Sensor ID: "
));
Serial
.
println
(
ampel
.
sensorId
);
Serial
.
print
(
F
(
"Board : "
));
Serial
.
println
(
BOARD
);
Serial
.
println
(
ampel
.
board
);
#ifdef AMPEL_WIFI
WiFiConnect
(
ampel
.
sensorId
);
...
...
ampel-firmware/util.cpp
View file @
1a4864e4
...
...
@@ -5,6 +5,14 @@ namespace config {
const
long
utc_offset_in_seconds
=
UTC_OFFSET_IN_SECONDS
;
// UTC+1
}
#if defined(ESP8266)
const
char
*
current_board
=
"ESP8266"
;
#elif defined(ESP32)
const
char
*
current_board
=
"ESP32"
;
#else
const
char
*
current_board
=
"UNKNOWN"
;
#endif
// Get last 3 bytes of ESP MAC (worldwide unique)
String
macToID
()
{
uint8_t
mac
[
6
];
...
...
@@ -58,7 +66,7 @@ void Ampel::showFreeSpace() {
}
Ampel
::
Ampel
()
:
sensorId
(
"ESP"
+
macToID
()),
max_loop_duration
(
0
)
{
board
(
current_board
),
sensorId
(
"ESP"
+
macToID
()),
max_loop_duration
(
0
)
{
sensor_console
::
defineIntCommand
(
"set_time"
,
ntp
::
setLocalTime
,
" 1618829570 (Sets time to the given UNIX time)"
);
sensor_console
::
defineCommand
(
"free"
,
Ampel
::
showFreeSpace
,
" (Displays available heap space)"
);
sensor_console
::
defineCommand
(
"reset"
,
[]()
{
...
...
ampel-firmware/util.h
View file @
1a4864e4
...
...
@@ -8,15 +8,11 @@
#include
"src/lib/NTPClient-master/NTPClient.h"
// NTP
#if defined(ESP8266)
# define BOARD "ESP8266" //TODO: Move to ampel.board?
# include <ESP8266WiFi.h> // required to get MAC address
# define get_free_heap_size() system_get_free_heap_size()
#elif defined(ESP32)
# define BOARD "ESP32"
# include <WiFi.h> // required to get MAC address
# define get_free_heap_size() esp_get_free_heap_size()
#else
# define BOARD "Unknown"
#endif
namespace
ntp
{
...
...
@@ -40,6 +36,7 @@ class Ampel {
private:
static
void
showFreeSpace
();
public:
const
char
*
board
;
const
String
sensorId
;
uint32_t
max_loop_duration
;
Ampel
();
...
...
ampel-firmware/web_server.cpp
View file @
1a4864e4
...
...
@@ -239,7 +239,7 @@ namespace web_server {
#endif
config
::
temperature_offset
,
config
::
auto_calibrate_sensor
?
"Yes"
:
"No"
,
ampel
.
sensorId
.
c_str
(),
ampel
.
sensorId
.
c_str
(),
WiFi
.
localIP
().
toString
().
c_str
(),
WiFi
.
localIP
().
toString
().
c_str
(),
get_free_heap_size
(),
ampel
.
max_loop_duration
,
BOARD
,
dd
,
hh
,
mm
,
ss
);
get_free_heap_size
(),
ampel
.
max_loop_duration
,
ampel
.
board
,
dd
,
hh
,
mm
,
ss
);
Serial
.
print
(
F
(
" - Body size : "
));
http
.
sendContent
(
content
);
...
...
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