Merge pull request #1 from cleanflight/development

Update fork from Head
10.3.x-maintenance
Roeland Lutters 2015-01-08 10:49:59 +01:00
commit 91a63e05cf
13 changed files with 213 additions and 146 deletions

View File

@ -39,7 +39,21 @@
},
"backupFileIncompatible": {
"message": "Backup file provided was generated for older version of configurator and is incompatible with this version of configurator. Sorry"
"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."
},
"configMigrationFrom": {
"message": "Migrating configuration file generated by configurator: $1"
},
"configMigratedTo": {
"message": "Migrated configuration to configurator: $1"
},
"configMigrationSuccessful": {
"message": "Configuration migration complete, migrations applied: $1"
},
"tabSetup": {
@ -103,7 +117,15 @@
"message": "No configuration received within <span style=\"color: red\">10 seconds</span>, communication <span style=\"color: red\">failed</span>"
},
"firmwareVersionNotSupported": {
"message": "This firmware version is <span style=\"color: red\">not supported</span>. Please upgrade to firmware that supports api version <strong>$1</strong> or higher. Only CLI is usable for backup purposes."
"message": "This firmware version is <span style=\"color: red\">not supported</span>. Please upgrade to firmware that supports api version <strong>$1</strong> or higher. Use CLI for backup before flashing. CLI backup/restore procedure is in the documention."
},
"tabSwitchConnectionRequired": {
"message": "You need to <strong>connect</strong> before you can view any of the tabs."
},
"tabSwitchUpgradeRequired": {
"message": "You need to <strong>upgrade</strong> your firmware before you can view any of the tabs."
},
"firmwareVersion": {
"message": "Firmware Version: <strong>$1</strong>"
@ -347,6 +369,9 @@
"configurationReceiver": {
"message": "Receiver Mode"
},
"configurationFailsafe": {
"message": "Receiver failsafe"
},
"configurationRSSI": {
"message": "RSSI (Signal Strength)"
},
@ -510,8 +535,8 @@
"receiverChannelMapTitle": {
"message": "You can define your own channel map by clicking inside the box"
},
"receiverRssiAux": {
"message": "RSSI on AUX"
"receiverRssiChannel": {
"message": "RSSI Channel"
},
"receiverRefreshRateTitle": {
"message": "Graph refresh rate"

View File

@ -1,3 +1,9 @@
<span>2015.01.07 - 0.59.1 - cleanflight</span>
<p>
- Update RSSI channel section to allow any channel.<br />
- Implemented configuration migration to aid with backwards compatibility.<br />
- Allow CLI access when connecting firmware with an out-of-date API.
</p>
<span>2015.01.04 - 0.59.0 - cleanflight</span>
<p>
- Overhaul configuration tab.<br />

View File

@ -225,7 +225,7 @@ function configuration_restore(callback) {
console.log('Read SUCCESSFUL');
try { // check if string provided is a valid JSON
var deserialized_configuration_object = JSON.parse(e.target.result);
var configuration = JSON.parse(e.target.result);
} catch (e) {
// data provided != valid json object
console.log('Data provided != valid JSON string, restore aborted.');
@ -233,7 +233,23 @@ function configuration_restore(callback) {
return;
}
configuration_upload(deserialized_configuration_object, callback);
// validate
if (typeof configuration.generatedBy !== 'undefined' && compareVersions(configuration.generatedBy, CONFIGURATOR.backupFileMinVersionAccepted)) {
if (configuration.generatedBy != chrome.runtime.getManifest().version) {
if (!migrate(configuration)) {
GUI.log(chrome.i18n.getMessage('backupFileUnmigratable'));
return;
}
}
configuration_upload(configuration, callback);
} else {
GUI.log(chrome.i18n.getMessage('backupFileIncompatible'));
}
}
};
@ -241,7 +257,6 @@ function configuration_restore(callback) {
});
});
function configuration_upload(configuration, callback) {
function compareVersions(generated, required) {
var a = generated.split('.'),
b = required.split('.');
@ -268,6 +283,25 @@ function configuration_restore(callback) {
return true;
}
function migrate(configuration) {
var appliedMigrationsCount = 0;
var migratedVersion = configuration.generatedBy;
GUI.log(chrome.i18n.getMessage('configMigrationFrom', [migratedVersion]));
if (!compareVersions(migratedVersion, '0.59.1')) {
configuration.MISC.rssi_channel = configuration.MISC.rssi_aux_channel; // variable was renamed
configuration.MISC.rssi_aux_channel = undefined;
migratedVersion = '0.59.1';
GUI.log(chrome.i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
GUI.log(chrome.i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount]));
return true;
}
function configuration_upload(configuration, callback) {
function upload() {
var activeProfile = null,
profilesN = 3;
@ -405,11 +439,6 @@ function configuration_restore(callback) {
}
}
// validate
if (typeof configuration.generatedBy !== 'undefined' && compareVersions(configuration.generatedBy, CONFIGURATOR.backupFileMinVersionAccepted)) {
upload();
} else {
GUI.log(chrome.i18n.getMessage('backupFileIncompatible'));
}
}
}

View File

@ -132,7 +132,7 @@ var MISC = {
gps_baudrate: 0,
gps_ubx_sbas: 0,
multiwiicurrentoutput: 0,
rssi_aux_channel: 0,
rssi_channel: 0,
placeholder2: 0,
mag_declination: 0, // not checked
vbatscale: 0,

View File

@ -321,7 +321,7 @@ var MSP = {
MISC.gps_baudrate = data.getUint8(11);
MISC.gps_ubx_sbas = data.getInt8(12);
MISC.multiwiicurrentoutput = data.getUint8(13);
MISC.rssi_aux_channel = data.getUint8(14);
MISC.rssi_channel = data.getUint8(14);
MISC.placeholder2 = data.getUint8(15);
MISC.mag_declination = data.getInt16(16, 1) / 10; // -18000-18000
MISC.vbatscale = data.getUint8(18, 1); // 10-200
@ -482,7 +482,7 @@ var MSP = {
break;
case MSP_codes.MSP_SET_BF_CONFIG:
break;
case MSP_codes.MSP_REBOOT:
case MSP_codes.MSP_SET_REBOOT:
console.log('Reboot request accepted');
break;
@ -563,6 +563,10 @@ var MSP = {
offset+= 4;
break;
case MSP_codes.MSP_SET_CF_SERIAL_CONFIG:
console.log('Serial config saved');
break;
case MSP_codes.MSP_MODE_RANGES:
MODE_RANGES = []; // empty the array as new data is coming in
@ -819,7 +823,7 @@ MSP.crunch = function (code) {
buffer.push(MISC.gps_baudrate);
buffer.push(MISC.gps_ubx_sbas);
buffer.push(MISC.multiwiicurrentoutput);
buffer.push(MISC.rssi_aux_channel);
buffer.push(MISC.rssi_channel);
buffer.push(MISC.placeholder2);
buffer.push(lowByte(MISC.mag_declination * 10));
buffer.push(highByte(MISC.mag_declination * 10));

View File

@ -63,12 +63,12 @@ $(document).ready(function () {
tab = $(self).parent().prop('class');
if (!CONFIGURATOR.connectionValid) {
GUI.log('You need to <strong>connect</strong> before you can view any of the tabs');
GUI.log('tabSwitchConnectionRequired');
return;
}
if (CONFIGURATOR.connectionValidCliOnly) {
GUI.log('You need to <strong>upgrade</strong> your firmware before you can view any of the tabs. Use CLI for backup before flashing!');
GUI.log(chrome.i18n.getMessage('tabSwitchUpgradeRequired'));
return;
}

View File

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"minimum_chrome_version": "38",
"version": "0.59.0",
"version": "0.59.1",
"author": "Hydra",
"name": "Cleanflight - Configurator",
"short_name": "cleanflight",

View File

@ -44,12 +44,6 @@
<span i18n="configurationThrottleMaximum"></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="failsafe_throttle" min="0" max="2000" />
<span i18n="configurationThrottleFailsafe"></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="mincommand" min="0" max="2000" />
@ -137,13 +131,94 @@
<th i18n="configurationFeatureDescription"></th>
</tr>
</thead>
<tbody class="features rxMisc">
<tbody class="features rxFailsafe">
<!-- table generated here -->
</tbody>
</table>
<div class="number">
<label>
<input type="number" name="failsafe_throttle" min="0" max="2000" />
<span i18n="configurationThrottleFailsafe"></span>
</label>
</div>
</div>
<div class="rightWrapper current voltage">
<div class="groupTitle" i18n="configurationBatteryVoltage"></div>
<table>
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
</tr>
</thead>
<tbody class="features batteryVoltage">
<!-- table generated here -->
</tbody>
</table>
<div class="number">
<label>
<input type="number" name="mincellvoltage" step="0.1" min="1" max="5" />
<span i18n="configurationBatteryMinimum"></span>
</label>
</div>
<div class="rightWrapper gps">
<div class="number">
<label>
<input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" />
<span i18n="configurationBatteryMaximum"></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="warningcellvoltage" step="0.1" min="1" max="5" />
<span i18n="configurationBatteryWarning"></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="voltagescale" step="1" min="10" max="200" />
<span i18n="configurationBatteryScale"></span>
</label>
</div>
<div class="groupTitle" i18n="configurationCurrent"></div>
<table>
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
</tr>
</thead>
<tbody class="features batteryCurrent">
<!-- table generated here -->
</tbody>
</table>
<div class="number">
<label>
<input type="number" name="currentscale" step="1" min="1" max="1000" />
<span i18n="configurationCurrentScale"></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="currentoffset" step="1" min="1" max="1000" />
<span i18n="configurationCurrentOffset"></span>
</label>
</div>
<div class="checkbox">
<label>
<div>
<input type="checkbox" name="multiwiicurrentoutput" />
</div>
<span i18n="configurationBatteryMultiwiiCurrent"></span>
</label>
</div>
</div>
<div class="clear-both"></div>
<div class="leftWrapper gps">
<div class="groupTitle" i18n="configurationGPS"></div>
<table>
<thead>
@ -183,84 +258,7 @@
</label>
</div>
</div>
<div class="clear-both"></div>
<div class="leftWrapper">
<div class="groupTitle" i18n="configurationBatteryVoltage"></div>
<table>
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
</tr>
</thead>
<tbody class="features batteryVoltage">
<!-- table generated here -->
</tbody>
</table>
<div class="number">
<label>
<input type="number" name="mincellvoltage" step="0.1" min="1" max="5" />
<span i18n="configurationBatteryMinimum"></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" />
<span i18n="configurationBatteryMaximum"></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="warningcellvoltage" step="0.1" min="1" max="5" />
<span i18n="configurationBatteryWarning"></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="voltagescale" step="1" min="10" max="200" />
<span i18n="configurationBatteryScale"></span>
</label>
</div>
</div>
<div class="rightWrapper current">
<div class="groupTitle" i18n="configurationCurrent"></div>
<table>
<thead>
<tr>
<th i18n="configurationFeatureEnabled"></th>
<th i18n="configurationFeatureName"></th>
<th i18n="configurationFeatureDescription"></th>
</tr>
</thead>
<tbody class="features batteryCurrent">
<!-- table generated here -->
</tbody>
</table>
<div class="number">
<label>
<input type="number" name="currentscale" step="1" min="1" max="1000" />
<span i18n="configurationCurrentScale"></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="currentoffset" step="1" min="1" max="1000" />
<span i18n="configurationCurrentOffset"></span>
</label>
</div>
<div class="checkbox">
<label>
<div>
<input type="checkbox" name="multiwiicurrentoutput" />
</div>
<span i18n="configurationBatteryMultiwiiCurrent"></span>
</label>
</div>
</div>
<div class="clear-both"></div>
<div class="leftWrapper">
<div class="rightWrapper">
<div class="groupTitle" i18n="configurationFeatures"></div>
<table>
<thead>

View File

@ -76,7 +76,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
{bit: 15, group: 'rssi', name: 'RSSI_ADC', description: 'Analog RSSI input'},
{bit: 16, group: 'other', name: 'LED_STRIP', description: 'Addressable RGB LED strip support'},
{bit: 17, group: 'other', name: 'DISPLAY', description: 'OLED Screen Display'},
{bit: 18, group: 'esc', name: 'ONESHOT125', description: 'ONESHOT ESC support (disconnect ESCs, remove props)'}
{bit: 18, group: 'esc', name: 'ONESHOT125', description: 'ONESHOT ESC support (disconnect ESCs, remove props)'},
{bit: 19, group: 'other', name: 'BLACKBOX', description: 'Blackbox flight data recorder'}
];
var radioGroups = [];

View File

@ -37,7 +37,9 @@ TABS.ports.initialize = function (callback, scrollPosition) {
'CLI',
'GPS Passthrough',
'MSP',
'SmartPort Telemetry'
'SmartPort Telemetry',
'Blackbox',
'MSP, CLI, Blackbox (when armed), GPS Passthrough'
];
var portIdentifierToNameMapping = {

View File

@ -127,7 +127,7 @@
line-height: 20px;
text-align: right;
}
.tab-receiver .rssi_aux_wrapper {
.tab-receiver .rssi_channel_wrapper {
float: right;
margin: 10px 0 0 0;
@ -137,7 +137,7 @@
border: 1px solid #8b8b8b;
border-left: 0;
}
.tab-receiver .rssi_aux_wrapper .head {
.tab-receiver .rssi_channel_wrapper .head {
height: 15px;
padding: 4px;
@ -147,7 +147,7 @@
border-bottom: 1px solid #8b8b8b;
background-color: #ececec;
}
.tab-receiver .rssi_aux_wrapper select {
.tab-receiver .rssi_channel_wrapper select {
width: 100%;
height: 22px;

View File

@ -22,14 +22,10 @@
<td><input type="number" name="expo" step="0.01" min="0" max="1" /></td>
</tr>
</table>
<div class="rssi_aux_wrapper">
<div class="head" i18n="receiverRssiAux"></div>
<select name="rssi_aux_channel">
<option value="0">Disabled</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<div class="rssi_channel_wrapper">
<div class="head" i18n="receiverRssiChannel"></div>
<select name="rssi_channel">
<!-- list generated here -->
</select>
</div>
<div class="rcmap_wrapper">

View File

@ -162,8 +162,14 @@ TABS.receiver.initialize = function (callback) {
$('input[name="rcmap"]').val($(this).val());
});
// rssi aux
$('select[name="rssi_aux_channel"]').val(MISC.rssi_aux_channel);
// rssi
var rssi_channel_e = $('select[name="rssi_channel"]');
rssi_channel_e.append('<option value="0">Disabled</option>');
for (var i = 0; i < RC.active_channels; i++) {
rssi_channel_e.append('<option value="' + i + '">' + i + '</option>');
}
$('select[name="rssi_channel"]').val(MISC.rssi_channel);
// UI Hooks
// curves
@ -272,7 +278,7 @@ TABS.receiver.initialize = function (callback) {
}
// catch rssi aux
MISC.rssi_aux_channel = parseInt($('select[name="rssi_aux_channel"]').val());
MISC.rssi_channel = parseInt($('select[name="rssi_channel"]').val());
function save_rc_map() {
MSP.send_message(MSP_codes.MSP_SET_RCMAP, MSP.crunch(MSP_codes.MSP_SET_RCMAP), false, save_misc);