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
a9636423
Commit
a9636423
authored
Jan 09, 2021
by
Eric Duminil
Browse files
Cleaning up log messages
parent
b1023818
Changes
6
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/ampel-firmware.ino
View file @
a9636423
...
@@ -78,7 +78,7 @@ void setup() {
...
@@ -78,7 +78,7 @@ void setup() {
#ifdef AMPEL_WIFI
#ifdef AMPEL_WIFI
WiFiConnect
(
SENSOR_ID
);
WiFiConnect
(
SENSOR_ID
);
Serial
.
print
(
F
(
"WiFi
STATUS
: "
));
Serial
.
print
(
F
(
"WiFi
- Status
: "
));
Serial
.
println
(
WiFi
.
status
());
Serial
.
println
(
WiFi
.
status
());
if
(
WiFi
.
status
()
==
WL_CONNECTED
)
{
if
(
WiFi
.
status
()
==
WL_CONNECTED
)
{
...
@@ -150,7 +150,7 @@ void loop() {
...
@@ -150,7 +150,7 @@ void loop() {
uint32_t
duration
=
millis
()
-
t0
;
uint32_t
duration
=
millis
()
-
t0
;
if
(
duration
>
max_loop_duration
)
{
if
(
duration
>
max_loop_duration
)
{
max_loop_duration
=
duration
;
max_loop_duration
=
duration
;
Serial
.
print
(
"
Max loop duration : "
);
Serial
.
print
(
F
(
"Debug -
Max loop duration : "
)
)
;
Serial
.
print
(
max_loop_duration
);
Serial
.
print
(
max_loop_duration
);
Serial
.
println
(
" ms."
);
Serial
.
println
(
" ms."
);
}
}
...
...
ampel-firmware/co2_sensor.cpp
View file @
a9636423
...
@@ -116,8 +116,8 @@ namespace sensor {
...
@@ -116,8 +116,8 @@ namespace sensor {
}
}
void
logToSerial
()
{
void
logToSerial
()
{
Serial
.
print
ln
(
timestamp
);
Serial
.
print
(
timestamp
);
Serial
.
print
(
F
(
"co2(ppm): "
));
Serial
.
print
(
F
(
"
-
co2(ppm): "
));
Serial
.
print
(
co2
);
Serial
.
print
(
co2
);
Serial
.
print
(
F
(
" temp(C): "
));
Serial
.
print
(
F
(
" temp(C): "
));
Serial
.
print
(
temperature
,
1
);
Serial
.
print
(
temperature
,
1
);
...
...
ampel-firmware/csv_writer.cpp
View file @
a9636423
...
@@ -115,11 +115,7 @@ namespace csv_writer {
...
@@ -115,11 +115,7 @@ namespace csv_writer {
// Open dir folder
// Open dir folder
Serial
.
println
(
"Filesystem content:"
);
Serial
.
println
(
"Filesystem content:"
);
showFilesystemContent
();
showFilesystemContent
();
Serial
.
println
();
if
(
FS_LIB
.
exists
(
filename
))
{
Serial
.
print
(
filename
);
Serial
.
println
(
" has been found."
);
}
}
}
File
openOrCreate
()
{
File
openOrCreate
()
{
...
@@ -145,7 +141,7 @@ namespace csv_writer {
...
@@ -145,7 +141,7 @@ namespace csv_writer {
if
(
written_bytes
==
0
)
{
if
(
written_bytes
==
0
)
{
Serial
.
println
(
F
(
"Nothing written. Disk full?"
));
Serial
.
println
(
F
(
"Nothing written. Disk full?"
));
}
else
{
}
else
{
Serial
.
print
ln
(
F
(
"
Wrote file content:
"
));
Serial
.
print
(
F
(
"
CSV - Wrote :
"
));
Serial
.
print
(
csv_line
);
Serial
.
print
(
csv_line
);
last_successful_write
=
ntp
::
getLocalTime
();
last_successful_write
=
ntp
::
getLocalTime
();
}
}
...
...
ampel-firmware/lorawan.cpp
View file @
a9636423
...
@@ -82,18 +82,18 @@ namespace lorawan {
...
@@ -82,18 +82,18 @@ namespace lorawan {
u1_t
nwkKey
[
16
];
u1_t
nwkKey
[
16
];
u1_t
artKey
[
16
];
u1_t
artKey
[
16
];
LMIC_getSessionKeys
(
&
netid
,
&
devaddr
,
nwkKey
,
artKey
);
LMIC_getSessionKeys
(
&
netid
,
&
devaddr
,
nwkKey
,
artKey
);
Serial
.
print
(
F
(
"netid: "
));
Serial
.
print
(
F
(
"
netid: "
));
Serial
.
println
(
netid
,
DEC
);
Serial
.
println
(
netid
,
DEC
);
Serial
.
print
(
F
(
"devaddr: "
));
Serial
.
print
(
F
(
"
devaddr: "
));
Serial
.
println
(
devaddr
,
HEX
);
Serial
.
println
(
devaddr
,
HEX
);
Serial
.
print
(
F
(
"AppSKey: "
));
Serial
.
print
(
F
(
"
AppSKey: "
));
for
(
size_t
i
=
0
;
i
<
sizeof
(
artKey
);
++
i
)
{
for
(
size_t
i
=
0
;
i
<
sizeof
(
artKey
);
++
i
)
{
if
(
i
!=
0
)
if
(
i
!=
0
)
Serial
.
print
(
"-"
);
Serial
.
print
(
"-"
);
printHex2
(
artKey
[
i
]);
printHex2
(
artKey
[
i
]);
}
}
Serial
.
println
(
""
);
Serial
.
println
();
Serial
.
print
(
"NwkSKey: "
);
Serial
.
print
(
"
NwkSKey: "
);
for
(
size_t
i
=
0
;
i
<
sizeof
(
nwkKey
);
++
i
)
{
for
(
size_t
i
=
0
;
i
<
sizeof
(
nwkKey
);
++
i
)
{
if
(
i
!=
0
)
if
(
i
!=
0
)
Serial
.
print
(
"-"
);
Serial
.
print
(
"-"
);
...
...
ampel-firmware/mqtt.cpp
View file @
a9636423
...
@@ -41,7 +41,7 @@ namespace mqtt {
...
@@ -41,7 +41,7 @@ namespace mqtt {
void
publish
(
const
String
&
timestamp
,
int16_t
co2
,
float
temperature
,
float
humidity
)
{
void
publish
(
const
String
&
timestamp
,
int16_t
co2
,
float
temperature
,
float
humidity
)
{
if
(
WiFi
.
status
()
==
WL_CONNECTED
&&
mqttClient
.
connected
())
{
if
(
WiFi
.
status
()
==
WL_CONNECTED
&&
mqttClient
.
connected
())
{
led_effects
::
onBoardLEDOn
();
led_effects
::
onBoardLEDOn
();
Serial
.
print
(
F
(
"Publishing
MQTT
message ... "
));
Serial
.
print
(
F
(
"
MQTT -
Publishing message ... "
));
char
payload
[
75
];
// Should be enough for json...
char
payload
[
75
];
// Should be enough for json...
snprintf
(
payload
,
sizeof
(
payload
),
json_sensor_format
,
timestamp
.
c_str
(),
co2
,
temperature
,
humidity
);
snprintf
(
payload
,
sizeof
(
payload
),
json_sensor_format
,
timestamp
.
c_str
(),
co2
,
temperature
,
humidity
);
...
@@ -185,7 +185,7 @@ namespace mqtt {
...
@@ -185,7 +185,7 @@ namespace mqtt {
// No WIFI
// No WIFI
return
;
return
;
}
}
Serial
.
print
(
F
(
"Attempting
MQTT
connection..."
));
Serial
.
print
(
F
(
"
MQTT -
Attempting connection..."
));
led_effects
::
onBoardLEDOn
();
led_effects
::
onBoardLEDOn
();
// Wait for connection, at most 15s (default)
// Wait for connection, at most 15s (default)
...
...
ampel-firmware/wifi_util.cpp
View file @
a9636423
...
@@ -23,7 +23,7 @@ void WiFiConnect(const String &hostname) {
...
@@ -23,7 +23,7 @@ void WiFiConnect(const String &hostname) {
WiFi
.
setHostname
(
hostname
.
c_str
());
WiFi
.
setHostname
(
hostname
.
c_str
());
#endif
#endif
Serial
.
print
(
"
\n
Connecting to "
);
Serial
.
print
(
F
(
"WiFi -
Connecting to "
)
)
;
Serial
.
println
(
config
::
wifi_ssid
);
Serial
.
println
(
config
::
wifi_ssid
);
WiFi
.
begin
(
config
::
wifi_ssid
,
config
::
wifi_password
);
WiFi
.
begin
(
config
::
wifi_ssid
,
config
::
wifi_password
);
...
@@ -35,11 +35,11 @@ void WiFiConnect(const String &hostname) {
...
@@ -35,11 +35,11 @@ void WiFiConnect(const String &hostname) {
if
(
WiFi
.
status
()
==
WL_CONNECTED
)
{
if
(
WiFi
.
status
()
==
WL_CONNECTED
)
{
led_effects
::
showKITTWheel
(
color
::
green
);
led_effects
::
showKITTWheel
(
color
::
green
);
Serial
.
println
();
Serial
.
println
();
Serial
.
print
(
"
\n
WiFi
c
onnected
,
IP address: "
);
Serial
.
print
(
F
(
"
WiFi
- C
onnected
!
IP address: "
)
)
;
Serial
.
println
(
WiFi
.
localIP
());
Serial
.
println
(
WiFi
.
localIP
());
}
else
{
}
else
{
//TODO: Allow sensor to work as an Access Point, in order to define SSID & password?
//TODO: Allow sensor to work as an Access Point, in order to define SSID & password?
led_effects
::
showKITTWheel
(
color
::
red
);
led_effects
::
showKITTWheel
(
color
::
red
);
Serial
.
println
(
"
\n
Connection to WiFi failed"
);
Serial
.
println
(
F
(
"
Connection to WiFi failed"
)
)
;
}
}
}
}
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