Bearing from destination

I’m using QField to collect viewpoint location and orientation data and I’d like to have the destination bearing recorded as an attribute for a survey point. Of course I can do this manually, but can someone help with the expression coding for the default value in a widget to achieve this? I’m using this approach because the in-built compass in my mobile phone is completely unreliable. I’d also be really interested if someone can think of another approach.


Imported from GitHub discussion by @NigelCowlin on 2023-07-19T11:14:57Z

Do you mean the bearing from your current location to the subject of the viewpoint? if so you need the destination as a variable and the expression would be something like the one below depending on your required output. I used to do this once back in the office.
(atan2((TargetX-$x),(TargetY-$y)))*57.295779513082320876798154814105


Imported from GitHub comment by @BTreeTech on 2023-07-31T07:54:17Z