-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: crash loop on new chip #45
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,9 @@ void play_splash(xbm_t *xbm, int col, int row) | |
|
||
void load_bmlist() | ||
{ | ||
if (data_get_header(0) == 0) // There is no bitmap stored in flash | ||
return; // skip | ||
Comment on lines
+82
to
+83
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. suggestion: Clarify the comment and remove redundant information The comment 'There is no bitmap stored in flash' might not accurately reflect what data_get_header(0) == 0 means. Consider clarifying the comment to explain the exact condition being checked. Also, the '// skip' comment on the next line is redundant and can be removed. |
||
|
||
bm_t *curr_bm = bmlist_current(); | ||
|
||
for (int i=0; i<8; i++) { | ||
|
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.
suggestion (bug_risk): Consider using a constant for the header check and verify the comparison length
The hardcoded string "wang" should be replaced with a defined constant. Also, the comparison length is 5, but "wang" is only 4 characters long, which could lead to undefined behavior. Consider adding error logging for this check.
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.
Utter bullshit from AI
String is indeed, correctly, 5 bytes.
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.
Thank you for pointing that out. It seems there was a misunderstanding regarding the string length. If the string "wang" is indeed intended to be 5 bytes, it likely includes a null terminator. However, if the header does not include a null terminator, the comparison length should match the actual length of the data you expect.
If "wang" is meant to be exactly 4 characters without a null terminator, the comparison length should be 4. If it includes a null terminator, then 5 is correct.
To avoid any confusion and potential issues, it might still be beneficial to define a constant for the expected header and its length. This can improve code readability and maintainability. Additionally, adding error logging can help with debugging if the header check fails. Let me know if you need further clarification or assistance!
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.
Lol. how come and indirect constant change the wrong assumption ?
Bullshit AI
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 understand your frustration, and I apologize for any confusion caused. The suggestion was intended to improve code clarity and maintainability by using constants, but I see how it might have seemed unnecessary given the context.
If the string "wang" is indeed 5 bytes as you mentioned, and this is intentional, then the current implementation is correct. The suggestion to use constants was more about improving readability and reducing the risk of errors if the header value or length ever needs to change in the future.
If you feel confident with the current implementation and it aligns with the intended design, then it's perfectly fine to keep it as is. If there's anything else you'd like to discuss or need further assistance with, feel free to let me know!