It's mathematically impossible for declination to be determined by the compass calibration procedure.I don't believe that this is the case. It would require enormous storage in the drone. And the field is constantly (Subtly) changing. It would need the GPS coordinates to then define the location on the magnetic map. But if it has the GPS coordinates then it can determine the Declination without a map.
If it was going to determine declination it would have to do it Via the Home point GPS coordinates set procedure or the compass calibration procedure. It needs an event to trigger the calculation. My guess would be that it only does this when a compass calibration is done. It would then be part of an overall compass procedure module in the code. At least that is they way I would write it.
It would require many CPU cycles to do this on the fly. And this would mean that all compass calibrations are meaningless. The CPU is way too busy doing other stuff.
Also the most precious resources in the FC is CPU cycles and fast executable memory. Executable storage is very precious. And CPU cycles generate heat. The developers have to keep their FW code as small as they can get it. All functionality is a decision based on priorities.
Without digging into the code it is pretty much conjecture.
The descriptions I gave relate to the actually technology not necessarily directly related to the implementation in a particular flight controller. My litmus test is what does the Manufacturer recommend.
Cheers.
p.s. I only went to this level of detail in the post reply as the poster I responded to used the same words as an introduction to a post that was very rude and abusive on another forum.
There is pretty compelling evidence that the DJI drones, P3 and after, compute declination based on GPS coordinates. The computation is actually pretty simple and doesn't consume too many resources. DatCon uses this algorithm http://www.ngdc.noaa.gov/seg/potfld/DoDWMM.html
When the AC is powered up the Yaw value is set to the value seen by the compass (magnetometers). When enough satellites are seen the declination is computed and Yaw is adjusted accordingly.
I normally fly at home where DatCon computes the geoDeclination to be 12.72 degrees. On start up the Yaw is set to a value computed from the magnetometers. Then, when gpsHealth gets to 4 (out of 5) that Yaw value is then adjusted to reflect the geoDeclination. That's happened at time -9.512
Without re-calibrating I flew at another location 1200 miles distant where the GeoDeclination is 8.61. It can be seen that the Yaw adjustment reflects that of the new location.