1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00

Merge pull request #5809 from jirif/rx_rate_calculation

Fix rx rate calculation when using fport
This commit is contained in:
Michael Keller 2018-05-05 18:34:59 +12:00 committed by GitHub
commit 8f50aad585
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 12 deletions

View file

@ -44,6 +44,7 @@
#include "fc/config.h"
#include "fc/fc_core.h"
#include "fc/fc_rc.h"
#include "fc/fc_dispatch.h"
#include "fc/fc_tasks.h"
#include "fc/rc_controls.h"
@ -151,13 +152,16 @@ static void taskUpdateRxMain(timeUs_t currentTimeUs)
return;
}
static timeUs_t lastRxTimeUs;
currentRxRefreshRate = constrain(currentTimeUs - lastRxTimeUs, 1000, 20000);
lastRxTimeUs = currentTimeUs;
isRXDataNew = true;
#ifdef USE_USB_CDC_HID
if (!ARMING_FLAG(ARMED)) {
int8_t report[8];
for (int i = 0; i < 8; i++) {
report[i] = scaleRange(constrain(rcData[i], 1000, 2000), 1000, 2000, -127, 127);
report[i] = scaleRange(constrain(rcData[i], 1000, 2000), 1000, 2000, -127, 127);
}
#ifdef STM32F4
USBD_HID_SendReport(&USB_OTG_dev, (uint8_t*)report, sizeof(report));