Skip to content

Commit

Permalink
Added code to create settings json file
Browse files Browse the repository at this point in the history
  • Loading branch information
jones139 committed Dec 14, 2023
1 parent cd55284 commit b2f3378
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions apps/openseizure/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
0.15: Converted 3d data to integer milli-g
0.16: I hate Javascript - it looks like saying if (variablename) is true, even if the variable is false...
0.17: Changed int(x) to Math.round(x).
0.18: Added json configuration file
2 changes: 1 addition & 1 deletion apps/openseizure/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "openseizure",
"name": "OpenSeizureDetector Widget",
"shortName": "OSD",
"version": "0.17",
"version": "0.18",
"description": "[BETA!] A widget to work alongside [OpenSeizureDetector](https://www.openseizuredetector.org.uk/)",
"icon": "widget.png",
"type": "widget",
Expand Down
11 changes: 7 additions & 4 deletions apps/openseizure/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ACC_FMT_3D = 3;

/////////////////////////////////
// Build Configuration
const WATCH_FW = "0.17";
const WATCH_FW = "0.18";
const WATCH_ID = "BangleJs";
//const ACC_FMT = ACC_FMT_3D; // Now defined in openseizure.json
const USE_TEST_ACC_DATA = false; // FIXME - does not send real data when set to true
Expand Down Expand Up @@ -80,16 +80,19 @@ function toByteArray(value, numberOfBytes, isSigned) {
return byteArray;
}


const saveSettings = () => require('Storage').write('openseizure.json', settings);

(() => {
var accelData = new Uint8Array(20);
var accelIdx = 0;
var accelArrayFull = false;
var batteryLevel = 0;
var hrVal = 0;

var settings = require('Storage').readJSON("openseizure.json", true) || {};
var settings = Object.assign({
ACC_FMT : 0,
TEST_MODE : false
}, require('Storage').readJSON('openseizure.json',1)||{});

Check failure on line 94 in apps/openseizure/widget.js

View workflow job for this annotation

GitHub Actions / build

Mixed spaces and tabs
saveSettings();

function draw() {
// Draw the OSD Icon
Expand Down

0 comments on commit b2f3378

Please sign in to comment.