1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-21 23:35:34 +03:00

initial support for receiver data viewing

This commit is contained in:
cTn 2013-04-09 02:14:23 +02:00
parent d61df6fc82
commit c7f88dcdc4
5 changed files with 39 additions and 6 deletions

View file

@ -1,3 +1,5 @@
var timers = new Array();
$(document).ready(function() {
var tabs = $('#tabs > ul');
$('a', tabs).click(function() {
@ -6,6 +8,9 @@ $(document).ready(function() {
return;
}
// Disable any active "data pulling" timer
disable_timers();
// Disable previous active button
$('li', tabs).removeClass('active');
@ -16,7 +21,18 @@ $(document).ready(function() {
$('#content').load("./tabs/initial_setup.html", tab_initialize_initial_setup);
} else if ($(this).parent().hasClass('tab_pid_tuning')) {
$('#content').load("./tabs/pid_tuning.html", tab_initialize_pid_tuning);
} else if ($(this).parent().hasClass('tab_receiver')) {
$('#content').load("./tabs/receiver.html", tab_initialize_receiver);
}
}
});
});
function disable_timers() {
for (var i = 0; i < timers.length; i++) {
clearInterval(timers[i]);
}
// kill all the refferences
timers = [];
}

View file

@ -111,6 +111,9 @@ $(document).ready(function() {
if (selected_port != '0') {
if (clicks) { // odd number of clicks
// Disable any active "data pulling" timer
disable_timers();
chrome.serial.close(connectionId, onClosed);
clearTimeout(connection_delay);
@ -144,7 +147,7 @@ function onOpen(openInfo) {
// start polling
serial_poll = setInterval(readPoll, 10);
// should request some sort of configuration data
// request configuration data
send_message(MSP_codes.MSP_IDENT, MSP_codes.MSP_IDENT);
send_message(MSP_codes.MSP_STATUS, MSP_codes.MSP_STATUS);
send_message(MSP_codes.MSP_PID, MSP_codes.MSP_PID);

View file

@ -12,18 +12,19 @@
<!-- Various tabs are divided into separate files (for clarity) -->
<script type="text/javascript" src="./tabs/initial_setup.js"></script>
<script type="text/javascript" src="./tabs/pid_tuning.js"></script>
<script type="text/javascript" src="./tabs/receiver.js"></script>
</head>
<body>
<div id="main-wrapper">
<div id="port-picker">
<ul>
<li class="port">
<select id="port">
<select id="port" title="Port">
<!-- port list gets generated here -->
</select>
</li>
<li>
<select id="baud">
<select id="baud" title="Baud Rate">
<option value="115200" selected="selected">115200</option>
<option value="57600">57600</option>
<option value="38400">38400</option>
@ -38,7 +39,7 @@
</select>
</li>
<li>
<select id="delay">
<select id="delay" title="Timeout">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
@ -73,6 +74,7 @@
<ul>
<li class="first tab_initial_setup"><a href="#">Initial Setup</a></li>
<li class="tab_pid_tuning"><a href="#">PID Tuning</a></li>
<li class="tab_receiver"><a href="#">Receiver</a></li>
</ul>
<div class="clear-both"></div>
</div>

2
tabs/receiver.html Normal file
View file

@ -0,0 +1,2 @@
<div class="tab-receiver">
</div>

10
tabs/receiver.js Normal file
View file

@ -0,0 +1,10 @@
function tab_initialize_receiver() {
receiver_poll = setInterval(receiverPoll, 100);
timers.push(receiver_poll);
}
function receiverPoll() {
send_message(MSP_codes.MSP_RC, MSP_codes.MSP_RC);
}
// TODO: This function / interval needs to be killed when leaving Receiver tab