The tilt compensation algorithm previously mirrored the compass heading value
across a North/South axis i.e. West measured as East and vice versa. This
patch corrects the calculation.
Updates to LSM303 magnetometer driver to:
- Configure for a clean DATA_READY signal, disabling all other interrupt
sources
- Correct the interrupt polarity
Updates to MicroBitCompass to:
- Define configure() as virtual, to enable applicaiton uses to correclty
configure all magnetometers for update period.
This patch:
- Corrects the getPitch() and getRoll() methods to use normalized data from accelerometer sensors.
- Provides a compile time option (default: enabled) to provide full range 0..360 degree pitch data
that is consistent with the rage of the roll data.
- Updates the tilt compensated compass heading calculation to use normalized data from accelerometer sensors.
This commit introduces differentiation of listeners based on the cb_arg. This means that multiple listeners can be registered for the same event source and value, but with different cb_args.
Upon listener deletion, the listener_deletion_callback is invoked if non-NULL.
Motivation:
MakeCode uses cb_arg as context for higher level function pointer mapping (key / value), it can currently hold only one function pointer due to dal limitations.
MakeCode currently has an indirection layer for events that could be first class listener invocations, this is due to omitting cb_arg when ignoring / adding listeners.
Implementation:
there is probably a "cooler" way of doing this, i.e. a meta listener where the cb arg is set with a pointer to the listener being removed.
reasons why a callback function is superior:
1) fast and immediate
2) requires far less configuration (could be really complex with a meta listener)
3) smaller memory and processing overhead
In upcoming commits I will add the ability to add/ignore listeners based also on the given listener cb_arg. With the possibility of multiple handlers being deleted at once, it's useful to application developers to be able to inspect what is being removed.
These values are determined from
http://infocenter.nordicsemi.com/pdf/S130_SDS_v1.0.pdf
pg 41
It appears using S130v2 would allow even lower memory consumption
This is for use in conjunction with the
bbc-microbot-classic-gcc-s130
target, which also needs a fix before it will work.