diff --git a/tabs/configuration.js b/tabs/configuration.js index 4136b345eb..6ef2b0a42f 100644 --- a/tabs/configuration.js +++ b/tabs/configuration.js @@ -10,18 +10,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) { googleAnalytics.sendAppView('Configuration'); } - function check_compatibility() { - if (bit_check(CONFIG.capability, 30)) { - // new stuff supported, continue fetching configuration data - load_config(); - } else { - // old version, deny access - $('#content').text('We are sorry, but advanced configuration is only available for boards with latest firmware, please update'); - - if (callback) callback(); - } - } - function load_config() { MSP.send_message(MSP_codes.MSP_CONFIG, false, false, load_rc_map); } @@ -42,7 +30,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) { $('#content').load("./tabs/configuration.html", process_html); } - MSP.send_message(MSP_codes.MSP_IDENT, false, false, check_compatibility); + MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config); function process_html() { // translate to user-selected language diff --git a/tabs/receiver.js b/tabs/receiver.js index 859640d3bd..4398d11c60 100644 --- a/tabs/receiver.js +++ b/tabs/receiver.js @@ -18,12 +18,7 @@ TABS.receiver.initialize = function (callback) { } function get_rc_map() { - // TODO remove this after compatibility period - if (bit_check(CONFIG.capability, 30)) { - MSP.send_message(MSP_codes.MSP_RCMAP, false, false, load_html); - } else { - load_html(); - } + MSP.send_message(MSP_codes.MSP_RCMAP, false, false, load_html); } function load_html() { @@ -109,70 +104,66 @@ TABS.receiver.initialize = function (callback) { $(window).on('resize', self.resize).resize(); // trigger so labels get correctly aligned on creation // handle rcmap & rssi aux channel - if (bit_check(CONFIG.capability, 30)) { - var RC_MAP_Letters = ['A', 'E', 'R', 'T', '1', '2', '3', '4']; + var RC_MAP_Letters = ['A', 'E', 'R', 'T', '1', '2', '3', '4']; - var strBuffer = []; - for (var i = 0; i < RC_MAP.length; i++) { - strBuffer[RC_MAP[i]] = RC_MAP_Letters[i]; + var strBuffer = []; + for (var i = 0; i < RC_MAP.length; i++) { + strBuffer[RC_MAP[i]] = RC_MAP_Letters[i]; + } + + // reconstruct + var str = strBuffer.join(''); + + // set current value + $('input[name="rcmap"]').val(str); + + // validation / filter + var last_valid = str; + + $('input[name="rcmap"]').on('input', function () { + var val = $(this).val(); + + // limit length to max 8 + if (val.length > 8) { + val = val.substr(0, 8); + $(this).val(val); + } + }); + + $('input[name="rcmap"]').focusout(function () { + var val = $(this).val(), + strBuffer = val.split(''), + duplicityBuffer = []; + + if (val.length != 8) { + $(this).val(last_valid); + return false; } - // reconstruct - var str = strBuffer.join(''); - - // set current value - $('input[name="rcmap"]').val(str); - - // validation / filter - var last_valid = str; - - $('input[name="rcmap"]').on('input', function () { - var val = $(this).val(); - - // limit length to max 8 - if (val.length > 8) { - val = val.substr(0, 8); - $(this).val(val); - } - }); - - $('input[name="rcmap"]').focusout(function () { - var val = $(this).val(), - strBuffer = val.split(''), - duplicityBuffer = []; - - if (val.length != 8) { + // check if characters inside are all valid, also check for duplicity + for (var i = 0; i < val.length; i++) { + if (RC_MAP_Letters.indexOf(strBuffer[i]) < 0) { $(this).val(last_valid); return false; } - // check if characters inside are all valid, also check for duplicity - for (var i = 0; i < val.length; i++) { - if (RC_MAP_Letters.indexOf(strBuffer[i]) < 0) { - $(this).val(last_valid); - return false; - } - - if (duplicityBuffer.indexOf(strBuffer[i]) < 0) { - duplicityBuffer.push(strBuffer[i]); - } else { - $(this).val(last_valid); - return false; - } + if (duplicityBuffer.indexOf(strBuffer[i]) < 0) { + duplicityBuffer.push(strBuffer[i]); + } else { + $(this).val(last_valid); + return false; } - }); + } + }); - // handle helper - $('select[name="rcmap_helper"]').val(0); // go out of bounds - $('select[name="rcmap_helper"]').change(function () { - $('input[name="rcmap"]').val($(this).val()); - }); + // handle helper + $('select[name="rcmap_helper"]').val(0); // go out of bounds + $('select[name="rcmap_helper"]').change(function () { + $('input[name="rcmap"]').val($(this).val()); + }); - // rssi aux - $('select[name="rssi_aux_channel"]').val(MISC.rssi_aux_channel); - } else { - $('.rcmap_wrapper, .rssi_aux_wrapper').hide(); - } + // rssi aux + $('select[name="rssi_aux_channel"]').val(MISC.rssi_aux_channel); // UI Hooks // curves @@ -297,11 +288,7 @@ TABS.receiver.initialize = function (callback) { }); } - if (bit_check(CONFIG.capability, 30)) { - MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_rc_map); - } else { - MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_to_eeprom); - } + MSP.send_message(MSP_codes.MSP_SET_RC_TUNING, MSP.crunch(MSP_codes.MSP_SET_RC_TUNING), false, save_rc_map); }); $('select[name="rx_refresh_rate"]').change(function () { diff --git a/tabs/setup.css b/tabs/setup.css index af0af4bdd2..c84d4c2422 100644 --- a/tabs/setup.css +++ b/tabs/setup.css @@ -1,19 +1,17 @@ -/* temporary styles that are used during compatibility period */ -.tab-setup .CAP_BASEFLIGHT_CONFIG, -.tab-setup .COMPATIBILITY { - display: none; +/* requires cleanup */ +.tab-setup .CAP_BASEFLIGHT_CONFIG { height: calc(100% - 138px); } -.tab-setup .CAP_BASEFLIGHT_CONFIG #interactive_block { +.tab-setup #interactive_block { width: calc(100% - 199px); } -.tab-setup .CAP_BASEFLIGHT_CONFIG .gps { +.tab-setup .gps { width: 185px; } -.tab-setup .CAP_BASEFLIGHT_CONFIG .gps .fields { +.tab-setup .gps .fields { padding: 5px 5px 3px 5px; } -.tab-setup .CAP_BASEFLIGHT_CONFIG .gps dt { +.tab-setup .gps dt { float: left; width: 85px; @@ -23,7 +21,7 @@ line-height: 20px; } -.tab-setup .CAP_BASEFLIGHT_CONFIG .gps dd { +.tab-setup .gps dd { height: 20px; margin-left: 85px; @@ -31,7 +29,6 @@ line-height: 20px; } -/* temporary styles end*/ .tab-setup { height: 100%; } @@ -97,29 +94,6 @@ border: 1px solid silver; background-color: white; } -#interactive_block .model { - float: left; - height: 15px; - margin: 10px 0 0 10px; - - font-weight: bold; -} -#interactive_block .modelMixDiagram { - position: absolute; - - top: 32px; - left: 10px; - - height: 95px; -} -#interactive_block .modelMixAirplane { /* Position airplane correctly */ - height: 115px; - padding-left: 0px; -} -#interactive_block .modelMixCustom { /* Position question mark correctly */ - height: 75px; - padding-left: 25px; -} #interactive_block .heading { float: right; height: 15px; @@ -180,37 +154,9 @@ border-bottom: 1px solid silver; background-color: #ececec; } -.tab-setup .mixer { - width: 200px; -} -.tab-setup .mixer .preview { - display: block; - - width: 200px; - height: 140px; - - margin: 5px 0 5px 0; -} -.tab-setup .mixer select { - display: block; - - padding-left: 5px; - - width: 100%; - height: 20px; - line-height: 20px; - - font-weight: bold; - - border-top: 1px solid silver; -} .tab-setup .block .info { width: 200px; } -.tab-setup .battery, -.tab-setup .throttle, -.tab-setup .acc-trim, -.tab-setup .magnetometer, .tab-setup .info { display: inline-block; vertical-align: top; @@ -221,131 +167,9 @@ border: 1px solid silver; } -.tab-setup .battery .head, -.tab-setup .throttle .head, -.tab-setup .acc-trim .head, -.tab-setup .magnetometer .head, -.tab-setup .info .head { - display: block; - - text-align: center; - line-height: 20px; - font-weight: bold; - - border-bottom: 1px solid silver; - background-color: #ececec; -} -.tab-setup .battery .fields, -.tab-setup .throttle .fields, -.tab-setup .magnetometer .fields, .tab-setup .info .fields { padding: 5px 5px 3px 5px; } -.tab-setup .acc-trim .fields { - padding: 5px 5px 3px 5px; -} -.tab-setup .magnetometer .fields { - padding: 5px 5px 5px 5px; -} -.tab-setup .battery dt { - float: left; - - width: 105px; - height: 22px; - - margin-bottom: 2px; - - line-height: 22px; -} -.tab-setup .battery dd { - height: 22px; - - margin-left: 105px; - margin-bottom: 2px; - - line-height: 22px; -} -.tab-setup .battery input { - width: 68px; - height: 20px; - line-height: 20px; - - border: 1px solid silver; - text-align: center; -} -.tab-setup .throttle dt { - float: left; - - width: 90px; - height: 22px; - - margin-bottom: 2px; - - line-height: 22px; -} -.tab-setup .throttle dd { - height: 22px; - - margin-left: 90px; - margin-bottom: 2px; - - line-height: 22px; -} -.tab-setup .throttle input { - width: 60px; - height: 20px; - line-height: 20px; - - border: 1px solid silver; - text-align: center; -} -.tab-setup .acc-trim dt { - float: left; - - width: 65px; - height: 22px; - line-height: 22px; - - margin-bottom: 2px; -} -.tab-setup .acc-trim dd { - height: 22px; - - margin-left: 65px; - margin-bottom: 2px; -} -.tab-setup .acc-trim input { - width: 60px; - height: 20px; - line-height: 20px; - - border: 1px solid silver; - text-align: center; -} -.tab-setup .magnetometer dt { - float: left; - - width: 90px; - height: 20px; - line-height: 22px; - - margin-bottom: 2px; -} -.tab-setup .magnetometer dd { - height: 20px; - line-height: 22px; - - margin-left: 90px; - margin-bottom: 2px; -} -.tab-setup .magnetometer input { - width: 60px; - height: 20px; - line-height: 20px; - - border: 1px solid silver; - text-align: center; -} .tab-setup .info dt { float: left; diff --git a/tabs/setup.html b/tabs/setup.html index 46e1bd2280..265e7447fd 100644 --- a/tabs/setup.html +++ b/tabs/setup.html @@ -51,69 +51,4 @@ -
-
-
- -
- - - - -
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
0 V
-
0 mAh
-
0 A
-
0 %
-
-
-
-
-
- -
-
\ No newline at end of file diff --git a/tabs/setup.js b/tabs/setup.js index f30100596f..d1f0d2b4e8 100644 --- a/tabs/setup.js +++ b/tabs/setup.js @@ -17,11 +17,7 @@ TABS.setup.initialize = function (callback) { } function load_config() { - if (bit_check(CONFIG.capability, 30)) { - MSP.send_message(MSP_codes.MSP_CONFIG, false, false, load_misc_data); - } else { - load_misc_data(); - } + MSP.send_message(MSP_codes.MSP_CONFIG, false, false, load_misc_data); } function load_misc_data() { @@ -38,154 +34,11 @@ TABS.setup.initialize = function (callback) { // translate to user-selected language localize(); - // if CAP_BASEFLIGHT_CONFIG (30) - if (bit_check(CONFIG.capability, 30)) { - // current stuff, this will become default when the compatibility period ends - $('.CAP_BASEFLIGHT_CONFIG').show(); + // initialize 3D + self.initialize3D(false); - // initialize 3D - self.initialize3D(false); - - // set heading in interactive block - $('span.heading').text(chrome.i18n.getMessage('initialSetupheading', [0])); - } else { - // old stuff - $('.COMPATIBILITY').show(); - - // initialize 3D - self.initialize3D(true); - - // Fill in misc stuff - $('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage); - $('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage); - $('input[name="voltagescale"]').val(MISC.vbatscale); - - $('input[name="minthrottle"]').val(MISC.minthrottle); - $('input[name="maxthrottle"]').val(MISC.maxthrottle); - $('input[name="failsafe_throttle"]').val(MISC.failsafe_throttle); - $('input[name="mincommand"]').val(MISC.mincommand); - - $('input[name="mag_declination"]').val(MISC.mag_declination / 10); - - // Fill in the accel trimms from CONFIG object - $('input[name="pitch"]').val(CONFIG.accelerometerTrims[0]); - $('input[name="roll"]').val(CONFIG.accelerometerTrims[1]); - - // Display multiType and motor diagram (if such exist) - var str; - switch (CONFIG.multiType) { - case 1: // TRI - str = 'TRI'; - $('.modelMixDiagram').attr('src', './resources/motor_order/tri.svg').addClass('modelMixTri'); - break; - case 2: // QUAD + - str = 'Quad +'; - $('.modelMixDiagram').attr('src', './resources/motor_order/quad_p.svg').addClass('modelMixQuadP'); - break; - case 3: // QUAD X - str = 'Quad X'; - $('.modelMixDiagram').attr('src', './resources/motor_order/quad_x.svg').addClass('modelMixQuadX'); - break; - case 4: // BI - str = 'BI'; - break; - case 5: // GIMBAL - str = 'Gimbal'; - break; - case 6: // Y6 - str = 'Y6'; - $('.modelMixDiagram').attr('src', './resources/motor_order/y6.svg').addClass('modelMixY6'); - break; - case 7: // HEX 6 - str = 'HEX 6'; - $('.modelMixDiagram').attr('src', './resources/motor_order/hex_p.svg').addClass('modelMixHex6P'); - break; - case 8: // FLYING_WING - str = 'Flying Wing'; - break; - case 9: // Y4 - str = 'Y4'; - $('.modelMixDiagram').attr('src', './resources/motor_order/y4.svg').addClass('modelMixY4'); - break; - case 10: // HEX6 X - str = 'HEX6 X'; - $('.modelMixDiagram').attr('src', './resources/motor_order/hex_x.svg').addClass('modelMixHex6X'); - break; - case 11: // OCTO X8 - case 12: - case 13: - str = 'OCTO X8'; - $('.modelMixDiagram').attr('src', './resources/motor_order/octo_flat_x.svg').addClass('modelMixOctoX'); - break; - case 14: // AIRPLANE - str = 'Airplane'; - $('.modelMixDiagram').attr('src', './resources/motor_order/airplane.svg').addClass('modelMixAirplane'); - break; - case 15: // Heli 120 - str = 'Heli 120'; - break; - case 16: // Heli 90 - str = 'Heli 90'; - break; - case 17: // Vtail - str = 'Vtail'; - $('.modelMixDiagram').attr('src', './resources/motor_order/vtail_quad.svg').addClass('modelMixVtail'); - break; - case 18: // HEX6 H - str = 'HEX6 H'; - $('.modelMixDiagram').attr("src", './resources/motor_order/custom.svg').addClass('modelMixCustom'); - break; - case 19: // PPM to SERVO - str = 'PPM to SERVO'; - $('.modelMixDiagram').attr("src", './resources/motor_order/custom.svg').addClass('modelMixCustom'); - break; - case 20: // Dualcopter - str = 'Dualcopter'; - $('.modelMixDiagram').attr("src", './resources/motor_order/custom.svg').addClass('modelMixCustom'); - break; - case 21: // Singlecopter - str = 'Singlecopter'; - $('.modelMixDiagram').attr("src", './resources/motor_order/custom.svg').addClass('modelMixCustom'); - break; - case 22: // Custom - str = 'Custom'; - $('.modelMixDiagram').attr("src", './resources/motor_order/custom.svg').addClass('modelMixCustom'); - break; - } - - $('span.model').text(chrome.i18n.getMessage('initialSetupModel', [str])); - - // Heading - $('span.heading').text(chrome.i18n.getMessage('initialSetupheading', [0])); - - $('a.update').click(function () { - CONFIG.accelerometerTrims[0] = parseInt($('input[name="pitch"]').val()); - CONFIG.accelerometerTrims[1] = parseInt($('input[name="roll"]').val()); - - MISC.vbatmincellvoltage = parseFloat($('input[name="mincellvoltage"]').val()) * 10; - MISC.vbatmaxcellvoltage = parseFloat($('input[name="maxcellvoltage"]').val()) * 10; - MISC.vbatscale = parseInt($('input[name="voltagescale"]').val()); - - MISC.minthrottle = parseInt($('input[name="minthrottle"]').val()); - MISC.maxthrottle = parseInt($('input[name="maxthrottle"]').val()); - MISC.failsafe_throttle = parseInt($('input[name="failsafe_throttle"]').val()); - MISC.mincommand = parseInt($('input[name="mincommand"]').val()); - - MISC.mag_declination = parseFloat($('input[name="mag_declination"]').val()) * 10; - - function save_to_eeprom() { - MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, function () { - GUI.log(chrome.i18n.getMessage('initialSetupEepromSaved')); - }); - } - - // Send over the new trims - MSP.send_message(MSP_codes.MSP_SET_ACC_TRIM, MSP.crunch(MSP_codes.MSP_SET_ACC_TRIM)); - - // Send over new misc - MSP.send_message(MSP_codes.MSP_SET_MISC, MSP.crunch(MSP_codes.MSP_SET_MISC), false, save_to_eeprom); - }); - } + // set heading in interactive block + $('span.heading').text(chrome.i18n.getMessage('initialSetupheading', [0])); // check if we have magnetometer if (!bit_check(CONFIG.activeSensors, 2)) {