Skip to content

Commit

Permalink
* Take the correct time stamp even when find_new_curve is not called …
Browse files Browse the repository at this point in the history
…on last packet.
  • Loading branch information
tzachi-dar authored and jamorham committed Sep 18, 2016
1 parent dd8e5ff commit 04d05be
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -928,11 +928,12 @@ public void find_slope() {
public void find_new_curve() {
List<BgReading> last_3 = BgReading.latest(3);
if ((last_3 != null) && (last_3.size() == 3)) {
BgReading latest = last_3.get(0);
BgReading second_latest = last_3.get(1);
BgReading third_latest = last_3.get(2);

double y3 = calculated_value;
double x3 = timestamp;
double y3 = latest.calculated_value;
double x3 = latest.timestamp;
double y2 = second_latest.calculated_value;
double x2 = second_latest.timestamp;
double y1 = third_latest.calculated_value;
Expand All @@ -952,7 +953,7 @@ public void find_new_curve() {
BgReading second_latest = last_3.get(1);

double y2 = latest.calculated_value;
double x2 = timestamp;
double x2 = latest.timestamp;
double y1 = second_latest.calculated_value;
double x1 = second_latest.timestamp;

Expand Down

0 comments on commit 04d05be

Please sign in to comment.