Skip to content

Commit

Permalink
Add support for touchscreen receivers, fix CGM loop bug for connected…
Browse files Browse the repository at this point in the history
… receivers (#1217)

* Add support for touchscreen receivers, fix CGM loop bug for connected receivers

Changed files:
`oref0-setup.sh`
- Includes cgm_loop_path fix found by @chuckj for both G5 and G6 (8799a13 to fix #1149) and includes support for G5/G6 touch receivers (previously under #1182)

`oref0-cron-every-minute.sh`
- Reincluding support for offline CGM, with optional upload, for G5 and G6 receivers

* Readding accidentally removed logging

Reenables apache-chainsaw support

* Resolving conflicts with newly merged changes

* Touchup
  • Loading branch information
jaylagorio authored and scottleibrand committed Mar 11, 2019
1 parent 8c1c980 commit dcb5cfd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
18 changes: 11 additions & 7 deletions bin/oref0-cron-every-minute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ find /var/log/openaps/pump-loop.log -mmin +5 | grep pump && (
# if the rig doesn't recover after that, reboot:
oref0-radio-reboot &

if [[ ${CGM,,} =~ "g5-upload" ]]; then
oref0-upload-entries &
fi

if [[ ${CGM,,} =~ "g4-go" ]]; then
cd $CGM_LOOPDIR
if ! is_bash_process_running_named oref0-g4-loop; then
Expand All @@ -81,6 +77,10 @@ elif [[ ${CGM,,} =~ "g4-upload" ]]; then
cp -up $CGM_LOOPDIR/monitor/glucose-raw-merge.json $directory/cgm/glucose.json
cp -up $CGM_LOOPDIR/$directory/cgm/glucose.json $directory/monitor/glucose.json
) &
elif [[ ${CGM,,} =~ "g5" || ${CGM,,} =~ "g5-upload" || ${CGM,,} =~ "g6" || ${CGM,,} =~ "g6-upload" ]]; then
if ! is_process_running_named "oref0-monitor-cgm"; then
(date; oref0-monitor-cgm) | tee -a /var/log/openaps/cgm-loop.log
fi
elif [[ ${CGM,,} =~ "xdrip" ]]; then
if ! is_process_running_named "monitor-xdrip"; then
monitor-xdrip | tee -a /var/log/openaps/xdrip-loop.log | adddate openaps.xdrip-loop | uncolor |tee -a /var/log/openaps/openaps-date.log &
Expand All @@ -95,21 +95,25 @@ elif ! [[ ${CGM,,} =~ "mdt" ]]; then # use nightscout for cgm
fi
fi

if [[ ${CGM,,} =~ "g5-upload" || ${CGM,,} =~ "g6-upload" ]]; then
oref0-upload-entries &
fi

if ! is_bash_process_running_named oref0-ns-loop; then
oref0-ns-loop | tee -a /var/log/openaps/ns-loop.log | adddate openaps.ns-loop | uncolor |tee -a /var/log/openaps/openaps-date.log &
fi

if ! is_bash_process_running_named oref0-autosens-loop; then
oref0-autosens-loop 2>&1 | tee -a /var/log/openaps/autosens-loop.log | adddate openaps.autosens-loop | uncolor |tee -a /var/log/openaps/openaps-date.log&
oref0-autosens-loop 2>&1 | tee -a /var/log/openaps/autosens-loop.log | adddate openaps.autosens-loop | uncolor |tee -a /var/log/openaps/openaps-date.log &
fi

if ! is_bash_process_running_named oref0-pump-loop; then
oref0-pump-loop 2>&1 | tee -a /var/log/openaps/pump-loop.log | adddate openaps.pump-loop | uncolor |tee -a /var/log/openaps/openaps-date.log&
oref0-pump-loop 2>&1 | tee -a /var/log/openaps/pump-loop.log | adddate openaps.pump-loop | uncolor |tee -a /var/log/openaps/openaps-date.log &
fi

if [[ ! -z "$BT_PEB" ]]; then
if ! is_process_running_named "peb-urchin-status $BT_PEB"; then
peb-urchin-status $BT_PEB 2>&1 | tee -a /var/log/openaps/urchin-loop.log | adddate openaps.urchin-loop | uncolor |tee -a /var/log/openaps/openaps-date.log&
peb-urchin-status $BT_PEB 2>&1 | tee -a /var/log/openaps/urchin-loop.log | adddate openaps.urchin-loop | uncolor |tee -a /var/log/openaps/openaps-date.log &
fi
fi

Expand Down
14 changes: 10 additions & 4 deletions bin/oref0-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ function validate_cgm ()
fi

# TODO: Compare against list of supported CGMs
# list of CGM supported by oref0 0.6.x: "g4-upload", "g5", "g5-upload", "mdt", "shareble", "xdrip", "g4-local"
# list of CGM supported by oref0 0.7.x: "g4-upload", "g5", "g5-upload", "G6", "G6-upload", "mdt", "shareble", "xdrip", "g4-local"

if ! [[ $selection =~ "g4-go" || $selection =~ "g5" || $selection =~ "g5-upload" || $selection =~ "mdt" || $selection =~ "xdrip" || $selection =~ "xdrip-js" || $selection =~ "g4-local" ]]; then
echo "Unsupported CGM. Please select (Dexcom) G4-go (default), G4-local-only, G5, G5-upload, MDT, xdrip, or xdrip-js."
if ! [[ $selection =~ "g4-go" || $selection =~ "g5" || $selection =~ "g5-upload" || ${CGM,,} =~ "g6" || ${CGM,,} =~ "g6-upload" || $selection =~ "mdt" || $selection =~ "xdrip" || $selection =~ "xdrip-js" || $selection =~ "g4-local" ]]; then
echo "Unsupported CGM. Please select (Dexcom) G4-go (default), G4-local-only, G5, G5-upload, G6, G6-upload, MDT, xdrip, or xdrip-js."
echo
return 1
fi
Expand Down Expand Up @@ -323,6 +323,8 @@ if [[ -z "$DIR" || -z "$serial" ]]; then
echo "G4-local-only: will use BGs from a plugged in G4, but will *not* upload them"
echo "G5: will use BGs from a plugged in G5, but will *not* upload them (the G5 app usually does that)"
echo "G5-upload: will use and upload BGs from a plugged in G5 receiver to Nightscout"
echo "G6: will use BGs from a plugged in G5/G6 touchscreen receiver, but will *not* upload them (the G6 app usually does that)"
echo "G6-upload: will use and upload BGs from a plugged in G5/G6 touchscreen receiver to Nightscout"
echo "MDT: will use and upload BGs from an Enlite sensor paired to your pump"
echo "xdrip: will work with an xDrip receiver app on your Android phone"
echo "xdrip-js: will work directly with a Dexcom G5 transmitter and will upload to Nightscout"
Expand Down Expand Up @@ -754,7 +756,7 @@ if prompt_yn "" N; then
# The Nightscout API_SECRET (admin password) should not be written in plain text, but in a hashed form
# set_pref_string .nightscout_api_secret "$API_SECRET"

if [[ ${CGM,,} =~ "g4-go" ]]; then
if [[ ${CGM,,} =~ "g4-go" || ${CGM,,} =~ "g5" || ${CGM,,} =~ "g5-upload" || ${CGM,,} =~ "g6" || ${CGM,,} =~ "g6-upload" ]]; then
set_pref_string .cgm_loop_path "$directory"
elif [[ ${CGM,,} =~ "g4-upload" || ${CGM,,} =~ "g4-local-only" ]]; then # TODO: deprecate g4-upload and g4-local-only
set_pref_string .cgm_loop_path "$directory-cgm-loop"
Expand Down Expand Up @@ -901,6 +903,10 @@ if prompt_yn "" N; then
openaps use cgm config --G5
openaps report add raw-cgm/raw-entries.json JSON cgm oref0_glucose --hours "24.0" --threshold "100" --no-raw
set_pref_string .cgm_loop_path "$directory"
elif [[ ${CGM,,} =~ "g6" || ${CGM,,} =~ "g6-upload" ]]; then
openaps use cgm config --G6
openaps report add raw-cgm/raw-entries.json JSON cgm oref0_glucose --hours "24.0" --threshold "100" --no-raw
set_pref_string .cgm_loop_path "$directory"
## TODO: figure out if any of this is still needed
#elif [[ ${CGM,,} =~ "g4-go" ]]; then
#echo Checking Adafruit_BluefruitLE installation
Expand Down

0 comments on commit dcb5cfd

Please sign in to comment.