-
Notifications
You must be signed in to change notification settings - Fork 400
restore ww pumps for 0.7.0-dev #1176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8ee8483
c6ea53e
d45d29c
5e15e18
e54bdbe
459c2e2
5b720b1
1d73dbb
4971861
ac43e91
889cca7
e94cc78
bd9a9c4
1e2ac27
620ea30
a679bd9
9bad0e2
60aa85c
300a100
9204022
2c3d41b
9defb3c
d7c8a27
2eeae2e
72eac54
21204a4
e658acc
54a0f25
e074d61
eb4d387
3b731e3
07eba20
641fbdd
ea1d009
8d4f608
4f95a21
3665309
7a809c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ source $(dirname $0)/oref0-bash-common-functions.sh || (echo "ERROR: Failed to r | |
|
|
||
| # TODO: deprecate g4-upload and g4-local-only | ||
| usage "$@" <<EOT | ||
| Usage: $self <--dir=directory> <--serial=pump_serial_#> [--tty=/dev/ttySOMETHING] [--max_iob=0] [--ns-host=https://mynightscout.herokuapp.com] [--api-secret=[myplaintextapisecret|token=subjectname-plaintexthashsecret] [--cgm=(G4-upload|G4-local-only|G4-go|G5|MDT|xdrip|xdrip-js)] [--bleserial=SM123456] [--blemac=FE:DC:BA:98:76:54] [--dexcom_tx_sn=12A34B] [--btmac=AB:CD:EF:01:23:45] [--enable='autotune'] [--radio_locale=(WW|US)] [--ww_ti_usb_reset=(yes|no)] | ||
| Usage: $self <--dir=directory> <--serial=pump_serial_#> [--tty=/dev/ttySOMETHING] [--max_iob=0] [--ns-host=https://mynightscout.herokuapp.com] [--api-secret=[myplaintextapisecret|token=subjectname-plaintexthashsecret] [--cgm=(G4-upload|G4-local-only|G4-go|G5|MDT|xdrip|xdrip-js)] [--bleserial=SM123456] [--blemac=FE:DC:BA:98:76:54] [--dexcom_tx_sn=12A34B] [--btmac=AB:CD:EF:01:23:45] [--enable='autotune'] [--radio_locale=(WW|US)] | ||
| EOT | ||
|
|
||
| # defaults | ||
|
|
@@ -104,9 +104,6 @@ case $i in | |
| -p=*|--btpeb=*) | ||
| BT_PEB="${i#*=}" | ||
| ;; | ||
| --ww_ti_usb_reset=*) # use reset if pump device disappears with TI USB and WW-pump | ||
| ww_ti_usb_reset="${i#*=}" | ||
| ;; | ||
| -pt=*|--pushover_token=*) | ||
| PUSHOVER_TOKEN="${i#*=}" | ||
| ;; | ||
|
|
@@ -284,7 +281,11 @@ function copy_go_binaries () { | |
|
|
||
| function move_mmtune () { | ||
| request_stop_local_binary Go-mmtune | ||
| mv /usr/local/bin/mmtune /usr/local/bin/Go-mmtune || echo "Couldn't move mmtune to Go-mmtune" | ||
| if [ -f /usr/local/bin/mmtune ]; then | ||
| mv /usr/local/bin/mmtune /usr/local/bin/Go-mmtune || die "Couldn't move mmtune to Go-mmtune" | ||
| else | ||
| die "Couldn't move_mmtune() because /usr/local/bin/mmtune exists" | ||
| fi | ||
| } | ||
|
|
||
|
|
||
|
|
@@ -376,7 +377,7 @@ if [[ -z "$DIR" || -z "$serial" ]]; then | |
| fi | ||
| read -p "Would you like to [D]ownload released precompiled Go pump communication library or install an [U]nofficial (possibly untested) version.[D]/U " -r | ||
| if [[ $REPLY =~ ^[Uu]$ ]]; then | ||
| read -p "You could either build the Medtronic library from [S]ource, or type the version tag you would like to use, example 'v2018.08.08' [S]/<version> " -r | ||
| read -p "You could either build the Medtronic library from [S]ource, or type the version tag you would like to use, example 'v2019.01.21' [S]/<version> " -r | ||
| if [[ $REPLY =~ ^[Ss]$ ]]; then | ||
| buildgofromsource=true | ||
| echo "Building Go pump binaries from source" | ||
|
|
@@ -395,7 +396,7 @@ if [[ -z "$DIR" || -z "$serial" ]]; then | |
| ecc1medtronicversion="tags/$REPLY" | ||
| echo "Will use https://github.com/ecc1/medtronic/releases/$REPLY." | ||
|
|
||
| read -p "Also enter the ecc1/dexcom version, example 'v2018.07.26' <version> " -r | ||
| read -p "Also enter the ecc1/dexcom version, example 'v2018.12.05' <version> " -r | ||
| ecc1dexcomversion="tags/$REPLY" | ||
| echo "Will use https://github.com/ecc1/dexcom/$REPLY if Go-dexcom is needed." | ||
| fi | ||
|
|
@@ -420,20 +421,6 @@ if [[ -z "$DIR" || -z "$serial" ]]; then | |
| # Force uppercase, just in case the user entered ww | ||
| radio_locale=${radio_locale^^} | ||
|
|
||
| # check if user has a TI USB stick and a WorldWide pump and want's to reset the USB subsystem during mmtune if the TI USB fails | ||
| ww_ti_usb_reset="no" # assume you don't want it by default | ||
| if ! is_edison; then | ||
| if [[ $radio_locale =~ ^WW$ ]]; then | ||
| echo "If you have a TI USB stick and a WW pump and a Raspberry PI, you might want to reset the USB subsystem if it can't be found during a mmtune process. If so, enter Y. Otherwise just hit enter (default no):" | ||
| echo | ||
| if prompt_yn "Do you want to reset the USB system in case the TI USB stick can't be found during a mmtune proces?" N; then | ||
| ww_ti_usb_reset="yes" | ||
| else | ||
| ww_ti_usb_reset="no" | ||
| fi | ||
| fi | ||
| fi | ||
|
|
||
| if [[ -z "${radio_locale}" ]]; then | ||
| radio_locale='US' | ||
| fi | ||
|
|
@@ -533,12 +520,6 @@ if [[ -z "$DIR" || -z "$serial" ]]; then | |
| echo | ||
| echo | ||
|
|
||
| else | ||
| if [[ $ww_ti_usb_reset =~ ^[Yy] ]]; then | ||
| ww_ti_usb_reset="yes" | ||
| else | ||
| ww_ti_usb_reset="no" | ||
| fi | ||
| fi | ||
|
|
||
| echo -n "Setting up oref0 in $directory for pump $serial with $CGM CGM, " | ||
|
|
@@ -617,9 +598,6 @@ fi | |
| if [[ ! -z "$radio_locale" ]]; then | ||
| echo -n " --radio_locale='$radio_locale'" | tee -a $OREF0_RUNAGAIN | ||
| fi | ||
| if [[ ${ww_ti_usb_reset,,} =~ "yes" ]]; then | ||
| echo -n " --ww_ti_usb_reset='$ww_ti_usb_reset'" | tee -a $OREF0_RUNAGAIN | ||
| fi | ||
| if [[ ! -z "$BLE_MAC" ]]; then | ||
| echo -n " --blemac='$BLE_MAC'" | tee -a $OREF0_RUNAGAIN | ||
| fi | ||
|
|
@@ -741,7 +719,7 @@ if prompt_yn "" N; then | |
| preferences_from_args+="\"min_5m_carbimpact\":$min_5m_carbimpact " | ||
| fi | ||
| function join_by { local IFS="$1"; shift; echo "$*"; } | ||
| # merge existing prefrences with preferences from arguments. (preferences from arguments take precedence) | ||
| # merge existing preferences with preferences from arguments. (preferences from arguments take precedence) | ||
| echo "{ $(join_by , ${preferences_from_args[@]}) }" > arg_prefs.json | ||
| if [[ -s preferences.json ]]; then | ||
| cat arg_prefs.json | jq --slurpfile existing_prefs preferences.json '$existing_prefs[0] + .' > updated_prefs.json && rm arg_prefs.json | ||
|
|
@@ -758,6 +736,8 @@ if prompt_yn "" N; then | |
| set_pref_string .enable "$ENABLE" | ||
| set_pref_string .ttyport "$ttyport" | ||
| set_pref_string .myopenaps_path "$directory" | ||
| set_pref_string .pump_serial "$serial" | ||
| set_pref_string .radio_locale "$radio_locale" | ||
| if [[ ! -z "$BT_PEB" ]]; then | ||
| set_pref_string .bt_peb "$BT_PEB" | ||
| fi | ||
|
|
@@ -998,15 +978,6 @@ if prompt_yn "" N; then | |
| fi | ||
| fi | ||
|
|
||
| # from 0.5.0 the subg-ww-radio-parameters script will be run from oref0_init_pump_comms.py | ||
| # this will be called when mmtune is use with a WW pump. | ||
| # See https://github.com/oskarpearson/mmeowlink/issues/51 or https://github.com/oskarpearson/mmeowlink/wiki/Non-USA-pump-settings for details | ||
| # use --ww_ti_usb_reset=yes if using a TI USB stick and a WW pump. This will reset the USB subsystem if the TI USB device is not found. | ||
| # TODO: remove this workaround once https://github.com/oskarpearson/mmeowlink/issues/60 has been fixed | ||
| if [[ ${ww_ti_usb_reset,,} =~ "yes" ]]; then | ||
| openaps alias remove mmtune | ||
| openaps alias add mmtune "! bash -c \"oref0_init_pump_comms.py --ww_ti_usb_reset=yes -v; find monitor/ -size +5c | grep -q mmtune && cp monitor/mmtune.json mmtune_old.json; echo {} > monitor/mmtune.json; echo -n \"mmtune: \" && openaps report invoke monitor/mmtune.json; grep -v setFreq monitor/mmtune.json | grep -A2 $(cat monitor/mmtune.json | jq -r .setFreq) | while read line; do echo -n \"$line \"; done\"" | ||
| fi | ||
| echo Checking kernel for mraa installation | ||
| #if uname -r 2>&1 | egrep "^4.1[0-9]"; then # don't install mraa on 4.10+ kernels | ||
| # echo "Skipping mraa install for kernel 4.10+" | ||
|
|
@@ -1040,39 +1011,37 @@ if prompt_yn "" N; then | |
| #echo Installing latest openaps dev && sudo pip install --default-timeout=1000 git+https://github.com/openaps/openaps.git@dev || die "Couldn't install openaps" | ||
| #fi | ||
|
|
||
| # we only need spi_serial and mraa for MDT CGM, which Go doesn't support yet | ||
| # Create pump device | ||
| # We only need the openaps pump device for mdt CGM and mmeowlink users, which Go doesn't support yet | ||
| if [[ ${CGM,,} =~ "mdt" ]]; then | ||
| cd $directory || die "Can't cd $directory" | ||
| echo "Removing any existing pump device:" | ||
| ( killall -g openaps; killall -g oref0-pump-loop) 2>/dev/null; openaps device remove pump 2>/dev/null | ||
| if [[ -z "$ttyport" ]]; then | ||
| openaps device add pump medtronic $serial || die "Can't add pump" | ||
| # add carelink to pump.ini | ||
| # add carelink to pump.ini. TODO: check if this workaround can be removed | ||
| grep -q radio_type pump.ini || echo "radio_type=carelink" >> pump.ini | ||
| # carelinks can't listen for silence or mmtune, so just do a preflight check instead | ||
| openaps alias add wait-for-silence 'report invoke monitor/temp_basal.json' | ||
| openaps alias add wait-for-long-silence 'report invoke monitor/temp_basal.json' | ||
| openaps alias add mmtune 'report invoke monitor/temp_basal.json' | ||
| else | ||
| # radio_locale requires openaps 0.2.0-dev or later | ||
| openaps device add pump mmeowlink subg_rfspy $ttyport $serial $radio_locale || die "Can't add pump" | ||
| #openaps alias add wait-for-silence '! bash -c "(mmeowlink-any-pump-comms.py --port '$ttyport' --wait-for 1 | grep -q comms && echo -n Radio ok, || openaps mmtune) && echo -n \" Listening: \"; for i in $(seq 1 100); do echo -n .; mmeowlink-any-pump-comms.py --port '$ttyport' --wait-for 30 2>/dev/null | egrep -v subg | egrep No && break; done"' | ||
| #openaps alias add wait-for-long-silence '! bash -c "echo -n \"Listening: \"; for i in $(seq 1 200); do echo -n .; mmeowlink-any-pump-comms.py --port '$ttyport' --wait-for 45 2>/dev/null | egrep -v subg | egrep No && break; done"' | ||
| if [[ ${radio_locale,,} =~ "ww" ]]; then | ||
| if [ -d "$HOME/src/subg_rfspy/" ]; then | ||
| echo "$HOME/src/subg_rfspy/ already exists; pulling latest" | ||
| (cd $HOME/src/subg_rfspy && git fetch && git pull) || die "Couldn't pull latest subg_rfspy" | ||
| else | ||
| echo -n "Cloning subg_rfspy: " | ||
| (cd $HOME/src && git clone https://github.com/ps2/subg_rfspy) || die "Couldn't clone oref0" | ||
| fi | ||
| fi | ||
| elif [[ "$ttyport" =~ "mmeowlink" ]]; then # e.g. for TI USB | ||
| # radio_locale requires openaps 0.2.0-dev or later | ||
| openaps device add pump mmeowlink subg_rfspy $ttyport $serial $radio_locale || die "Can't add pump" | ||
| #openaps alias add wait-for-silence '! bash -c "(mmeowlink-any-pump-comms.py --port '$ttyport' --wait-for 1 | grep -q comms && echo -n Radio ok, || openaps mmtune) && echo -n \" Listening: \"; for i in $(seq 1 100); do echo -n .; mmeowlink-any-pump-comms.py --port '$ttyport' --wait-for 30 2>/dev/null | egrep -v subg | egrep No && break; done"' | ||
| #openaps alias add wait-for-long-silence '! bash -c "echo -n \"Listening: \"; for i in $(seq 1 200); do echo -n .; mmeowlink-any-pump-comms.py --port '$ttyport' --wait-for 45 2>/dev/null | egrep -v subg | egrep No && break; done"' | ||
| # TODO: check in codebase if https://github.com/ps2/subg_rfspy/tree/master/tools python scripts are still used | ||
| if [[ ${radio_locale,,} =~ "ww" ]]; then | ||
| if [ -d "$HOME/src/subg_rfspy/" ]; then | ||
| echo "$HOME/src/subg_rfspy/ already exists; pulling latest" | ||
| (cd $HOME/src/subg_rfspy && git fetch && git pull) || die "Couldn't pull latest subg_rfspy" | ||
| else | ||
| echo -n "Cloning subg_rfspy: " | ||
| (cd $HOME/src && git clone https://github.com/ps2/subg_rfspy) || die "Couldn't clone oref0" | ||
| fi | ||
|
|
||
| # Hack to check if radio_locale has been set in pump.ini. | ||
| # It will remove empty line at the end of pump.ini and then append radio_locale if it's not there yet | ||
| grep -q radio_locale pump.ini || echo "$(< pump.ini)" > pump.ini ; echo "radio_locale=$radio_locale" >> pump.ini | ||
| fi | ||
| else | ||
| else # in all other case create a pump.ini with serial and radio_locale. TODO: can we skip creating a pump.ini. I can't find references of it's being used | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that xdrip-js uses
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't want to suggest to remove it now. As far as I can see I removed all the references to the pump.ini from the oref0 code base. I hope @efidoman @jpcunningh @thebookins can say if their software somehow uses pump.ini. I just checked Lookout, but can't find any reference: https://github.com/xdrip-js/Lookout/search?q=pump.ini&unscoped_q=pump.ini
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only use might be for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created xdrip-js/Logger#137 for that |
||
| echo '[device "pump"]' > pump.ini | ||
| echo "serial = $serial" >> pump.ini | ||
| echo "radio_locale = $radio_locale" >> pump.ini | ||
|
|
@@ -1285,13 +1254,9 @@ if prompt_yn "" N; then | |
| mkdir -p $HOME/go | ||
| source $HOME/.bash_profile | ||
|
|
||
|
|
||
| #Necessary to "bootstrap" Go commands... | ||
| if [[ ${radio_locale,,} =~ "ww" ]]; then | ||
| echo 868.4 > $directory/monitor/medtronic_frequency.ini | ||
| #Store radio_locale for later use | ||
| # It will remove empty line at the end of pump.ini and then append radio_locale if it's not there yet | ||
| grep -q radio_locale pump.ini || echo "$(< pump.ini)" > pump.ini ; echo "radio_locale=$radio_locale" >> pump.ini | ||
| else | ||
| echo 916.55 > $directory/monitor/medtronic_frequency.ini | ||
| fi | ||
|
|
@@ -1347,16 +1312,6 @@ if prompt_yn "" N; then | |
| move_mmtune | ||
| fi | ||
|
|
||
| #if [[ "$ttyport" =~ "spi" ]]; then | ||
| #echo Resetting spi_serial | ||
| #reset_spi_serial.py | ||
| #fi | ||
| # Commenting out the mmtune as attempt to stop the radio reboot errors that happen when re-setting up. | ||
| # echo Attempting to communicate with pump: | ||
| # ( killall -g openaps; killall -g oref0-pump-loop ) 2>/dev/null | ||
| # openaps mmtune | ||
| # echo | ||
|
|
||
| # clear any extraneous input before prompting | ||
| while(read -r -t 0.1); do true; done | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.