diff --git a/.gitignore b/.gitignore
index d04edac2..bfcb31dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
.DS_store
+nbproject/
diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index 5a18ef93..ebcfd294 100755
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -503,6 +503,9 @@
"configurationBatteryMultiwiiCurrent": {
"message": "Enable support for legacy Multiwii MSP current output"
},
+ "configurationLoopTimeHead": {
+ "message": "Flight Controller Loop Time"
+ },
"configurationGPS": {
"message": "GPS"
},
diff --git a/changelog.html b/changelog.html
index 09720a49..4a5df904 100644
--- a/changelog.html
+++ b/changelog.html
@@ -6,6 +6,7 @@
2015.05.23 - 0.65.0 - cleanflight
+ - Configuration tab supports setting FC loop time - Requires 1.8.0 firmware.
- Support flashing of the SPRacingF3.
- Support manual baud rate configuration for flashing.
diff --git a/tabs/configuration.css b/tabs/configuration.css
index f32be360..2d8c7434 100644
--- a/tabs/configuration.css
+++ b/tabs/configuration.css
@@ -154,7 +154,27 @@
.tab-configuration .disarm .checkbox span {
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 {
display: block;
float: right;
diff --git a/tabs/configuration.html b/tabs/configuration.html
index 4428f99a..1a82b07c 100644
--- a/tabs/configuration.html
+++ b/tabs/configuration.html
@@ -237,7 +237,14 @@
-
+
+
diff --git a/tabs/configuration.js b/tabs/configuration.js
index 86cce852..ade7a696 100644
--- a/tabs/configuration.js
+++ b/tabs/configuration.js
@@ -36,7 +36,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
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() {
@@ -262,7 +266,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
// fill magnetometer
$('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")) {
$('input[name="autodisarmdelay"]').val(ARMING_CONFIG.auto_disarm_delay);
$('input[name="disarmkillswitch"]').prop('checked', ARMING_CONFIG.disarm_kill_switch);
@@ -271,6 +275,15 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('div.disarmdelay').show();
else
$('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
@@ -293,6 +306,14 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
// 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 () {
var element = $(this),
index = element.data('bit'),
@@ -344,6 +365,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
if(semver.gte(CONFIG.apiVersion, "1.8.0")) {
ARMING_CONFIG.auto_disarm_delay = parseInt($('input[name="autodisarmdelay"]').val());
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());
@@ -379,7 +401,11 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
}
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() {