BLE central devices (such as mobile phones/tablets) are permitted to cache the
list of services and characteristics provided by a BLE peripheral such as the
micro:bit. This was causing compatibility problems with IOS during FOTA
flashing, as the the list of BLE services may change after flashing.
The Nordic BLE stack contains a fixed size bond table - a list of devices that
have paired with our device (in the case the micro:bit). The default mbed
wrapper around the nordic stack does not account for the case where the bond
table is full.
This patch implements basic bounds checking within the MicroBitBLEManager so
that this table cannot overrun. If a new device attempts to pair when the bond
table is full, the table is emptied prior to completing bonding.
Added configuration option in MicroBitConfig to allow the default power level
to be defined. Based on experiments undertaken by the BBC and subsequent policies defined by
the BBC's child protection panel, to is set by default it's lowest level (0),
in order to protect children's privacy.
It should be noted that this is 30dB below the device's default setting, so will
inevitably leave the device more susceptible to interference, and therefore
significantly reduce the reliability of the device. This will likely present
itself through increased packet loss, reduced thorughout, lost data and
connection drop outs. The normal BLE power level on commercial devices
translates to power level of 6.
The author has witnessed an inability to connect to a micro:bit from a
distance of 40cm under domestic conditions using a Samsung S5 mini
running Android 4.4.2.
Added MicroBitConfig.h option to enable/disable whitelisting
Added MicroBitConfig.h option to enable/disable limited period advertising
Added support for limited period advertising
Minor code cleanups
See bbc/microbit-extras/issues/#1100 or lancaster-university/microbit-dal/issues/5 for full details.
Summary:
A stride of 0 would lock the calling fiber indefinitely, which was not the expected behaviour
for many people.
This update fixes this issue in both animate and scroll, returning immediately when there is
a stride of zero.
issue #73 highlighted an issue whereby the destruction of an instance
registered as an idle or system component, would result in a hardfault.
This was due to not deregistering idle or system callbacks.
This patch has been applied to all components currently in use by the
idle or system callbacks.
Replaced newer struct-style initialisation of CompassSample in MicroBit.cpp
with the more traditional constructor-style initialisation, to enfore
C98 compliance.
Closes#74
The destructor for MicroBitButton didn't take into account the fact that
an instance can be destructed after registering a callback. This would then
result in a HardFault if an instance was destructed.
A clear repro case was registering a Touch input on a pin (abstracted as a button)
and swapping to a DigitalIn.
* Added a number of #defines to MicroBitPin.h which ultimately lead to retabulation of the #defines
* Added two new instance methods:
- setServoValue() which sets the default servo period (20ms) and accepts a value in the range
0 - 180, which maps to a duty cycle between 5% and 10% respectively. This
mapping is also configurable.
- setServoPulseUs() which accepts a pulse width in microseconds, and maps it onto the PWM
channel.
Based on the previous commit, the api for MicroBitPin
has two new accessor methods:
* getAnalogPeriodUs
* getAnalogPeriod
There are also whitespace changes in the MicroBitPin head file
as well as some minor textual changes.
This commit introduces an initial draft fix
for a bug where it would take two "setPeriods" for the
PWM class to update to the expected value.
This commit also adds three new methods to a DynamicPwm instance:
* write() - which is a lightweight wrapper around PwmOut write,
so that the value can be trapped. The trapping of the value
is necessary for the bug fix.
* getPeriod() - which returns the value of a static variable,
containing the current period shared across the pwm bus.
* getValue() - which returns a scaled value in the range 0-1024
representing the current duty cycle.
Dynamic pwm previously didn't round robin transient pwm channels,
and would therefore bias towards the first transient channel it found.
This update ensures that there is now an equal opportunity for all
channels to be considered for redirection.
Previously there would be the possibility of the period being reset
each time a new DynamicPwm was instantiated. This has now been
removed from the constructor, and the comments have been updated
Events listed recorded in MESEvents.h were enumerated from zero.
This is not ideal, as MicroBitMessageBus uses a code of zero for
MICROBIT_EVT_ANY - a wildcard mechanism to register interest in all events
from a given ID.
All event values recorded in MESEvents.h have therefore incremented.
There was a duplication in IDs for MICROBIT_ID_THERMOMETER and MICROBIT_ID_IO_P0
for the event bus. This has been rectified by appending the MICROBIT_ID_THERMOMETER
All internal uses of accelerometer sample values now updated to access the
data via accessor methods. This now ensures consistent use irrespective of
the coordinate system used.
declarations
Added missing operator new[] wrapper in MicroBitHeapAllocator.h
Ammended defualt microBitConfig.h to allocate 90% of available heap, rather
than 95%. this is to leave a little more heap for external libraries.
native printf() call.
The Matrix4::print() function is useful, but non essential for most
applications, and the underlying printf() call required cost an
additional 1K of RAM on first use, which is currently above the budget for
micro:bit.
An e-compass solution requires knowwlede two pieces of data to provide an
accurate heading:
- Accurate calibration of the magnetometer hardware so that reliable
measurements can be taken.
- Knowledge of the pitch and roll of of device, so that the correct
components of the X/Y and Z axis sensors of the magnetomer can be used
to sense the magnetic field in a horizontal plane regardless of the tilt
of the device.
This commit represent changes to the MicroBitAccelerometer and MicroBitCompass
classes to implemen tthese goals. More specifically, this commit provides:
- The introduciton of an interactive calibration 'game', that can rapidly
gather all the data required to calibrate the compass.
- An improved calibration algorithm based on a Least Mean Squares approach of
compass samples, as documened in Freescale Application Note AN4248.
- The inclusion of a simple Matrix4 class to enable efficient Least Mean
Squares implementation.
- A change from asynchronous to synchronous calibration of the compass when
first used. This is in repsonse to a feature request for this from users
and high level languages using microbit-dal.
- Support for detemrining tilt and roll angle in MicroBitAccelerometer
- Support for multiple co-ordinate spaces in MicroBitAccelerometer and
MicroBitCompass. Data can now be read in either RAW (unaltered) data.
MICORBIT_SIMPLE_CARTESIAN (as used previously) or NORTH_EAST_DOWN
(the industry convention in mobile phones, tablets and aviation)
- Implementation of a tilt compensated algorithm, used when determining
device heading.