-
Notifications
You must be signed in to change notification settings - Fork 2
Arduinization of code #5
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
Conversation
|
potentially, this code will be more efficient than the previous one |
37ddd06 to
ae1b7c7
Compare
|
This looks great! I'm going to test it on actual hardware just to be fully confident about its correct behavior, and then I'll go ahead and merge the changes. Thanks a lot! |
74ab1d9 to
7045151
Compare
|
The And I insist, previously using This change breaks compatibility for users upgrading from older firmware versions, since their EEPROM data contains only the original 8 characters and lacks the null terminator at the ninth byte. Fortunately, the fix is simple: subtract one byte from the comparison length to ensure only the original 8 characters are checked. if (strncmp(flag, flag_read, sizeof(flag)-1) == 0)Thanks. |
which header contains |
cleaner code using Arduino functionality. latchdevel#4
7045151 to
bfaaa48
Compare
|
Using these functions from |
|
I think this should work because the template<typename T>
const T &put(int idx, const T &t) {
EEPtr e = idx;
const uint8_t *ptr = (const uint8_t*) &t;
for (int count = sizeof(T); count; --count, ++e) {
(*e).update(*ptr++);
}
return t;
}I'll test it on actual hardware and let you know. |
Perhaps you yourself will suggest a more elegant option, or of course you can refuse to accept such changes at all))) |
|
Hi @safocl, I've tested the changes — they work perfectly, are elegantly implemented, and save over 1KB of flash. The only thing I'd suggest is removing the unnecessary Thanks a lot! |
cleaner code using Arduino functionality.
#4