Skip to content
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

Make pump profile required for autotune #298

Merged
merged 2 commits into from Dec 28, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 3 additions & 11 deletions bin/oref0-autotune.js
Expand Up @@ -22,7 +22,7 @@

var autotune = require('oref0/lib/autotune');
function usage ( ) {
console.error('usage: ', process.argv.slice(0, 2), '<autotune/glucose.json> <autotune/autotune.json [settings/profile.json]');
console.error('usage: ', process.argv.slice(0, 2), '<autotune/glucose.json> <autotune/autotune.json> <settings/profile.json>');
}

if (!module.parent) {
Expand All @@ -34,7 +34,7 @@ if (!module.parent) {
var previous_autotune_input = process.argv.slice(3, 4).pop();
var pumpprofile_input = process.argv.slice(4, 5).pop();

if (!prepped_glucose_input || !previous_autotune_input) {
if (!prepped_glucose_input || !previous_autotune_input || !pumpprofile_input ) {
usage( );
console.log('{ "error": "Insufficient arguments" }');
process.exit(1);
Expand All @@ -44,20 +44,12 @@ if (!module.parent) {
try {
var prepped_glucose_data = JSON.parse(fs.readFileSync(prepped_glucose_input, 'utf8'));
var previous_autotune_data = JSON.parse(fs.readFileSync(previous_autotune_input, 'utf8'));
var pumpprofile_data = JSON.parse(fs.readFileSync(pumpprofile_input, 'utf8'));
} catch (e) {
console.log('{ "error": "Could not parse input data" }');
return console.error("Could not parse input data: ", e);
}

var pumpprofile_data = { };
if (typeof pumpprofile_input != 'undefined') {
try {
pumpprofile_data = JSON.parse(fs.readFileSync(pumpprofile_input, 'utf8'));
} catch (e) {
console.error("Warning: could not parse "+pumpprofile_input);
}
}

var inputs = {
prepped_glucose: prepped_glucose_data
, previous_autotune: previous_autotune_data
Expand Down