Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved restart into pairing mode code to Microbit.cpp #395

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions inc/bluetooth/MicroBitBLEManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,6 @@ class MicroBitBLEManager : MicroBitComponent
int advertiseEddystoneUid(const char* uid_namespace, const char* uid_instance, int8_t calibratedPower = MICROBIT_BLE_EDDYSTONE_DEFAULT_POWER, bool connectable = true, uint16_t interval = MICROBIT_BLE_EDDYSTONE_ADV_INTERVAL);
#endif

/**
* Restarts in BLE Mode
*
*/
void restartInBLEMode();

/**
* Get current BLE mode; application, pairing
* #define MICROBIT_MODE_PAIRING 0x00
Expand Down
2 changes: 2 additions & 0 deletions inc/core/MicroBitComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ DEALINGS IN THE SOFTWARE.
#define MICROBIT_ID_IO_INT3 35 //INT3
#define MICROBIT_ID_PARTIAL_FLASHING 36

#define MICROBIT_ID_RESET_INTO_PAIRING 37

#define MICROBIT_ID_MESSAGE_BUS_LISTENER 1021 // Message bus indication that a handler for a given ID has been registered.
#define MICROBIT_ID_NOTIFY_ONE 1022 // Notfication channel, for general purpose synchronisation
#define MICROBIT_ID_NOTIFY 1023 // Notfication channel, for general purpose synchronisation
Expand Down
14 changes: 0 additions & 14 deletions source/bluetooth/MicroBitBLEManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,20 +842,6 @@ void MicroBitBLEManager::showNameHistogram(MicroBitDisplay &display)
}
}

/**
* Restarts into BLE Mode
*
*/
void MicroBitBLEManager::restartInBLEMode(){
KeyValuePair* RebootMode = storage->get("RebootMode");
if(RebootMode == NULL){
uint8_t RebootModeValue = MICROBIT_MODE_PAIRING;
storage->put("RebootMode", &RebootModeValue, sizeof(RebootMode));
delete RebootMode;
}
microbit_reset();
}

/**
* Get BLE mode. Returns the current mode: application, pairing mode
*/
Expand Down
7 changes: 1 addition & 6 deletions source/bluetooth/MicroBitPartialFlashingService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void MicroBitPartialFlashingService::onDataWritten(const GattWriteCallbackParams
switch(data[1]) {
case MICROBIT_MODE_PAIRING:
{
MicroBitEvent evt(MICROBIT_ID_PARTIAL_FLASHING, MICROBIT_RESET );
MicroBitEvent evt(MICROBIT_ID_PARTIAL_FLASHING, MICROBIT_ID_RESET_INTO_PAIRING );
break;
}
case MICROBIT_MODE_APPLICATION:
Expand Down Expand Up @@ -316,11 +316,6 @@ void MicroBitPartialFlashingService::partialFlashingEvent(MicroBitEvent e)
microbit_reset();
break;
}
case MICROBIT_RESET:
{
MicroBitBLEManager::manager->restartInBLEMode();
break;
}
}

}
Expand Down