Updates
This commit is contained in:
parent
f77b0068fe
commit
a2dab580f4
@ -5,6 +5,7 @@
|
|||||||
- [ArduPilot](ardupilot/index.md)
|
- [ArduPilot](ardupilot/index.md)
|
||||||
- [ArduPilot recommended settings](ardupilot/ardupilot-recommended-settings.md)
|
- [ArduPilot recommended settings](ardupilot/ardupilot-recommended-settings.md)
|
||||||
- [ArduPilot setup checklist](ardupilot/ardupilot-setup-checklist.md)
|
- [ArduPilot setup checklist](ardupilot/ardupilot-setup-checklist.md)
|
||||||
|
- [Bitmask calculator](ardupilot/bitmask-calculator.md)
|
||||||
- [Building ArduPilot](ardupilot/building-ardupilot.md)
|
- [Building ArduPilot](ardupilot/building-ardupilot.md)
|
||||||
- [Configuring a switch as a relay](ardupilot/configuring-a-switch-as-a-relay.md)
|
- [Configuring a switch as a relay](ardupilot/configuring-a-switch-as-a-relay.md)
|
||||||
- [DJI FPV configuration](ardupilot/dji-fpv-configuration.md)
|
- [DJI FPV configuration](ardupilot/dji-fpv-configuration.md)
|
||||||
|
160
content/ardupilot/bitmask-calculator.md
Normal file
160
content/ardupilot/bitmask-calculator.md
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
# Bitmask calculator
|
||||||
|
|
||||||
|
<style>
|
||||||
|
div.box{
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
border: 1px solid #222;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function dec2bin(dec) {
|
||||||
|
return reverse((dec >>> 0).toString(2));
|
||||||
|
}
|
||||||
|
function reverse(str) {
|
||||||
|
return str.split("").reverse().join("");
|
||||||
|
}
|
||||||
|
|
||||||
|
var bitmaskDescArr = [];
|
||||||
|
|
||||||
|
function loadBitmask(){
|
||||||
|
url = document.getElementById("built").value;
|
||||||
|
|
||||||
|
if (url == ""){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch(url)
|
||||||
|
.then(response => response.text())
|
||||||
|
.then(data => {
|
||||||
|
const parser = new DOMParser();
|
||||||
|
const xml = parser.parseFromString(data, "application/xml");
|
||||||
|
|
||||||
|
var params = xml.getElementsByTagName("param");
|
||||||
|
console.log(params);
|
||||||
|
|
||||||
|
for (var i = 0; i < params.length; i++) {
|
||||||
|
var param = params[i].attributes.name.nodeValue; //works, param name
|
||||||
|
|
||||||
|
|
||||||
|
if(params[i].childNodes[1]){
|
||||||
|
if( typeof params[i].childNodes[1].attributes.name == "object"){
|
||||||
|
if(params[i].childNodes[1].attributes.name.nodeValue && params[i].childNodes[1].attributes.name.nodeValue == "Bitmask"){
|
||||||
|
|
||||||
|
// // populate dropdown
|
||||||
|
var paramSelect = document.getElementById("paramSelect");
|
||||||
|
var el = document.createElement("option");
|
||||||
|
el.textContent = param.replace("ArduPlane:","");
|
||||||
|
el.value = param;
|
||||||
|
paramSelect.appendChild(el);
|
||||||
|
|
||||||
|
var bitmaskDescTxt = params[i].textContent.trim();
|
||||||
|
bitmaskDescArr[param] = bitmaskDescTxt.split(',');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(console.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
function bitbox(bit){
|
||||||
|
dec = parseInt(document.getElementById("decimal").value);
|
||||||
|
if(document.getElementById(bit).checked == true){
|
||||||
|
dec += parseInt(bit);
|
||||||
|
}else{
|
||||||
|
dec -= parseInt(bit);
|
||||||
|
}
|
||||||
|
document.getElementById("decimal").value = dec;
|
||||||
|
parseBitmask();
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseBitmask() {
|
||||||
|
console.log("found "+Object.keys(bitmaskDescArr).length+" bitmask parameters");
|
||||||
|
|
||||||
|
document.getElementById("result").innerHTML="";
|
||||||
|
var tbl = document.createElement('table');
|
||||||
|
tbl.style="border: 1px solid #222";
|
||||||
|
var tbdy = document.createElement('tbody');
|
||||||
|
|
||||||
|
dec = document.getElementById("decimal").value;
|
||||||
|
binary=dec2bin(document.getElementById("decimal").value);
|
||||||
|
var param = document.getElementById("paramSelect").value;
|
||||||
|
|
||||||
|
for (var bit = 0; bit < bitmaskDescArr[param].length; bit++) {
|
||||||
|
var val = binary[bit];
|
||||||
|
|
||||||
|
var tr = document.createElement('tr');
|
||||||
|
|
||||||
|
var td = document.createElement('td');
|
||||||
|
td.style="border: 1px solid black;";
|
||||||
|
var singleBitDecvalue = Math.pow(2,bit); // convert the bit to a decimal
|
||||||
|
var checkbox = document.createElement('input');
|
||||||
|
checkbox.type = "checkbox";
|
||||||
|
checkbox.name = "name";
|
||||||
|
checkbox.value = "checked";
|
||||||
|
checkbox.id = singleBitDecvalue;
|
||||||
|
checkbox.setAttribute("onclick","bitbox("+singleBitDecvalue+")");
|
||||||
|
|
||||||
|
if (val == "1"){
|
||||||
|
checkbox.checked = true;
|
||||||
|
}else{
|
||||||
|
checkbox.checked = false;
|
||||||
|
}
|
||||||
|
td.appendChild(checkbox);
|
||||||
|
tr.appendChild(td);
|
||||||
|
|
||||||
|
|
||||||
|
var td = document.createElement('td');
|
||||||
|
td.appendChild(document.createTextNode(bitmaskDescArr[param][bit]));
|
||||||
|
|
||||||
|
if (val == "1"){
|
||||||
|
td.style = "border: 1px solid black; color: green";
|
||||||
|
}else{
|
||||||
|
td.style = "border: 1px solid black; color: red";
|
||||||
|
}
|
||||||
|
tr.appendChild(td);
|
||||||
|
|
||||||
|
var td = document.createElement('td');
|
||||||
|
td.style="border: 1px solid black; color: grey";
|
||||||
|
td.appendChild(document.createTextNode(Math.pow(2,bit)));
|
||||||
|
tr.appendChild(td);
|
||||||
|
|
||||||
|
tbdy.appendChild(tr);
|
||||||
|
tbl.appendChild(tbdy);
|
||||||
|
}
|
||||||
|
document.getElementById("result").appendChild(tbl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<div id="input">
|
||||||
|
<select id="built" onChange="loadBitmask();">
|
||||||
|
<option value="">select your build</option>
|
||||||
|
<option value='https://arducustom.github.io/v/dev/ArduPlane/apm.pdef.xml'>ArduCustom master</option>
|
||||||
|
<option value='https://arducustom.github.io/v/10.0/ArduPlane/apm.pdef.xml'>ArduCustom v10</option>
|
||||||
|
<option value='https://arducustom.github.io/v/9.0/ArduPlane/apm.pdef.xml'>ArduCustom v9.0</option>
|
||||||
|
<!-- <option value='https://autotest.ardupilot.org/Parameters/ArduPlane/apm.pdef.xml'>ArduPlane offical master</option> -->
|
||||||
|
</select>
|
||||||
|
<select id="paramSelect" onChange="parseBitmask();">
|
||||||
|
</select>
|
||||||
|
<input type="text" id="decimal" value="1" oninput="parseBitmask();">
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div id="result">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
_(Many thanks to mfoos for writing this note.)_
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
<p style="font-size:80%; font-style: italic">
|
||||||
|
Last updated on August 13, 2022. For any questions/feedback,
|
||||||
|
email me at <a href="mailto:hi@stavros.io">hi@stavros.io</a>.
|
||||||
|
</p>
|
@ -4,6 +4,7 @@ Click on a link in the list below to go to that page:
|
|||||||
|
|
||||||
1. [ArduPilot recommended settings](../../ardupilot/ardupilot-recommended-settings.html)
|
1. [ArduPilot recommended settings](../../ardupilot/ardupilot-recommended-settings.html)
|
||||||
1. [ArduPilot setup checklist](../../ardupilot/ardupilot-setup-checklist.html)
|
1. [ArduPilot setup checklist](../../ardupilot/ardupilot-setup-checklist.html)
|
||||||
|
1. [Bitmask calculator](../../ardupilot/bitmask-calculator.html)
|
||||||
1. [Building ArduPilot](../../ardupilot/building-ardupilot.html)
|
1. [Building ArduPilot](../../ardupilot/building-ardupilot.html)
|
||||||
1. [Configuring a switch as a relay](../../ardupilot/configuring-a-switch-as-a-relay.html)
|
1. [Configuring a switch as a relay](../../ardupilot/configuring-a-switch-as-a-relay.html)
|
||||||
1. [DJI FPV configuration](../../ardupilot/dji-fpv-configuration.html)
|
1. [DJI FPV configuration](../../ardupilot/dji-fpv-configuration.html)
|
||||||
|
@ -7,7 +7,7 @@ parachute restore -f "^(ACRO_LOCKING|OSD.*|RC[\d_]+.*|\
|
|||||||
FLTMODE.*|FLIGHT_OPTIONS|FS_.*|RTL_CLIMB_MIN|RTL_RADIUS|\
|
FLTMODE.*|FLIGHT_OPTIONS|FS_.*|RTL_CLIMB_MIN|RTL_RADIUS|\
|
||||||
THR_PASS_STAB|THR_SLEWRATE|THR_SUPP_MAN|TKOFF_ACCEL_CNT|\
|
THR_PASS_STAB|THR_SLEWRATE|THR_SUPP_MAN|TKOFF_ACCEL_CNT|\
|
||||||
TKOFF_THR_.*|TKOFF_ALT|TKOFF_DIST|HOME_RESET_ALT|\
|
TKOFF_THR_.*|TKOFF_ALT|TKOFF_DIST|HOME_RESET_ALT|\
|
||||||
ALT_HOLD_RTL|MIN_GNDSPD_CM|ARMING_RUDDER)\$" \
|
ALT_HOLD_RTL|MIN_GNDSPD_CM|ARMING_RUDDER)$" \
|
||||||
<backup>
|
<backup>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -17,6 +17,6 @@ Use it to set up a new plane by copying over settings from an older plane.
|
|||||||
* * *
|
* * *
|
||||||
|
|
||||||
<p style="font-size:80%; font-style: italic">
|
<p style="font-size:80%; font-style: italic">
|
||||||
Last updated on June 11, 2022. For any questions/feedback,
|
Last updated on August 07, 2022. For any questions/feedback,
|
||||||
email me at <a href="mailto:hi@stavros.io">hi@stavros.io</a>.
|
email me at <a href="mailto:hi@stavros.io">hi@stavros.io</a>.
|
||||||
</p>
|
</p>
|
||||||
|
BIN
content/static/resources/6489c6e219874e20a55fcb697dcd8ab3.png
Normal file
BIN
content/static/resources/6489c6e219874e20a55fcb697dcd8ab3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 311 KiB |
BIN
content/static/resources/b7e313de59d4412382b2c36675085fdc.png
Normal file
BIN
content/static/resources/b7e313de59d4412382b2c36675085fdc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 224 KiB |
BIN
content/static/resources/f4679b76f438463382a2849083f6d51d.png
Normal file
BIN
content/static/resources/f4679b76f438463382a2849083f6d51d.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 655 KiB |
Loading…
Reference in New Issue
Block a user