MBP-247: Position Recovery Improvements - #17
aslanliafichev wants to merge 35 commits into
Conversation
aslanliafichev
commented
Mar 6, 2026
- Check that position, encoder position bias are saved after a power failure.
- Check that we timestamp the power failure and startup of the CPU.
- At startup check that axises are calibrated and initliazed correctly.
Incorporate eRestoreWithoutHome in RESTORE_POSITIONS() action.
Check that BUSY bit is false, before the check of the DONE bit is made.
Make the timestamping a one-liner, instead of an action.
MC_SetPosition is replaced by MC_Home, thus it sets the home position to actual position and the calibration flag.
Changed solution to loop using the iCurrentAxis index, and incrementing if position restore was properly executed or if axis was not initialized properly or if axis was not homed before power failure.
Changed encoder reference to be constants, for better readability.
Always restore position despite an axis not being initilized or homed during shutdown.
For incremental encoders the moving status of the axis cannot be determined before a power failure, therefore the position of the axis is sampled every 5 seconds with a difference limit of 0.001 mm. These values can be changed.
Cleanup of the execution logic for restore position action.
|
Please review the latest changes to the position recovery improvements. Overall the following changes have been made:
|
Change to correct naming for TON-timers and time.
MBP-247: Adjust execution logic to match E_RestorePosition changes.
The following function blocks have been changed to fb's fbReadEncRefSys: MC_ReadParameter; fbSetHomePosition: MC_Home; fbSetPosition: MC_SetPosition; fbWritePositionBias: MC_WriteParameter; To adhere to the solution handling each axis separeatly. The following afb is still kept as is, as these values needs to be stored as persistent before shutdown. afbReadPositionBias: ARRAY [1..GVL_APP.nAXIS_NUM] OF MC_ReadParameter;
Included more steps into the eRestorePositions enum to handle each edge case for an encoder separatly.
Added error handling for the fbs as well as a retry counter.
Uses encoder reference system to decide restore type. Keeps only the check for whether restore is needed.
|
Tested for various setups, code works as expected.
In all cases Initialized was TRUE, otherwise no restore occurs. |
|
I just noticed that you have doen here What I asked in the other one. Could you just copy paste the info here in teh confluence page and if you seem something can be added or explain more in detail do, if not then just also copy oaste this to the ticket and I will merge both tickets |
|
I will close this PR because it does not follow the branch naming convention. I already created a new branch and new PR here: |