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
042bd0bc
Commit
042bd0bc
authored
2 years ago
by
Moritz Perschke
Browse files
Options
Downloads
Patches
Plain Diff
moved retrieval of host mac from flash to seperate function
parent
e6707cf2
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
+12
-24
12 additions, 24 deletions
client/client/lib/espnow/src/espnow.cpp
with
12 additions
and
24 deletions
client/client/lib/espnow/src/espnow.cpp
+
12
−
24
View file @
042bd0bc
...
@@ -41,15 +41,7 @@ esp_err_t espnow_setup(){
...
@@ -41,15 +41,7 @@ esp_err_t espnow_setup(){
return
result
;
// not sure about this
return
result
;
// not sure about this
}
}
preferences
.
begin
(
"config"
,
false
);
get_host_mac
(
hostInfo
.
peer_addr
);
// check if there is a host saved in flash mem, broadcast otherwise
if
(
preferences
.
isKey
(
"host"
)){
preferences
.
getBytes
(
"host"
,
hostInfo
.
peer_addr
,
sizeof
(
hostInfo
.
peer_addr
));
Serial
.
println
(
"Mac used from flash"
);
}
else
{
memcpy
(
hostInfo
.
peer_addr
,
BROADCAST_MAC
,
sizeof
(
hostInfo
.
peer_addr
));
}
preferences
.
end
();
// check if there is a host saved in flash mem, broadcast otherwise
hostInfo
.
channel
=
0
;
hostInfo
.
channel
=
0
;
hostInfo
.
encrypt
=
0
;
hostInfo
.
encrypt
=
0
;
...
@@ -92,15 +84,8 @@ esp_err_t Message::send(){
...
@@ -92,15 +84,8 @@ esp_err_t Message::send(){
Message
::
Message
(){
Message
::
Message
(){
data
=
(
data_struct
*
)
malloc
(
sizeof
(
data_struct
));
data
=
(
data_struct
*
)
malloc
(
sizeof
(
data_struct
));
preferences
.
begin
(
"config"
,
true
);
// check for existing host mac address, use broadcast otherwise
if
(
preferences
.
isKey
(
"host"
)){
get_host_mac
(
recipient
);
preferences
.
getBytes
(
"host"
,
recipient
,
sizeof
(
uint8_t
)
*
6
);
}
else
{
memcpy
(
recipient
,
BROADCAST_MAC
,
sizeof
(
BROADCAST_MAC
));
Serial
.
println
(
"backup mac used"
);
}
preferences
.
end
();
data
->
amountData
=
0
;
data
->
amountData
=
0
;
data
->
timestamp
=
rtc
.
getMillis
();
// I am assuming we are not sending data from Unix Epoch
data
->
timestamp
=
rtc
.
getMillis
();
// I am assuming we are not sending data from Unix Epoch
...
@@ -108,18 +93,21 @@ Message :: Message(){
...
@@ -108,18 +93,21 @@ Message :: Message(){
Message
::
Message
(
data_struct
old_data
){
Message
::
Message
(
data_struct
old_data
){
memcpy
(
data
,
&
old_data
,
sizeof
(
data
));
memcpy
(
data
,
&
old_data
,
sizeof
(
data
));
get_host_mac
(
recipient
);
}
Message
::
~
Message
(){
free
((
void
*
)
data
);
}
void
get_host_mac
(
uint8_t
*
destination
){
preferences
.
begin
(
"config"
,
true
);
preferences
.
begin
(
"config"
,
true
);
if
(
preferences
.
isKey
(
"host"
)){
if
(
preferences
.
isKey
(
"host"
)){
preferences
.
getBytes
(
"host"
,
recipient
,
sizeof
(
uint8_t
)
*
6
);
preferences
.
getBytes
(
"host"
,
destination
,
sizeof
(
uint8_t
)
*
6
);
}
}
else
{
else
{
memcpy
(
recipient
,
BROADCAST_MAC
,
sizeof
(
BROADCAST_MAC
));
memcpy
(
destination
,
BROADCAST_MAC
,
sizeof
(
BROADCAST_MAC
));
Serial
.
println
(
"backup mac used"
);
Serial
.
println
(
"backup mac used"
);
}
}
preferences
.
end
();
preferences
.
end
();
}
Message
::
~
Message
(){
free
((
void
*
)
data
);
}
}
\ No newline at end of file
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