-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add getSketchMD5() to ESP.h and ESP.cpp #2164
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
…_rxBuffer is not initialised
uint32_t lengthLeft = getSketchSize(); | ||
|
||
const esp_partition_t *running = esp_ota_get_running_partition(); | ||
if (!running) return String(); |
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.
please do not use one liners like this :) also please add some log_e
messages on why the call failed. It will be helpful if something goes wrong.
std::unique_ptr<uint8_t[]> buf(new uint8_t[bufSize]); | ||
uint32_t offset = 0; | ||
if(!buf.get()) { | ||
return String(); |
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.
log_e
here also
while( lengthLeft > 0) { | ||
size_t readBytes = (lengthLeft < bufSize) ? lengthLeft : bufSize; | ||
if (!ESP.flashRead(running->address + offset, reinterpret_cast<uint32_t*>(buf.get()), (readBytes + 3) & ~3)) { | ||
return String(); |
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.
log_e
here also
Replaced by PR #2176. |
With this change it is possible to calculate the MD5 hash of the running sketch. This can be used to create a unique 'fingerprint' of the running sketch.