mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Fix RX rate calculation when using fport
This commit is contained in:
parent
cb19bb16d4
commit
fa40fbe865
5 changed files with 15 additions and 12 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue