Added expert mode. Moved FAILSAFE feature back into failsafe tab.

10.3.x-maintenance
mikeller 2016-08-24 00:34:51 +12:00 committed by Michael Keller
parent af3903c8d6
commit eafbaa5d06
10 changed files with 496 additions and 323 deletions

View File

@ -11,10 +11,6 @@
"options_receive_app_notifications": {
"message": "Receive desktop <strong>notification</strong> when application updates"
},
"options_improve_configurator": {
"message": "Send anonymous usage data to the developer team"
},
"connect": {
"message": "Connect"
},
@ -33,6 +29,12 @@
"autoConnectDisabled": {
"message": "Auto-Connect: Disabled - User needs to select the correct serial port and click \"Connect\" button on its own"
},
"expertMode": {
"message": "Enable Expert Mode"
},
"permanentExpertMode": {
"message": "Permanently enable Expert Mode"
},
"deviceRebooting": {
"message": "Device - <span style=\"color: red\">Rebooting</span>"
},
@ -544,10 +546,16 @@
"message": "On Screen Display"
},
"featureFAILSAFE": {
"message": "Override failsafe behaviour on RX signal loss"
"message": "Enable Failsafe Stage 2"
},
"featureFAILSAFEOld": {
"message": "Enable Failsafe"
},
"featureFAILSAFETip": {
"message": "<strong>Warning:</strong> Use this only if you know what you are doing. The default behaviour on RX signal loss (deactivate all motors to bring craft to the ground) is the safest option in most situations."
"message": "<strong>Note:</strong> When Stage 2 is DISABLED, the fallback setting <strong>Auto</strong> is used instead of the user settings for all flightchannels (Roll, Pitch, Yaw and Throttle)."
},
"featureFAILSAFEOldTip": {
"message": "Apply Failsafe settings on RX signal loss"
},
"configurationFeatureEnabled": {
"message": "Enabled"

View File

@ -12,7 +12,6 @@ var Features = function (config) {
{bit: 5, group: 'other', name: 'SERVO_TILT'},
{bit: 6, group: 'other', name: 'SOFTSERIAL', haveTip: true},
{bit: 7, group: 'gps', name: 'GPS', haveTip: true},
{bit: 8, group: 'other', name: 'FAILSAFE', haveTip: true},
{bit: 9, group: 'other', name: 'SONAR'},
{bit: 10, group: 'other', name: 'TELEMETRY'},
{bit: 11, group: 'batteryCurrent', name: 'CURRENT_METER'},
@ -31,6 +30,16 @@ var Features = function (config) {
);
}
if (semver.gte(config.apiVersion, "1.15.0")) {
features.push(
{bit: 8, group: 'rxFailsafe', name: 'FAILSAFE', haveTip: true}
);
} else {
features.push(
{bit: 8, group: 'rxFailsafe', name: 'FAILSAFE', haveTip: true}
);
}
if (semver.gte(config.apiVersion, "1.16.0")) {
features.push(
{bit: 21, group: 'other', name: 'TRANSPONDER', haveTip: true}

View File

@ -1,7 +1,28 @@
Number.prototype.clamp = function(min, max) {
return Math.min(Math.max(this, min), max);
};
/**
* String formatting now supports currying (partial application).
* For a format string with N replacement indices, you can call .format
* with M <= N arguments. The result is going to be a format string
* with N-M replacement indices, properly counting from 0 .. N-M.
* The following Example should explain the usage of partial applied format:
* "{0}:{1}:{2}".format("a","b","c") === "{0}:{1}:{2}".format("a","b").format("c")
* "{0}:{1}:{2}".format("a").format("b").format("c") === "{0}:{1}:{2}".format("a").format("b", "c")
**/
String.prototype.format = function () {
var args = arguments;
return this.replace(/\{(\d+)\}/g, function (t, i) {
return args[i] !== void 0 ? args[i] : "{"+(i-args.length)+"}";
});
};
Array.prototype.push8 = function(val) {
this.push(0xFF & val);
return this;
};
Array.prototype.push16 = function(val) {
// low byte
this.push(0x00FF & val);
@ -10,13 +31,15 @@ Array.prototype.push16 = function(val) {
// chainable
return this;
};
Array.prototype.push32 = function(val) {
this.push8(val)
.push8(val >> 8)
.push8(val >> 16)
.push8(val >> 24);
return this;
}
};
DataView.prototype.offset = 0;
DataView.prototype.readU8 = function() {
if (this.byteLength >= this.offset+1) {
@ -24,28 +47,32 @@ DataView.prototype.readU8 = function() {
} else {
return null;
}
}
};
DataView.prototype.readU16 = function() {
if (this.byteLength >= this.offset+2) {
return this.readU8() + this.readU8()*256;
} else {
return null;
}
}
};
DataView.prototype.readU32 = function() {
if (this.byteLength >= this.offset+4) {
return this.readU16() + this.readU16()*65536;
} else {
return null;
}
}
};
DataView.prototype.read8 = function() {
if (this.byteLength >= this.offset+1) {
return this.getInt8(this.offset++, 1);
} else {
return null;
}
}
};
DataView.prototype.read16 = function() {
this.offset += 2;
if (this.byteLength >= this.offset) {
@ -53,7 +80,8 @@ DataView.prototype.read16 = function() {
} else {
return null;
}
}
};
DataView.prototype.read32 = function() {
this.offset += 4;
if (this.byteLength >= this.offset) {
@ -61,4 +89,4 @@ DataView.prototype.read32 = function() {
} else {
return null;
}
}
};

