-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #707 from openaps/dev
Prep for oref0 0.6.0 release dev to master
- Loading branch information
Showing
68 changed files
with
4,074 additions
and
5,634 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,7 @@ coverage/ | |
|
||
npm-debug.log | ||
bin/__pycache__ | ||
|
||
package-lock.json | ||
|
||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
if [[ ! -z "$2" ]]; then | ||
input=$(oref0-set-local-temptarget $@) | ||
elif [[ ! -z "$1" ]]; then | ||
input=$(cat $1) | ||
else | ||
input=$(cat /dev/stdin) | ||
fi | ||
#cat "${1:-/dev/stdin}" \ | ||
echo $input \ | ||
| tee /tmp/temptarget.json \ | ||
&& jq -s '[.[0]] + .[1]' /tmp/temptarget.json settings/local-temptargets.json \ | ||
| tee settings/local-temptargets.json.new \ | ||
&& mv settings/local-temptargets.json.new settings/local-temptargets.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
main() { | ||
echo | ||
echo Starting oref0-autosens-loop at $(date): | ||
overtemp && exit 1 | ||
if highload && completed_recently; then | ||
echo Load high at $(date): waiting up to 30m to continue | ||
exit 2 | ||
fi | ||
|
||
autosens 2>&1 | ||
touch /tmp/autons-completed | ||
echo Completed oref0-autons-loop at $(date) | ||
} | ||
|
||
function overtemp { | ||
# check for CPU temperature above 85°C | ||
sensors -u 2>/dev/null | awk '$NF > 85' | grep input \ | ||
&& echo Edison is too hot: waiting for it to cool down at $(date)\ | ||
&& echo Please ensure rig is properly ventilated | ||
} | ||
|
||
function highload { | ||
# check whether system load average is high | ||
uptime | awk '$NF > 2' | grep load | ||
} | ||
|
||
function completed_recently { | ||
find /tmp/ -mmin -30 | egrep -q "autosens-completed" | ||
} | ||
|
||
# find settings/ -newer settings/autosens.json | grep -q pumphistory-24h-zoned.json || find settings/ -size -5c | grep -q autosens.json || ! find settings/ | grep -q autosens || ! find settings/autosens.json | ||
# openaps use detect-sensitivity shell monitor/glucose.json settings/pumphistory-24h-zoned.json settings/insulin_sensitivities.json settings/basal_profile.json settings/profile.json monitor/carbhistory.json settings/temptargets.json | ||
function autosens { | ||
# only run autosens if pumphistory-24h is newer than autosens | ||
if find settings/ -newer settings/autosens.json | grep -q pumphistory-24h-zoned.json \ | ||
|| find settings/ -size -5c | grep -q autosens.json \ | ||
|| ! find settings/ | grep -q autosens \ | ||
|| ! find settings/autosens.json >/dev/null; then | ||
if oref0-detect-sensitivity monitor/glucose.json settings/pumphistory-24h-zoned.json settings/insulin_sensitivities.json settings/basal_profile.json settings/profile.json monitor/carbhistory.json settings/temptargets.json > settings/autosens.json.new && cat settings/autosens.json.new | jq .ratio | grep -q [0-9]; then | ||
mv settings/autosens.json.new settings/autosens.json | ||
echo -n "Autosens refreshed: " | ||
else | ||
echo -n "Failed to refresh autosens: using old autosens.json: " | ||
fi | ||
else | ||
echo -n "No need to refresh autosens yet: " | ||
fi | ||
cat settings/autosens.json | jq . -C -c | ||
} | ||
|
||
die() { | ||
echo "$@" | ||
exit 1 | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.