Skip to content

Commit

Permalink
[REMOVED]: Repetitive calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
Witty-Wizard authored Jul 1, 2024
1 parent 7e66641 commit 26b0f19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
12 changes: 3 additions & 9 deletions src/crsf/crsf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,13 @@ void crsf::processIncoming() {
}
}
}

if (_rxData[CRSF_MAX_PACKET_SIZE - 1] == CRSF_ADDRESS_CRSF_TRANSMITTER ||
_rxData[CRSF_MAX_PACKET_SIZE - 1] == CRSF_ADDRESS_FLIGHT_CONTROLLER) {
leftShift(_rxData, sizeof(_rxData));
} else if (_rxData[CRSF_MAX_PACKET_SIZE - 2] ==
if (_rxData[CRSF_MAX_PACKET_SIZE - 2] ==
CRSF_ADDRESS_CRSF_TRANSMITTER ||
_rxData[CRSF_MAX_PACKET_SIZE - 2] ==
CRSF_ADDRESS_FLIGHT_CONTROLLER) {
size = _rxData[CRSF_MAX_PACKET_SIZE - 1];
leftShift(_rxData, sizeof(_rxData));
} else {
leftShift(_rxData, sizeof(_rxData));
}
}
leftShift(_rxData, sizeof(_rxData));
}
}

Expand Down
9 changes: 2 additions & 7 deletions src/fport/fport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,10 @@ void fport::processIncoming() {
sizeof(_channelData));
}
}

if (_rxData[FPORT_MAX_PACKET_SIZE - 1] == FPORT_END_BYTES) {
leftShift(_rxData, sizeof(_rxData));
} else if (_rxData[FPORT_MAX_PACKET_SIZE - 2] == 0x7E) {
if (_rxData[FPORT_MAX_PACKET_SIZE - 2] == FPORT_END_BYTES) {
size = _rxData[FPORT_MAX_PACKET_SIZE - 1];
}
leftShift(_rxData, sizeof(_rxData));
} else {
leftShift(_rxData, sizeof(_rxData));
}
}
}

Expand Down

0 comments on commit 26b0f19

Please sign in to comment.