SITL: only de-select data types in xplane once

don't fight the user
This commit is contained in:
Andrew Tridgell 2017-01-07 14:41:23 +11:00
parent c2521dd650
commit 35d6dc141a
2 changed files with 7 additions and 1 deletions

View File

@ -79,10 +79,14 @@ void XPlane::select_data(uint64_t usel_mask, uint64_t sel_mask)
uint32_t data[8] {}; uint32_t data[8] {};
} usel; } usel;
count = 0; count = 0;
// only de-select an output once, so we don't fight the user
usel_mask &= ~unselected_mask;
unselected_mask |= usel_mask;
for (uint8_t i=0; i<64 && count<8; i++) { for (uint8_t i=0; i<64 && count<8; i++) {
if ((((uint64_t)1)<<i) & usel_mask) { if ((((uint64_t)1)<<i) & usel_mask) {
usel.data[count++] = i; usel.data[count++] = i;
printf("i=%u\n", (unsigned)i);
} }
} }
if (count != 0) { if (count != 0) {

View File

@ -68,6 +68,8 @@ private:
// are we controlling a heli? // are we controlling a heli?
bool heli_frame; bool heli_frame;
uint64_t unselected_mask;
// throttle joystick input is very weird. See comments in the main code // throttle joystick input is very weird. See comments in the main code
const float throttle_magic = 0.000123f; const float throttle_magic = 0.000123f;