View File

@ -1581,6 +1581,14 @@ dialog {
display:none;
}
#expertMode {
color: #ddd;
margin-top: 16px;
width:125px;
float: right;
margin-right: 0px;
line-height: 12px;
}
/* Battery element styling*/

504
main.html
View File

@ -1,261 +1,281 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="cTn" />
<link type="text/css" rel="stylesheet" href="./main.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./js/libraries/jquery.nouislider.min.css" />
<link type="text/css" rel="stylesheet" href="./js/libraries/jquery.nouislider.pips.min.css" />
<link type="text/css" rel="stylesheet" href="./js/libraries/flightindicators.css" />
<link type="text/css" rel="stylesheet" href="./tabs/landing.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/setup.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/help.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/ports.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/configuration.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/pid_tuning.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/receiver.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/servos.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/gps.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/motors.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/led_strip.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/sensors.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/cli.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/logging.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/onboard_logging.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/firmware_flasher.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/adjustments.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/auxiliary.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/failsafe.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/osd.css" media="all" />
<link type="text/css" rel="stylesheet" href="./tabs/transponder.css" media="all" />
<link type="text/css" rel="stylesheet" href="./css/opensans_webfontkit/fonts.css" media="all" />
<link type="text/css" rel="stylesheet" href="./css/dropdown-lists/css/style_lists.css" media="all" />
<link type="text/css" rel="stylesheet" href="./js/libraries/switchery/switchery.css" media="all" />
<link rel="stylesheet" type="text/css" href="./js/libraries/jbox/jBox.css" />
<script type="text/javascript" src="./js/libraries/q.js"></script>
<script type="text/javascript" src="./js/libraries/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="./js/libraries/jquery-ui-1.11.4.min.js"></script>
<script type="text/javascript" src="./js/libraries/d3.min.js"></script>
<script type="text/javascript" src="./js/libraries/jquery.nouislider.all.min.js"></script>
<script type="text/javascript" src="./js/libraries/three/three.min.js"></script>
<script type="text/javascript" src="./js/libraries/three/Projector.js"></script>
<script type="text/javascript" src="./js/libraries/three/CanvasRenderer.js"></script>
<script type="text/javascript" src="./js/libraries/jquery.flightindicators.js"></script>
<script type="text/javascript" src="./js/libraries/semver.js"></script>
<script type="text/javascript" src="./js/libraries/jbox/jBox.min.js"></script>
<script type="text/javascript" src="./js/libraries/switchery/switchery.js"></script>
<script type="text/javascript" src="./js/libraries/bluebird.min.js"></script>
<script type="text/javascript" src="./js/libraries/jquery.ba-throttle-debounce.min.js"></script>
<script type="text/javascript" src="./js/libraries/inflection.min.js"></script>
<script type="text/javascript" src="./js/injected_methods.js"></script>
<script type="text/javascript" src="./js/port_handler.js"></script>
<script type="text/javascript" src="./js/port_usage.js"></script>
<script type="text/javascript" src="./js/serial.js"></script>
<script type="text/javascript" src="./js/gui.js"></script>
<script type="text/javascript" src="./js/model.js"></script>
<script type="text/javascript" src="./js/serial_backend.js"></script>
<script type="text/javascript" src="./js/data_storage.js"></script>
<script type="text/javascript" src="./js/fc.js"></script>
<script type="text/javascript" src="./js/msp/MSPCodes.js"></script>
<script type="text/javascript" src="./js/msp.js"></script>
<script type="text/javascript" src="./js/msp/MSPHelper.js"></script>
<script type="text/javascript" src="./js/backup_restore.js"></script>
<script type="text/javascript" src="./js/protocols/stm32.js"></script>
<script type="text/javascript" src="./js/protocols/stm32usbdfu.js"></script>
<script type="text/javascript" src="./js/localization.js"></script>
<script type="text/javascript" src="./js/boards.js"></script>
<script type="text/javascript" src="./js/RateCurve.js"></script>
<script type="text/javascript" src="./js/Features.js"></script>
<script type="text/javascript" src="./main.js"></script>
<script type="text/javascript" src="./tabs/landing.js"></script>
<script type="text/javascript" src="./tabs/setup.js"></script>
<script type="text/javascript" src="./tabs/help.js"></script>
<script type="text/javascript" src="./tabs/ports.js"></script>
<script type="text/javascript" src="./tabs/configuration.js"></script>
<script type="text/javascript" src="./tabs/pid_tuning.js"></script>
<script type="text/javascript" src="./tabs/receiver.js"></script>
<script type="text/javascript" src="./tabs/auxiliary.js"></script>
<script type="text/javascript" src="./tabs/adjustments.js"></script>
<script type="text/javascript" src="./tabs/servos.js"></script>
<script type="text/javascript" src="./tabs/gps.js"></script>
<script type="text/javascript" src="./tabs/motors.js"></script>
<script type="text/javascript" src="./tabs/led_strip.js"></script>
<script type="text/javascript" src="./tabs/sensors.js"></script>
<script type="text/javascript" src="./tabs/cli.js"></script>
<script type="text/javascript" src="./tabs/logging.js"></script>
<script type="text/javascript" src="./tabs/onboard_logging.js"></script>
<script type="text/javascript" src="./tabs/firmware_flasher.js"></script>
<script type="text/javascript" src="./tabs/failsafe.js"></script>
<script type="text/javascript" src="./tabs/osd.js"></script>
<script type="text/javascript" src="./tabs/transponder.js"></script>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="author" content="cTn"/>
<link type="text/css" rel="stylesheet" href="./main.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./js/libraries/jquery.nouislider.min.css"/>
<link type="text/css" rel="stylesheet" href="./js/libraries/jquery.nouislider.pips.min.css"/>
<link type="text/css" rel="stylesheet" href="./js/libraries/flightindicators.css"/>
<link type="text/css" rel="stylesheet" href="./tabs/landing.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/setup.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/help.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/ports.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/configuration.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/pid_tuning.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/receiver.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/servos.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/gps.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/motors.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/led_strip.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/sensors.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/cli.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/logging.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/onboard_logging.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/firmware_flasher.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/adjustments.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/auxiliary.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/failsafe.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/osd.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./tabs/transponder.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./css/opensans_webfontkit/fonts.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./css/dropdown-lists/css/style_lists.css" media="all"/>
<link type="text/css" rel="stylesheet" href="./js/libraries/switchery/switchery.css" media="all"/>
<link rel="stylesheet" type="text/css" href="./js/libraries/jbox/jBox.css"/>
<script type="text/javascript" src="./js/libraries/q.js"></script>
<script type="text/javascript" src="./js/libraries/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="./js/libraries/jquery-ui-1.11.4.min.js"></script>
<script type="text/javascript" src="./js/libraries/d3.min.js"></script>
<script type="text/javascript" src="./js/libraries/jquery.nouislider.all.min.js"></script>
<script type="text/javascript" src="./js/libraries/three/three.min.js"></script>
<script type="text/javascript" src="./js/libraries/three/Projector.js"></script>
<script type="text/javascript" src="./js/libraries/three/CanvasRenderer.js"></script>
<script type="text/javascript" src="./js/libraries/jquery.flightindicators.js"></script>
<script type="text/javascript" src="./js/libraries/semver.js"></script>
<script type="text/javascript" src="./js/libraries/jbox/jBox.min.js"></script>
<script type="text/javascript" src="./js/libraries/switchery/switchery.js"></script>
<script type="text/javascript" src="./js/libraries/bluebird.min.js"></script>
<script type="text/javascript" src="./js/libraries/jquery.ba-throttle-debounce.min.js"></script>
<script type="text/javascript" src="./js/libraries/inflection.min.js"></script>
<script type="text/javascript" src="./js/injected_methods.js"></script>
<script type="text/javascript" src="./js/port_handler.js"></script>
<script type="text/javascript" src="./js/port_usage.js"></script>
<script type="text/javascript" src="./js/serial.js"></script>
<script type="text/javascript" src="./js/gui.js"></script>
<script type="text/javascript" src="./js/model.js"></script>
<script type="text/javascript" src="./js/serial_backend.js"></script>
<script type="text/javascript" src="./js/data_storage.js"></script>
<script type="text/javascript" src="./js/fc.js"></script>
<script type="text/javascript" src="./js/msp/MSPCodes.js"></script>
<script type="text/javascript" src="./js/msp.js"></script>
<script type="text/javascript" src="./js/msp/MSPHelper.js"></script>
<script type="text/javascript" src="./js/backup_restore.js"></script>
<script type="text/javascript" src="./js/protocols/stm32.js"></script>
<script type="text/javascript" src="./js/protocols/stm32usbdfu.js"></script>
<script type="text/javascript" src="./js/localization.js"></script>
<script type="text/javascript" src="./js/boards.js"></script>
<script type="text/javascript" src="./js/RateCurve.js"></script>
<script type="text/javascript" src="./js/Features.js"></script>
<script type="text/javascript" src="./main.js"></script>
<script type="text/javascript" src="./tabs/landing.js"></script>
<script type="text/javascript" src="./tabs/setup.js"></script>
<script type="text/javascript" src="./tabs/help.js"></script>
<script type="text/javascript" src="./tabs/ports.js"></script>
<script type="text/javascript" src="./tabs/configuration.js"></script>
<script type="text/javascript" src="./tabs/pid_tuning.js"></script>
<script type="text/javascript" src="./tabs/receiver.js"></script>
<script type="text/javascript" src="./tabs/auxiliary.js"></script>
<script type="text/javascript" src="./tabs/adjustments.js"></script>
<script type="text/javascript" src="./tabs/servos.js"></script>
<script type="text/javascript" src="./tabs/gps.js"></script>
<script type="text/javascript" src="./tabs/motors.js"></script>
<script type="text/javascript" src="./tabs/led_strip.js"></script>
<script type="text/javascript" src="./tabs/sensors.js"></script>
<script type="text/javascript" src="./tabs/cli.js"></script>
<script type="text/javascript" src="./tabs/logging.js"></script>
<script type="text/javascript" src="./tabs/onboard_logging.js"></script>
<script type="text/javascript" src="./tabs/firmware_flasher.js"></script>
<script type="text/javascript" src="./tabs/failsafe.js"></script>
<script type="text/javascript" src="./tabs/osd.js"></script>
<script type="text/javascript" src="./tabs/transponder.js"></script>
<title></title>
</head>
<body>
<div id="main-wrapper">
<div class="headerbar">
<div id="logo">
<div class="logo_text">
CONFIGURATOR
<div class="version"></div>
</div>
<div id="main-wrapper">
<div class="headerbar">
<div id="logo">
<div class="logo_text">
CONFIGURATOR
<div class="version"></div>
</div>
<a id="options" href="#" i18n_title="options_title"></a>
<div id="port-picker">
<div class="connect_controls" id="connectbutton">
<div class="connect_b">
<a class="connect" href="#"></a>
</div>
<a class="connect_state" i18n="connect"></a>
</div>
<a id="options" href="#" i18n_title="options_title"></a>
<div id="port-picker">
<div class="connect_controls" id="connectbutton">
<div class="connect_b">
<a class="connect" href="#"></a>
</div>
<div id="portsinput">
<div class="dropdown dropdown-dark">
<select class="dropdown-select" id="port" title="Port">
<option value="manual">Manual</option>
<!-- port list gets generated here -->
</select>
</div>
<div class="dropdown dropdown-dark">
<select class="dropdown-select" id="baud" title="Baud Rate">
<option value="115200" selected="selected">115200</option>
<option value="57600">57600</option>
<option value="38400">38400</option>
<option value="28800">28800</option>
<option value="19200">19200</option>
<option value="14400">14400</option>
<option value="9600">9600</option>
<option value="4800">4800</option>
<option value="2400">2400</option>
<option value="1200">1200</option>
</select>
</div>
<div id="port-override-option">
<label for="port-override">Port: <input id="port-override" type="text"
value="/dev/rfcomm0" /></label>
</div>
<div>
<label><input class="auto_connect togglesmall" type="checkbox" /><span
<a class="connect_state" i18n="connect"></a>
</div>
<div id="portsinput">
<div class="dropdown dropdown-dark">
<select class="dropdown-select" id="port" title="Port">
<option value="manual">Manual</option>
<!-- port list gets generated here -->
</select>
</div>
<div class="dropdown dropdown-dark">
<select class="dropdown-select" id="baud" title="Baud Rate">
<option value="115200" selected="selected">115200</option>
<option value="57600">57600</option>
<option value="38400">38400</option>
<option value="28800">28800</option>
<option value="19200">19200</option>
<option value="14400">14400</option>
<option value="9600">9600</option>
<option value="4800">4800</option>
<option value="2400">2400</option>
<option value="1200">1200</option>
</select>
</div>
<div id="port-override-option">
<label for="port-override">Port: <input id="port-override" type="text"
value="/dev/rfcomm0"/></label>
</div>
<div>
<label><input class="auto_connect togglesmall" type="checkbox"/><span
class="auto_connect" i18n="autoConnect"></span></label>
</div>
</div>
</div>
<div class="header-wrapper">
<div id="dataflash_wrapper_global">
<div class="noflash_global" align="center">No dataflash <br>chip found</div>
<ul class="dataflash-contents_global">
<li class="dataflash-free_global">
<div class="legend">Dataflash: free space</div>
</li>
</ul>
</div>
<div id="sensor-status" class="sensor_state mode-connected">
<ul>
<li class="gyro" title="Gyroscope">
<div class="gyroicon">Gyro</div>
</li>
<li class="accel" title="Accelerometer">
<div class="accicon">Accel</div>
</li>
<li class="mag" title="Magnetometer">
<div class="magicon">Mag</div>
</li>
<li class="baro" title="Barometer">
<div class="baroicon">Baro</div>
</li>
<li class="gps" title="GPS">
<div class="gpsicon">GPS</div>
</li>
<li class="sonar" title="Sonar / Range finder">
<div class="sonaricon">Sonar</div>
</li>
</ul>
</div>
<div id="quad-status_wrapper">
<div class="battery-icon">
<div class="quad-status-contents">
<div class="battery-status"></div>
</div>
</div>
<div class="battery-legend">Battery voltage</div>
<div class="bottomStatusIcons">
<div class="armedicon cf_tip" i18n_title="mainHelpArmed"></div>
<div class="failsafeicon cf_tip" i18n_title="mainHelpFailsafe"></div>
<div class="linkicon cf_tip" i18n_title="mainHelpLink"></div>
</div>
</div>
</div>
</div>
<div class="clear-both"></div>
<div id="log">
<div class="logswitch">
<a href="#" id="showlog">Show Log</a>
<div class="header-wrapper">
<div id="dataflash_wrapper_global">
<div class="noflash_global" align="center">No dataflash <br>chip found</div>
<ul class="dataflash-contents_global">
<li class="dataflash-free_global">
<div class="legend">Dataflash: free space</div>
</li>
</ul>
<div id="expertMode" align="center">
<label>
<input name="expertModeCheckbox" class="togglesmall" type="checkbox"/>
<span i18n="expertMode"></span>
</label>
</div>
</div>
<div id="scrollicon"></div>
<div class="wrapper"></div>
</div>
<div class="tab_container">
<div id="tabs">
<ul class="mode-disconnected">
<li class="tab_landing"><a href="#" i18n="tabLanding" class="tabicon ic_welcome" title="Welcome"></a></li>
<li class="tab_help"><a href="#" i18n="tabHelp" class="tabicon ic_help" title="Documentation &amp; Support"></a></li>
<li class="tab_firmware_flasher"><a href="#" i18n="tabFirmwareFlasher" class="tabicon ic_flasher" title="Firmware Flasher"></a></li>
</ul>
<ul class="mode-connected">
<li class="tab_setup"><a href="#" i18n="tabSetup" class="tabicon ic_setup" title="Setup"></a></li>
<li class="tab_ports"><a href="#" i18n="tabPorts" class="tabicon ic_ports" title="Ports"></a></li>
<li class="tab_configuration"><a href="#" i18n="tabConfiguration" class="tabicon ic_config" title="Configuration"></a></li>
<li class="tab_failsafe"><a href="#" i18n="tabFailsafe" class="tabicon ic_failsafe" title="Failsafe"></a></li>
<li class="tab_pid_tuning"><a href="#" i18n="tabPidTuning" class="tabicon ic_pid" title="PID Tuning"></a></li>
<li class="tab_receiver"><a href="#" i18n="tabReceiver" class="tabicon ic_rx" title="Receiver"></a></li>
<li class="tab_auxiliary"><a href="#" i18n="tabAuxiliary" class="tabicon ic_modes" title="Modes"></a></li>
<li class="tab_adjustments"><a href="#" i18n="tabAdjustments" class="tabicon ic_adjust" title="Adjustments"></a></li>
<li class="tab_servos"><a href="#" i18n="tabServos" class="tabicon ic_servo" title="Servos"></a></li>
<li class="tab_gps"><a href="#" i18n="tabGPS" class="tabicon ic_gps" title="GPS"></a></li>
<li class="tab_motors"><a href="#" i18n="tabMotorTesting" class="tabicon ic_motor" title="Motors"></a></li>
<li class="tab_osd"><a href="#" i18n="tabOsd" class="tabicon ic_osd" title="Osd"></a></li>
<li class="tab_transponder"><a href="#" i18n="tabTransponder" class="tabicon ic_transponder" title="Transponder"></a></li>
<li class="tab_led_strip"><a href="#" i18n="tabLedStrip" class="tabicon ic_led" title="LED Strip"></a></li>
<li class="tab_sensors"><a href="#" i18n="tabRawSensorData" class="tabicon ic_sensors" title="Sensors"></a></li>
<li class="tab_logging"><a href="#" i18n="tabLogging" class="tabicon ic_log" title="Tethered Logging"></a></li>
<li class="tab_onboard_logging"><a href="#" i18n="tabOnboardLogging" class="tabicon ic_data" title="Onboard Logging"></a></li>
</ul>
<ul class="mode-connected-cli">
<li class="tab_cli"><a href="#" i18n="tabCLI" class="tabicon ic_cli" title="CLI"></a></li>
<!-- spare icons
<li class=""><a href="#"class="tabicon ic_mission">Mission (spare icon)</a></li>
<li class=""><a href="#"class="tabicon ic_advanced">Advanced (spare icon)</a></li>
<li class=""><a href="#"class="tabicon ic_wizzard">Wizzard (spare icon)</a></li>
-->
<div id="sensor-status" class="sensor_state mode-connected">
<ul>
<li class="gyro" title="Gyroscope">
<div class="gyroicon">Gyro</div>
</li>
<li class="accel" title="Accelerometer">
<div class="accicon">Accel</div>
</li>
<li class="mag" title="Magnetometer">
<div class="magicon">Mag</div>
</li>
<li class="baro" title="Barometer">
<div class="baroicon">Baro</div>
</li>
<li class="gps" title="GPS">
<div class="gpsicon">GPS</div>
</li>
<li class="sonar" title="Sonar / Range finder">
<div class="sonaricon">Sonar</div>
</li>
</ul>
</div>
<div class="clear-both"></div>
</div>
<div id="content"></div>
<div id="status-bar">
<div>
<span i18n="statusbar_port_utilization"></span> <span class="port_usage_down">D: 0%</span> <span
class="port_usage_up">U: 0%</span>
</div>
<div>
<span i18n="statusbar_packet_error"></span> <span class="packet-error">0</span>
</div>
<div>
<span i18n="statusbar_i2c_error"></span> <span class="i2c-error">0</span>
</div>
<div>
<span i18n="statusbar_cycle_time"></span> <span class="cycle-time">0</span>
</div>
<div>
<span class="cpu-load"> </span>
</div>
<div class="version">
<!-- configuration version generated here -->
</div>
</div>
<div id="cache">
<div class="data-loading">
<p>Waiting for data ...</p>
<div id="quad-status_wrapper">
<div class="battery-icon">
<div class="quad-status-contents">
<div class="battery-status"></div>
</div>
</div>
<div class="battery-legend">Battery voltage</div>
<div class="bottomStatusIcons">
<div class="armedicon cf_tip" i18n_title="mainHelpArmed"></div>
<div class="failsafeicon cf_tip" i18n_title="mainHelpFailsafe"></div>
<div class="linkicon cf_tip" i18n_title="mainHelpLink"></div>
</div>
</div>
</div>
</div>
<div class="clear-both"></div>
<div id="log">
<div class="logswitch">
<a href="#" id="showlog">Show Log</a>
</div>
<div id="scrollicon"></div>
<div class="wrapper"></div>
</div>
<div class="tab_container">
<div id="tabs">
<ul class="mode-disconnected">
<li class="tab_landing"><a href="#" i18n="tabLanding" class="tabicon ic_welcome" title="Welcome"></a>
</li>
<li class="tab_help"><a href="#" i18n="tabHelp" class="tabicon ic_help"
title="Documentation &amp; Support"></a></li>
<li class="tab_firmware_flasher"><a href="#" i18n="tabFirmwareFlasher" class="tabicon ic_flasher"
title="Firmware Flasher"></a></li>
</ul>
<ul class="mode-connected">
<li class="tab_setup"><a href="#" i18n="tabSetup" class="tabicon ic_setup" title="Setup"></a></li>
<li class="tab_ports"><a href="#" i18n="tabPorts" class="tabicon ic_ports" title="Ports"></a></li>
<li class="tab_configuration"><a href="#" i18n="tabConfiguration" class="tabicon ic_config"
title="Configuration"></a></li>
<li class="tab_failsafe"><a href="#" i18n="tabFailsafe" class="tabicon ic_failsafe"
title="Failsafe"></a></li>
<li class="tab_pid_tuning"><a href="#" i18n="tabPidTuning" class="tabicon ic_pid"
title="PID Tuning"></a></li>
<li class="tab_receiver"><a href="#" i18n="tabReceiver" class="tabicon ic_rx" title="Receiver"></a></li>
<li class="tab_auxiliary"><a href="#" i18n="tabAuxiliary" class="tabicon ic_modes" title="Modes"></a>
</li>
<li class="tab_adjustments"><a href="#" i18n="tabAdjustments" class="tabicon ic_adjust"
title="Adjustments"></a></li>
<li class="tab_servos"><a href="#" i18n="tabServos" class="tabicon ic_servo" title="Servos"></a></li>
<li class="tab_gps"><a href="#" i18n="tabGPS" class="tabicon ic_gps" title="GPS"></a></li>
<li class="tab_motors"><a href="#" i18n="tabMotorTesting" class="tabicon ic_motor" title="Motors"></a>
</li>
<li class="tab_osd"><a href="#" i18n="tabOsd" class="tabicon ic_osd" title="Osd"></a></li>
<li class="tab_transponder"><a href="#" i18n="tabTransponder" class="tabicon ic_transponder"
title="Transponder"></a></li>
<li class="tab_led_strip"><a href="#" i18n="tabLedStrip" class="tabicon ic_led" title="LED Strip"></a>
</li>
<li class="tab_sensors"><a href="#" i18n="tabRawSensorData" class="tabicon ic_sensors"
title="Sensors"></a></li>
<li class="tab_logging"><a href="#" i18n="tabLogging" class="tabicon ic_log"
title="Tethered Logging"></a></li>
<li class="tab_onboard_logging"><a href="#" i18n="tabOnboardLogging" class="tabicon ic_data"
title="Onboard Logging"></a></li>
</ul>
<ul class="mode-connected-cli">
<li class="tab_cli"><a href="#" i18n="tabCLI" class="tabicon ic_cli" title="CLI"></a></li>
<!-- spare icons
<li class=""><a href="#"class="tabicon ic_mission">Mission (spare icon)</a></li>
<li class=""><a href="#"class="tabicon ic_advanced">Advanced (spare icon)</a></li>
<li class=""><a href="#"class="tabicon ic_wizzard">Wizzard (spare icon)</a></li>
-->
</ul>
</div>
<div class="clear-both"></div>
</div>
<div id="content"></div>
<div id="status-bar">
<div>
<span i18n="statusbar_port_utilization"></span> <span class="port_usage_down">D: 0%</span> <span
class="port_usage_up">U: 0%</span>
</div>
<div>
<span i18n="statusbar_packet_error"></span> <span class="packet-error">0</span>
</div>
<div>
<span i18n="statusbar_i2c_error"></span> <span class="i2c-error">0</span>
</div>
<div>
<span i18n="statusbar_cycle_time"></span> <span class="cycle-time">0</span>
</div>
<div>
<span class="cpu-load"> </span>
</div>
<div class="version">
<!-- configuration version generated here -->
</div>
</div>
<div id="cache">
<div class="data-loading">
<p>Waiting for data ...</p>
</div>
</div>
</div>
</body>
</html>

