diff --git a/interface/help.js b/interface/help.js index fc526d0e1..d61aa2c77 100644 --- a/interface/help.js +++ b/interface/help.js @@ -59,3 +59,6 @@ exports.rampingNightCompensation = "Target exposure compensation for night expos exports.saveXMPs = "This saves the XMP files to a folder on the inserted SD card (XMP files contain settings for Lightroom). \n The XMP files within the folder will have the same names as the image file and will need to be copied to the same folder as the images and then imported into Lightroom. \n Or, if the images are already in Lightroom, copy the XMP files into the existing image folder and then in Lightroom, select all the images and right-click, select Metadata -> Read Metadata from Files.\n Note that none of this is necessary if the time-lapse destination setting was set to SD card - the XMPs will already have been saved with the images and will import together in Lightroom."; exports.appCode = "The VIEW is connected to the internet and trying to authenticate with view.tl, a service for remotely monitoring and controlling the VIEW via the internet. \n To activate, open http://app.view.tl on your phone and login or register, then press \"Add Device\" and enter the code shown here on the VIEW screen. \n You will then be able to use view.tl to access your VIEW device remotely when it's connected to the internet."; + +exports.developerModeMenu = "When enabled, Developer Mode enables pre-release software updates. THIS IS NOT RECOMMENDED unless you're doing software development with the VIEW, as pre-release updates could brick your device (it's always fixable, but will take some work). \nDeveloper Mode may also enable other development-related functions in the future." + diff --git a/interface/ui.js b/interface/ui.js index 88ae15f36..f97474b7e 100644 --- a/interface/ui.js +++ b/interface/ui.js @@ -209,12 +209,16 @@ exports.back = function() { } } -exports.set = function(object, key, value) { +exports.set = function(object, key, value, callback) { return { type: "function", fn: function(arg, cb) { object[key] = value; - if (cb) cb(); + if(callback) { + callback(cb); + } else { + cb && cb(); + } }, selected: exports.select(object, key, value) } diff --git a/main.js b/main.js index 5c4243986..3190d1ba6 100644 --- a/main.js +++ b/main.js @@ -970,30 +970,42 @@ if (VIEW_HARDWARE) { name: "Charge Indicator LED", value: "enabled", help: help.chargeIndicatorMenu, - action: { - type: 'function', - fn: function(arg, cb) { - if(power.lightDisabled !== false) { - db.set('chargeLightDisabled', "no"); - power.init(false); - } - cb(); - } - } + action: ui.set(power, 'lightDisabled', false, function(cb){ + db.set('chargeLightDisabled', "no"); + power.init(false); + cb && cb(); + }) }, { name: "Charge Indicator LED", value: "disabled", help: help.chargeIndicatorMenu, - action: { - type: 'function', - fn: function(arg, cb) { - if(power.lightDisabled !== true) { - db.set('chargeLightDisabled', "yes"); - power.init(true); - } - cb(); - } - } + action: ui.set(power, 'lightDisabled', true, function(cb){ + db.set('chargeLightDisabled', "yes"); + power.init(true); + cb && cb(); + }) + }] + } + + var developerModeMenu = { + name: "Developer Mode", + type: "options", + items: [{ + name: "Developer Mode", + value: "disabled", + help: help.developerModeMenu, + action: ui.set(updates, 'developerMode', false, function(cb){ + db.set('developerMode', "no"); + cb && cb(); + }) + }, { + name: "Developer Mode", + value: "enabled", + help: help.developerModeMenu, + action: ui.set(updates, 'developerMode', true, function(cb){ + db.set('developerMode', "yes"); + cb && cb(); + }) }] } @@ -1100,6 +1112,10 @@ if (VIEW_HARDWARE) { name: "Factory Reset", action: factoryResetConfirmMenu, help: help.eraseAllSettingsMenu + }, { + name: "Developer Mode", + action: developerModeMenu, + help: help.developerModeMenu }, ] } @@ -1429,6 +1445,12 @@ db.get('chargeLightDisabled', function(err, en) { } }); +db.get('developerMode', function(err, en) { + if(!err) { + updates.developerMode = (en == "yes"); + } +}); + db.get('gps', function(err, en) { if(!err) { power.gps(en == "yes"); diff --git a/system/updates.js b/system/updates.js index 334d6fec0..464a81152 100644 --- a/system/updates.js +++ b/system/updates.js @@ -93,7 +93,7 @@ if(installs.indexOf('current') !== -1) { exports.version = current; } -exports.includeBeta = false; +exports.developerMode = false; var cachedVersions = null; exports.getVersions = function(callback){ if(cachedVersions) { @@ -111,7 +111,7 @@ exports.getVersions = function(callback){ } var list = []; for(var i = 0; i < res.length; i++) { - if(!res[i].prerelease || exports.includeBeta) list.push({ + if(!res[i].prerelease || exports.developerMode) list.push({ version: res[i].tag_name, description: res[i].name, notes: res[i].body,