Skip to content

Commit

Permalink
Merge branch 'dev' into misc-stuff
Browse files Browse the repository at this point in the history
Conflicts:
	bin/openaps-packages.sh
  • Loading branch information
scottleibrand committed Aug 15, 2018
2 parents 2416069 + d7d3b8f commit 79f835f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
5 changes: 4 additions & 1 deletion bin/openaps-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4

apt-get install -y sudo
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y git python python-dev software-properties-common python-numpy python-pip nodejs-legacy watchdog strace tcpdump screen acpid vim locate jq lm-sensors || die "Couldn't install packages"
sudo apt-get install -y git python python-dev software-properties-common python-numpy python-pip watchdog strace tcpdump screen acpid vim locate jq lm-sensors || die "Couldn't install packages"
if getent passwd edison > /dev/null; then
sudo apt-get -o Acquire::ForceIPv4=true install -y nodejs-legacy || die "Couldn't install nodejs-legacy"
fi
#if ! sudo apt-get install -y npm; then
# install/upgrade to node 8
if ! nodejs --version | grep 'v8.'; then
Expand Down
43 changes: 35 additions & 8 deletions bin/oref0-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ directory=""
EXTRAS=""
radio_locale="US"
buildgofromsource=false
ecc1medtronicversion="latest"
ecc1dexcomversion="latest"
radiotags="cc111x"

# Echo text, but in bright-blue. Used for confirmation echo text. This takes
# the same arguments as echo, including the -n option.
Expand Down Expand Up @@ -339,12 +342,36 @@ if [[ -z "$DIR" || -z "$serial" ]]; then
echo
fi
fi
read -p "Would you like to [D]ownload precompiled Go pump communication library or build them from [S]ource? [D]/S " -r
if [[ $REPLY =~ ^[Ss]$ ]]; then
buildgofromsource=true
echo "Building Go pump binaries from source"
read -p "Would you like to [D]ownload 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 library from [S]ource, or type the version you would like to use, example 'v2018.07.09' [S]/<version> " -r
if [[ $REPLY =~ ^[Ss]$ ]]; then
buildgofromsource=true
echo "Building Go pump binaries from source"
buildgofromsource=true
read -p "What type of radio do you use? [1] for cc1101 [2] for CC1110 or CC1111 [3] for RFM69HCW radio module 1/[2]/3 " -r
if [[ $REPLY =~ ^[1]$ ]]; then
radiotags="cc1101"
elif [[ $REPLY =~ ^[2]$ ]]; then
radiotags="cc111x"
elif [[ $REPLY =~ ^[3]$ ]]; then
radiotags="rfm69"
else
radiotags="cc111x"
fi
echo "Building Go pump binaries from source with " + radiotags + " tags."
else
ecc1medtronicversion="tags/$REPLY"
echo "Will use https://github.com/ecc1/medtronic/releases/$REPLY."

read -p "Also enter the ecc1/dexcom version, example 'v2018.07.09' <version> " -r
ecc1dexcomversion="tags/$REPLY"
echo "Will use https://github.com/ecc1/dexcom/releases/$REPLY if Go-dexcom is needed."
fi
else
echo "Downloading precompiled Go pump binaries."
echo "Downloading latest precompiled Go pump binaries."
ecc1medtronicversion="latest"
ecc1dexcomversion="latest"
fi

