updates
Dependencies: BLE_API mbed-dev-bin nRF51822
Fork of microbit-dal-eddystone by
Revision 48:34d1adb6771c, committed 2016-07-13
- Comitter:
- LancasterUniversity
- Date:
- Wed Jul 13 12:18:27 2016 +0100
- Parent:
- 47:69f452b1a5c9
- Child:
- 49:88f03f3feff1
- Commit message:
- Synchronized with git rev dc9b0078
Changed in this revision
--- a/source/drivers/MicroBitCompass.cpp Wed Jul 13 12:18:26 2016 +0100 +++ b/source/drivers/MicroBitCompass.cpp Wed Jul 13 12:18:27 2016 +0100 @@ -55,7 +55,7 @@ if(this->storage != NULL) { - KeyValuePair *calibrationData = storage->get(ManagedString("compassCal")); + KeyValuePair *calibrationData = storage->get("compassCal"); if(calibrationData != NULL) {
--- a/source/drivers/MicroBitStorage.cpp Wed Jul 13 12:18:26 2016 +0100 +++ b/source/drivers/MicroBitStorage.cpp Wed Jul 13 12:18:27 2016 +0100 @@ -223,6 +223,16 @@ if(keySize > (int)sizeof(pair.key) || dataSize > (int)sizeof(pair.value) || dataSize < 0) return MICROBIT_INVALID_PARAMETER; + KeyValuePair *currentValue = get(key); + + int upToDate = currentValue && (memcmp(currentValue->value, data, dataSize) == 0); + + if(currentValue) + delete currentValue; + + if(upToDate) + return MICROBIT_OK; + memcpy(pair.key, key, keySize); memcpy(pair.value, data, dataSize);
--- a/source/drivers/MicroBitThermometer.cpp Wed Jul 13 12:18:26 2016 +0100 +++ b/source/drivers/MicroBitThermometer.cpp Wed Jul 13 12:18:27 2016 +0100 @@ -71,7 +71,7 @@ this->sampleTime = 0; this->offset = 0; - KeyValuePair *tempCalibration = storage->get(ManagedString("tempCal")); + KeyValuePair *tempCalibration = storage->get("tempCal"); if(tempCalibration != NULL) {