A computing device, comprising: a sensor hub; a magnetic sensor communicably coupled to the sensor hub, wherein the magnetic sensor is configured to collect sensor data corresponding to the computing device; a processor; and a storage device comprising processor executable code that, when executed by the processor, is configured to: determine a system state of the computing device; and send the determined system state of the computing device to the sensor hub; and wherein the sensor hub is configured to dynamically calibrate the magnetic sensor based on the sensor data collected via the magnetic sensor and the determined system state of the computing device, characterized in that the determined system state of the computing device is based on a plurality of detected system state change events; and the dynamically calibrating comprises: determining a calibration offset value for each detected system state change event from a calibration offset table which includes calibration offset values relating to various system state change events; determining a combined calibration offset value corresponding to the determined system state of the computing device by summing the determined calibration offset values for the plurality of detected system change events; and correcting an output of the magnetic sensor comprising the sensor data by subtracting the combined calibration offset value from a value of the output of the magnetic sensor. a sensor hub; a magnetic sensor communicably coupled to the sensor hub, wherein the magnetic sensor is configured to collect sensor data corresponding to the computing device; a processor; and a storage device comprising processor executable code that, when executed by the processor, is configured to: determine a system state of the computing device; and send the determined system state of the computing device to the sensor hub; and wherein the sensor hub is configured to dynamically calibrate the magnetic sensor based on the sensor data collected via the magnetic sensor and the determined system state of the computing device, determine a system state of the computing device; and send the determined system state of the computing device to the sensor hub; and wherein the sensor hub is configured to dynamically calibrate the magnetic sensor based on the sensor data collected via the magnetic sensor and the determined system state of the computing device, characterized in that the determined system state of the computing device is based on a plurality of detected system state change events; and the dynamically calibrating comprises: determining a calibration offset value for each detected system state change event from a calibration offset table which includes calibration offset values relating to various system state change events; determining a combined calibration offset value corresponding to the determined system state of the computing device by summing the determined calibration offset values for the plurality of detected system change events; and correcting an output of the magnetic sensor comprising the sensor data by subtracting the combined calibration offset value from a value of the output of the magnetic sensor. determining a calibration offset value for each detected system state change event from a calibration offset table which includes calibration offset values relating to various system state change events; determining a combined calibration offset value corresponding to the determined system state of the computing device by summing the determined calibration offset values for the plurality of detected system change events; and correcting an output of the magnetic sensor comprising the sensor data by subtracting the combined calibration offset value from a value of the output of the magnetic sensor.