Merge pull request #10 from cleanflight/development

Development
10.3.x-maintenance
tricopterY 2015-03-14 10:40:51 +11:00
commit 58d0381097
13 changed files with 267 additions and 90 deletions

View File

@ -518,6 +518,9 @@
"portsHelp": {
"message": "Configure serial ports. <strong>Note:</strong> not all combinations are valid. When the flight controller firmware detects this the serial port configuration will be reset."
},
"portsFirmwareUpgradeRequired": {
"message": "Firmware upgrade <span style=\"color: red\">required</span>. Serial port configurations of firmware &lt; 1.8.0 is not supported."
},
"portsButtonSave": {
"message": "Save and Reboot"
},
@ -567,6 +570,12 @@
"pidTuningRollPitchRate": {
"message": "ROLL &amp; PITCH rate"
},
"pidTuningRollRate": {
"message": "ROLL rate"
},
"pidTuningPitchRate": {
"message": "PITCH rate"
},
"pidTuningYawRate": {
"message": "YAW rate"
},
@ -893,6 +902,9 @@
"dataflashNotSupportedNote": {
"message": "Your flight controller does not have a compatible dataflash chip available."
},
"dataflashFirmwareUpgradeRequired": {
"message": "Dataflash requires firmware &gt;= 1.8.0."
},
"dataflashButtonSaveFile": {
"message": "Save flash to file..."
},

View File

@ -3,9 +3,6 @@
- PID Tuning tab allows TPA Breakpoint changes - Requires 1.8.0 firmware.<br />
- Corrected Artificial Horizon Pitch/Roll views.<br />
- Changed logging time stamp to include date stamp.<br />
</p>
<span>2015.03.03 - 0.63 - cleanflight</span>
<p>
- Support new firmware 1.8 serial port configuration.<br />
- Move documentation and help to new tab.<br />
- Add contributing section to welcome tab.<br />

View File

