diff --git a/inc/MicroBitCompass.h b/inc/MicroBitCompass.h index e7e169de..966f9b3b 100644 --- a/inc/MicroBitCompass.h +++ b/inc/MicroBitCompass.h @@ -22,8 +22,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef MICROBIT_COMPASS -#define MICROBIT_COMPASS +#ifndef MICROBIT_COMPASS_H +#define MICROBIT_COMPASS_H #include "MicroBitConfig.h" #include "MicroBitComponent.h" diff --git a/inc/MicroBitConfig.h b/inc/MicroBitConfig.h index a0c77e20..95f4ac45 100644 --- a/inc/MicroBitConfig.h +++ b/inc/MicroBitConfig.h @@ -175,7 +175,7 @@ #endif // Configure for open BLE operation if so configured -#if (MICROBIT_BLE_OPEN == 1) +#if CONFIG_ENABLED(MICROBIT_BLE_OPEN) #define MICROBIT_BLE_SECURITY_MODE 1 #define MICROBIT_BLE_WHITELIST 0 #define MICROBIT_BLE_ADVERTISING_TIMEOUT 0 @@ -292,3 +292,17 @@ #endif #endif + +// Defines default behaviour of triple-tap-reset-to-pair feature. +// 0: Feature disabled +// 1: Feature enabled. Triple tap of reset button enters Bluetooth pairing mode. +#ifndef MICROBIT_TRIPLE_RESET_TO_PAIR + #define MICROBIT_TRIPLE_RESET_TO_PAIR 1 +#endif + +// Defines default behaviour of any stored user data when the micro:bit is reflashed. +// 0: No action is taken +// 1: Data is invalidated (any may be hard erased, as per policy of the respective file system used) +#ifndef CONFIG_MICROBIT_ERASE_USER_DATA_ON_REFLASH + #define CONFIG_MICROBIT_ERASE_USER_DATA_ON_REFLASH 1 +#endif diff --git a/model/MicroBit.cpp b/model/MicroBit.cpp index 2ed3fe1f..6e2b2caa 100644 --- a/model/MicroBit.cpp +++ b/model/MicroBit.cpp @@ -242,7 +242,7 @@ int MicroBit::init() uint8_t x = 0; uint8_t y = 0; bool triple_reset = 0; -#if CONFIG_ENABLED(DEVICE_TRIPLE_RESET_TO_PAIR) +#if CONFIG_ENABLED(MICROBIT_TRIPLE_RESET_TO_PAIR) triple_reset = (microbit_no_init_memory_region.resetClickCount == 3); #endif @@ -458,7 +458,7 @@ void MicroBit::eraseUserStorage(bool forceErase) f.write((uint32_t) &reflash_status, &zero, 1); // Determine if our flash contains a recognised file system. If so, invalidate it. -#if (CONFIG_MICROBIT_ERASE_USER_DATA_ON_REFLASH == 1) +#if CONFIG_ENABLED(CONFIG_MICROBIT_ERASE_USER_DATA_ON_REFLASH) log.invalidate(); #endif } diff --git a/model/MicroBit.h b/model/MicroBit.h index e1648bdc..d5f57883 100644 --- a/model/MicroBit.h +++ b/model/MicroBit.h @@ -88,32 +88,13 @@ DEALINGS IN THE SOFTWARE. #include "MicroBitStorage.h" -//#include "MicroBitLightSensor.h" - - // Status flag values #define DEVICE_INITIALIZED 0x01 -// Flag that we have integrate face-touch as a feature -#define MICROBIT_UBIT_FACE_TOUCH_BUTTON 1 - // Power on delay time (in milliseconds) applied after a hard power-on reset only. #define KL27_POWER_ON_DELAY 1000 -// Defines default behaviour of any stored user data when the micro:bit is reflashed. -// 0: No action is taken -// 1: Data is invalidated (any may be hard erased, as per policy of the respective file system used) -#ifndef CONFIG_MICROBIT_ERASE_USER_DATA_ON_REFLASH -#define CONFIG_MICROBIT_ERASE_USER_DATA_ON_REFLASH 1 -#endif - -// Defines default behaviour of triple-tap-reset-to-pair feature. -// 0: Feature disabled -// 1: Feature enabled. Triple tap of reset button enters Bluetooth pairing mode. -#ifndef DEVICE_TRIPLE_RESET_TO_PAIR -#define DEVICE_TRIPLE_RESET_TO_PAIR 1 -#endif /** * Class definition for a MicroBit device. diff --git a/source/MicroBitLog.cpp b/source/MicroBitLog.cpp index bb6f5375..6c4c8d02 100644 --- a/source/MicroBitLog.cpp +++ b/source/MicroBitLog.cpp @@ -910,7 +910,7 @@ void MicroBitLog::_invalidate() if (_isPresent()) { -#if (CONFIG_MICROBIT_LOG_FULL_ERASE_BY_DEFAULT) +#if CONFIG_ENABLED(CONFIG_MICROBIT_LOG_FULL_ERASE_BY_DEFAULT) _clear(); #endif MicroBitLogMetaData m;