-
Notifications
You must be signed in to change notification settings - Fork 117
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
OTA update Fails with [TB: preparing for update fails, Attributes might be NULL] #183
Comments
This seems to be a case of the const OTA_Update_Callback callback(&progressCallback, &updatedCallback, CURRENT_FIRMWARE_TITLE, CURRENT_FIRMWARE_VERSION, &updater, FIRMWARE_FAILURE_RETRIES, FIRMWARE_PACKET_SIZE); Especially important are the Ensure you pass valid |
ok that was the first failure , corrected and now it works, but the device didn't download the Version 0.0.2 . If I use the example I got the failure: not for us: Title different... but I use in device and thingsboard-cloud the same title... eg: "Test" |
Are you really sure the title are the same. The title configured in the To check can you add a print to Serial.printf("Received fw title: (%s), curr_fw_title: (%s)\n", fw_title, curr_fw_title); |
curr_fw_title : �!@ |
As mentioned above in less detail, because the More simply the memory to the string has been erased already and it is now garbage and is then compared with from the cloud received JSON data. This results in the comparison failing, because the 2 strings can not be the same. If you need further help I would need your main file and especially the location your |
I use the orgiginal example 0009-esp8266-esp32-proceess_ota.ino without StreamUtil support. |
Okay good to know, perhaps there is some issue with flash strings, can you add this line on top of your main file. #define THINGSBOARD_ENABLE_PROGMEM 0 |
is by default, because i use platformio and board=d1_mini that has #define ESP8266... i see it higlighted in editor |
Ah good to know you are on ESP8266. For now as a dirty fix can you go into the const char *m_fwTitel; // Current firmware title of device to std::string m_fwTitel; // Current firmware title of device and additionally add an include to |
i tried to alter m_fwTitle but i got an compiler_error:
.pio\libdeps\d1_mini\ThingsBoard\src\OTA_Update_Callback.cpp: In member function 'void OTA_Update_Callback::Set_Firmware_Title(const char*)': |
Sorry my bad simply change void OTA_Update_Callback::Set_Firmware_Title(const char *currFwTitle) {
m_fwTitel = currFwTitle;
} to this instead void OTA_Update_Callback::Set_Firmware_Title(std::string currFwTitle) {
m_fwTitel = currFwTitle;
} |
I altered all depending functions on std::string currFwTitle , and pushed to my fork in branch "testing". What now happens is that my ESP8266 abort due to some runtime errors. compilation works fine...
and:
|
I am not 100% sure but perhaps it is an issue with the constness. const std::string Get_Firmware_Title() const; Will return a const copy-by-value. Which means the one calling the method can not make the received value non-const. To fix that please adjust the method like this. std::string Get_Firmware_Title() const; For the second error I am unsure, but for now simply go into the |
now it seems as fixed, OTA-Update works |
The problem is the But the underlying issue of the string being mangled even tough it should be in global scope still happens and that is what shouldn't occur. The problem is that I can't really reproduce your issue and as you mentioned you use the OTA example from the library so I am also not really sure were the error could be. For now can you check out your branch without the And then retry if it works, because I am assuming it has to do something with this. I currently can't imagine anything else, because that is the only real difference between the |
I was facing the same issue and could get it working with the changes proposed by the two of you, thank you very much! 😊 When I solved this, I got the same issue that I got in the past (see #159) where I was getting the error Given firmaware was NULL, then solved it in the same way by doing the initialization of the |
I am also getting the same error but can't fix it either by changing const OTA_Update_Callback callback(&progressCallback, &updatedCallback, CURRENT_FIRMWARE_TITLE, CURRENT_FIRMWARE_VERSION, &updater, FIRMWARE_FAILURE_RETRIES, FIRMWARE_PACKET_SIZE); in the global scope. Still getting the same error message:
Although I made sure the value of |
What are you using Subscribe_Firmware, or Update_Firmware. Because to start the udpate the device needs to have certain attributes set server side. The attributes found with this link in the INITIATED state need to be set. Additionally which version of the library are you using? |
I've looked for all failures but I didn't get any idea for fixing this. On demo.thingsboard.io i have Version: esp8266_pt1k 0.0.2 and on my device ( D1 mini) there is version esp8266_pt1k 0.0.1.. the code is like yours.
The text was updated successfully, but these errors were encountered: