Skip to content

Commit

Permalink
Use original oref0 profile script (Artificial-Pancreas#805)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasvargiu authored and Rig22 committed Sep 14, 2024
1 parent 91cbc7a commit 089aef1
Show file tree
Hide file tree
Showing 34 changed files with 76 additions and 17 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added .github/.DS_Store
Binary file not shown.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,7 @@ fastlane/FastlaneRunner

ConfigOverride.xcconfig

branch.txt
branch.txt
package-lock.json
node_modules
oref0
Binary file added BuildTools/.DS_Store
Binary file not shown.
Binary file added Dependencies/.DS_Store
Binary file not shown.
Binary file not shown.
Binary file added Dependencies/LibreTransmitter/.DS_Store
Binary file not shown.
Binary file added Dependencies/MKRingProgressView/.DS_Store
Binary file not shown.
Binary file added FreeAPS/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Resources/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Resources/Assets.xcassets/.DS_Store
Binary file not shown.
Binary file not shown.
Binary file added FreeAPS/Resources/javascript/.DS_Store
Binary file not shown.
3 changes: 1 addition & 2 deletions FreeAPS/Resources/javascript/bundle/profile.js

Large diffs are not rendered by default.

39 changes: 38 additions & 1 deletion FreeAPS/Resources/javascript/prepare/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,42 @@ function generate(pumpsettings_data, bgtargets_data, isf_data, basalprofile_data
if (autotune_data.carb_ratio) { inputs.carbratio.schedule[0].ratio = autotune_data.carb_ratio; }
}
}
return freeaps_profile(inputs);

// merge oref0 defaults with iAPS ones
const defaults = Object.assign(
{},
freeaps_profile.defaults(),
{
type: 'iAPS', // attribute to override defaults
// +++++ iAPS settings
// smb_delivery_ratio: included in the current oref0 PR (https://github.com/openaps/oref0/pull/1465/files)
smb_delivery_ratio: 0.5,
adjustmentFactor: 1,
useNewFormula: false,
enableDynamicCR: false,
sigmoid: false,
weightPercentage: 0.65,
tddAdjBasal: false,
// threshold_setting: temporary fix to test thomasvargiu/iAPS#original-oref0 branch before build.
// We can remove it after merged and after build the new original bundles
// because it's included in the current oref0 PR (https://github.com/openaps/oref0/pull/1465/files)
// currently (2024-08-09) this settings probably doesn't work in the current iAPS main/dev branch
threshold_setting: 60
}
)

var logs = { err: '', stdout: '', return_val: 0 };
var profile = freeaps_profile(logs, inputs, defaults);
if (logs.err.length > 0) {
console.error(logs.err);
}
if (logs.stdout.length > 0) {
console.error(logs.stdout);
}

if (typeof profile !== 'object') {
return;
}

return profile;
}
Binary file added FreeAPS/Resources/json/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Resources/json/defaults/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/APS/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/Localizations/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/Localizations/Main/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/Modules/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/Modules/Bolus/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/Modules/Home/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/Modules/Home/View/.DS_Store
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added FreeAPS/Sources/Modules/Main/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/Modules/Settings/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/Services/.DS_Store
Binary file not shown.
Binary file added FreeAPS/Sources/Shortcuts/.DS_Store
Binary file not shown.
Binary file added FreeAPSWatch WatchKit Extension/.DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"scripts": {
"build": "webpack --config ./scripts/webpack.config.js"
},
"devDependencies": {
"webpack-cli": "^5.1.4"
}
}
38 changes: 25 additions & 13 deletions scripts/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@
const path = require('path');
const TerserPlugin = require("terser-webpack-plugin");

const libPath = process.env['OREF0_DIST_PATH'] || './lib'

module.exports = {
mode: 'production',
entry: {
iob: './lib/iob/index.js',
meal: './lib/meal/index.js',
"determineBasal": './lib/determine-basal/determine-basal.js',
"glucoseGetLast": './lib/glucose-get-last.js',
"basalSetTemp": './lib/basal-set-temp.js',
autosens: './lib/determine-basal/autosens.js',
profile: './lib/profile/index.js',
"autotunePrep": './lib/autotune-prep/index.js',
"autotuneCore": './lib/autotune/index.js'
iob: path.resolve(libPath, 'iob/index.js'),
meal: path.resolve(libPath, 'meal/index.js'),
determineBasal: path.resolve(libPath, 'determine-basal/determine-basal.js'),
glucoseGetLast: path.resolve(libPath, 'glucose-get-last.js'),
basalSetTemp: path.resolve(libPath, 'basal-set-temp.js'),
autosens: path.resolve(libPath, 'determine-basal/autosens.js'),
profile: path.resolve(libPath, 'profile/index.js'),
autotunePrep: path.resolve(libPath, 'autotune-prep/index.js'),
autotuneCore: path.resolve(libPath, 'autotune/index.js')
},
output: {
path: path.resolve(__dirname, 'dist'),
path: path.resolve(__dirname, '..', 'FreeAPS', 'Resources', 'javascript', 'bundle'),
filename: (pathData) => {
return pathData.chunk.name.replace(/[A-Z]/g, function(match) {
return '-' + match.toLowerCase();
}) + '.js';
},
libraryTarget: 'var',
library: 'freeaps_[name]'
library: {
type: 'var',
name: 'freeaps_[name]'
}
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
minimizer: [new TerserPlugin({
extractComments: false,
parallel: true,
terserOptions: {
format: {
comments: false,
},
},
})],
},
};

0 comments on commit 089aef1

Please sign in to comment.