Merge pull request #383 from microbit-sam/ble-memory-fixes

Add "DO NOT PAGE" flag to pairingMode fiber. Store animation in flash.
This commit is contained in:
Joe Finney 2018-09-07 18:25:40 +01:00 committed by GitHub
commit b2f56b97ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -641,6 +641,9 @@ int MicroBitBLEManager::advertiseEddystoneUid(const char* uid_namespace, const c
*/ */
void MicroBitBLEManager::pairingMode(MicroBitDisplay &display, MicroBitButton &authorisationButton) void MicroBitBLEManager::pairingMode(MicroBitDisplay &display, MicroBitButton &authorisationButton)
{ {
// Do not page this fiber!
currentFiber->flags |= MICROBIT_FIBER_FLAG_DO_NOT_PAGE;
ManagedString namePrefix("BBC micro:bit ["); ManagedString namePrefix("BBC micro:bit [");
ManagedString namePostfix("]"); ManagedString namePostfix("]");
ManagedString BLEName = namePrefix + deviceName + namePostfix; ManagedString BLEName = namePrefix + deviceName + namePostfix;
@ -780,10 +783,9 @@ void MicroBitBLEManager::showManagementModeAnimation(MicroBitDisplay &display)
// Animation for display object // Animation for display object
// https://makecode.microbit.org/93264-81126-90471-58367 // https://makecode.microbit.org/93264-81126-90471-58367
const int mgmt_animation_w = 20; const uint8_t mgmt_animation[] __attribute__ ((aligned (4))) =
const int mgmt_animation_h = 5;
const uint8_t mgmt_animation[] =
{ {
0xff, 0xff, 20, 0, 5, 0,
255,255,255,255,255, 255,255,255,255,255, 255,255, 0,255,255, 255, 0, 0, 0,255, 255,255,255,255,255, 255,255,255,255,255, 255,255, 0,255,255, 255, 0, 0, 0,255,
255,255,255,255,255, 255,255, 0,255,255, 255, 0, 0, 0,255, 0, 0, 0, 0, 0, 255,255,255,255,255, 255,255, 0,255,255, 255, 0, 0, 0,255, 0, 0, 0, 0, 0,
255,255, 0,255,255, 255, 0, 0, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255,255, 0,255,255, 255, 0, 0, 0,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -791,7 +793,7 @@ void MicroBitBLEManager::showManagementModeAnimation(MicroBitDisplay &display)
255,255,255,255,255, 255,255,255,255,255, 255,255, 0,255,255, 255, 0, 0, 0,255 255,255,255,255,255, 255,255,255,255,255, 255,255, 0,255,255, 255, 0, 0, 0,255
}; };
MicroBitImage mgmt(mgmt_animation_w,mgmt_animation_h,mgmt_animation); MicroBitImage mgmt((ImageData*)mgmt_animation);
display.animate(mgmt,100,5); display.animate(mgmt,100,5);
const uint8_t bt_icon_raw[] = const uint8_t bt_icon_raw[] =