master slider, min/max limits, needs more testing

fixes #19
pull/3/head
cTn 11 years ago
parent eaeda19842
commit 834345a80c

@ -64,10 +64,23 @@
.tab-motor_outputs .motor_testing .notice {
float: right;
width: 480px;
width: 440px;
margin-top: 20px;
padding: 5px;
border: 1px dotted silver;
}
.tab-motor_outputs .motor_testing .notice input[type="number"] {
margin: 0 10px 0 5px;
width: 45px;
text-align: center;
border: 1px solid silver;
}
.tab-motor_outputs .motor_testing .notice input[type="checkbox"] {
margin-left: 5px;
vertical-align: middle;
}

@ -59,6 +59,7 @@
<input type="range" min="1000" max="2000" value="1000" disabled="disabled" />
<input type="range" min="1000" max="2000" value="1000" disabled="disabled" />
<input type="range" min="1000" max="2000" value="1000" disabled="disabled" />
<input class="master" type="range" min="1000" max="2000" value="1000" disabled="disabled" />
</div>
<div class="values">
<ul>
@ -70,16 +71,19 @@
<li>1000</li>
<li>1000</li>
<li>1000</li>
<li style="font-weight: bold;">Master</li>
</ul>
</div>
</div>
<div class="notice">
<strong>Motor Test Mode Notice:</strong><br />
Moving the sliders will cause the motors to <strong>spin up</strong>.<br />
In order to prevent injury you must <strong style="color: red">remove ALL propellers</strong> before using this feature.<br />
If you understand these instructions check the <strong>box</strong> below to <strong style="color: green">enable</strong> motor test mode.<br />
In order to prevent injury <strong style="color: red">remove ALL propellers</strong> before using this feature.<br />
If you understand these instructions check the <strong>box</strong> below to <strong style="color: green">enable</strong> motor test.<br />
<br />
<input type="checkbox" />
Min: <input class="min" type="number" min="1000" max="2000" disabled="disabled" />
Max: <input class="max" type="number" min="1000" max="2000" disabled="disabled" />
Check: <input type="checkbox" />
</div>
<div class="cler-both"></div>
</div>

@ -3,10 +3,23 @@ function tab_initialize_motor_outputs() {
GUI.active_tab = 'motor_outputs';
// if CAP_DYNBALANCE is true
if (bit_check(CONFIG.capability, 2)) $('div.motor_testing').show();
if (bit_check(CONFIG.capability, 2)) {
$('div.motor_testing').show();
}
send_message(MSP_codes.MSP_MISC, MSP_codes.MSP_MISC, false, function() {
$('input.min').val(MISC.minthrottle);
$('input.max').val(MISC.maxthrottle);
$('div.sliders input').prop('min', MISC.minthrottle);
$('div.sliders input').prop('max', MISC.maxthrottle);
$('div.sliders input').val(MISC.minthrottle);
$('div.values li:not(:last)').html(MISC.minthrottle);
});
// UI hooks
$('div.sliders input').change(function() {
$('div.sliders input:not(.master)').change(function() {
var index = $(this).index();
$('div.values li').eq(index).html($(this).val());
@ -24,22 +37,41 @@ function tab_initialize_motor_outputs() {
send_message(MSP_codes.MSP_SET_MOTOR, buffer_out);
});
$('div.notice input').change(function() {
$('div.sliders input.master').change(function() {
var val = $(this).val();
$('div.sliders input').val(val);
$('div.sliders input:not(:last)').change();
});
$('div.notice input[type="checkbox"]').change(function() {
if ($(this).is(':checked')) {
$('div.sliders input').prop('disabled', false);
$('div.sliders input, .notice input[type="number"]').prop('disabled', false);
} else {
// disable sliders
$('div.sliders input').prop('disabled', true);
// disable sliders / min max
$('div.sliders input, .notice input[type="number"]').prop('disabled', true);
// change all values to default
$('div.sliders input').val(1000);
$('div.values li').html(1000);
$('div.values li:not(:last)').html(1000);
// trigger change event so values are sent to mcu
$('div.sliders input').change();
}
});
$('div.notice input[type="number"]').change(function() {
var min = parseInt($('div.notice .min').val());
var max = parseInt($('div.notice .max').val());
$('div.sliders input').prop('min', min);
$('div.sliders input').prop('max', max);
// trigger change event so values are sent to mcu
$('div.sliders input').change();
});
// enable Motor data pulling
GUI.interval_add('motor_poll', function() {
// Request New data

Loading…
Cancel
Save