Delay save settings to prevent ESC lockup on emergency rearm#9681
Conversation
The PR pauses the save after disarm if an emergency rearm is possible. This is to stop things like the RX pausing and the ESC restarting if you disarm in flight. If you are still flying, you will have 5 seconds to rearm. After that, the save will happen. The save will not happen if you rearm within the 5 seconds. If you're on the ground. The emergency rearm system will deactivate quickly. So the save will happen soon after landing. OSD messages are shown to show the state of the save process.
Updated comment on processDelayedSave() delay
|
@MrD-RC Tested it with a quad, having the I also ran some back to back tests with the current firmware and this commit. And could replicate @rts18 findings with the current firmware. And found as he did, that having a higher data logging rate caused an increased prevalence of this occurring. But when I tested it with this commit. It always delayed the eeprom save until after the emergency rearm window had expired.. And only then would the ESC occasionally reboot, when the Saved message was displayed... But by that time it was on the ground after being auto disarmed. Which is the desired effect. |
|
I'm surprised it appeared to work @Jetrell because it shouldn't as far as I can see simply because the |
|
@breadoven Well.. It did take some getting it to show up in the first place.. This was done by disarming and rearming a good half dozen times, one after another in flight.. And it only rebooted the ESC's once.
I guess it was because of the continual disarming and rearming, one after another. Meaning the flag condition was meet.. Either that, or I just got lucky and it didn't happen again.. And I worn out my arming switch for nothing. :-) |
|
When I looked through the code. It appeared that the [edit] I was wrong about the above. I did test with HITL this morning, and noticed that it wasn’t working as expected. There were system messages issues, which I’m working on fixing. I also saw ** SETTINGS SAVED ** when I shouldn’t have. So there is still some work needed. |
|
Now tested in HITL and working as expected. In flight, if you re-arm within 5 seconds, the settings are not saved. After the 5 seconds expire, the settings are saved. Once landed, disarming by switch or detection saves the settings after a brief pause. https://youtu.be/5fSwQVvQkg4 |
|
One issue with this is the Simple fix for this would be to disable the |
|
@breadoven sounds good to me. I can add this if you like. I was going to add system messages with a countdown for emergency rearm. [EDIT] |
|
As a note. The above suggestion was removed from #9688 as it caused issues. However, the home position and altitude are not reset. Looking at the code, it shouldn't reset either while |
|
I think the branch should be restored and this change reverted. There is something strange going on. I won't have time to get this sorted before the 14th deadline. |
The PR pauses the save after disarm if an emergency rearm is possible. This is to stop things like the RX pausing and the ESC restarting if you disarm in flight. If you are still flying, you will have 5 seconds to rearm. After that, the save will happen. The save will not happen if you rearm within the 5 seconds. If you're on the ground. The emergency rearm system will deactivate quickly. So the save will happen soon after landing. OSD messages are shown to show the state of the save process.
Fixes #9441