improed processing of sbus frames
This commit is contained in:
2
.vscode/arduino.json
vendored
2
.vscode/arduino.json
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"board": "bsfrance:avr:lora32u4",
|
"board": "bsfrance:avr:lora32u4",
|
||||||
"sketch": "crossbow/crossbow.ino",
|
"sketch": "crossbow/crossbow.ino",
|
||||||
"port": "COM3",
|
"port": "COM7",
|
||||||
"output": "../build"
|
"output": "../build"
|
||||||
}
|
}
|
||||||
5
.vscode/c_cpp_properties.json
vendored
5
.vscode/c_cpp_properties.json
vendored
@@ -14,7 +14,10 @@
|
|||||||
"intelliSenseMode": "msvc-x64",
|
"intelliSenseMode": "msvc-x64",
|
||||||
"cStandard": "c11",
|
"cStandard": "c11",
|
||||||
"cppStandard": "c++17",
|
"cppStandard": "c++17",
|
||||||
"compilerPath": "/usr/bin/clang"
|
"compilerPath": "/usr/bin/clang",
|
||||||
|
"defines": [
|
||||||
|
"FEATURE_TX_INPUT_SBUS"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Mac",
|
"name": "Mac",
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ Copyright (c) 20xx, MPL Contributor1 contrib1@example.net
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "lora.h"
|
#include "lora.h"
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
#include "main_variables.h"
|
#include "main_variables.h"
|
||||||
|
|||||||
@@ -21,12 +21,14 @@ equivalent to
|
|||||||
map(channels[i], RC_CHANNEL_MIN, RC_CHANNEL_MAX, SBUS_MIN_OFFSET, SBUS_MAX_OFFSET);
|
map(channels[i], RC_CHANNEL_MIN, RC_CHANNEL_MAX, SBUS_MIN_OFFSET, SBUS_MAX_OFFSET);
|
||||||
*/
|
*/
|
||||||
int mapChannelToSbus(int in) {
|
int mapChannelToSbus(int in) {
|
||||||
return (((long) in * 1605l) / 1000l) - 1417;
|
return ((long) in * 1605l / 1000l) - 1417;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Precomputed mapping from 173:1811 to 990-2010
|
||||||
|
*/
|
||||||
int mapSbusToChannel(int in) {
|
int mapSbusToChannel(int in) {
|
||||||
//TODO, speed up this processing
|
return (((long) in - 173l) * 1020l / 1638l) + 990;
|
||||||
return map(in, 173, 1811, 990, 2010);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sbusPreparePacket(uint8_t packet[], int16_t channels[], bool isSignalLoss, bool isFailsafe){
|
void sbusPreparePacket(uint8_t packet[], int16_t channels[], bool isSignalLoss, bool isFailsafe){
|
||||||
|
|||||||
Reference in New Issue
Block a user