Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sensor System
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institut für Informatik
QE Research Group
FORTE
Sensor System
Commits
c28745c4
"README.md" did not exist on "cc49495a47ccaeba90616bf81f09db62b0b54996"
Commit
c28745c4
authored
2 years ago
by
Moritz Perschke
Browse files
Options
Downloads
Patches
Plain Diff
added time sync
#7
and timestamping of message
parent
4f6a78ea
No related branches found
No related tags found
5 merge requests
!39
Merge Develop into Main
,
!19
development into master
,
!17
Inital Host, initial Client
,
!3
Merge Branch `develop` into `sensor_readout`
,
!1
Espnow
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/client/lib/espnow/src/espnow.cpp
+4
-0
4 additions, 0 deletions
client/client/lib/espnow/src/espnow.cpp
with
4 additions
and
0 deletions
client/client/lib/espnow/src/espnow.cpp
+
4
−
0
View file @
c28745c4
#include
<esp_now.h>
#include
<esp_now.h>
#include
<Preferences.h>
#include
<Preferences.h>
#include
<ESP32Time.h>
#include
"WiFi.h"
#include
"WiFi.h"
#include
"espnow.hpp"
#include
"espnow.hpp"
...
@@ -7,6 +8,7 @@ uint8_t BROADCAST_MAC[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // leaving this
...
@@ -7,6 +8,7 @@ uint8_t BROADCAST_MAC[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // leaving this
bool
host_defined
=
false
;
bool
host_defined
=
false
;
esp_now_peer_info_t
hostInfo
;
esp_now_peer_info_t
hostInfo
;
Preferences
preferences
;
Preferences
preferences
;
ESP32Time
rtc
(
7200
);
void
on_data_sent
(
const
uint8_t
*
mac_addr
,
esp_now_send_status_t
status
){
void
on_data_sent
(
const
uint8_t
*
mac_addr
,
esp_now_send_status_t
status
){
// go to sleep
// go to sleep
...
@@ -23,6 +25,7 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len){
...
@@ -23,6 +25,7 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len){
}
// host change shouldn't be an issue
}
// host change shouldn't be an issue
preferences
.
end
();
preferences
.
end
();
// sync time
// sync time
rtc
.
setTime
(
new_config
.
time_millis
);
// see https://www.esp32.com/viewtopic.php?t=9965, maybe this needs an offset
}
}
...
@@ -69,6 +72,7 @@ void Message::add_data(float value, int identifier){
...
@@ -69,6 +72,7 @@ void Message::add_data(float value, int identifier){
if
(
data
->
timestamp
==
0
){
if
(
data
->
timestamp
==
0
){
//add timestamp
//add timestamp
data
->
timestamp
=
rtc
.
getMillis
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment