-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move Edu program status history to FRAM #328
base: master
Are you sure you want to change the base?
Conversation
Add a new RingArray programStatusHistory variable, and a new update() method for it.
The only missing thing is to test that the fram is correctly written, i.e something like `Require(fram::ram::memory[address] == value)`.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #328 +/- ##
==========================================
+ Coverage 97.69% 97.83% +0.13%
==========================================
Files 33 33
Lines 1039 1106 +67
Branches 25 25
==========================================
+ Hits 1015 1082 +67
Misses 24 24 ☔ View full report in Codecov by Sentry. |
0593f19
to
3f90355
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Unit tests should be as self-contained as possible. Therefore, please remove the dependency on the EDU code and test
RingArray
with a custom type that is defined right in the source file.
auto entry = programStatusHistory.Get(i); | ||
if(entry.startTime == startTime and entry.programId == programId) | ||
{ | ||
programStatusHistory.vals[i].status = newStatus; | ||
entry.status = newStatus; | ||
programStatusHistory.Set(i, entry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that this is not thread-safe in the sense that someone might call PushBack()
between Get()
and Set()
. This would mean that the index i
might point to a different location/entry. We somehow need to ensure that getting and setting the entry is atomic. The only way that I can think of right now that would achieve that is to add RingArray<T>::FindAndReplace(predicate, newData/Element/Entry)
where predicate
is a callable that takes a T const &
and returns something convertible to bool
.
Remove useless variables and clang-format comments.
Remove dependency to Edu module.
Description
Move EDU program status history to FRAM by using the
fram::RingArray
to store program status history entries. Additionally, improve the unit test forRingArray
with the addition of a custom typeRingArray
test case.Fixes #204