Skip to content

Commit

Permalink
Take the correct time stamp even when find_new_raw_curve is not calle…
Browse files Browse the repository at this point in the history
…d on last packet.
  • Loading branch information
tzachi-dar authored and jamorham committed Sep 18, 2016
1 parent 84b63b9 commit dd8e5ff
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -990,11 +990,13 @@ public void calculateAgeAdjustedRawValue(){
public void find_new_raw_curve() {
List<BgReading> last_3 = BgReading.latest(3);
if ((last_3 != null) && (last_3.size() == 3)) {
BgReading second_latest = last_3.get(1);
BgReading third_latest = last_3.get(2);

double y3 = age_adjusted_raw_value;
double x3 = timestamp;
final BgReading latest = last_3.get(0);
final BgReading second_latest = last_3.get(1);
final BgReading third_latest = last_3.get(2);

double y3 = latest.age_adjusted_raw_value;
double x3 = latest.timestamp;
double y2 = second_latest.age_adjusted_raw_value;
double x2 = second_latest.timestamp;
double y1 = third_latest.age_adjusted_raw_value;
@@ -1011,7 +1013,7 @@ public void find_new_raw_curve() {
BgReading second_latest = last_3.get(1);

double y2 = latest.age_adjusted_raw_value;
double x2 = timestamp;
double x2 = latest.timestamp;
double y1 = second_latest.age_adjusted_raw_value;
double x1 = second_latest.timestamp;
if(y1 == y2) {

0 comments on commit dd8e5ff

Please sign in to comment.