-
-
Notifications
You must be signed in to change notification settings - Fork 23
adding inv error to crit screen #2100
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
Open
setaremalekiii
wants to merge
24
commits into
master
Choose a base branch
from
crit_inv_error
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d1c41e9
adding inv error to segment
setaremalekiii e47ee34
format
setaremalekiii 076717d
screencount patch
Lucien950 ac259d0
new screen
setaremalekiii 06f5a59
Merge branch 'crit_inv_error' of https://github.com/UBCFormulaElectri…
setaremalekiii 68fee8a
making seperate screen
setaremalekiii cd1c202
mod
Lucien950 8564ab8
make the array static
setaremalekiii 6f6d934
Merge branch 'crit_inv_error' of https://github.com/UBCFormulaElectri…
setaremalekiii a4fd70e
crit screen tests
Lucien950 276559d
oops
Lucien950 c6b681d
printf
Lucien950 e4871d9
one more
Lucien950 138e172
string sgit
setaremalekiii 6614eec
Merge branch 'master' into crit_inv_error
Lucien950 808eb54
fix issues
setaremalekiii 753444f
Merge branch 'crit_inv_error' of https://github.com/UBCFormulaElectri…
setaremalekiii bcac262
increase sze
setaremalekiii c0b34d9
fix span error
setaremalekiii 4b12b69
test fix
setaremalekiii 91b4b18
fix test
setaremalekiii 39ff472
Merge branch 'master' into crit_inv_error
Lucien950 8593eab
Merge branch 'master' into crit_inv_error
Lucien950 d12ad09
Merge branch 'master' into crit_inv_error
Lucien950 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
firmware/hexray/CRIT/src/app/screens/app_screen_invError.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| #include "app_screens.hpp" | ||
| #include "io_sevenSeg.hpp" | ||
| #include "util_retry.hpp" | ||
| #include "app_canRx.hpp" | ||
| #include <cassert> | ||
|
|
||
| using namespace app::can_rx; | ||
|
|
||
| static char screen_buf[io::seven_seg::DIGITS + 1]; | ||
|
|
||
| static uint16_t prev_fr = 0u; | ||
| static uint16_t prev_rr = 0u; | ||
| static uint16_t prev_fl = 0u; | ||
| static uint16_t prev_rl = 0u; | ||
|
|
||
| static void write_error_code(const char pos1, const char pos2, const uint16_t error_code) | ||
| { | ||
| screen_buf[0] = pos1; | ||
| screen_buf[1] = pos2; | ||
|
|
||
| snprintf(&screen_buf[2], 6, "%05u", static_cast<unsigned>(error_code)); | ||
| screen_buf[7] = '\0'; | ||
| screen_buf[8] = '\0'; | ||
| } | ||
|
|
||
| static void update() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will not work, because the moment fr is set to something it will auto override everything else. please keep track of the errorcode/errored inverter in one variable |
||
| { | ||
| const bool fl_inv_error = INVFL_bError_get(); | ||
| const bool fr_inv_error = INVFR_bError_get(); | ||
| const bool rl_inv_error = INVRL_bError_get(); | ||
| const bool rr_inv_error = INVRR_bError_get(); | ||
| const uint16_t fr_error_code = INVFR_ErrorInfo_get(); | ||
| const uint16_t rr_error_code = INVRR_ErrorInfo_get(); | ||
| const uint16_t fl_error_code = INVFL_ErrorInfo_get(); | ||
| const uint16_t rl_error_code = INVRL_ErrorInfo_get(); | ||
|
|
||
| // priority of error codes is based on which wheels travel longer dist: | ||
| // 1. fr | ||
| // 2. rr | ||
| // 3. fl | ||
| // 4. rl | ||
| // If higher priority error code is on we'll just keep that on first two segs are the | ||
| // inverter last 5 the code from CAN | ||
|
|
||
| if (fr_inv_error && fr_error_code != prev_fr) | ||
| { | ||
| write_error_code('f', 'r', fr_error_code); | ||
| prev_fr = fr_error_code; | ||
| } | ||
| else if (rr_inv_error && rr_error_code != prev_rr) | ||
| { | ||
| write_error_code('r', 'r', rr_error_code); | ||
| prev_rr = rr_error_code; | ||
| } | ||
| else if (fl_inv_error && fl_error_code != prev_fl) | ||
| { | ||
| write_error_code('f', 'l', fl_error_code); | ||
| prev_fl = fl_error_code; | ||
| } | ||
| else if (rl_inv_error && rl_error_code != prev_rl) | ||
| { | ||
| write_error_code('r', 'l', rl_error_code); | ||
| prev_rl = rl_error_code; | ||
| } | ||
|
|
||
| const auto screen_write_result = util::retry( | ||
| []() -> result<void> { | ||
| return io::seven_seg::write(std::span<char, io::seven_seg::DIGITS>{ screen_buf, 9 }); | ||
| }, | ||
| 3); | ||
| assert(screen_write_result.has_value()); | ||
| } | ||
|
|
||
| constexpr app::screens::Screen app::screens::inv_error_screen = { | ||
| [] {}, | ||
| [] {}, | ||
| update, | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
great changes