diff --git a/_locales/en/messages.json b/_locales/en/messages.json index f38f80d8c2..7275ff4eab 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -12,7 +12,7 @@ "options_improve_configurator": { "message": "Send anonymous usage data to the developer team" }, - + "connect": { "message": "Connect" }, @@ -41,7 +41,7 @@ "backupFileIncompatible": { "message": "Backup file provided was generated for previous version of the configurator and is incompatible with this version of configurator. Sorry" }, - + "backupFileUnmigratable": { "message": "Backup file provided was generated by a previous version of the configurator and is not migratable. Sorry." }, @@ -109,7 +109,7 @@ "tabAuxiliary": { "message": "Modes" }, - + "serialPortOpened": { "message": "Serial port successfully opened with ID: $1" }, @@ -122,21 +122,21 @@ "serialPortClosedFail": { "message": "Failed to close serial port" }, - + "noConfigurationReceived": { "message": "No configuration received within 10 seconds, communication failed" }, "firmwareVersionNotSupported": { "message": "This firmware version is not supported. Please upgrade to firmware that supports api version $1 or higher. Use CLI for backup before flashing. CLI backup/restore procedure is in the documention." }, - + "tabSwitchConnectionRequired": { "message": "You need to connect before you can view any of the tabs." }, "tabSwitchWaitForOperation": { "message": "You can't do this right now, please wait for current operation to finish ..." - }, - + }, + "tabSwitchUpgradeRequired": { "message": "You need to upgrade your firmware before you can use the $1 tab." }, @@ -352,6 +352,9 @@ "initialSetupGPSHead": { "message": "GPS" }, + "initialSetupInstrumentsHead": { + "message": "Instruments" + }, "initialSetupButtonSave": { "message": "Save" }, @@ -402,7 +405,7 @@ }, "configurationFailsafe": { "message": "Receiver failsafe" - }, + }, "configurationRSSI": { "message": "RSSI (Signal Strength)" }, @@ -412,7 +415,7 @@ "configurationFeaturesHelp": { "message": "Note: Not all combinations of features are valid. When the flight controller firmware detects invalid feature combinations conflicting features will be disabled.
Note: Configure serial ports before enabling the features that will use the ports." }, - + "configurationBoardAlignment": { "message": "Board Alignment" }, @@ -703,7 +706,7 @@ "adjustmentsEepromSaved": { "message": "EEPROM saved" }, - + "servosModel": { "message": "Model:" @@ -843,7 +846,7 @@ "message": "Automatically loaded previous log file: $1" }, - "firmwareFlasherReleaseSummaryHead": { + "firmwareFlasherReleaseSummaryHead": { "message": "Release info" }, "firmwareFlasherReleaseName": { @@ -876,7 +879,7 @@ "firmwareFlasherTargetWarning": { "message": "IMPORTANT: Ensure you flash a file appropriate for your target. Flashing a binary for the wrong target can cause bad things to happen." }, - + "firmwareFlasherPath": { "message": "Path:" }, @@ -976,7 +979,7 @@ "firmwareFlasherFailedToLoadOnlineFirmware": { "message": "Failed to load remote firmware" }, - + "ledStripHelp": { "message": "The flight controller can control colors and effects of individual LEDs on a strip.
Configure LEDs on the grid, configure wiring order then attach LEDs on your aircraft according to grid positions." }, diff --git a/images/flightindicators/altitude_pressure.svg b/images/flightindicators/altitude_pressure.svg new file mode 100644 index 0000000000..5c1b195d19 --- /dev/null +++ b/images/flightindicators/altitude_pressure.svg @@ -0,0 +1,106 @@ + + + + + + 990 + 985 + 980 + 995 + 1000 + 1005 + 1010 + 1015 + 1020 + 1025 + 1030 + + 1035 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/flightindicators/altitude_ticks.svg b/images/flightindicators/altitude_ticks.svg new file mode 100644 index 0000000000..a2ccffb996 --- /dev/null +++ b/images/flightindicators/altitude_ticks.svg @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +ALT +1 +2 +3 +4 +5 +6 +7 +8 +9 + + + + + + + + + + + +FEET +100 +1000 FEET +CALIBRATEDTO25 000 FEET + diff --git a/images/flightindicators/fi_box.svg b/images/flightindicators/fi_box.svg new file mode 100644 index 0000000000..e7187b7d61 --- /dev/null +++ b/images/flightindicators/fi_box.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + diff --git a/images/flightindicators/fi_circle.svg b/images/flightindicators/fi_circle.svg new file mode 100644 index 0000000000..1a5692111d --- /dev/null +++ b/images/flightindicators/fi_circle.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + diff --git a/images/flightindicators/fi_needle.svg b/images/flightindicators/fi_needle.svg new file mode 100644 index 0000000000..e94e94e0ca --- /dev/null +++ b/images/flightindicators/fi_needle.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/images/flightindicators/fi_needle_small.svg b/images/flightindicators/fi_needle_small.svg new file mode 100644 index 0000000000..983087b115 --- /dev/null +++ b/images/flightindicators/fi_needle_small.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/images/flightindicators/fi_tc_airplane.svg b/images/flightindicators/fi_tc_airplane.svg new file mode 100644 index 0000000000..e9904889d3 --- /dev/null +++ b/images/flightindicators/fi_tc_airplane.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/images/flightindicators/heading_mechanics.svg b/images/flightindicators/heading_mechanics.svg new file mode 100644 index 0000000000..8020d3091d --- /dev/null +++ b/images/flightindicators/heading_mechanics.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/flightindicators/heading_yaw.svg b/images/flightindicators/heading_yaw.svg new file mode 100644 index 0000000000..1d0f4e2be9 --- /dev/null +++ b/images/flightindicators/heading_yaw.svg @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/flightindicators/horizon_back.svg b/images/flightindicators/horizon_back.svg new file mode 100644 index 0000000000..e7e2d0a0a7 --- /dev/null +++ b/images/flightindicators/horizon_back.svg @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/images/flightindicators/horizon_ball.svg b/images/flightindicators/horizon_ball.svg new file mode 100644 index 0000000000..d25a50b0ab --- /dev/null +++ b/images/flightindicators/horizon_ball.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/flightindicators/horizon_circle.svg b/images/flightindicators/horizon_circle.svg new file mode 100644 index 0000000000..8598d37a73 --- /dev/null +++ b/images/flightindicators/horizon_circle.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/flightindicators/horizon_mechanics.svg b/images/flightindicators/horizon_mechanics.svg new file mode 100644 index 0000000000..d1f6c008e0 --- /dev/null +++ b/images/flightindicators/horizon_mechanics.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/images/flightindicators/speed_mechanics.svg b/images/flightindicators/speed_mechanics.svg new file mode 100644 index 0000000000..47d31f6ca7 --- /dev/null +++ b/images/flightindicators/speed_mechanics.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +20 +40 +60 +80 +100 +120 +140 +160 +KNOTS +AIR SPEED +0 + diff --git a/images/flightindicators/turn_coordinator.svg b/images/flightindicators/turn_coordinator.svg new file mode 100644 index 0000000000..a1525b22ab --- /dev/null +++ b/images/flightindicators/turn_coordinator.svg @@ -0,0 +1,382 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NO PITCHINFORMATION + D.C.ELEC. + TURN COORDINATOR + + + + + 2 MIN. + R + L + + + + + + + + + + diff --git a/images/flightindicators/vertical_mechanics.svg b/images/flightindicators/vertical_mechanics.svg new file mode 100644 index 0000000000..71bb9398fb --- /dev/null +++ b/images/flightindicators/vertical_mechanics.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 + + + + +UP +DOWN +1 +1 +.5 +.5 +1.5 +1.5 +2 +VERTICAL SPEED +1000FT PER MIN + diff --git a/js/libraries/flightindicators.css b/js/libraries/flightindicators.css new file mode 100644 index 0000000000..3dbe0fe2e2 --- /dev/null +++ b/js/libraries/flightindicators.css @@ -0,0 +1,52 @@ +/* +* jQuery Flight Indicators plugin +* By Sébastien Matton (seb_matton@hotmail.com) +* Published under GPLv3 License. +* +* https://github.com/sebmatton/jQuery-Flight-Indicators +*/ + +/* Global block of an indicator*/ +div.instrument { + width: 250px; + height: 250px; + position: relative; + display: inline-block; + overflow: hidden; +} + +/* The box containing any element of an indicator */ +div.instrument .box { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +/* Default transformations */ + +div.instrument.attitude div.roll { + transform: rotate(0deg); +} +div.instrument.attitude div.roll div.pitch { + top: 0%; +} +div.instrument.heading div.yaw { + transform: rotate(0deg); +} +div.instrument.vario div.vario { + transform: rotate(0deg); +} +div.instrument.speed div.airspeed { + transform: rotate(90deg); +} +div.instrument.altimeter div.pressure { + transform: rotate(40deg); +} +div.instrument.altimeter div.needle { + transform: rotate(90deg); +} +div.instrument.altimeter div.needleSmall { + transform: rotate(90deg); +} diff --git a/js/libraries/jquery.flightindicators.js b/js/libraries/jquery.flightindicators.js new file mode 100644 index 0000000000..1a954bff2e --- /dev/null +++ b/js/libraries/jquery.flightindicators.js @@ -0,0 +1,173 @@ +/* +* jQuery Flight Indicators plugin +* By Sébastien Matton (seb_matton@hotmail.com) +* Published under GPLv3 License. +* +* https://github.com/sebmatton/jQuery-Flight-Indicators +*/ +(function($) { + function FlightIndicator( placeholder, type, options ) { + // Initial configuration + var attitude = this; + var settings = $.extend({ + size : 200, + roll : 0, + pitch : 0, + turn : 0, + heading: 0, + vario: 0, + airspeed: 0, + altitude: 0, + pressure: 1000, + showBox : true, + img_directory : 'img/' + }, options ); + + var constants = { + pitch_bound:30, + vario_bound : 1.95, + airspeed_bound_l : 0, + airspeed_bound_h : 160 + } + + // Creation of the instrument + placeholder.each(function(){ + switch(type){ + case 'heading': + $(this).html('
'); + _setHeading(settings.heading); + break; + case 'variometer': + $(this).html('
'); + _setVario(settings.vario); + break; + case 'turn_coordinator': + $(this).html('
'); + _setTurn(settings.turn); + break; + case 'airspeed': + $(this).html('
'); + _setAirSpeed(settings.airspeed); + break + case 'altimeter': + $(this).html('
'); + _setAltitude(settings.altitude); + _setPressure(settings.pressure); + break; + default: + $(this).html('
'); + _setRoll(settings.roll); + _setPitch(settings.pitch); + } + $(this).find('div.instrument').css({height : settings.size, width : settings.size}); + $(this).find('div.instrument img.box.background').toggle(settings.showBox); + }); + + // Private methods + function _setRoll(roll){ + placeholder.each(function(){ + $(this).find('div.instrument.attitude div.roll').css('transform', 'rotate('+roll+'deg)'); + }); + } + + function _setPitch(pitch){ + // alert(pitch); + if(pitch>constants.pitch_bound){pitch = constants.pitch_bound;} + else if(pitch<-constants.pitch_bound){pitch = -constants.pitch_bound;} + placeholder.each(function(){ + $(this).find('div.instrument.attitude div.roll div.pitch').css('top', pitch*0.7 + '%'); + }); + } + + function _setHeading(heading){ + placeholder.each(function(){ + $(this).find('div.instrument.heading div.heading').css('transform', 'rotate(' + -heading + 'deg)'); + }); + } + + function _setTurn(turn){ + placeholder.each(function(){ + $(this).find('div.instrument.turn_coordinator div.turn').css('transform', 'rotate('+turn+'deg)'); + }); + } + + function _setVario(vario){ + if(vario > constants.vario_bound){vario = constants.vario_bound;} + else if(vario < -constants.vario_bound){vario = -constants.vario_bound;} + vario = vario*90; + placeholder.each(function(){ + $(this).find('div.instrument.vario div.vario').css('transform', 'rotate(' + vario + 'deg)'); + }); + } + + function _setAirSpeed(speed){ + if(speed > constants.airspeed_bound_h){speed = constants.airspeed_bound_h;} + else if(speed < constants.airspeed_bound_l){speed = constants.airspeed_bound_l;} + speed = 90+speed*2; + placeholder.each(function(){ + $(this).find('div.instrument.airspeed div.speed').css('transform', 'rotate(' + speed + 'deg)'); + }); + } + + function _setAltitude(altitude){ + var needle = 90 + altitude%1000 * 360 / 1000; + var needleSmall = altitude / 10000 * 360; + placeholder.each(function(){ + $(this).find('div.instrument.altimeter div.needle').css('transform', 'rotate(' + needle + 'deg)'); + $(this).find('div.instrument.altimeter div.needleSmall').css('transform', 'rotate(' + needleSmall + 'deg)'); + }); + } + + function _setPressure(pressure){ + pressure = 2*pressure - 1980; + placeholder.each(function(){ + $(this).find('div.instrument.altimeter div.pressure').css('transform', 'rotate(' + pressure + 'deg)'); + }); + } + + function _resize(size){ + placeholder.each(function(){ + $(this).find('div.instrument').css({height : size, width : size}); + }); + } + + function _showBox(){ + placeholder.each(function(){ + $(this).find('img.box.background').show(); + }); + } + + function _hideBox(){ + placeholder.each(function(){ + $(this).find('img.box.background').hide(); + }); + } + + // Public methods + this.setRoll = function(roll){_setRoll(roll);} + this.setPitch = function(pitch){_setPitch(pitch);} + this.setHeading = function(heading){_setHeading(heading);} + this.setTurn = function(turn){_setTurn(turn);} + this.setVario = function(vario){_setVario(vario);} + this.setAirSpeed = function(speed){_setAirSpeed(speed);} + this.setAltitude = function(altitude){_setAltitude(altitude);} + this.setPressure = function(pressure){_setPressure(pressure);} + this.resize = function(size){_resize(size);} + this.showBox = function(){_showBox();} + this.hideBox = function(){_hideBox();} + + return attitude; + }; + + // Extension to jQuery + $.flightIndicator = function(placeholder, type, options){ + var flightIndicator = new FlightIndicator($(placeholder), type, options) + return flightIndicator; + } + + $.fn.flightIndicator = function(data, type, options){ + return this.each(function(){ + $.flightIndicator(this, type, options); + }); + } +}( jQuery )); diff --git a/main.html b/main.html index f6ace55452..3ffd777881 100755 --- a/main.html +++ b/main.html @@ -7,6 +7,7 @@ + @@ -35,6 +36,7 @@ + diff --git a/tabs/gps.html b/tabs/gps.html index c6bce68907..61a4f82b0b 100644 --- a/tabs/gps.html +++ b/tabs/gps.html @@ -122,4 +122,4 @@ - \ No newline at end of file + diff --git a/tabs/modes.html b/tabs/modes.html index c0b92e1711..7edabe59ec 100644 --- a/tabs/modes.html +++ b/tabs/modes.html @@ -10,4 +10,4 @@
- \ No newline at end of file + diff --git a/tabs/motors.html b/tabs/motors.html index 06ec582cfb..8eed6ef39f 100644 --- a/tabs/motors.html +++ b/tabs/motors.html @@ -49,7 +49,7 @@
- +
Motors
- \ No newline at end of file + diff --git a/tabs/setup.css b/tabs/setup.css index 19dca29641..f5b3fc6494 100644 --- a/tabs/setup.css +++ b/tabs/setup.css @@ -22,7 +22,7 @@ border: 1px solid silver; background-color: #ececec; - + white-space: nowrap; } .tab-setup .section a:hover { @@ -156,6 +156,7 @@ } .tab-setup .block.gps { width: 185px; + margin-bottom: 10px; } .tab-setup .block.gps .fields { padding: 5px 5px 3px 5px; @@ -178,6 +179,9 @@ line-height: 20px; } +.tab-setup .block.instruments { + width: 185px; +} .tab-setup .buttons { width: calc(100% - 20px); @@ -201,4 +205,4 @@ } .tab-setup .update:hover { background-color: #dedcdc; -} \ No newline at end of file +} diff --git a/tabs/setup.html b/tabs/setup.html index c39cd7aa4a..9168ebf779 100644 --- a/tabs/setup.html +++ b/tabs/setup.html @@ -50,5 +50,10 @@ +
+ + + +
- \ No newline at end of file + diff --git a/tabs/setup.js b/tabs/setup.js index 865885e9a4..3c5cae1396 100644 --- a/tabs/setup.js +++ b/tabs/setup.js @@ -41,7 +41,7 @@ TABS.setup.initialize = function (callback) { if (CONFIG.apiVersion < CONFIGURATOR.backupRestoreMinApiVersionAccepted) { $('#content .backup').addClass('disabled'); $('#content .restore').addClass('disabled'); - + GUI.log(chrome.i18n.getMessage('initialSetupBackupAndRestoreApiVersion', [CONFIG.apiVersion, CONFIGURATOR.backupRestoreMinApiVersionAccepted])); } // initialize 3D @@ -55,6 +55,8 @@ TABS.setup.initialize = function (callback) { $('a.calibrateMag').addClass('disabled'); } + self.initializeInstruments(); + // UI Hooks $('a.calibrateAccel').click(function () { var self = $(this); @@ -153,7 +155,7 @@ TABS.setup.initialize = function (callback) { function get_slow_data() { MSP.send_message(MSP_codes.MSP_STATUS); - + MSP.send_message(MSP_codes.MSP_ANALOG, false, false, function () { bat_voltage_e.text(chrome.i18n.getMessage('initialSetupBatteryValue', [ANALOG.voltage])); bat_mah_drawn_e.text(chrome.i18n.getMessage('initialSetupBatteryMahValue', [ANALOG.mAhdrawn])); @@ -174,6 +176,10 @@ TABS.setup.initialize = function (callback) { heading_e.text(chrome.i18n.getMessage('initialSetupheading', [SENSOR_DATA.kinematics[2]])); self.render3D(); }); + + MSP.send_message(MSP_codes.MSP_RAW_IMU, false, false, function () { + self.updateInstruments(); + }); } GUI.interval_add('setup_data_pull_fast', get_fast_data, 33, true); // 30 fps @@ -183,6 +189,18 @@ TABS.setup.initialize = function (callback) { } }; +TABS.setup.initializeInstruments = function() { + var options = {size:90, showBox : false, img_directory: 'images/flightindicators/'}; + var attitude = $.flightIndicator('#attitude', 'attitude', options); + var heading = $.flightIndicator('#heading', 'heading', options); + + this.updateInstruments = function() { + attitude.setRoll(SENSOR_DATA.kinematics[0]); + attitude.setPitch(SENSOR_DATA.kinematics[1]); + heading.setHeading(SENSOR_DATA.magnetometer[0] * 360); + }; +}; + TABS.setup.initialize3D = function (compatibility) { var self = this, loader, canvas, wrapper, renderer, camera, scene, light, light2, modelWrapper, model, model_file, @@ -199,7 +217,7 @@ TABS.setup.initialize3D = function (compatibility) { renderer = new THREE.WebGLRenderer({canvas: canvas.get(0), alpha: true, antialias: true}); useWebGlRenderer = true; } else { - + renderer = new THREE.CanvasRenderer({canvas: canvas.get(0), alpha: true}); } @@ -212,7 +230,7 @@ TABS.setup.initialize3D = function (compatibility) { } else { model_file = 'fallback' } - + // Temporary workaround for 'custom' model until akfreak's custom model is merged. var useLegacyCustomModel = false; if (model_file == 'custom') {