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
38205401
Commit
38205401
authored
2 years ago
by
Moritz Perschke
Browse files
Options
Downloads
Patches
Plain Diff
fixed error that cut off beginning of strings, added usability methods
parent
d1fac93e
No related branches found
No related tags found
4 merge requests
!39
Merge Develop into Main
,
!19
development into master
,
!17
Inital Host, initial Client
,
!6
Espnow
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/client/lib/caching/src/ram_caching.cpp
+12
-7
12 additions, 7 deletions
client/client/lib/caching/src/ram_caching.cpp
client/client/lib/caching/src/ram_caching.hpp
+3
-6
3 additions, 6 deletions
client/client/lib/caching/src/ram_caching.hpp
with
15 additions
and
13 deletions
client/client/lib/caching/src/ram_caching.cpp
+
12
−
7
View file @
38205401
...
...
@@ -3,6 +3,7 @@
namespace
RtcMemory
{
// 2D array of 20 Strings with maxLength of 251
RTC_DATA_ATTR
char
storage
[
maxLength_
][
maxSize_
];
RTC_DATA_ATTR
int
storedElements
;
RTC_DATA_ATTR
int
headElement
=
0
;
RTC_DATA_ATTR
int
tailElement
=
0
;
...
...
@@ -19,13 +20,11 @@ namespace RtcMemory{
// apparently I am not allowed to copy to rtc mem
for
(
int
i
=
0
;
i
<
maxLength_
;
i
++
){
storage
[
i
][
headElement
]
=
jsonString
[
i
];
Serial
.
print
(
jsonString
[
i
]);
if
(
jsonString
[
i
]
==
'\0'
){
Serial
.
println
(
"
\n
"
);
Serial
.
flush
();
break
;
}
}
storedElements
++
;
ESP_LOGE
(
TAG
,
"Moved message to storage."
);
}
...
...
@@ -36,16 +35,22 @@ namespace RtcMemory{
for
(
int
i
=
0
;
i
<
maxLength_
;
i
++
){
current
=
storage
[
i
][
tailElement
];
buf
+=
current
;
Serial
.
print
(
current
);
if
(
current
==
'\0'
){
Serial
.
println
(
"
\n
"
);
Serial
.
flush
();
break
;
}
}
// move tail to next element
tailElement
=
(
tailElement
+
1
)
%
maxLength_
;
tailElement
=
(
tailElement
+
1
)
%
maxSize_
;
storedElements
--
;
ESP_LOGE
(
TAG
,
"Retrieved message from storage"
);
return
buf
;
}
bool
is_full
(){
return
headElement
==
tailElement
;
}
int
stored_amount
(){
return
storedElements
;
}
}
This diff is collapsed.
Click to expand it.
client/client/lib/caching/src/ram_caching.hpp
+
3
−
6
View file @
38205401
...
...
@@ -3,17 +3,14 @@
#include
"esp_log.h"
#include
<ESP32Time.h>
#define maxSize_ 2
#define maxSize_ 2
0
#define maxLength_ 251
namespace
RtcMemory
{
void
store
(
std
::
string
message
);
String
get_from_storage
();
bool
is_full
();
int
stored_amount
();
}
// bool ram_cache_is_empty();
// bool ram_cache_is_full();
// void ram(ClientDataPackage data);
// ClientDataPackage ram_cache_pop();
#endif
\ 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