Skip to content

Commit

Permalink
autotune carb_ratio null check (#450)
Browse files Browse the repository at this point in the history
* if carb_ratio is null buy we have a valid carb_ratios object, use that

* if carb_ratio is null buy we have a valid carb_ratios object, use that

* if profile.json contains null carb_ratio use profile.pump.json

* Revert "if carb_ratio is null buy we have a valid carb_ratios object, use that"

This reverts commit 687edb8.

* Revert "if carb_ratio is null buy we have a valid carb_ratios object, use that"

This reverts commit 35d506e.

* check for carb_ratio==null if oref0-autotune-core fails
  • Loading branch information
scottleibrand authored May 1, 2017
1 parent 9272ded commit 7134baf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions bin/oref0-autotune.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,15 @@ do
# Autotune (required args, <autotune/glucose.json> <autotune/autotune.json> <settings/profile.json>),
# output autotuned profile or what will be used as <autotune/autotune.json> in the next iteration
echo "oref0-autotune-core autotune.$run_number.$i.json profile.json profile.pump.json > newprofile.$run_number.$i.json"
oref0-autotune-core autotune.$run_number.$i.json profile.json profile.pump.json > newprofile.$run_number.$i.json || die "Could not run oref0-autotune-core autotune.$run_number.$i.json profile.json profile.pump.json"

# Copy tuned profile produced by autotune to profile.json for use with next day of data
cp newprofile.$run_number.$i.json profile.json
if ! oref0-autotune-core autotune.$run_number.$i.json profile.json profile.pump.json > newprofile.$run_number.$i.json; then
if cat profile.json | jq --exit-status .carb_ratio==null; then
echo "ERROR: profile.json contains null carb_ratio: using profile.pump.json"
cp profile.pump.json profile.json
exit
else
die "Could not run oref0-autotune-core autotune.$run_number.$i.json profile.json profile.pump.json"
fi
fi

done # End Date Range Iteration
done # End Number of Runs Loop
Expand Down

0 comments on commit 7134baf

Please sign in to comment.