diff --git a/lib/drivers/tandemTslimDriver.js b/lib/drivers/tandemTslimDriver.js index 5afae6d897..13d1616648 100644 --- a/lib/drivers/tandemTslimDriver.js +++ b/lib/drivers/tandemTslimDriver.js @@ -1183,6 +1183,7 @@ module.exports = function (config) { } else { if(__DEBUG__) { + debug('oldest event seq: ', start_seq); debug('oldest record deviceTime: ', result.payload.deviceTime); } minIndex = start_seq; @@ -1194,7 +1195,7 @@ module.exports = function (config) { function binarySearch(err, result) { if (err) { - debug('error retrieving record ', result); + debug('error retrieving record during binary search ', result); callback(err, null); } else { @@ -1213,6 +1214,9 @@ module.exports = function (config) { tandemFetchEventRange(progress, data, callback); } currentIndex = (minIndex + maxIndex) / 2 | 0; + if (currentIndex < start_seq) { + currentIndex = start_seq; + } tandemLogRequester(currentIndex, currentIndex, progress, binarySearch); } else { @@ -1543,6 +1547,7 @@ module.exports = function (config) { case 'timed_segment|temp_rate_end': case 'new_profile': case 'temp_rate_end': + case 'temp_rate_end|pump_resumed': case 'pump_resumed': // when the command_basal_rate is not the same as the base_basal_rate // that means we're in a temp basal that crosses the border between