The heap printing in MicrobitHeapAllocator is really useful for
gauging how much memory is free at various points in the program.
Specifically, by calling this after the uBit object is created we
can start to measure a high-water-mark for RAM and track it over
releases, etc
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