Merge branch 'looptime' of https://github.com/tricopterY/cleanflight-configurator into tricopterY-looptime

10.3.x-maintenance
Dominic Clifton 2015-07-13 18:18:18 +01:00
commit be93f37416
6 changed files with 63 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.DS_store .DS_store
nbproject/

View File

@ -503,6 +503,9 @@
"configurationBatteryMultiwiiCurrent": { "configurationBatteryMultiwiiCurrent": {
"message": "Enable support for legacy Multiwii MSP current output" "message": "Enable support for legacy Multiwii MSP current output"
}, },
"configurationLoopTimeHead": {
"message": "Flight Controller Loop Time"
},
"configurationGPS": { "configurationGPS": {
"message": "GPS" "message": "GPS"
}, },

View File

@ -6,6 +6,7 @@
</p> </p>
<span>2015.05.23 - 0.65.0 - cleanflight</span> <span>2015.05.23 - 0.65.0 - cleanflight</span>
<p> <p>
- Configuration tab supports setting FC loop time - Requires 1.8.0 firmware.<br />
- Support flashing of the SPRacingF3.<br /> - Support flashing of the SPRacingF3.<br />
- Support manual baud rate configuration for flashing.<br /> - Support manual baud rate configuration for flashing.<br />
</p> </p>

View File

@ -154,7 +154,27 @@
.tab-configuration .disarm .checkbox span { .tab-configuration .disarm .checkbox span {
margin-left: 15px; margin-left: 15px;
} }
.tab-configuration .cycles {
border-bottom: 1px solid #dddddd;
margin-top: 16px;
}
.tab-configuration .block {
float: left;
display: block;
border: 1px solid silver;
}
.tab-configuration .block .head {
display: block;
text-align: center;
line-height: 20px;
font-weight: bold;
border-bottom: 1px solid silver;
background-color: #ececec;
}
.tab-configuration .block.looptime {
width: 200px;
margin-top: 11px;
}
.tab-configuration .save { .tab-configuration .save {
display: block; display: block;
float: right; float: right;

View File

@ -238,6 +238,13 @@
<span i18n="configurationBatteryMultiwiiCurrent"></span> <span i18n="configurationBatteryMultiwiiCurrent"></span>
</label> </label>
</div> </div>
<div class="cycles" style="display: none;">
<div class="block looptime">
<span class="head" i18n="configurationLoopTimeHead"></span>
<input type="number" name="looptime" step="100" min="0" max="9000"/>
<span class="looptimehz"></span>
</div>
</div>
</div> </div>
<div class="clear-both"></div> <div class="clear-both"></div>
<div class="leftWrapper gps"> <div class="leftWrapper gps">

View File

@ -36,7 +36,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
function load_arming_config() { function load_arming_config() {
MSP.send_message(MSP_codes.MSP_ARMING_CONFIG, false, false, load_html); MSP.send_message(MSP_codes.MSP_ARMING_CONFIG, false, false, load_loop_time);
}
function load_loop_time() {
MSP.send_message(MSP_codes.MSP_LOOP_TIME, false, false, load_html);
} }
function load_html() { function load_html() {
@ -262,7 +266,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
// fill magnetometer // fill magnetometer
$('input[name="mag_declination"]').val(MISC.mag_declination); $('input[name="mag_declination"]').val(MISC.mag_declination);
//fill motor disarm params //fill motor disarm params and FC loop time
if(semver.gte(CONFIG.apiVersion, "1.8.0")) { if(semver.gte(CONFIG.apiVersion, "1.8.0")) {
$('input[name="autodisarmdelay"]').val(ARMING_CONFIG.auto_disarm_delay); $('input[name="autodisarmdelay"]').val(ARMING_CONFIG.auto_disarm_delay);
$('input[name="disarmkillswitch"]').prop('checked', ARMING_CONFIG.disarm_kill_switch); $('input[name="disarmkillswitch"]').prop('checked', ARMING_CONFIG.disarm_kill_switch);
@ -271,6 +275,15 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('div.disarmdelay').show(); $('div.disarmdelay').show();
else else
$('div.disarmdelay').hide(); $('div.disarmdelay').hide();
// fill FC loop time
$('input[name="looptime"]').val(FC_CONFIG.loopTime);
if(FC_CONFIG.loopTime > 0)
$('span.looptimehz').text(parseFloat((1/FC_CONFIG.loopTime)*1000*1000).toFixed(0) + ' Cycles per Sec');
else
$('span.looptimehz').text('Maximum Cycles per Sec');
$('div.cycles').show();
} }
// fill throttle // fill throttle
@ -293,6 +306,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
// UI hooks // UI hooks
$('input[name="looptime"]').change(function() {
FC_CONFIG.loopTime = parseInt($('input[name="looptime"]').val());
if(FC_CONFIG.loopTime > 0)
$('span.looptimehz').text(parseFloat((1/FC_CONFIG.loopTime)*1000*1000).toFixed(0) + ' Cycles per Sec');
else
$('span.looptimehz').text('Maximum Cycles per Sec');
});
$('input[type="checkbox"].feature', features_e).change(function () { $('input[type="checkbox"].feature', features_e).change(function () {
var element = $(this), var element = $(this),
index = element.data('bit'), index = element.data('bit'),
@ -344,6 +365,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
if(semver.gte(CONFIG.apiVersion, "1.8.0")) { if(semver.gte(CONFIG.apiVersion, "1.8.0")) {
ARMING_CONFIG.auto_disarm_delay = parseInt($('input[name="autodisarmdelay"]').val()); ARMING_CONFIG.auto_disarm_delay = parseInt($('input[name="autodisarmdelay"]').val());
ARMING_CONFIG.disarm_kill_switch = ~~$('input[name="disarmkillswitch"]').is(':checked'); // ~~ boolean to decimal conversion ARMING_CONFIG.disarm_kill_switch = ~~$('input[name="disarmkillswitch"]').is(':checked'); // ~~ boolean to decimal conversion
FC_CONFIG.loopTime = parseInt($('input[name="looptime"]').val());
} }
MISC.minthrottle = parseInt($('input[name="minthrottle"]').val()); MISC.minthrottle = parseInt($('input[name="minthrottle"]').val());
@ -379,7 +401,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
} }
function save_arming_config() { function save_arming_config() {
MSP.send_message(MSP_codes.MSP_SET_ARMING_CONFIG, MSP.crunch(MSP_codes.MSP_SET_ARMING_CONFIG), false, save_to_eeprom); MSP.send_message(MSP_codes.MSP_SET_ARMING_CONFIG, MSP.crunch(MSP_codes.MSP_SET_ARMING_CONFIG), false, save_looptime_config);
}
function save_looptime_config() {
MSP.send_message(MSP_codes.MSP_SET_LOOP_TIME, MSP.crunch(MSP_codes.MSP_SET_LOOP_TIME), false, save_to_eeprom);
} }
function save_to_eeprom() { function save_to_eeprom() {