Board makes strange turn on takeoff

I used source code from repository (ver 3.9.8) to compile firmware build for my Pixhawk4.
From the moment I have started to use custom build version (instead of official) my Pixhawk started to make strange turn on takeoff. Before takeoff complete board make turn (to the left or right) without any visible reason. After takeoff completed it goes to next WP as should be, and then flight is ok. I don’t understand what is the reason of this turn.
First flight bin
Second flight bin