initializing input elements for throttle and battery, changed to 2 row design

10.3.x-maintenance
cTn 2014-09-17 15:20:21 +02:00
parent c352199434
commit a34357d92a
5 changed files with 134 additions and 32 deletions

View File

@ -300,8 +300,11 @@
"configurationFeatures": {
"message": "Features"
},
"configurationThrottleAndRC": {
"message": "Throttle & RC"
"configurationThrottle": {
"message": "Throttle"
},
"configurationBattery": {
"message": "Battery"
},
"configurationEepromSaved": {
"message": "EEPROM <span style=\"color: green\">saved</span>"

View File

@ -22,17 +22,8 @@ a:hover {
text-decoration: none;
}
input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
display: block;
opacity: 1; /* required for chromium 33+ beta */
width: 15px;
background-image: url('../images/arrows.png');
background-repeat: no-repeat;
border-left: 1px solid silver;
margin-left: 5px;
}
.clear-both {
clear: both;

View File

@ -3,33 +3,43 @@
}
.tab-configuration .groupTitle {
padding: 0 0 5px 0;
margin: 10px 0 10px 0;
margin: 0 0 10px 0;
font-size: 16px;
border-bottom: 1px solid #dddddd;
}
.tab-configuration .groupTitle:nth-of-type(1){
margin-top: 0;
.tab-configuration .leftWrapper {
float: left;
width: 50%;
margin: 0 0 10px 0;
}
.tab-configuration .rightWrapper {
float: left;
width: calc(50% - 10px);
margin: 0 0 10px 10px;
}
.tab-configuration .mixerList {
float: left;
height: 100px;
width: 120px;
height: 250px;
border: 1px solid silver;
}
.tab-configuration .mixerPreview {
float: left;
width: 100px;
height: 100px;
margin: 0 0 0 15px;
width: calc(100% - 120px);
height: 150px;
}
.tab-configuration .mixerPreview img {
width: 100%;
height: 100%;
margin-top: 60px;
}
.tab-configuration dl.features dt {
float: left;
@ -47,6 +57,21 @@
line-height: 18px;
}
.tab-configuration .number {
margin-bottom: 5px;
}
.tab-configuration .number input {
width: 60px;
height: 20px;
line-height: 20px;
text-align: right;
border: 1px solid silver;
}
.tab-configuration .number span {
margin-left: 10px;
}
.tab-configuration .buttons {
position: fixed;

View File

@ -1,17 +1,71 @@
<div class="tab-configuration">
<div class="groupTitle" i18n="configurationMixer"></div>
<select class="mixerList" size="6">
<!-- mixer list generated here -->
</select>
<div class="mixerPreview">
<img src="./images/motor_order/custom.svg" />
<div class="leftWrapper">
<div class="groupTitle" i18n="configurationMixer"></div>
<select class="mixerList" size="10">
<!-- mixer list generated here -->
</select>
<div class="mixerPreview">
<img src="./images/motor_order/custom.svg" />
</div>
<div class="clear-both"></div>
</div>
<div class="rightWrapper">
<div class="groupTitle" i18n="configurationFeatures"></div>
<dl class="features">
<!-- feature list generated here -->
</dl>
</div>
<div class="clear-both"></div>
<div class="groupTitle" i18n="configurationFeatures"></div>
<dl class="features">
<!-- feature list generated here -->
</dl>
<div class="groupTitle" i18n="configurationThrottleAndRC"></div>
<div class="leftWrapper">
<div class="groupTitle" i18n="configurationThrottle"></div>
<div class="number">
<label>
<input type="number" name="minthrottle" min="0" max="2000" />
<span></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="maxthrottle" min="0" max="2000" />
<span></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="failsafe_throttle" min="1000" max="2000" />
<span></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="mincommand" min="0" max="2000" />
<span></span>
</label>
</div>
</div>
<div class="rightWrapper">
<div class="groupTitle" i18n="configurationBattery"></div>
<div class="number">
<label>
<input type="number" name="mincellvoltage" step="0.1" min="1" max="5" />
<span></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="maxcellvoltage" step="0.1" min="1" max="5" />
<span></span>
</label>
</div>
<div class="number">
<label>
<input type="number" name="voltagescale" step="1" min="10" max="200" />
<span></span>
</label>
</div>
</div>
<div class="clear-both"></div>
<div class="buttons">
<a class="save" href="#" i18n="configurationButtonSave"></a>
</div>

View File

@ -119,6 +119,17 @@ TABS.configuration.initialize = function (callback) {
features_e.append(element);
}
// fill throttle data
$('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);
// fill battery data
$('input[name="mincellvoltage"]').val(MISC.vbatmincellvoltage);
$('input[name="maxcellvoltage"]').val(MISC.vbatmaxcellvoltage);
$('input[name="voltagescale"]').val(MISC.vbatscale);
// UI hooks
$('input', features_e).change(function () {
@ -134,6 +145,24 @@ TABS.configuration.initialize = function (callback) {
});
$('a.save').click(function () {
// gather data that doesn't have automatic change event bound
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());
function save_misc() {
MSP.send_message(MSP_codes.MSP_SET_MISC, MSP.crunch(MSP_codes.MSP_SET_MISC), false, save_acc_trim);
}
function save_acc_trim() {
MSP.send_message(MSP_codes.MSP_SET_ACC_TRIM, MSP.crunch(MSP_codes.MSP_SET_ACC_TRIM), false, save_to_eeprom);
}
function save_to_eeprom() {
MSP.send_message(MSP_codes.MSP_EEPROM_WRITE, false, false, reboot);
}
@ -155,7 +184,7 @@ TABS.configuration.initialize = function (callback) {
});
}
MSP.send_message(MSP_codes.MSP_SET_CONFIG, MSP.crunch(MSP_codes.MSP_SET_CONFIG), false, save_to_eeprom);
MSP.send_message(MSP_codes.MSP_SET_CONFIG, MSP.crunch(MSP_codes.MSP_SET_CONFIG), false, save_misc);
});
// status data pulled via separate timer with static speed