if [[ ! -z "${ttyport}" ]]; then
Expand Down Expand Up @@ -1217,7 +1244,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
if [[ "$ttyport" =~ "spidev" ]]; then
if $buildgofromsource; then
#go get -u -v github.com/ecc1/cc111x || die "Couldn't go get cc111x"
go get -u -v -tags cc111x github.com/ecc1/medtronic/... || die "Couldn't go get medtronic"
go get -u -v -tags $radiotags github.com/ecc1/medtronic/... || die "Couldn't go get medtronic"
#cd $HOME/go/src/github.com/ecc1/medtronic/cmd
#cd mdt && go install -tags cc111x || die "Couldn't go install mdt"
#cd ../mmtune && go install -tags cc111x || die "Couldn't go install mmtune"
Expand All @@ -1232,7 +1259,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
arch=386-spi
fi
mkdir -p $HOME/go/bin && \
downloadUrl=$(curl -s https://api.github.com/repos/ecc1/medtronic/releases/latest | \
downloadUrl=$(curl -s https://api.github.com/repos/ecc1/medtronic/releases/$ecc1medtronicversion | \
jq --raw-output '.assets[] | select(.name | contains("'$arch'")) | .browser_download_url')
echo "Downloading Go pump binaries from:" $downloadUrl
wget -qO- $downloadUrl | tar xJv -C $HOME/go/bin || die "Couldn't download and extract Go pump binaries"
Expand All @@ -1256,7 +1283,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
if egrep -i "edison" /etc/passwd &>/dev/null; then
arch=386
fi
downloadUrl=$(curl -s https://api.github.com/repos/ecc1/dexcom/releases/latest | \
downloadUrl=$(curl -s https://api.github.com/repos/ecc1/dexcom/releases/$ecc1dexcomversion | \
jq --raw-output '.assets[] | select(.name | contains("'$arch'")) | .browser_download_url')
echo "Downloading Go dexcom binaries from:" $downloadUrl
wget -qO- $downloadUrl | tar xJv -C $HOME/go/bin || die "Couldn't download and extract Go dexcom binaries"
Expand Down
10 changes: 6 additions & 4 deletions lib/iob/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ function calcTempTreatments (inputs, zeroTempDuration) {
var temp = current;
current = temp.bolus;
}
if (current.created_at) {
current.timestamp = current.created_at;
}
var currentRecordTime = new Date(tz(current.timestamp));
//console.error(current);
//console.error(currentRecordTime,lastRecordTime);
// ignore duplicate or out-of-order records (due to 1h and 24h overlap, or timezone changes)
if (currentRecordTime > lastRecordTime) {
Expand Down Expand Up @@ -299,14 +303,14 @@ function calcTempTreatments (inputs, zeroTempDuration) {
} else if (current.enteredBy == "xdrip") {
var temp = {};
temp.timestamp = current.timestamp;
temp.started_at = new Date(tz(current.timestamp));
temp.started_at = new Date(tz(temp.timestamp));
temp.date = temp.started_at.getTime();
temp.insulin = current.insulin;
tempBoluses.push(temp);
} else if (current.enteredBy =="HAPP_App" && current.insulin) {
var temp = {};
temp.timestamp = current.created_at;
temp.started_at = new Date(tz(current.timestamp));
temp.started_at = new Date(tz(temp.timestamp));
temp.date = temp.started_at.getTime();
temp.insulin = current.insulin;
tempBoluses.push(temp);
Expand All @@ -317,7 +321,6 @@ function calcTempTreatments (inputs, zeroTempDuration) {
temp.timestamp = current.created_at;
temp.started_at = new Date(tz(temp.timestamp));
temp.date = temp.started_at.getTime();
temp.duration = current.duration;
tempHistory.push(temp);
} else if (current.eventType == "Temp Basal") {
var temp = {};
Expand All @@ -326,7 +329,6 @@ function calcTempTreatments (inputs, zeroTempDuration) {
temp.timestamp = current.timestamp;
temp.started_at = new Date(tz(temp.timestamp));
temp.date = temp.started_at.getTime();
temp.duration = current.duration;
tempHistory.push(temp);
} else if (current._type == "TempBasal") {
if (current.temp == 'percent') {
Expand Down
1 change: 1 addition & 0 deletions lib/meal/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function findMealInputs (inputs) {
temp.carbs = current.carbs;
temp.nsCarbs = current.carbs;
temp.timestamp = current.created_at;
temp.bolus = current.insulin;
if (!arrayHasElementWithSameTimestampAndProperty(mealInputs,current.timestamp,"carbs")) {
mealInputs.push(temp);
} else {
Expand Down

0 comments on commit 79f835f

Please sign in to comment.