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
6e05c8cc
Verified
Commit
6e05c8cc
authored
2 years ago
by
Zoe Michaela Dietmar Pfister
Browse files
Options
Downloads
Plain Diff
Missing merge from ESPNow cleanup
parents
59445779
8e05e442
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!39
Merge Develop into Main
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
host/host_central_mast/src/main.cpp
+7
-6
7 additions, 6 deletions
host/host_central_mast/src/main.cpp
with
7 additions
and
6 deletions
host/host_central_mast/src/main.cpp
+
7
−
6
View file @
6e05c8cc
...
...
@@ -61,8 +61,14 @@ void on_data_sent(const uint8_t *mac_addr, esp_now_send_status_t status) {
void
on_data_recv
(
const
uint8_t
*
mac
,
const
uint8_t
*
incomingData
,
int
len
)
{
esp_log_write
(
ESP_LOG_INFO
,
TAG_ESPNOW
,
"Message received
\n
"
);
response
response
=
{};
// send a host change msg if client is new, simplifies client
response
.
type
=
esp_now_is_peer_exist
(
mac
)
?
dataAck
:
hostChange
;
esp_read_mac
(
response
.
mac
,
ESP_MAC_WIFI_STA
);
response
.
time
=
rtc
.
getEpoch
();
// this block needs to happen before we send the message, as it's not possible to
// send a message to an unregistered peer (i.e. new client)
if
(
!
esp_now_is_peer_exist
(
mac
))
{
esp_now_peer_info_t
client
=
{};
memcpy
(
client
.
peer_addr
,
mac
,
sizeof
(
uint8_t
)
*
6
);
...
...
@@ -75,11 +81,6 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len) {
}
}
// TODO: Think if response to client may contain error messages
response
response
=
{};
response
.
type
=
dataAck
;
esp_read_mac
(
response
.
mac
,
ESP_MAC_WIFI_STA
);
response
.
time
=
rtc
.
getEpoch
();
esp_err_t
success
=
esp_now_send
(
mac
,
(
uint8_t
*
)
&
response
,
sizeof
(
response
));
esp_log_write
(
ESP_LOG_DEBUG
,
TAG_ESPNOW
,
(
success
==
ESP_OK
)
?
"Response sent
\n
"
:
"Failed to respond
\n
"
);
...
...
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