Disarm to allow calibration during flight

Hardware: Quadcopter configuration using pixhawk 2.4.8
Firmware version: arducopter-4.1.5
I am controlling the drone using rpizeroW as companion computer.

Flight explanation:
I flew it in guided mode and after few lines I gave RTL from my custom GCS. While it was in the air I gave Resume(implemented using companion computer) and ideally it should return straight forward to the same point where it switched to RTL but somehow it followed weird path and then I received message “disarm to allow calibration”. After this message speed was very fluctuating. Finally it reached to the point where it should go after resume but again after that it started moving in different direction with unexpected speed.

Many times I came across a situation where copter shows message “Disarm to allow calibration”. I tried to understand the meaning of this particular message but didn’t find enough resources.

In the same flight once the copter throws the mentioned message copter behavior in speed was very unusual.

Two things I am trying to figure out.

  1. Which calibration it asks for as after landing there is no such message of any calibration received.
  2. Once this message is received copter started behaving weirdly. So what is the reason behind this?

Any help would be much appreciated.
Please find the log below.

log file

you have sent the command to “start preflight calibration”

@geofrancis can’t it be triggered by autopilot for any known scenario?
As I am not sending this command to autopilot in any condition.

Also any idea about the weird behavior of the copter after that?

It switched to Guided mode before trying to Preflight calibrate.

@geofrancis You were right. I did find the code where I was sending preflight calibration before switching to guided mode(for resume). Earlier I was resuming after battery swapping only. So before takeoff I was calibrating barometer. While implementing resume in air I missed to remove that.
So could that be the issue for unusual behavior after the preflight calibration command? .

im not sure, possibly.

Thanks a lot @geofrancis. I would test it in next few flights.