167
main.js
View File

@ -29,22 +29,25 @@ $(document).ready(function () {
// check for newer releases online to inform people in case they are running an old release
chrome.storage.local.get(['lastVersionChecked', 'lastVersionAvailableOnline'], function(result) {
if (typeof result.lastVersionChecked === undefined || ($.now() - result.lastVersionChecked) > 3600*1000) {
chrome.storage.local.get(['lastVersionChecked', 'lastVersionAvailableOnline'], function (result) {
if (typeof result.lastVersionChecked === undefined || ($.now() - result.lastVersionChecked) > 3600 * 1000) {
try {
var url = 'https://api.github.com/repos/betaflight/betaflight-configurator/tags';
$.get(url).done(function (data) {
var versions = data.sort(function (v1, v2) {
try {
return semver.compare(v2.name, v1.name);
} catch (e) {
return false;
}
});
chrome.storage.local.set({'lastVersionChecked': $.now(), 'lastVersionAvailableOnline': versions[0].name}, function(result) {
console.log("Latest version available online: "+ versions[0].name);
});
notifyOutdatedVersion(versions[0].name);
var versions = data.sort(function (v1, v2) {
try {
return semver.compare(v2.name, v1.name);
} catch (e) {
return false;
}
});
chrome.storage.local.set({
'lastVersionChecked': $.now(),
'lastVersionAvailableOnline': versions[0].name
}, function (result) {
console.log("Latest version available online: " + versions[0].name);
});
notifyOutdatedVersion(versions[0].name);
});
} catch (e) {
// Just to catch and supress warnings if no internet connection is available
@ -57,7 +60,7 @@ $(document).ready(function () {
chrome.storage.local.get('logopen', function (result) {
if (result.logopen) {
$("#showlog").trigger('click');
}
}
});
// log webgl capability
@ -206,12 +209,30 @@ $(document).ready(function () {
if (typeof result.update_notify === 'undefined' || result.update_notify) {
$('div.notifications input').prop('checked', true);
}
$('div.notifications input').change(function () {
var check = $(this).is(':checked');
chrome.storage.local.set({'update_notify': check});
});
});
$('div.notifications input').change(function () {
var check = $(this).is(':checked');
chrome.storage.local.get('permanentExpertMode', function (result) {
if (result.permanentExpertMode) {
$('div.permanentExpertMode input').prop('checked', true);
}
chrome.storage.local.set({'update_notify': check});
$('div.permanentExpertMode input').change(function () {
var checked = $(this).is(':checked');
chrome.storage.local.set({'permanentExpertMode': checked});
$('input[name="expertModeCheckbox"]').prop('checked', checked).change();
if (BF_CONFIG) {
updateTabList(BF_CONFIG.features);
}
}).change();
});
function close_and_cleanup(e) {
@ -307,37 +328,48 @@ $(document).ready(function () {
}
});
$("#showlog").on('click', function() {
var state = $(this).data('state');
if ( state ) {
$("#log").animate({height: 27}, 200, function() {
var command_log = $('div#log');
command_log.scrollTop($('div.wrapper', command_log).height());
});
$("#log").removeClass('active');
$("#content").removeClass('logopen');
$(".tab_container").removeClass('logopen');
$("#scrollicon").removeClass('active');
chrome.storage.local.set({'logopen': false});
$("#showlog").on('click', function () {
var state = $(this).data('state');
if (state) {
$("#log").animate({height: 27}, 200, function () {
var command_log = $('div#log');
command_log.scrollTop($('div.wrapper', command_log).height());
});
$("#log").removeClass('active');
$("#content").removeClass('logopen');
$(".tab_container").removeClass('logopen');
$("#scrollicon").removeClass('active');
chrome.storage.local.set({'logopen': false});
state = false;
}else{
$("#log").animate({height: 111}, 200);
$("#log").addClass('active');
$("#content").addClass('logopen');
$(".tab_container").addClass('logopen');
$("#scrollicon").addClass('active');
chrome.storage.local.set({'logopen': true});
state = false;
} else {
$("#log").animate({height: 111}, 200);
$("#log").addClass('active');
$("#content").addClass('logopen');
$(".tab_container").addClass('logopen');
$("#scrollicon").addClass('active');
chrome.storage.local.set({'logopen': true});
state = true;
}
$(this).text(state ? 'Hide Log' : 'Show Log');
$(this).data('state', state);
state = true;
}
$(this).text(state ? 'Hide Log' : 'Show Log');
$(this).data('state', state);
});
chrome.storage.local.get('permanentExpertMode', function (result) {
if (result.permanentExpertMode) {
$('input[name="expertModeCheckbox"]').prop('checked', true);
}
$('input[name="expertModeCheckbox"]').change(function () {
if (BF_CONFIG) {
updateTabList(BF_CONFIG.features);
}
}).change();
});
});
function notifyOutdatedVersion (version) {
function notifyOutdatedVersion(version) {
if (semver.lt(chrome.runtime.getManifest().version, version)) {
GUI.log('You are using an old version of ' + chrome.runtime.getManifest().name + '. Version ' + version + ' is available online with possible improvements and fixes.');
}
@ -379,45 +411,52 @@ function bytesToSize(bytes) {
return bytes;
}
Number.prototype.clamp = function(min, max) {
return Math.min(Math.max(this, min), max);
};
/**
* String formatting now supports currying (partial application).
* For a format string with N replacement indices, you can call .format
* with M <= N arguments. The result is going to be a format string
* with N-M replacement indices, properly counting from 0 .. N-M.
* The following Example should explain the usage of partial applied format:
* "{0}:{1}:{2}".format("a","b","c") === "{0}:{1}:{2}".format("a","b").format("c")
* "{0}:{1}:{2}".format("a").format("b").format("c") === "{0}:{1}:{2}".format("a").format("b", "c")
**/
String.prototype.format = function () {
var args = arguments;
return this.replace(/\{(\d+)\}/g, function (t, i) {
return args[i] !== void 0 ? args[i] : "{"+(i-args.length)+"}";
});
};
function isExpertModeEnabled() {
return $('input[name="expertModeCheckbox"]').is(':checked');
}
function updateTabList(features) {
if (features.isEnabled('GPS')) {
if (features.isEnabled('GPS') && isExpertModeEnabled()) {
$('#tabs ul.mode-connected li.tab_gps').show();
} else {
$('#tabs ul.mode-connected li.tab_gps').hide();
}
if (features.isEnabled('FAILSAFE')) {
if (isExpertModeEnabled()) {
$('#tabs ul.mode-connected li.tab_failsafe').show();
} else {
$('#tabs ul.mode-connected li.tab_failsafe').hide();
}
if (isExpertModeEnabled()) {
$('#tabs ul.mode-connected li.tab_adjustments').show();
} else {
$('#tabs ul.mode-connected li.tab_adjustments').hide();
}
if (isExpertModeEnabled()) {
$('#tabs ul.mode-connected li.tab_servos').show();
} else {
$('#tabs ul.mode-connected li.tab_servos').hide();
}
if (features.isEnabled('LED_STRIP')) {
$('#tabs ul.mode-connected li.tab_led_strip').show();
} else {
$('#tabs ul.mode-connected li.tab_led_strip').hide();
}
if (isExpertModeEnabled()) {
$('#tabs ul.mode-connected li.tab_sensors').show();
} else {
$('#tabs ul.mode-connected li.tab_sensors').hide();
}
if (isExpertModeEnabled()) {
$('#tabs ul.mode-connected li.tab_logging').show();
} else {
$('#tabs ul.mode-connected li.tab_logging').hide();
}
if (features.isEnabled('BLACKBOX')) {
$('#tabs ul.mode-connected li.tab_onboard_logging').show();
} else {

View File

@ -252,6 +252,37 @@
height: 90px;
}
.tab-failsafe .featuresNew {
width: 100%;
}
.tab-failsafe .featuresNew tr {
width: 100%;
border-bottom: 1px solid #ddd;
float: left;
padding: 0px;
padding-bottom: 6px;
margin-bottom: 3px;
}
.tab-failsafe .featuresNew td:first-child {
width: 52px;
}
.tab-failsafe .featuresNew td:last-child {
width: calc(100% - 125px);
margin-right: 0px;
}
.tab-failsafe .featuresNew td {
float: left;
margin-right: 10px;
}
.tab-failsafe .featuresNew .helpicon {
margin-right: -2px;
}
.tab-failsafe table {
width: 100%;
}

View File

@ -22,6 +22,11 @@
<div class="spacer_box_title" i18n="failsafePaneTitleOld"></div>
</div>
<div class="spacer_box">
<table>
<tbody class="featuresOld rxFailsafe">
<!-- table generated here -->
</tbody>
</table>
<div class="number">
<label> <input type="number" name="failsafe_throttle_old" min="0" max="2000" /> <span
i18n="failsafeThrottleItemOld"></span>
@ -65,6 +70,11 @@
<div class="spacer_box_title" i18n="failsafeStageTwoSettingsTitle"></div>
</div>
<div class="spacer_box">
<table>
<tbody class="featuresNew rxFailsafe">
<!-- table generated here -->
</tbody>
</table>
<div class="checkbox stage2">
<div class="numberspacer" >
<input type="checkbox" name="failsafe_kill_switch" class="toggle" id="failsafe_kill_switch" />

View File

@ -63,6 +63,15 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
}
function process_html() {
// fill stage 2 fields
function toggleStage2(doShow) {
if (doShow) {
$('div.stage2').show();
} else {
$('div.stage2').hide();
}
}
// Conditionally hide the old or the new control pane's
if(apiVersionGte1_15_0) {
var oldPane = $('div.oldpane');
@ -199,6 +208,14 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
channel_mode_array[i].change();
}
BF_CONFIG.features.generateElements($('.tab-failsafe .featuresNew'));
var failsafeFeature = $('input[name="FAILSAFE"]');
failsafeFeature.change(function () {
toggleStage2($(this).is(':checked'));
});
toggleStage2(BF_CONFIG.features.isEnabled('FAILSAFE'));
$('input[name="failsafe_throttle"]').val(FAILSAFE_CONFIG.failsafe_throttle);
$('input[name="failsafe_off_delay"]').val(FAILSAFE_CONFIG.failsafe_off_delay);
$('input[name="failsafe_throttle_low_delay"]').val(FAILSAFE_CONFIG.failsafe_throttle_low_delay);
@ -244,6 +261,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
$('input[name="failsafe_kill_switch"]').prop('checked', FAILSAFE_CONFIG.failsafe_kill_switch);
} else {
BF_CONFIG.features.generateElements($('.tab-failsafe .featuresOld'));
// fill failsafe_throttle field (pre API 1.15.0)
$('input[name="failsafe_throttle_old"]').val(MISC.failsafe_throttle);
}
@ -251,6 +269,8 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
$('a.save').click(function () {
// gather data that doesn't have automatic change event bound
BF_CONFIG.features.updateData($('input[name="FAILSAFE"]'));
if(apiVersionGte1_15_0) {
RX_CONFIG.rx_min_usec = parseInt($('input[name="rx_min_usec"]').val());
RX_CONFIG.rx_max_usec = parseInt($('input[name="rx_max_usec"]').val());

View File

@ -1,6 +1,6 @@
<div class="notifications">
<label><input type="checkbox" /><span i18n="options_receive_app_notifications"></span></label>
</div>
<div class="statistics">
<label><input type="checkbox" /><span i18n="options_improve_configurator"></span></label>
<div class="permanentExpertMode">
<label><input type="checkbox" /><span i18n="permanentExpertMode"></span></label>
</div>