1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 09:45:37 +03:00

implementing live mode

This commit is contained in:
cTn 2013-11-12 11:43:08 +01:00
parent 43b0d615dc
commit 7cbf695602
2 changed files with 92 additions and 61 deletions

View file

@ -11,6 +11,10 @@
background-color: #ececec; background-color: #ececec;
} }
.tab-servos table.directions td.direction select {
height: 19px;
line-height: 19px;
}
.tab-servos table { .tab-servos table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
@ -80,6 +84,18 @@
text-align: center; text-align: center;
} }
.tab-servos .live {
float: left;
margin-top: 10px;
}
.tab-servos .live span {
float: left;
}
.tab-servos .live input {
float: left;
margin: 0 0 0 5px;
}
.tab-servos .update { .tab-servos .update {
display: block; display: block;
float: right; float: right;
@ -123,5 +139,8 @@
<th style="width: 200px">Direction</th> <th style="width: 200px">Direction</th>
</tr> </tr>
</table> </table>
<div class="live">
<span>Enable Live mode: </span><input type="checkbox" />
</div>
<a class="update" href="#" title="">Save</a> <a class="update" href="#" title="">Save</a>
</div> </div>

View file

@ -94,11 +94,23 @@ function tab_initialize_servos() {
default: default:
model.html('Doesn\'t support servos'); model.html('Doesn\'t support servos');
} }
// UI hooks for dynamically generated elements
$('table.directions select, table.directions input, table.fields select, table.fields input').change(function() {
if ($('div.live input').is(':checked')) {
// apply small delay as there seems to be some funky update business going wrong
GUI.timeout_add('servos_update', servos_update, 10);
}
});
}); });
}); });
// UI hooks
$('a.update').click(function() { $('a.update').click(function() {
servos_update(true);
});
}
function servos_update(save_to_eeprom) {
// update bitfields // update bitfields
$('div.tab-servos table.directions tr:not(".main")').each(function() { $('div.tab-servos table.directions tr:not(".main")').each(function() {
var info = $('select', this).data('info'); var info = $('select', this).data('info');
@ -156,11 +168,11 @@ function tab_initialize_servos() {
send_message(MSP_codes.MSP_SET_SERVO_CONF, buffer_out); send_message(MSP_codes.MSP_SET_SERVO_CONF, buffer_out);
if (save_to_eeprom) {
// Save changes to EEPROM // Save changes to EEPROM
send_message(MSP_codes.MSP_EEPROM_WRITE, MSP_codes.MSP_EEPROM_WRITE); send_message(MSP_codes.MSP_EEPROM_WRITE, MSP_codes.MSP_EEPROM_WRITE);
});
} }
}
function process_directions(name, obj, bitpos) { function process_directions(name, obj, bitpos) {
var val; var val;