1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-27 12:26:48 +01:00

Merge pull request #60 from danielegobbetti/fix_data_in_the_future

Do not allocate the buffer if there's no data available.
This commit is contained in:
Carsten Pfeiffer 2015-06-02 21:43:32 +02:00
commit 32b2500d6b

View File

@ -462,8 +462,10 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
LOG.info("data to read until next header: "+ dataUntilNextHeader +" len: " + (dataUntilNextHeader / 3) + " minute(s)");
LOG.info("TIMESTAMP: " + DateFormat.getDateTimeInstance().format(timestamp.getTime()).toString() + " magic byte: " + dataUntilNextHeader);
this.activityDataRemainingBytes = this.activityDataUntilNextHeader = dataUntilNextHeader;
this.activityDataTimestampProgress = this.activityDataTimestampToAck = timestamp;
if (dataUntilNextHeader > 0 ) { //tentative fix for data in the future
this.activityDataRemainingBytes = this.activityDataUntilNextHeader = dataUntilNextHeader;
this.activityDataTimestampProgress = this.activityDataTimestampToAck = timestamp;
}
} else {
bufferActivityData(value);