@ -102,7 +102,7 @@ function configuration_backup(callback) {
configuration.RCMAP = jQuery.extend(true, [], RC_MAP);
configuration.BF_CONFIG = jQuery.extend(true, {}, BF_CONFIG);
configuration.SERIAL_CONFIG = jQuery.extend(true, {}, SERIAL_CONFIG);
configuration.LED_STRIP = jQuery.extend(true, {}, LED_STRIP);
configuration.LED_STRIP = jQuery.extend(true, [], LED_STRIP);
save();
}
@ -314,7 +314,7 @@ function configuration_restore(callback) {
GUI.log(chrome.i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
if (!compareVersions(migratedVersion, '0.61.0')) {
// Changing PID controller via UI was added.
@ -330,6 +330,77 @@ function configuration_restore(callback) {
appliedMigrationsCount++;
}
if (!compareVersions(migratedVersion, '0.63.0')) {
// LED Strip was saved as object instead of array.
if (typeof(configuration.LED_STRIP) == 'object') {
var fixed_led_strip = [];
var index = 0;
while (configuration.LED_STRIP[index]) {
fixed_led_strip.push(configuration.LED_STRIP[index++]);
}
configuration.LED_STRIP = fixed_led_strip;
}
// Serial configuation redesigned
var ports = [];
for (var portIndex = 0; portIndex < configuration.SERIAL_CONFIG.ports.length; portIndex++) {
var oldPort = configuration.SERIAL_CONFIG.ports[portIndex];
var newPort = {
identifier: oldPort.identifier,
functionMask: 0,
msp_baudrate: configuration.SERIAL_CONFIG.mspBaudRate,
gps_baudrate: configuration.SERIAL_CONFIG.gpsBaudRate,
telemetry_baudrate: 0, // auto
blackbox_baudrate: 5, // 115200
};
switch(oldPort.scenario) {
case 1: // MSP, CLI, TELEMETRY, SMARTPORT TELEMETRY, GPS-PASSTHROUGH
case 5: // MSP, CLI, GPS-PASSTHROUGH
case 8: // MSP ONLY
newPort.functionMask = 1; // FUCNTION_MSP
break;
case 2: // GPS
newPort.functionMask = 2; // FUNCTION_GPS
break;
case 3: // RX_SERIAL
newPort.functionMask = 64; // FUNCTION_RX_SERIAL
break;
case 10: // BLACKBOX ONLY
newPort.functionMask = 128; // FUNCTION_BLACKBOX
break;
case 11: // MSP, CLI, BLACKBOX, GPS-PASSTHROUGH
newPort.functionMask = 1 + 128; // FUNCTION_BLACKBOX
break;
}
ports.push(newPort);
}
configuration.SERIAL_CONFIG = {
ports: ports
};
for (var profileIndex = 0; profileIndex < 3; profileIndex++) {
var RC = configuration.profiles[profileIndex].RC;
// TPA breakpoint was added
if (!RC.dynamic_THR_breakpoint) {
RC.dynamic_THR_breakpoint = 1500; // firmware default
}
// Roll and pitch rates were split
RC.roll_rate = RC.roll_pitch_rate;
RC.pitch_rate = RC.roll_pitch_rate;
}
migratedVersion = '0.63.0';
GUI.log(chrome.i18n.getMessage('configMigratedTo', [migratedVersion]));
appliedMigrationsCount++;
}
GUI.log(chrome.i18n.getMessage('configMigrationSuccessful', [appliedMigrationsCount]));
return true;
}

View File

@ -3,9 +3,9 @@
var CONFIGURATOR = {
'releaseDate': 1424462791805, // new Date().getTime() - 2015.02.20
'apiVersionAccepted': 1.2,
'backupRestoreMinApiVersionAccepted': 1.6,
'backupRestoreMinApiVersionAccepted': 1.5,
'pidControllerChangeMinApiVersion': 1.5,
'backupFileMinVersionAccepted': '0.63', // chrome.runtime.getManifest().version is stored as string, so does this one
'backupFileMinVersionAccepted': '0.55', // chrome.runtime.getManifest().version is stored as string, so does this one
'connectionValid': false,
'connectionValidCliOnly': false,
'cliActive': false,
@ -65,7 +65,9 @@ var RC = {
var RC_tuning = {
RC_RATE: 0,
RC_EXPO: 0,
roll_pitch_rate: 0,
roll_pitch_rate: 0, // pre 1.7 api only
roll_rate: 0,
pitch_rate: 0,
yaw_rate: 0,
dynamic_THR_PID: 0,
throttle_MID: 0,
@ -87,6 +89,8 @@ var SERVO_CONFIG = [];
var SERIAL_CONFIG = {
ports: [],
// pre 1.6 settings
mspBaudRate: 0,
gpsBaudRate: 0,
gpsPassthroughBaudRate: 0,

File diff suppressed because one or more lines are too long

View File

@ -108,7 +108,9 @@ var MSP = {
'19200',
'38400',
'57600',
'115200'
'115200',
'230400',
'250000',
],
serialPortFunctions: // in LSB bit order
@ -288,14 +290,22 @@ var MSP = {
ANALOG.amperage = data.getInt16(5, 1) / 100; // A
break;
case MSP_codes.MSP_RC_TUNING:
RC_tuning.RC_RATE = parseFloat((data.getUint8(0) / 100).toFixed(2));
RC_tuning.RC_EXPO = parseFloat((data.getUint8(1) / 100).toFixed(2));
RC_tuning.roll_pitch_rate = parseFloat((data.getUint8(2) / 100).toFixed(2));
RC_tuning.yaw_rate = parseFloat((data.getUint8(3) / 100).toFixed(2));
RC_tuning.dynamic_THR_PID = parseFloat((data.getUint8(4) / 100).toFixed(2));
RC_tuning.throttle_MID = parseFloat((data.getUint8(5) / 100).toFixed(2));
RC_tuning.throttle_EXPO = parseFloat((data.getUint8(6) / 100).toFixed(2));
RC_tuning.dynamic_THR_breakpoint = parseInt(data.getUint16(7, 1));
var offset = 0;
RC_tuning.RC_RATE = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.RC_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
if (CONFIG.apiVersion < 1.7) {
RC_tuning.roll_pitch_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
} else {
RC_tuning.roll_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.pitch_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
}
RC_tuning.yaw_rate = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.dynamic_THR_PID = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.throttle_MID = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
RC_tuning.throttle_EXPO = parseFloat((data.getUint8(offset++) / 100).toFixed(2));
if (CONFIG.apiVersion >= 1.7) {
RC_tuning.dynamic_THR_breakpoint = data.getUint16(offset++, 1);
}
break;
case MSP_codes.MSP_PID:
// PID data arrived, we need to scale it and save to appropriate bank / array
@ -913,13 +923,20 @@ MSP.crunch = function (code) {
case MSP_codes.MSP_SET_RC_TUNING:
buffer.push(parseInt(RC_tuning.RC_RATE * 100));
buffer.push(parseInt(RC_tuning.RC_EXPO * 100));
buffer.push(parseInt(RC_tuning.roll_pitch_rate * 100));
if (CONFIG.apiVersion < 1.7) {
buffer.push(parseInt(RC_tuning.roll_pitch_rate * 100));
} else {
buffer.push(parseInt(RC_tuning.roll_rate * 100));
buffer.push(parseInt(RC_tuning.pitch_rate * 100));
}
buffer.push(parseInt(RC_tuning.yaw_rate * 100));
buffer.push(parseInt(RC_tuning.dynamic_THR_PID * 100));
buffer.push(parseInt(RC_tuning.throttle_MID * 100));
buffer.push(parseInt(RC_tuning.throttle_EXPO * 100));
buffer.push(lowByte(RC_tuning.dynamic_THR_breakpoint));
buffer.push(highByte(RC_tuning.dynamic_THR_breakpoint));
if (CONFIG.apiVersion >= 1.7) {
buffer.push(lowByte(RC_tuning.dynamic_THR_breakpoint));
buffer.push(highByte(RC_tuning.dynamic_THR_breakpoint));
}
break;
// Disabled, cleanflight does not use MSP_SET_BOX.
/*

View File

@ -62,6 +62,6 @@
<a href="#" class="save-flash" i18n="dataflashButtonSaveFile"></a>
</div>
</div>
<div class="note require-no-dataflash" i18n="dataflashNotSupportedNote">
<div class="note require-no-dataflash">
</div>
</div>

View File

@ -1,6 +1,8 @@
'use strict';
TABS.dataflash = {};
TABS.dataflash = {
available: false
};
TABS.dataflash.initialize = function (callback) {
var
self = this,
@ -18,10 +20,19 @@ TABS.dataflash.initialize = function (callback) {
log_buffer = [];
if (CONFIGURATOR.connectionValid) {
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false, function() {
$('#content').load("./tabs/dataflash.html", function() {
create_html();
});
TABS.dataflash.available = (CONFIG.apiVersion >= 1.6)
if (!TABS.dataflash.available) {
load_html();
return;
}
MSP.send_message(MSP_codes.MSP_DATAFLASH_SUMMARY, false, false, load_html);
}
function load_html() {
$('#content').load("./tabs/dataflash.html", function() {
create_html();
});
}
@ -71,27 +82,35 @@ TABS.dataflash.initialize = function (callback) {
}
function create_html() {
var
supportsDataflash = DATAFLASH.totalSize > 0;
// translate to user-selected language
localize();
if (TABS.dataflash.available) {
var supportsDataflash = DATAFLASH.totalSize > 0;
$(".tab-dataflash").toggleClass("supported", supportsDataflash);
$(".tab-dataflash").toggleClass("supported", supportsDataflash);
if (supportsDataflash) {
// UI hooks
$('.tab-dataflash a.erase-flash').click(ask_to_erase_flash);
$('.tab-dataflash a.erase-flash-confirm').click(flash_erase);
$('.tab-dataflash a.erase-flash-cancel').click(flash_erase_cancel);
if (supportsDataflash) {
// UI hooks
$('.tab-dataflash a.erase-flash').click(ask_to_erase_flash);
$('.tab-dataflash a.erase-flash-confirm').click(flash_erase);
$('.tab-dataflash a.erase-flash-cancel').click(flash_erase_cancel);
$('.tab-dataflash a.save-flash').click(flash_save_begin);
$('.tab-dataflash a.save-flash-cancel').click(flash_save_cancel);
$('.tab-dataflash a.save-flash-dismiss').click(dismiss_saving_dialog);
update_html();
$('.tab-dataflash a.save-flash').click(flash_save_begin);
$('.tab-dataflash a.save-flash-cancel').click(flash_save_cancel);
$('.tab-dataflash a.save-flash-dismiss').click(dismiss_saving_dialog);
update_html();
} else {
$(".tab-dataflash .note").html(chrome.i18n.getMessage('dataflashNotSupportedNote'));
}
} else {
$(".tab-dataflash").removeClass("supported");
$(".tab-dataflash .note").html(chrome.i18n.getMessage('dataflashFirmwareUpgradeRequired'));
}
if (callback) callback();
}

View File

@ -12,7 +12,6 @@
</select>
</div>
<div class="clear-both"></div>
<form name="pid-tuning" id="pid-tuning">
<table class="pid_tuning">
<tr>
@ -80,21 +79,28 @@
</tr>
</table>
<table class="rate-tpa">
<tr>
<th i18n="pidTuningRollPitchRate"></th>
<th i18n="pidTuningYawRate"></th>
<th i18n="pidTuningTPA"></th>
<th i18n="pidTuningTPABreakPoint" class="tpa"></th>
</tr>
<tr>
<td><input type="number" name="roll-pitch" step="0.01" min="0" max="2.55"/></td>
<td><input type="number" name="yaw" step="0.01" min="0" max="2.55"/></td>
<td><input type="number" name="tpa" step="0.01" min="0" max="2.55"/></td>
<td><input type="number" name="tpa-breakpoint" step="10" min="1000" max="2000" /></td>
</tr>
<thead>
<tr>
<th class="roll-pitch" i18n="pidTuningRollPitchRate"></th>
<th class="roll" i18n="pidTuningRollRate"></th>
<th class="pitch" i18n="pidTuningPitchRate"></th>
<th i18n="pidTuningYawRate"></th>
<th i18n="pidTuningTPA"></th>
<th class="tpa-breakpoint" i18n="pidTuningTPABreakPoint"></th>
</tr>
</thead>
<tbody>
<tr>
<td class="roll-pitch" ><input type="number" name="roll-pitch" step="0.01" min="0" max="2.55"/></td>
<td class="roll" ><input type="number" name="roll" step="0.01" min="0" max="2.55"/></td>
<td class="pitch" ><input type="number" name="pitch" step="0.01" min="0" max="2.55"/></td>
<td><input type="number" name="yaw" step="0.01" min="0" max="2.55"/></td>
<td><input type="number" name="tpa" step="0.01" min="0" max="2.55"/></td>
<td class="tpa-breakpoint"><input type="number" name="tpa-breakpoint" step="10" min="1000" max="2000" /></td>
</tr>
</tbody>
</table>
</form>
<div class="clear-both"></div>
<div class="profile">
<span class="head" i18n="pidTuningProfileHead"></span>

View File

@ -39,8 +39,8 @@ TABS.pid_tuning.initialize = function (callback) {
// requesting MSP_STATUS manually because it contains CONFIG.profile
MSP.send_message(MSP_codes.MSP_STATUS, false, false, get_pid_controller);
function data_stoarage_to_form() {
// Fill in the data from PIDs array
function pid_and_rc_to_form() {
// Fill in the data from PIDs array
var i = 0;
$('.pid_tuning .ROLL input').each(function () {
switch (i) {
@ -173,13 +173,15 @@ TABS.pid_tuning.initialize = function (callback) {
// Fill in data from RC_tuning object
$('.rate-tpa input[name="roll-pitch"]').val(RC_tuning.roll_pitch_rate.toFixed(2));
$('.rate-tpa input[name="roll"]').val(RC_tuning.roll_rate.toFixed(2));
$('.rate-tpa input[name="pitch"]').val(RC_tuning.pitch_rate.toFixed(2));
$('.rate-tpa input[name="yaw"]').val(RC_tuning.yaw_rate.toFixed(2));
$('.rate-tpa input[name="tpa"]').val(RC_tuning.dynamic_THR_PID.toFixed(2));
$('.rate-tpa input[name="tpa-breakpoint"]').val(RC_tuning.dynamic_THR_breakpoint);
}
function form_to_pid_and_rc() {
// Catch all the changes and stuff the inside PIDs array
// Catch all the changes and stuff the inside PIDs array
var i = 0;
$('table.pid_tuning tr.ROLL input').each(function () {
PIDs[0][i++] = parseFloat($(this).val());
@ -232,6 +234,8 @@ TABS.pid_tuning.initialize = function (callback) {
// catch RC_tuning changes
RC_tuning.roll_pitch_rate = parseFloat($('.rate-tpa input[name="roll-pitch"]').val());
RC_tuning.roll_rate = parseFloat($('.rate-tpa input[name="roll"]').val());
RC_tuning.pitch_rate = parseFloat($('.rate-tpa input[name="pitch"]').val());
RC_tuning.yaw_rate = parseFloat($('.rate-tpa input[name="yaw"]').val());
RC_tuning.dynamic_THR_PID = parseFloat($('.rate-tpa input[name="tpa"]').val());
RC_tuning.dynamic_THR_breakpoint = parseInt($('.rate-tpa input[name="tpa-breakpoint"]').val());
@ -254,7 +258,7 @@ TABS.pid_tuning.initialize = function (callback) {
$('.pid_tuning tr:eq(9) td:first').text(PID_names[7]);
$('.pid_tuning tr:eq(10) td:first').text(PID_names[8]);
data_stoarage_to_form();
pid_and_rc_to_form();
var pidController_e = $('select[name="controller"]');
var profile_e = $('select[name="profile"]');
@ -270,6 +274,14 @@ TABS.pid_tuning.initialize = function (callback) {
pidController_e.prop('disabled', true);
}
if (CONFIG.apiVersion < 1.7) {
$('.rate-tpa .tpa-breakpoint').hide();
$('.rate-tpa .roll').hide();
$('.rate-tpa .pitch').hide();
} else {
$('.rate-tpa .roll-pitch').hide();
}
// Fill in currently selected profile
@ -313,11 +325,12 @@ TABS.pid_tuning.initialize = function (callback) {
// update == save.
$('a.update').click(function () {
form_to_pid_and_rc();
function send_pids() {
if (!TABS.pid_tuning.controllerChanged) MSP.send_message(MSP_codes.MSP_SET_PID, MSP.crunch(MSP_codes.MSP_SET_PID), false, send_rc_tuning_changes);
if (!TABS.pid_tuning.controllerChanged) {
MSP.send_message(MSP_codes.MSP_SET_PID, MSP.crunch(MSP_codes.MSP_SET_PID), false, send_rc_tuning_changes);
}
}
function send_rc_tuning_changes() {
@ -348,10 +361,14 @@ TABS.pid_tuning.initialize = function (callback) {
MSP.send_message(MSP_codes.MSP_STATUS);
}, 250, true);
if (callback) callback();
if (callback) {
callback();
}
}
};
TABS.pid_tuning.cleanup = function (callback) {
if (callback) callback();
if (callback) {
callback();
}
};

View File

@ -64,4 +64,22 @@
}
.tab-ports .save:hover {
background-color: #dedcdc;
}
}
.tab-ports .note {
padding: 5px;
border: 1px dashed silver;
margin-bottom: 8px;
}
.require-support {
display:none;
}
.tab-ports.supported .require-support {
display:block;
}
.require-upgrade {
display:block;
}
.tab-ports.supported .require-upgrade {
display:none;
}

View File

@ -1,25 +1,29 @@
<div id="content-watermark"></div>
<div class="tab-ports">
<div class="help">
<p i18n="portsHelp"></p>
<div class="require-support">
<div class="help">
<p i18n="portsHelp"></p>
</div>
<table class="ports">
<thead>
<tr>
<td>Identifier</td>
<td>Data</td>
<td>Logging</td>
<td>Telemetry</td>
<td>RX</td>
<td>GPS</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="clear-both"></div>
<div class="buttons">
<a class="save" href="#" i18n="portsButtonSave"></a>
</div>
</div>
<table class="ports">
<thead>
<tr>
<td>Identifier</td>
<td>Data</td>
<td>Logging</td>
<td>Telemetry</td>
<td>RX</td>
<td>GPS</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="clear-both"></div>
<div class="buttons">
<a class="save" href="#" i18n="portsButtonSave"></a>
<div class="note require-upgrade" i18n="portsFirmwareUpgradeRequired">
</div>
</div>

View File

@ -48,7 +48,12 @@ TABS.ports.initialize = function (callback, scrollPosition) {
];
var blackboxBaudRates = [
'115200'
'19200',
'38400',
'57600',
'115200',
'230400',
'250000',
];
var columns = ['data', 'logging', 'gps', 'telemetry', 'rx'];
@ -75,6 +80,13 @@ TABS.ports.initialize = function (callback, scrollPosition) {
function update_ui() {
if (CONFIG.apiVersion < 1.6) {
$(".tab-ports").removeClass("supported");
return;
}
$(".tab-ports").addClass("supported");
var portIdentifierToNameMapping = {
0: 'UART1',
@ -264,4 +276,4 @@ TABS.ports.initialize = function (callback, scrollPosition) {
TABS.ports.cleanup = function (callback) {
if (callback) callback();
};
};