Freefall now detected when the net force on the device drops below 0.4g,
rather than 0.2g as previously defined. This improves sensitivity, without
generating false positives under common use.
Also correction of minor typos / layout errors.
- updated acceleration threshold event names to reflect numeric values e.g.
GESTURE_3G, GESTURE_6G, GESTURE_8G.
- Add scoping to elements of SimpleGesture enum.
- Code scrub of code layout caused by editor with incorrect configuration.
- rename of internal state variables and functions to better reflect use.
- added clarification to some comments.
Whilst Android devices permit explicit initiation of the BLE pairing process,
IOS based devices are only capable of implicit initiation of pairing based
on accessing a protected characteristic. Adding read capability to the
ControlPoint characteristic provides a safe and convenient way for IOS devices
to initiate pairing.
Minor amends:
- bleDisconnectionCallback signature change
- bleSetAdvertisingInterval now takes milliseconds as a parameter
- event based invocation of DFU bootloader
More specifically:
- BLUEZONE mode renamed to PairingMode (by popular request).
- Added timeout of 90 seconds before automatic device reboot.
- Move from a scroll to a print based algorithm to improve the amount of time key is displayed fully.
- Added compulsory 'click to bond' button press.
- Improved response time of tick/cross being displayed.
Changes to default BLE name. During normal operation, all micro:bits now have the same name: BBC micro:bit
When pairing mode (AKA BLUEZONE) is entered, device name details re appended as before, to give BBC micro:bit [<name>]
This is to provide a degree of anonymity to users, to make tracking of kids more difficult.
This option is now configured when the BLE stack is initialised. This ensures that SoftDevice is never
starved of CPU during periods of criticality. This does lock out the CPU for application use, but prevents
MIC failures caused by __disable_irq() operations (as found in the mbed Ticker API for example).
Minor amends:
- bleDisconnectionCallback signature change
- bleSetAdvertisingInterval now takes milliseconds as a parameter
- event based invocation of DFU bootloader
The following postures of the device are now detected:
- TILT_UP
- TILT_DOWN
- TILT_LEFT
- TILT_RIGHT
- FACE_UP
- FACE_DOWN
In addition, the following gestures are inferred:
- NONE
- SHAKE
- FREEFALL
- WHEEE (>=3g)
- SICK (>=5g)
- UNCONSCIOUS (>=8g)
Events are now triggered on the MessageBus upon the transition from one posture/gesture to another,
and a synchronous getGesture() method is now also provided to interogate the last gesture recognised.
I should be noted that the default accelerator range of +/-2g will be insufficient to detect some of
the events noted above, and MicroBitAccelerometer::setRange() should be used to increase the range
if required.
- LFSR generated values in a subset of the range requested (rounded to the nearest lower power of 2).
Corrected by increasing the number of bits usedby one, such that it now generated st least the power of 2 greater.
- replaced enable/disable of interrupts with a local snapshot of randomValue. Much of the nordic software is sensitive to interrupt timings,
so best avoided where possible. Chance of race condition is low, and effect is minimal (duplicate number returned).
- Removed flashcode base authorization
- silenced unused parameter in MicroBitHeapAllocator
- bugfixed BLUEZONE mode so that sensor data is still available via BLE
The serial baud rate is set duing construction of the uBit object. We
don't need to do it again, and especially with fixed values that can't
be overridden.
Uisng libc's implementation is likely to be safer than rolling our own. At least
the failure modes are well documented. (glibc's implementation of rand() is
actually not bad).
The LFSR used only provides 1 bit of random data each time it is cycled.
This implementation generates the minimum number of bits needed. Further
it discards numbers that are bigger than required and re-calculates -
this keeps the distribution flat.
If BLE is connected when performing a hard reset, attempt to disconnect
first to allow the remote peer to handle the disconnect gracefully
without haing to wait for a supervision timeout.
- refactored BLE funcitonality into BLEManager class.
- added security requirements standard BLE profile services.
- updated bluezone pairing process to use BLE passkey exchange.