mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-11-27 06:49:40 +00:00
Compare commits
95 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f12f99761 | ||
|
|
3d98abb6d4 | ||
|
|
e35879a5d0 | ||
|
|
37138f03ae | ||
|
|
51d39bbd8c | ||
|
|
0932a1c93f | ||
|
|
19164521e4 | ||
|
|
df28cfe3cc | ||
|
|
354878d542 | ||
|
|
695264d59a | ||
|
|
de190f3349 | ||
|
|
b049385094 | ||
|
|
75dc616130 | ||
|
|
b542f5e7cd | ||
|
|
f3bee3cded | ||
|
|
a9b7ab9a06 | ||
|
|
ed019e954e | ||
|
|
65186b4356 | ||
|
|
e1d4f9a270 | ||
|
|
69c95ca153 | ||
|
|
e6976fb08d | ||
|
|
f502ba3659 | ||
|
|
e6ccc7e7cc | ||
|
|
da9d8851c2 | ||
|
|
ad48291d2a | ||
|
|
d6da230369 | ||
|
|
f8ac406a94 | ||
|
|
e691ecd167 | ||
|
|
930c26a111 | ||
|
|
64419a6cf4 | ||
|
|
5c59cddc7a | ||
|
|
4c7a51be46 | ||
|
|
7dad0fb89f | ||
|
|
adebb3fc5c | ||
|
|
5ab00b9d18 | ||
|
|
fbd5d7cf48 | ||
|
|
84132678cc | ||
|
|
78421748ba | ||
|
|
7112f58dae | ||
|
|
e56f737b34 | ||
|
|
49d993f613 | ||
|
|
63dd8a9215 | ||
|
|
d5f819dd59 | ||
|
|
a68787f16e | ||
|
|
858ef5801c | ||
|
|
9e0bd29cee | ||
|
|
15395de579 | ||
|
|
db4aad04a7 | ||
|
|
466e4cf227 | ||
|
|
05a3780c38 | ||
|
|
85ea91cdbb | ||
|
|
985d7a6fd9 | ||
|
|
2a19b8dd45 | ||
|
|
b2b3078861 | ||
|
|
2ac92f5725 | ||
|
|
e2f5afd71e | ||
|
|
e094ee036d | ||
|
|
2ad7f3e9f2 | ||
|
|
8e1f2258f8 | ||
|
|
5c01bbf284 | ||
|
|
647425fc1a | ||
|
|
7286049d07 | ||
|
|
ce67a065cd | ||
|
|
8948cb6287 | ||
|
|
4daa5fa2bb | ||
|
|
c49a7dae0a | ||
|
|
890a042a43 | ||
|
|
c95e576ef3 | ||
|
|
2aa96dd129 | ||
|
|
908634474b | ||
|
|
79b525ee71 | ||
|
|
872b8259ab | ||
|
|
a14c82708f | ||
|
|
7e53778680 | ||
|
|
210fbe3b9e | ||
|
|
0a5fd72bdc | ||
|
|
6e1701ecc5 | ||
|
|
a5f627a2d6 | ||
|
|
b4a1f175c6 | ||
|
|
e0690fa661 | ||
|
|
bd962eff35 | ||
|
|
b515355249 | ||
|
|
d1feef97be | ||
|
|
f52f96d44e | ||
|
|
944ec62f49 | ||
|
|
30905014d2 | ||
|
|
32dbdfc6e3 | ||
|
|
b2e312b41e | ||
|
|
52f4096197 | ||
|
|
c547ea0c0f | ||
|
|
c73ee61128 | ||
|
|
90b287f1f4 | ||
|
|
0316c9eea9 | ||
|
|
374b46966c | ||
|
|
3705415927 |
80
.travis.yml
80
.travis.yml
@@ -1,14 +1,13 @@
|
|||||||
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
sudo: true
|
|
||||||
language: c
|
language: c
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
jobs:
|
||||||
- IDE_VERSION=1.8.9
|
|
||||||
matrix:
|
|
||||||
- BOARD="multi4in1:avr:multiatmega328p:bootloader=none"
|
- BOARD="multi4in1:avr:multiatmega328p:bootloader=none"
|
||||||
- BOARD="multi4in1:avr:multiatmega328p:bootloader=optiboot"
|
- BOARD="multi4in1:avr:multiatmega328p:bootloader=optiboot"
|
||||||
- BOARD="multi4in1:avr:multixmega32d4"
|
- BOARD="multi4in1:avr:multixmega32d4"
|
||||||
|
- BOARD="multi4in1:STM32F1:multi5in1t18int"
|
||||||
- BOARD="multi4in1:STM32F1:multistm32f103c:debug_option=none"
|
- BOARD="multi4in1:STM32F1:multistm32f103c:debug_option=none"
|
||||||
- BOARD="multi4in1:STM32F1:multistm32f103c:debug_option=native"
|
- BOARD="multi4in1:STM32F1:multistm32f103c:debug_option=native"
|
||||||
- BOARD="multi4in1:STM32F1:multistm32f103c:debug_option=ftdi"
|
- BOARD="multi4in1:STM32F1:multistm32f103c:debug_option=ftdi"
|
||||||
@@ -24,16 +23,8 @@ before_install:
|
|||||||
- chmod +x ${TRAVIS_BUILD_DIR}/buildroot/bin/*
|
- chmod +x ${TRAVIS_BUILD_DIR}/buildroot/bin/*
|
||||||
- export PATH=${TRAVIS_BUILD_DIR}/buildroot/bin/:${PATH}
|
- export PATH=${TRAVIS_BUILD_DIR}/buildroot/bin/:${PATH}
|
||||||
|
|
||||||
# Arduino IDE adds a lot of noise caused by network traffic; firewall it
|
|
||||||
- sudo iptables -P INPUT DROP
|
|
||||||
- sudo iptables -P FORWARD DROP
|
|
||||||
- sudo iptables -P OUTPUT ACCEPT
|
|
||||||
- sudo iptables -A INPUT -i lo -j ACCEPT
|
|
||||||
- sudo iptables -A OUTPUT -o lo -j ACCEPT
|
|
||||||
- sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
|
||||||
|
|
||||||
# Helper functions for the builds
|
# Helper functions for the builds
|
||||||
- buildMulti() { start_fold config_diff; travis_time_start; git diff Multiprotocol/_Config.h; end_fold config_diff; exitcode=0; BUILDCMD="arduino --verify --board $BOARD Multiprotocol/Multiprotocol.ino --pref build.path=./build/"; echo $BUILDCMD; $BUILDCMD; if [ $? -ne 0 ]; then exitcode=1; fi; echo; return $exitcode; }
|
- buildMulti() { start_fold config_diff; travis_time_start; git diff Multiprotocol/_Config.h; end_fold config_diff; exitcode=0; BUILDCMD="arduino-cli compile -b $BOARD Multiprotocol/Multiprotocol.ino --build-path ${TRAVIS_BUILD_DIR}/build/"; echo $BUILDCMD; $BUILDCMD; if [ $? -ne 0 ]; then exitcode=1; fi; echo; return $exitcode; }
|
||||||
- buildProtocol() { exitcode=0; opt_disable $ALL_PROTOCOLS; opt_enable $1; buildMulti; if [ $? -ne 0 ]; then exitcode=1; fi; return $exitcode; }
|
- buildProtocol() { exitcode=0; opt_disable $ALL_PROTOCOLS; opt_enable $1; buildMulti; if [ $? -ne 0 ]; then exitcode=1; fi; return $exitcode; }
|
||||||
- buildEachProtocol() { exitcodesum=0; for PROTOCOL in $ALL_PROTOCOLS ; do printf "\e[33;1mBuilding $PROTOCOL\e[0m"; buildProtocol $PROTOCOL; if [ $? -ne 0 ]; then exitcodesum=$((exitcodesum + 1)); fi; done; return $exitcodesum; }
|
- buildEachProtocol() { exitcodesum=0; for PROTOCOL in $ALL_PROTOCOLS ; do printf "\e[33;1mBuilding $PROTOCOL\e[0m"; buildProtocol $PROTOCOL; if [ $? -ne 0 ]; then exitcodesum=$((exitcodesum + 1)); fi; done; return $exitcodesum; }
|
||||||
- buildRFModule() { exitcode=0; opt_disable $ALL_RFMODULES; opt_enable $1; buildMulti; if [ $? -ne 0 ]; then exitcode=1; fi; return $exitcode; }
|
- buildRFModule() { exitcode=0; opt_disable $ALL_RFMODULES; opt_enable $1; buildMulti; if [ $? -ne 0 ]; then exitcode=1; fi; return $exitcode; }
|
||||||
@@ -58,6 +49,10 @@ before_install:
|
|||||||
exitcode=$((exitcode+$?));
|
exitcode=$((exitcode+$?));
|
||||||
mv build/Multiprotocol.ino.bin ./binaries/multi-orangerx-aetr-blue-inv-v$MULTI_VERSION.bin;
|
mv build/Multiprotocol.ino.bin ./binaries/multi-orangerx-aetr-blue-inv-v$MULTI_VERSION.bin;
|
||||||
cp Multiprotocol/Multi.txt ./binaries/Multi.txt;
|
cp Multiprotocol/Multi.txt ./binaries/Multi.txt;
|
||||||
|
mkdir -p TOOLS/SCRIPTS;
|
||||||
|
cp Lua_scripts/*.lua TOOLS/SCRIPTS/;
|
||||||
|
cp Lua_scripts/*.txt TOOLS/SCRIPTS/;
|
||||||
|
zip ./binaries/MultiLuaScripts.zip TOOLS/SCRIPTS/*;
|
||||||
return $exitcode; };
|
return $exitcode; };
|
||||||
elif [[ "$BOARD" == "multi4in1:avr:multiatmega328p:bootloader=none" ]]; then
|
elif [[ "$BOARD" == "multi4in1:avr:multiatmega328p:bootloader=none" ]]; then
|
||||||
buildReleaseFiles(){
|
buildReleaseFiles(){
|
||||||
@@ -72,6 +67,7 @@ before_install:
|
|||||||
printf "\n\e[33;1mBuilding multi-avr-usbasp-aetr-CC2500-inv-v$MULTI_VERSION.bin\e[0m";
|
printf "\n\e[33;1mBuilding multi-avr-usbasp-aetr-CC2500-inv-v$MULTI_VERSION.bin\e[0m";
|
||||||
opt_disable $ALL_PROTOCOLS;
|
opt_disable $ALL_PROTOCOLS;
|
||||||
opt_enable $CC2500_PROTOCOLS;
|
opt_enable $CC2500_PROTOCOLS;
|
||||||
|
opt_disable HITEC_CC2500_INO REDPINE_CC2500_INO SKYARTEC_CC2500_INO SCANNER_CC2500_INO;
|
||||||
buildMulti;
|
buildMulti;
|
||||||
mv build/Multiprotocol.ino.bin ./binaries/multi-avr-usbasp-aetr-CC2500-inv-v$MULTI_VERSION.bin;
|
mv build/Multiprotocol.ino.bin ./binaries/multi-avr-usbasp-aetr-CC2500-inv-v$MULTI_VERSION.bin;
|
||||||
printf "\n\e[33;1mBuilding multi-avr-usbasp-aetr-CYRF6936-inv-v$MULTI_VERSION.bin\e[0m";
|
printf "\n\e[33;1mBuilding multi-avr-usbasp-aetr-CYRF6936-inv-v$MULTI_VERSION.bin\e[0m";
|
||||||
@@ -94,6 +90,7 @@ before_install:
|
|||||||
printf "\n\e[33;1mBuilding multi-avr-txflash-aetr-CC2500-inv-v$MULTI_VERSION.bin\e[0m";
|
printf "\n\e[33;1mBuilding multi-avr-txflash-aetr-CC2500-inv-v$MULTI_VERSION.bin\e[0m";
|
||||||
opt_disable $ALL_PROTOCOLS;
|
opt_disable $ALL_PROTOCOLS;
|
||||||
opt_enable $CC2500_PROTOCOLS;
|
opt_enable $CC2500_PROTOCOLS;
|
||||||
|
opt_disable HITEC_CC2500_INO REDPINE_CC2500_INO SKYARTEC_CC2500_INO SCANNER_CC2500_INO;
|
||||||
buildMulti;
|
buildMulti;
|
||||||
exitcode=$((exitcode+$?));
|
exitcode=$((exitcode+$?));
|
||||||
mv build/Multiprotocol.ino.bin ./binaries/multi-avr-txflash-aetr-CC2500-inv-v$MULTI_VERSION.bin;
|
mv build/Multiprotocol.ino.bin ./binaries/multi-avr-txflash-aetr-CC2500-inv-v$MULTI_VERSION.bin;
|
||||||
@@ -238,28 +235,49 @@ before_install:
|
|||||||
exitcode=$((exitcode+$?));
|
exitcode=$((exitcode+$?));
|
||||||
mv build/Multiprotocol.ino.bin ./binaries/multi-stm-opentx-xn297dump-inv-ftdidebug-v$MULTI_VERSION.bin;
|
mv build/Multiprotocol.ino.bin ./binaries/multi-stm-opentx-xn297dump-inv-ftdidebug-v$MULTI_VERSION.bin;
|
||||||
return $exitcode; };
|
return $exitcode; };
|
||||||
|
elif [[ "$BOARD" == "multi4in1:STM32F1:multi5in1t18int" ]]; then
|
||||||
|
buildReleaseFiles(){
|
||||||
|
printf "\n\e[33;1mBuilding multi-t18int-opentx-aetr-noinv-v$MULTI_VERSION.bin\e[0m";
|
||||||
|
opt_disable INVERT_TELEMETRY;
|
||||||
|
exitcode=0;
|
||||||
|
buildMulti;
|
||||||
|
exitcode=$((exitcode+$?));
|
||||||
|
mv build/Multiprotocol.ino.bin ./binaries/multi-t18int-opentx-aetr-noinv-v$MULTI_VERSION.bin;
|
||||||
|
printf "\n\e[33;1mBuilding multi-t18int-opentx-taer-noinv-v$MULTI_VERSION.bin\e[0m";
|
||||||
|
opt_replace AETR TAER;
|
||||||
|
exitcode=0;
|
||||||
|
buildMulti;
|
||||||
|
exitcode=$((exitcode+$?));
|
||||||
|
mv build/Multiprotocol.ino.bin ./binaries/multi-t18int-opentx-taer-noinv-v$MULTI_VERSION.bin;
|
||||||
|
printf "\n\e[33;1mBuilding multi-t18int-opentx-reta-noinv-v$MULTI_VERSION.bin\e[0m";
|
||||||
|
opt_replace TAER RETA;
|
||||||
|
exitcode=0;
|
||||||
|
buildMulti;
|
||||||
|
exitcode=$((exitcode+$?));
|
||||||
|
mv build/Multiprotocol.ino.bin ./binaries/multi-t18int-opentx-reta-noinv-v$MULTI_VERSION.bin;
|
||||||
|
return $exitcode; };
|
||||||
else
|
else
|
||||||
buildReleaseFiles() { echo "No release files for this board."; };
|
buildReleaseFiles() { echo "No release files for this board."; };
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install:
|
install:
|
||||||
# Install Arduino IDE
|
# Install Arduino CLI
|
||||||
- wget http://downloads.arduino.cc/arduino-$IDE_VERSION-linux64.tar.xz
|
- mkdir ~/arduino-cli
|
||||||
- tar xf arduino-$IDE_VERSION-linux64.tar.xz
|
- curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=~/arduino-cli sh;
|
||||||
- mv arduino-$IDE_VERSION $HOME/arduino-ide
|
- export PATH=$PATH:$HOME/arduino-cli
|
||||||
- export PATH=$PATH:$HOME/arduino-ide
|
|
||||||
|
|
||||||
# Set the Multi boards package URL
|
# Update the board url and package index
|
||||||
- arduino --pref "boardsmanager.additional.urls=https://raw.githubusercontent.com/pascallanger/DIY-Multiprotocol-TX-Module-Boards/master/package_multi_4in1_board_index.json" --save-prefs
|
- arduino-cli core update-index --additional-urls https://raw.githubusercontent.com/pascallanger/DIY-Multiprotocol-TX-Module-Boards/master/package_multi_4in1_board_index.json
|
||||||
|
|
||||||
# Install the STM32 board if needed
|
# Install the STM32 board if needed
|
||||||
- if [[ "$BOARD" =~ "multi4in1:STM32F1:" ]]; then
|
- if [[ "$BOARD" =~ "multi4in1:STM32F1:" ]]; then
|
||||||
arduino --install-boards multi4in1:STM32F1;
|
arduino-cli core install multi4in1:STM32F1 --additional-urls https://raw.githubusercontent.com/pascallanger/DIY-Multiprotocol-TX-Module-Boards/master/package_multi_4in1_board_index.json;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install the AVR board if needed
|
# Install the AVR board if needed
|
||||||
- if [[ "$BOARD" =~ "multi4in1:avr:" ]]; then
|
- if [[ "$BOARD" =~ "multi4in1:avr:" ]]; then
|
||||||
arduino --install-boards multi4in1:avr;
|
arduino-cli core install arduino:avr;
|
||||||
|
arduino-cli core install multi4in1:avr --additional-urls https://raw.githubusercontent.com/pascallanger/DIY-Multiprotocol-TX-Module-Boards/master/package_multi_4in1_board_index.json;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
@@ -287,15 +305,24 @@ before_script:
|
|||||||
- CC2500_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_CC2500_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h)
|
- CC2500_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_CC2500_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h)
|
||||||
- CYRF6936_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_CYRF6936_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h)
|
- CYRF6936_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_CYRF6936_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h)
|
||||||
- NRF24L01_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_NRF24L01_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h)
|
- NRF24L01_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_NRF24L01_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h)
|
||||||
|
- SX1276_PROTOCOLS=$(sed -n 's/[\/\/]*[[:blank:]]*#define[[:blank:]]*\([[:alnum:]_]*_SX1276_INO\)\(.*\)/\1/p' Multiprotocol/_Config.h)
|
||||||
|
|
||||||
|
# Get the full set of protocols for each board
|
||||||
- if [[ "$BOARD" =~ "multi4in1:avr:multixmega32d4" ]]; then
|
- if [[ "$BOARD" =~ "multi4in1:avr:multixmega32d4" ]]; then
|
||||||
ALL_PROTOCOLS=$(echo $CYRF6936_PROTOCOLS);
|
ALL_PROTOCOLS=$(echo $CYRF6936_PROTOCOLS);
|
||||||
else
|
elif [[ "$BOARD" =~ "multi4in1:avr:multiatmega328p:" ]]; then
|
||||||
ALL_PROTOCOLS=$(echo $A7105_PROTOCOLS $CC2500_PROTOCOLS $CYRF6936_PROTOCOLS $NRF24L01_PROTOCOLS);
|
ALL_PROTOCOLS=$(echo $A7105_PROTOCOLS $CC2500_PROTOCOLS $CYRF6936_PROTOCOLS $NRF24L01_PROTOCOLS);
|
||||||
|
elif [[ "$BOARD" =~ "multi4in1:STM32F1:" ]]; then
|
||||||
|
ALL_PROTOCOLS=$(echo $A7105_PROTOCOLS $CC2500_PROTOCOLS $CYRF6936_PROTOCOLS $NRF24L01_PROTOCOLS $SX1276_PROTOCOLS);
|
||||||
fi
|
fi
|
||||||
- echo $ALL_PROTOCOLS
|
- echo $ALL_PROTOCOLS
|
||||||
|
|
||||||
# Declare all the installed modules
|
# Declare all the installed modules
|
||||||
- ALL_RFMODULES=$(echo A7105_INSTALLED CYRF6936_INSTALLED CC2500_INSTALLED NRF24L01_INSTALLED);
|
- if [[ "$BOARD" =~ "multi4in1:STM32F1:" ]]; then
|
||||||
|
ALL_RFMODULES=$(echo A7105_INSTALLED CYRF6936_INSTALLED CC2500_INSTALLED NRF24L01_INSTALLED SX1276_INSTALLED);
|
||||||
|
else
|
||||||
|
ALL_RFMODULES=$(echo A7105_INSTALLED CYRF6936_INSTALLED CC2500_INSTALLED NRF24L01_INSTALLED);
|
||||||
|
fi
|
||||||
|
|
||||||
# Disable CHECK_FOR_BOOTLOADER when not needed
|
# Disable CHECK_FOR_BOOTLOADER when not needed
|
||||||
- if [[ "$BOARD" == "multi4in1:avr:multiatmega328p:bootloader=none" ]]; then
|
- if [[ "$BOARD" == "multi4in1:avr:multiatmega328p:bootloader=none" ]]; then
|
||||||
@@ -348,12 +375,15 @@ script:
|
|||||||
# Restore the default configuration
|
# Restore the default configuration
|
||||||
- cp ./_Config.h.bak Multiprotocol/_Config.h
|
- cp ./_Config.h.bak Multiprotocol/_Config.h
|
||||||
|
|
||||||
|
# Restore the default configuration
|
||||||
|
- cp ./_Config.h.bak Multiprotocol/_Config.h
|
||||||
|
|
||||||
# Builds the files for a release - always built, but only copied to Github if the test is tagged as a release
|
# Builds the files for a release - always built, but only copied to Github if the test is tagged as a release
|
||||||
- buildReleaseFiles
|
- buildReleaseFiles
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
api_key:
|
token:
|
||||||
secure: KGXaoqvd8rbZ3AZtL9Rrn1JYiocGsPaihRUyR8gM8vTfvH9WYAE1+h6SzROQOuJSwr89MvTo3SBOTlM/0PDBnEGLec9Irt7cwO0xf9xM2vPuUG8DYcUzmJJzME9dkn/7qHof1JGgRpp1duUAN1triE9NxhKxL1hbs+tUUbDPAejxwoFNfnta/T4PfD6xmkZNJbneIfYFuFgyLpwwFhuUy9JP7s1AFOiT+fCHxPaZrPn5GsXqAi95Cb7Q3w1iVSt3BmrGxL2j3CeNpWzFY1RrMdc8ay+ppOhSPEIl2vyM7VeLRRBL3EVeFWkiS4ywevqw70wOivTczluv3OeuIJAe5o2UU+w5+59c7+i44Nih23PDAZBhAG5JkLUYUN0XUJpXJ5ZlZsb8IS8sI1txlZa5tNVoXO9+soGEY4rKSpZaPptuENm792CzzAjcaUI9pOFJ/0CBoSCbu5MpM/plkJCMd8fY27EE8cNYvolMuRATNlXs7h9mURGR69pmcR1jFShH+A7Kyp1S1sH19sGCEU16rt2aAtf2FadFg/gKACC2y9rB3wBb4Qnapu2AwNRlTYNuU1+G+kb2FXRwMl04q+38S+cIBHH9NHfdftp9MRPf8Ekatojs92be/Ux21S+hcA7sx/DV22Dl45V6l4mXzR7U4x1nQcdn1SGuy5I4lL6IYCk=
|
secure: KGXaoqvd8rbZ3AZtL9Rrn1JYiocGsPaihRUyR8gM8vTfvH9WYAE1+h6SzROQOuJSwr89MvTo3SBOTlM/0PDBnEGLec9Irt7cwO0xf9xM2vPuUG8DYcUzmJJzME9dkn/7qHof1JGgRpp1duUAN1triE9NxhKxL1hbs+tUUbDPAejxwoFNfnta/T4PfD6xmkZNJbneIfYFuFgyLpwwFhuUy9JP7s1AFOiT+fCHxPaZrPn5GsXqAi95Cb7Q3w1iVSt3BmrGxL2j3CeNpWzFY1RrMdc8ay+ppOhSPEIl2vyM7VeLRRBL3EVeFWkiS4ywevqw70wOivTczluv3OeuIJAe5o2UU+w5+59c7+i44Nih23PDAZBhAG5JkLUYUN0XUJpXJ5ZlZsb8IS8sI1txlZa5tNVoXO9+soGEY4rKSpZaPptuENm792CzzAjcaUI9pOFJ/0CBoSCbu5MpM/plkJCMd8fY27EE8cNYvolMuRATNlXs7h9mURGR69pmcR1jFShH+A7Kyp1S1sH19sGCEU16rt2aAtf2FadFg/gKACC2y9rB3wBb4Qnapu2AwNRlTYNuU1+G+kb2FXRwMl04q+38S+cIBHH9NHfdftp9MRPf8Ekatojs92be/Ux21S+hcA7sx/DV22Dl45V6l4mXzR7U4x1nQcdn1SGuy5I4lL6IYCk=
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
file_glob: true
|
file_glob: true
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
echo Installing Maple DFU driver...
|
echo Installing MULTI-Module DFU Bootloader Driver...
|
||||||
"%~dp0wdi-simple" --vid 0x1EAF --pid 0x0003 --type 1 --name "Maple DFU" --dest "%~dp0maple-dfu"
|
"%~dp0wdi-simple" --vid 0x1EAF --pid 0x0003 --type 2 --name "MULTI-Module DFU Bootloader" --dest "%~dp0MULTI-DFU-Bootloader" -b
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
echo Installing Maple Serial driver...
|
echo Installing MULTI-Module USB Serial Driver...
|
||||||
"%~dp0wdi-simple" --vid 0x1EAF --pid 0x0004 --type 3 --name "Maple Serial" --dest "%~dp0maple-serial"
|
"%~dp0wdi-simple" --vid 0x1EAF --pid 0x0004 --type 3 --name "MULTI-Module USB Serial" --dest "%~dp0MULTI-USB-Serial" -b
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
pause
|
pause
|
||||||
|
|||||||
@@ -527,6 +527,28 @@
|
|||||||
"version": "4.8.3-2014q1"
|
"version": "4.8.3-2014q1"
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Multi X-in-1 STM32 Boards",
|
||||||
|
"architecture": "STM32F1",
|
||||||
|
"version": "1.1.8",
|
||||||
|
"category": "Contributed",
|
||||||
|
"help": {
|
||||||
|
"online": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module"
|
||||||
|
},
|
||||||
|
"url": "https://github.com/pascallanger/DIY-Multiprotocol-TX-Module-Boards/raw/master/archives/package_multi_4in1_stm32_board_v1.1.8.tar.gz",
|
||||||
|
"archiveFileName": "package_multi_4in1_stm32_board_v1.1.8.tar.gz",
|
||||||
|
"checksum": "SHA-256:e9ed8055ebf72abf37e60e1b8d1c6ee5472132ea7c0a3c4a63fbb8442613e4c2",
|
||||||
|
"size": "7481800",
|
||||||
|
"boards": [
|
||||||
|
{"name": "Multi 4-in-1 (STM32F103C)"},
|
||||||
|
{"name": "Multi 5-in-1 (Jumper T18 Internal)"}
|
||||||
|
],
|
||||||
|
"toolsDependencies": [{
|
||||||
|
"packager": "arduino",
|
||||||
|
"name": "arm-none-eabi-gcc",
|
||||||
|
"version": "4.8.3-2014q1"
|
||||||
|
}]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Multi 4-in-1 OrangeRX Board - DEPRECATED, USE MULTI 4-IN-1 AVR BOARDS PACKAGE INSTEAD",
|
"name": "Multi 4-in-1 OrangeRX Board - DEPRECATED, USE MULTI 4-IN-1 AVR BOARDS PACKAGE INSTEAD",
|
||||||
"architecture": "orangerx",
|
"architecture": "orangerx",
|
||||||
|
|||||||
171
Lua_scripts/Graupner HoTT.lua
Normal file
171
Lua_scripts/Graupner HoTT.lua
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
---- #########################################################################
|
||||||
|
---- # #
|
||||||
|
---- # Copyright (C) OpenTX #
|
||||||
|
-----# #
|
||||||
|
---- # License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html #
|
||||||
|
---- # #
|
||||||
|
---- # This program is free software; you can redistribute it and/or modify #
|
||||||
|
---- # it under the terms of the GNU General Public License version 2 as #
|
||||||
|
---- # published by the Free Software Foundation. #
|
||||||
|
---- # #
|
||||||
|
---- # This program is distributed in the hope that it will be useful #
|
||||||
|
---- # but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||||
|
---- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||||
|
---- # GNU General Public License for more details. #
|
||||||
|
---- # #
|
||||||
|
---- #########################################################################
|
||||||
|
|
||||||
|
|
||||||
|
--###############################################################################
|
||||||
|
-- Multi buffer for HoTT description
|
||||||
|
-- To start operation:
|
||||||
|
-- Write "HoTT" at address 0..3
|
||||||
|
-- Write 0xFF at address 4 will request the buffer to be cleared
|
||||||
|
-- Write 0x0F at address 5
|
||||||
|
-- Read buffer from address 6 access the RX text for 168 bytes, 21 caracters
|
||||||
|
-- by 8 lines
|
||||||
|
-- Write at address 5 sends an order to the RX: 0xXF=start, 0xX7=prev page,
|
||||||
|
-- 0xXE=next page, 0xX9=enter, 0xXD=next or 0xXB=prev with X being the sensor
|
||||||
|
-- to request data from 8=RX only, 9=Vario, A=GPS, B=Cust, C=ESC, D=GAM, E=EAM
|
||||||
|
-- Write at address 4 the value 0xFF will request the buffer to be cleared
|
||||||
|
-- !! Before exiting the script must write 0 at address 0 for normal operation !!
|
||||||
|
--###############################################################################
|
||||||
|
|
||||||
|
HoTT_Sensor = 0
|
||||||
|
Timer_128 = 100
|
||||||
|
|
||||||
|
local function HoTT_Release()
|
||||||
|
multiBuffer( 0, 0 )
|
||||||
|
end
|
||||||
|
|
||||||
|
local function HoTT_Send(button)
|
||||||
|
multiBuffer( 5, 0x80+(HoTT_Sensor*16) + button)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function HoTT_Sensor_Inc()
|
||||||
|
local detected_sensors=multiBuffer( 4 )
|
||||||
|
local a
|
||||||
|
if detected_sensors ~= 0xFF then
|
||||||
|
repeat
|
||||||
|
HoTT_Sensor=(HoTT_Sensor+1)%7 -- Switch to next sensor
|
||||||
|
if HoTT_Sensor ~= 0 then
|
||||||
|
a = math.floor(detected_sensors/ (2^(HoTT_Sensor-1))) -- shift right
|
||||||
|
end
|
||||||
|
until HoTT_Sensor==0 or a % 2 == 1
|
||||||
|
HoTT_Send( 0x0F )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function HoTT_Draw_LCD()
|
||||||
|
local i
|
||||||
|
local value
|
||||||
|
local line
|
||||||
|
local result
|
||||||
|
local offset=0
|
||||||
|
|
||||||
|
local sensor_name = { "", "+Vario", "+GPS", "+Cust", "+ESC", "+GAM", "+EAM" }
|
||||||
|
|
||||||
|
lcd.clear()
|
||||||
|
|
||||||
|
if LCD_W == 480 then
|
||||||
|
--Draw title
|
||||||
|
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
|
||||||
|
lcd.drawText(1, 5, "Graupner HoTT: config RX" .. sensor_name[HoTT_Sensor+1] .. " - Menu cycle Sensors", MENU_TITLE_COLOR)
|
||||||
|
--Draw RX Menu
|
||||||
|
if multiBuffer( 4 ) == 0xFF then
|
||||||
|
lcd.drawText(10,50,"No HoTT telemetry...", BLINK)
|
||||||
|
else
|
||||||
|
for line = 0, 7, 1 do
|
||||||
|
for i = 0, 21-1, 1 do
|
||||||
|
value=multiBuffer( line*21+6+i )
|
||||||
|
if value > 0x80 then
|
||||||
|
value = value - 0x80
|
||||||
|
lcd.drawText(10+i*16,32+20*line,string.char(value).." ",INVERS)
|
||||||
|
else
|
||||||
|
lcd.drawText(10+i*16,32+20*line,string.char(value))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
--Draw RX Menu on LCD_W=128
|
||||||
|
if multiBuffer( 4 ) == 0xFF then
|
||||||
|
lcd.drawText(2,17,"No HoTT telemetry...",SMLSIZE)
|
||||||
|
else
|
||||||
|
if Timer_128 ~= 0 then
|
||||||
|
--Intro page
|
||||||
|
Timer_128 = Timer_128 - 1
|
||||||
|
lcd.drawScreenTitle("Graupner Hott",0,0)
|
||||||
|
lcd.drawText(2,17,"Configuration of RX" .. sensor_name[HoTT_Sensor+1] ,SMLSIZE)
|
||||||
|
lcd.drawText(2,37,"Press menu to cycle Sensors" ,SMLSIZE)
|
||||||
|
else
|
||||||
|
--Menu page
|
||||||
|
for line = 0, 7, 1 do
|
||||||
|
for i = 0, 21-1, 1 do
|
||||||
|
value=multiBuffer( line*21+6+i )
|
||||||
|
if value > 0x80 then
|
||||||
|
value = value - 0x80
|
||||||
|
lcd.drawText(2+i*6,1+8*line,string.char(value).." ",SMLSIZE+INVERS)
|
||||||
|
else
|
||||||
|
lcd.drawText(2+i*6,1+8*line,string.char(value),SMLSIZE)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Init
|
||||||
|
local function HoTT_Init()
|
||||||
|
--Set protocol to talk to
|
||||||
|
multiBuffer( 0, string.byte('H') )
|
||||||
|
--test if value has been written
|
||||||
|
if multiBuffer( 0 ) ~= string.byte('H') then
|
||||||
|
error("Not enough memory!")
|
||||||
|
return 2
|
||||||
|
end
|
||||||
|
multiBuffer( 1, string.byte('o') )
|
||||||
|
multiBuffer( 2, string.byte('T') )
|
||||||
|
multiBuffer( 3, string.byte('T') )
|
||||||
|
--Request init of the RX buffer
|
||||||
|
multiBuffer( 4, 0xFF )
|
||||||
|
--Request RX to send the config menu
|
||||||
|
HoTT_Send( 0x0F )
|
||||||
|
HoTT_Sensor = 0;
|
||||||
|
HoTT_Detected_Sensors=0;
|
||||||
|
Timer_128 = 100
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Main
|
||||||
|
local function HoTT_Run(event)
|
||||||
|
if event == nil then
|
||||||
|
error("Cannot be run as a model script!")
|
||||||
|
return 2
|
||||||
|
elseif event == EVT_VIRTUAL_EXIT then
|
||||||
|
HoTT_Release()
|
||||||
|
return 2
|
||||||
|
else
|
||||||
|
if event == EVT_VIRTUAL_PREV_PAGE then
|
||||||
|
killEvents(event)
|
||||||
|
HoTT_Send( 0x07 )
|
||||||
|
elseif event == EVT_VIRTUAL_ENTER then
|
||||||
|
HoTT_Send( 0x09 )
|
||||||
|
elseif event == EVT_VIRTUAL_PREV then
|
||||||
|
HoTT_Send( 0x0B )
|
||||||
|
elseif event == EVT_VIRTUAL_NEXT then
|
||||||
|
HoTT_Send( 0x0D )
|
||||||
|
elseif event == EVT_VIRTUAL_NEXT_PAGE then
|
||||||
|
HoTT_Send( 0x0E )
|
||||||
|
elseif event == EVT_VIRTUAL_MENU then
|
||||||
|
Timer_128 = 100
|
||||||
|
HoTT_Sensor_Inc()
|
||||||
|
else
|
||||||
|
HoTT_Send( 0x0F )
|
||||||
|
end
|
||||||
|
HoTT_Draw_LCD()
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return { init=HoTT_Init, run=HoTT_Run }
|
||||||
174
Lua_scripts/MultiChan.txt
Normal file
174
Lua_scripts/MultiChan.txt
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
24,0,Assan,Std,0,CH5,CH6,CH7,CH8
|
||||||
|
14,0,Bayang,Std,1,Flip,RTH,Pict,Video,HLess,Invert,Rates,n-a,n-a,AnAux1,AnAux2
|
||||||
|
14,1,Bayang,H8S3D,1,Flip,RTH,Pict,Video,HLess,Invert,Rates
|
||||||
|
14,2,Bayang,X16_AH,1,Flip,RTH,Pict,Video,HLess,Invert,Rates,TakeOf
|
||||||
|
14,3,Bayang,IRDRONE,1,Flip,RTH,Pict,Video,HLess,Invert,Rates,TakeOf,EmStop
|
||||||
|
14,4,Bayang,DHD_D4,1,Flip,RTH,Pict,Video,HLess,Invert,Rates,TakeOf,EmStop
|
||||||
|
14,5,Bayang,QX100,1,Flip,RTH,Pict,Video,HLess,Invert,Rates,TakeOf,EmStop
|
||||||
|
59,0,BayangRX,RX,1,AnAux1,AnAux2,Flip,RTH,Pict,Video
|
||||||
|
41,0,Bugs,3-6-8,0,Arm,Angle,Flip,Pict,Video,LED
|
||||||
|
42,0,BugsMini,Mini,0,Arm,Angle,Flip,Pict,Video,LED
|
||||||
|
42,1,BugsMini,3H,0,Arm,Angle,Flip,Pict,Video,LED,AltHol
|
||||||
|
34,0,Cabell,V3,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
34,1,Cabell,V3Telem,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
13,0,CG023,Std,1,Flip,Light,Pict,Video,HLess
|
||||||
|
13,1,CG023,YD829,1,Flip,n-a,Pict,Video,HLess
|
||||||
|
37,0,Corona,COR_V1,0,CH5,CH6,CH7,CH8
|
||||||
|
37,1,Corona,COR_V2,0,CH5,CH6,CH7,CH8
|
||||||
|
37,2,Corona,FD_V3,0,CH5,CH6,CH7,CH8
|
||||||
|
12,0,CX10,Green,1,Flip,Rate
|
||||||
|
12,1,CX10,Blue,1,Flip,Rate,Pict,Video
|
||||||
|
12,2,CX10,DM007,1,Flip,Mode,Pict,Video,HLess
|
||||||
|
12,4,CX10,JC3015_1,1,Flip,Mode,Pict,Video
|
||||||
|
12,5,CX10,JC3015_2,1,Flip,Mode,LED,DFlip
|
||||||
|
12,6,CX10,MK33041,1,Flip,Mode,Pict,Video,HLess,RTH
|
||||||
|
7,0,Devo,8CH,0,CH5,CH6,CH7,CH8
|
||||||
|
7,1,Devo,10CH,0,CH5,CH6,CH7,CH8,CH9,CH10
|
||||||
|
7,2,Devo,12CH,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12
|
||||||
|
7,3,Devo,6CH,0,CH5,CH6
|
||||||
|
7,4,Devo,7CH,0,CH5,CH6,CH7
|
||||||
|
33,0,DM022,Std,1,Flip,LED,Cam1,Cam2,HLess,RTH,RLow
|
||||||
|
6,0,DSM,2_22,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,n-a,ThKill
|
||||||
|
6,1,DSM,2_11,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,n-a,ThKill
|
||||||
|
6,2,DSM,X_22,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,n-a,ThKill
|
||||||
|
6,3,DSM,X_11,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,n-a,ThKill
|
||||||
|
6,4,DSM,AUTO,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,n-a,ThKill
|
||||||
|
70,0,DSM_RX,RX,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12
|
||||||
|
45,0,E01X,E012,1,n-a,Flip,n-a,HLess,RTH
|
||||||
|
45,1,E01X,E015,1,Arm,Flip,LED,HLess,RTH
|
||||||
|
45,2,E01X,E016H,1,Stop,Flip,n-a,HLess,RTH
|
||||||
|
16,0,ESKY,Std,0,Gyro,Pitch
|
||||||
|
16,1,ESKY,ET4,0,Gyro,Pitch
|
||||||
|
35,0,ESKY150,4CH,0
|
||||||
|
35,1,ESKY150,7CH,0,FMode,Aux6,Aux7
|
||||||
|
69,0,ESKY150V2,Std,0,CH5_RA,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
1,0,Flysky,Flysky,0,CH5,CH6,CH7,CH8
|
||||||
|
1,1,Flysky,V9x9,1,Flip,Light,Pict,Video
|
||||||
|
1,2,Flysky,V6x6,1,Flip,Light,Pict,Video,HLess,RTH,XCAL,YCAL
|
||||||
|
1,3,Flysky,V912,1,BtmBtn,TopBtn
|
||||||
|
1,4,Flysky,CX20,0,CH5,CH6,CH7
|
||||||
|
28,0,Flysky_AFHDS2A,PWM_IBUS,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14
|
||||||
|
28,1,Flysky_AFHDS2A,PPM_IBUS,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14
|
||||||
|
28,2,Flysky_AFHDS2A,PWM_SBUS,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14
|
||||||
|
28,3,Flysky_AFHDS2A,PPM_SBUS,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14
|
||||||
|
28,4,Flysky_AFHDS2A,PWM_IB16,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
28,5,Flysky_AFHDS2A,PPM_IB16,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
56,0,Flysky2A_RX,RX,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14
|
||||||
|
53,0,Height,5ch,0,Gear
|
||||||
|
53,1,Height,8ch,0,Gear,Gyro,Flap,Light
|
||||||
|
25,0,FrSkyV,V8,0,CH5,CH6,CH7,CH8
|
||||||
|
3,0,FrSkyD,D8,0,CH5,CH6,CH7,CH8
|
||||||
|
3,0,FrSkyD,D8Cloned,0,CH5,CH6,CH7,CH8
|
||||||
|
67,0,FrSkyL,LR12,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12
|
||||||
|
67,1,FrSkyL,LR12_6CH,0,CH5,CH6
|
||||||
|
15,0,FrSkyX,D16_FCC,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
15,1,FrSkyX,D16_8CH_FCC,0,CH5,CH6,CH7,CH8
|
||||||
|
15,2,FrSkyX,D16_LBT,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
15,3,FrSkyX,D16_8CH_LBT,0,CH5,CH6,CH7,CH8
|
||||||
|
15,4,FrSkyX,D16Cloned,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
15,5,FrSkyX,D16Cloned_8CH,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
64,0,FrSkyX2,D16_FCC,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
64,1,FrSkyX2,D16_8CH_FCC,0,CH5,CH6,CH7,CH8
|
||||||
|
64,2,FrSkyX2,D16_LBT,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
64,3,FrSkyX2,D16_8CH_LBT,1,CH5,CH6,CH7,CH8
|
||||||
|
64,4,FrSkyX2,D16Cloned,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
64,5,FrSkyX2,D16Cloned_8CH,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
65,0,FrSkyR9,R9_915,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
65,1,FrSkyR9,R9_868,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
65,2,FrSkyR9,R9_915_8CH,0,CH5,CH6,CH7,CH8
|
||||||
|
65,3,FrSkyR9,R9_968_8CH,0,CH5,CH6,CH7,CH8
|
||||||
|
55,0,FrSkyRX,RX,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14,CH15,CH16
|
||||||
|
55,1,FrSkyRX,CloneTX,0
|
||||||
|
58,0,FX816,P38,1
|
||||||
|
20,0,FY326,FY326,1,Flip,RTH,HLess,Expert,Calib
|
||||||
|
20,1,FY326,FY319,1,Flip,RTH,HLess,Expert,Calib
|
||||||
|
23,0,FY326,FY326,1,Flip,RTH,HLess,Expert
|
||||||
|
47,0,GD00x,V1,1,Trim,LED,Rate
|
||||||
|
47,1,GD00x,V2,1,Trim,LED,Rate
|
||||||
|
32,0,GW008,FY326,1,Flip
|
||||||
|
36,0,H8_3D,Std,1,Flip,Light,Pict,Video,RTH,FlMode,Cal1
|
||||||
|
36,1,H8_3D,H20H,1,Flip,Light,Pict,Video,Opt1,Opt2,Cal1,Cal2,Gimbal
|
||||||
|
36,2,H8_3D,H20,1,Flip,Light,Pict,Video,Opt1,Opt2,Cal1,Cal2,Gimbal
|
||||||
|
36,3,H8_3D,H30,1,Flip,Light,Pict,Video,Opt1,Opt2,Cal1,Cal2,Gimbal
|
||||||
|
4,0,Hisky,Std,0,Gear,Pitch,Gyro,CH8
|
||||||
|
4,1,Hisky,HK310,0,Aux
|
||||||
|
39,0,Hitec,Opt_Fw,0,CH5,CH6,CH7,CH8,CH9
|
||||||
|
39,1,Hitec,Opt_Hub,0,CH5,CH6,CH7,CH8,CH9
|
||||||
|
39,2,Hitec,Minima,0,CH5,CH6,CH7,CH8,CH9
|
||||||
|
26,0,Hontai,Std,1,Flip,LED,Pict,Video,HLess,RTH,Calib
|
||||||
|
26,1,Hontai,JJRCX1,1,Flip,Arm,Pict,Video,HLess,RTH,Calib
|
||||||
|
26,2,Hontai,X5C1,1,Flip,Arm,Pict,Video,HLess,RTH,Calib
|
||||||
|
26,3,Hontai,FQ777_951,1,Flip,Arm,Pict,Video,HLess,RTH,Calib
|
||||||
|
57,0,HoTT,Sync,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12
|
||||||
|
57,1,HoTT,No_Sync,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12
|
||||||
|
2,0,Hubsan,H107,1,Flip,Light,Pict,Video,HLess
|
||||||
|
2,1,Hubsan,H301,0,RTH,Light,Stab,Video
|
||||||
|
2,2,Hubsan,H501,0,RTH,Light,Pict,Video,HLess,GPS_H,ALT_H,Flip,FModes
|
||||||
|
22,0,J6Pro,Std,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12
|
||||||
|
71,0,JJRC345,Std,1,Flip,HLess,RTH
|
||||||
|
49,0,KF606,Std,1,Trim
|
||||||
|
9,0,KN,WLToys,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim
|
||||||
|
9,1,KN,Feilun,0,DRate,THold,IdleUp,Gyro,Ttrim,Atrim,Etrim
|
||||||
|
73,0,Kyosho,Std,0,CH5,CH6,CH7,CH8,CH9,CH10,CH11,CH12,CH13,CH14
|
||||||
|
18,0,MJXQ,WHL08,1,Flip,LED,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate
|
||||||
|
18,1,MJXQ,X600,1,Flip,LED,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate
|
||||||
|
18,2,MJXQ,X800,1,Flip,LED,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate
|
||||||
|
18,3,MJXQ,H26D,1,Flip,LED,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate
|
||||||
|
18,4,MJXQ,E010,1,Flip,LED,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate
|
||||||
|
18,5,MJXQ,H26WH,1,Flip,Arm,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate
|
||||||
|
18,6,MJXQ,Phoenix,1,Flip,Arm,Pict,Video,HLess,RTH,AuFlip,Pan,Tilt,Rate
|
||||||
|
17,0,MT99XX,Std,1,Flip,LED,Pict,Video,HLess
|
||||||
|
17,1,MT99XX,H7,1,Flip,LED,Pict,Video,HLess
|
||||||
|
17,2,MT99XX,YZ,1,Flip,LED,Pict,Video,HLess
|
||||||
|
17,3,MT99XX,LS,1,Flip,Invert,Pict,Video,HLess
|
||||||
|
17,4,MT99XX,FY805,1,Flip,n-a,n-a,n-a,HLess
|
||||||
|
44,0,NCC1701,Std,1,Warp
|
||||||
|
60,0,Pelikan,PRO_V4,0,CH5,CH6,CH7,CH8
|
||||||
|
60,1,Pelikan,LITE_V4,0,CH5,CH6,CH7,CH8
|
||||||
|
51,0,Potensic,A20,1,TakLan,Emerg,Mode,HLess
|
||||||
|
66,0,Propel,74-Z,1,LEDs,RollCW,RolCCW,Fire,Weapon,Calib,AltHol,TakeOf,Land,Train
|
||||||
|
29,0,Q2x2,Q222,1,Flip,LED,Mod2,Mod1,HLess,RTH,XCal,YCal
|
||||||
|
29,1,Q2x2,Q242,1,Flip,LED,Pict,Video,HLess,RTH,XCal,YCal
|
||||||
|
29,2,Q2x2,Q282,1,Flip,LED,Pict,Video,HLess,RTH,XCal,YCal
|
||||||
|
31,0,Q303,Q303,1,AltHol,Flip,Pict,Video,HLess,RTH,Gimbal
|
||||||
|
31,1,Q303,C35,1,Arm,VTX,Pict,Video,n-a,RTH,Gimbal
|
||||||
|
31,2,Q303,CX10D,1,Arm,Flip
|
||||||
|
31,3,Q303,CX10WD,1,Arm,Flip
|
||||||
|
72,0,Q90C,Std,0,FMode,VTX+
|
||||||
|
50,0,Redpine,Fast,0,sCH5,sCH6,sCH7,sCH8,sCH9,sCH10,sCH11,sCH12,sCH13,sCH14,sCH15,sCH16
|
||||||
|
50,1,Redpine,Slow,0,sCH5,sCH6,sCH7,sCH8,sCH9,sCH10,sCH11,sCH12,sCH13,sCH14,sCH15,sCH16
|
||||||
|
74,0,RadioLink,Surface,0,CH5,CH6,CH7,CH8,FS_CH1,FS_CH2,FS_CH3,FS_CH4,FS_CH5,FS_CH6,FS_CH7,FS_CH8
|
||||||
|
74,1,RadioLink,Air,0,CH5,CH6,CH7,CH8,FS_CH1,FS_CH2,FS_CH3,FS_CH4,FS_CH5,FS_CH6,FS_CH7,FS_CH8
|
||||||
|
21,0,SFHSS,Std,0,CH5,CH6,CH7,CH8
|
||||||
|
19,0,Shenqi,Cycle,1
|
||||||
|
68,0,Skyartec,Std,0,CH5,CH6,CH7
|
||||||
|
11,0,SLT,V1,0,Gear,Pitch
|
||||||
|
11,1,SLT,V2,0,CH5,CH6,CH7,CH8
|
||||||
|
11,2,SLT,Q100,0,Rates,n-a,CH7,CH8,Mode,Flip,n-a,n-a,Calib
|
||||||
|
11,3,SLT,Q200,0,Rates,n-a,CH7,CH8,Mode,VidOn,VidOff,Calib
|
||||||
|
11,4,SLT,MR100,0,Rates,n-a,CH7,CH8,Mode,Flip,Video,Pict
|
||||||
|
10,0,Symax,Std,1,Flip,Rates,Pict,Video,HLess
|
||||||
|
10,1,Symax,X5C,1,Flip,Rates,Pict,Video,HLess
|
||||||
|
61,0,Tiger,Std,1,Flip,Light
|
||||||
|
43,0,Traxxas,6519,0
|
||||||
|
5,0,V2x2,Std,1,Flip,Light,Pict,Video,HLess,CalX,CalY
|
||||||
|
5,1,V2x2,JXD506,1,Flip,Light,Pict,Video,HLess,StaSto,Emerg,Cam_UD
|
||||||
|
48,0,V761,3CH,0,Gyro,Calib,Flip,RtnAct,Rtn
|
||||||
|
48,1,V761,4CH,0,Gyro,Calib,Flip,RtnAct,Rtn
|
||||||
|
46,0,V911s,V911s,1,Calib
|
||||||
|
46,1,V911s,E119,1,Calib
|
||||||
|
22,0,WFLY,WFR0xS,0,CH5,CH6,CH7,CH8,CH9
|
||||||
|
30,0,WK2x01,WK2801,0,CH5,CH6,CH7,CH8
|
||||||
|
30,1,WK2x01,WK2401,0
|
||||||
|
30,2,WK2x01,W6_5_1,0,Gear,Dis,Gyro
|
||||||
|
30,3,WK2x01,W6_6_1,0,Gear,Col,Gyro
|
||||||
|
30,4,WK2x01,W6HEL,0,Gear,Col,Gyro
|
||||||
|
30,5,WK2x01,W6HEL_I,0,Gear,Col,Gyro
|
||||||
|
62,0,XK,X450,1,FMode,TakeOf,Emerg,3D_6G,Pict,Video
|
||||||
|
62,1,XK,X420,1,FMode,TakeOf,Emerg,3D_6G,Pict,Video
|
||||||
|
8,0,YD717,Std,1,Flip,Light,Pict,Video,HLess
|
||||||
|
8,1,YD717,SkyWlkr,1,Flip,Light,Pict,Video,HLess
|
||||||
|
8,2,YD717,Simax4,1,Flip,Light,Pict,Video,HLess
|
||||||
|
8,3,YD717,XinXun,1,Flip,Light,Pict,Video,HLess
|
||||||
|
8,4,YD717,NiHui,1,Flip,Light,Pict,Video,HLess
|
||||||
|
52,0,ZSX,280,1,Light
|
||||||
311
Lua_scripts/MultiChannelsUpdater.lua
Normal file
311
Lua_scripts/MultiChannelsUpdater.lua
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
|
||||||
|
local toolName = "TNS|Multi chan namer|TNE"
|
||||||
|
|
||||||
|
---- #########################################################################
|
||||||
|
---- # #
|
||||||
|
---- # Copyright (C) OpenTX #
|
||||||
|
-----# #
|
||||||
|
---- # License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html #
|
||||||
|
---- # #
|
||||||
|
---- # This program is free software; you can redistribute it and/or modify #
|
||||||
|
---- # it under the terms of the GNU General Public License version 2 as #
|
||||||
|
---- # published by the Free Software Foundation. #
|
||||||
|
---- # #
|
||||||
|
---- # This program is distributed in the hope that it will be useful #
|
||||||
|
---- # but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||||
|
---- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||||
|
---- # GNU General Public License for more details. #
|
||||||
|
---- # #
|
||||||
|
---- #########################################################################
|
||||||
|
|
||||||
|
local protocol_name = ""
|
||||||
|
local sub_protocol_name = ""
|
||||||
|
local bind_ch = 0
|
||||||
|
local module_conf = {}
|
||||||
|
local module_pos = "Internal"
|
||||||
|
local file_ok = 0
|
||||||
|
local done = 0
|
||||||
|
local protocol = 0
|
||||||
|
local sub_protocol = 0
|
||||||
|
local f_seek = 0
|
||||||
|
local channel_names={}
|
||||||
|
local num_search = "Searching"
|
||||||
|
|
||||||
|
local function drawScreenTitle(title)
|
||||||
|
if LCD_W == 480 then
|
||||||
|
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
|
||||||
|
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
|
||||||
|
else
|
||||||
|
lcd.drawScreenTitle(title, 0, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function bitand(a, b)
|
||||||
|
local result = 0
|
||||||
|
local bitval = 1
|
||||||
|
while a > 0 and b > 0 do
|
||||||
|
if a % 2 == 1 and b % 2 == 1 then -- test the rightmost bits
|
||||||
|
result = result + bitval -- set the current bit
|
||||||
|
end
|
||||||
|
bitval = bitval * 2 -- shift left
|
||||||
|
a = math.floor(a/2) -- shift right
|
||||||
|
b = math.floor(b/2)
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
local function Multi_Draw_LCD(event)
|
||||||
|
local line = 0
|
||||||
|
|
||||||
|
lcd.clear()
|
||||||
|
drawScreenTitle("Multi channels namer")
|
||||||
|
|
||||||
|
--Display settings
|
||||||
|
local lcd_opt = 0
|
||||||
|
if LCD_W == 480 then
|
||||||
|
x_pos = 10
|
||||||
|
y_pos = 32
|
||||||
|
y_inc = 20
|
||||||
|
else
|
||||||
|
x_pos = 0
|
||||||
|
y_pos = 9
|
||||||
|
y_inc = 8
|
||||||
|
lcd_opt = SMLSIZE
|
||||||
|
end
|
||||||
|
|
||||||
|
--Multi Module detection
|
||||||
|
if module_conf["Type"] ~= 6 then
|
||||||
|
if LCD_W == 480 then
|
||||||
|
lcd.drawText(10,50,"No Multi module configured...", BLINK)
|
||||||
|
else
|
||||||
|
--Draw on LCD_W=128
|
||||||
|
lcd.drawText(2,17,"No Multi module configured...",SMLSIZE)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
else
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,module_pos .. " Multi detected.", lcd_opt)
|
||||||
|
line = line + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
--Channel order
|
||||||
|
if (ch_order == -1) then
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,"Channels order can't be read from Multi...", lcd_opt)
|
||||||
|
line = line + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
--Can't open file MultiChan.txt
|
||||||
|
if file_ok == 0 then
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,"Can't read MultiChan.txt file...", lcd_opt)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( protocol_name == "" or sub_protocol_name == "" ) and f_seek ~=-1 then
|
||||||
|
local f = io.open("/SCRIPTS/TOOLS/MultiChan.txt", "r")
|
||||||
|
if f == nil then return end
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,num_search, lcd_opt)
|
||||||
|
num_search = num_search .. "."
|
||||||
|
if #num_search > 15 then
|
||||||
|
num_search = string.sub(num_search,1,9)
|
||||||
|
end
|
||||||
|
local proto = 0
|
||||||
|
local sub_proto = 0
|
||||||
|
local proto_name = ""
|
||||||
|
local sub_proto_name = ""
|
||||||
|
local channels = ""
|
||||||
|
local nbr_try = 0
|
||||||
|
local nbr_car = 0
|
||||||
|
repeat
|
||||||
|
io.seek(f, f_seek)
|
||||||
|
local data = io.read(f, 100) -- read 100 characters
|
||||||
|
if #data ==0 then
|
||||||
|
f_seek = -1 -- end of file
|
||||||
|
break
|
||||||
|
end
|
||||||
|
proto, sub_proto, proto_name, sub_proto_name, bind_ch, channels = string.match(data,'(%d+),(%d),([%w-_ ]+),([%w-_ ]+),(%d)(.+)')
|
||||||
|
if proto ~= nil and sub_proto ~= nil and protocol_name ~= nil and sub_protocol_name ~= nil and bind_ch ~= nil then
|
||||||
|
if tonumber(proto) == protocol and tonumber(sub_proto) == sub_protocol then
|
||||||
|
protocol_name = proto_name
|
||||||
|
sub_protocol_name = sub_proto_name
|
||||||
|
bind_ch = tonumber(bind_ch)
|
||||||
|
if channels ~= nil then
|
||||||
|
--extract channel names
|
||||||
|
nbr_car = string.find(channels, "\r")
|
||||||
|
if nbr_car == nil then nbr_car = string.find(channels, "\n") end
|
||||||
|
if nbr_car ~= nil then
|
||||||
|
channels = string.sub(channels,1,nbr_car-1)
|
||||||
|
end
|
||||||
|
local i = 5
|
||||||
|
for k in string.gmatch(channels, ",([%w-_ ]+)") do
|
||||||
|
channel_names[i] = k
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
f_seek = -1 -- protocol found
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if f_seek ~= -1 then
|
||||||
|
nbr_car = string.find(data, "\n")
|
||||||
|
if nbr_car == nil then nbr_car = string.find(data, "\r") end
|
||||||
|
if nbr_car == nil then
|
||||||
|
f_seek = -1 -- end of file
|
||||||
|
break
|
||||||
|
end
|
||||||
|
f_seek = f_seek + nbr_car -- seek to next line
|
||||||
|
nbr_try = nbr_try + 1
|
||||||
|
end
|
||||||
|
until nbr_try > 20 or f_seek == -1
|
||||||
|
io.close(f)
|
||||||
|
end
|
||||||
|
|
||||||
|
if f_seek ~= -1 then
|
||||||
|
return -- continue searching...
|
||||||
|
end
|
||||||
|
|
||||||
|
--Protocol & Sub_protocol
|
||||||
|
if protocol_name == "" or sub_protocol_name == "" then
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,"Unknown protocol "..tostring(protocol).."/"..tostring(sub_protocol).." ...", lcd_opt)
|
||||||
|
return
|
||||||
|
elseif LCD_W > 128 then
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,"Protocol: " .. protocol_name .. " / SubProtocol: " .. sub_protocol_name, lcd_opt)
|
||||||
|
line = line + 1
|
||||||
|
else
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,"Protocol: " .. protocol_name, lcd_opt)
|
||||||
|
line = line + 1
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,"SubProtocol: " .. sub_protocol_name, lcd_opt)
|
||||||
|
line = line + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
text1=""
|
||||||
|
text2=""
|
||||||
|
for i,v in ipairs(channel_names) do
|
||||||
|
if i<=8 then
|
||||||
|
if i==1 then
|
||||||
|
text1 = v
|
||||||
|
else
|
||||||
|
text1=text1 .. "," .. v
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if i==9 then
|
||||||
|
text2 = v
|
||||||
|
else
|
||||||
|
text2=text2 .. "," .. v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if LCD_W > 128 then
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,"Channels: " .. text1, lcd_opt)
|
||||||
|
line = line + 1
|
||||||
|
if text2 ~= "" then
|
||||||
|
lcd.drawText(x_pos*9, y_pos+y_inc*line,text2, lcd_opt)
|
||||||
|
line = line + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if event ~= EVT_VIRTUAL_ENTER and done == 0 then
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,"<ENT> Save", lcd_opt + INVERS + BLINK)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,"Setting channel names.", lcd_opt)
|
||||||
|
line = line + 1
|
||||||
|
local output, nbr
|
||||||
|
if done == 0 then
|
||||||
|
for i,v in ipairs(channel_names) do
|
||||||
|
output = model.getOutput(i-1)
|
||||||
|
output["name"] = v
|
||||||
|
model.setOutput(i-1,output)
|
||||||
|
nbr = i
|
||||||
|
end
|
||||||
|
for i = nbr, 15 do
|
||||||
|
output = model.getOutput(i)
|
||||||
|
output["name"] = "n-a"
|
||||||
|
model.setOutput(i,output)
|
||||||
|
end
|
||||||
|
if bind_ch == 1 then
|
||||||
|
output = model.getOutput(15)
|
||||||
|
output["name"] = "BindCH"
|
||||||
|
model.setOutput(15,output)
|
||||||
|
end
|
||||||
|
done = 1
|
||||||
|
end
|
||||||
|
lcd.drawText(x_pos, y_pos+y_inc*line,"Done!", lcd_opt)
|
||||||
|
line = line + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Init
|
||||||
|
local function Multi_Init()
|
||||||
|
module_conf = model.getModule(0)
|
||||||
|
if module_conf["Type"] ~= 6 then
|
||||||
|
module_pos = "External"
|
||||||
|
module_conf = model.getModule(1)
|
||||||
|
if module_conf["Type"] ~= 6 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
protocol = module_conf["protocol"]
|
||||||
|
sub_protocol = module_conf["subProtocol"]
|
||||||
|
|
||||||
|
--Exceptions on first 4 channels...
|
||||||
|
local stick_names = { "Rud", "Ele", "Thr", "Ail" }
|
||||||
|
if ( protocol == 4 and sub_protocol == 1 ) or protocol == 19 or protocol == 52 then -- Hisky/HK310, Shenqi, ZSX
|
||||||
|
stick_names[2] = "n-a"
|
||||||
|
stick_names[4] = "n-a"
|
||||||
|
elseif protocol == 43 then -- Traxxas
|
||||||
|
stick_names[2] = "Aux4"
|
||||||
|
stick_names[4] = "Aux3"
|
||||||
|
elseif ( protocol == 48 and sub_protocol == 0 ) then -- V761 3CH
|
||||||
|
stick_names[4] = "n-a"
|
||||||
|
elseif protocol == 47 or protocol == 49 or protocol == 58 then -- GD00x, KF606, FX816
|
||||||
|
stick_names[1] = "n-a"
|
||||||
|
stick_names[2] = "n-a"
|
||||||
|
end
|
||||||
|
|
||||||
|
--Determine fist 4 channels order
|
||||||
|
local ch_order=module_conf["channelsOrder"]
|
||||||
|
if (ch_order == -1) then
|
||||||
|
channel_names[1] = stick_names[defaultChannel(0)+1]
|
||||||
|
channel_names[2] = stick_names[defaultChannel(1)+1]
|
||||||
|
channel_names[3] = stick_names[defaultChannel(2)+1]
|
||||||
|
channel_names[4] = stick_names[defaultChannel(3)+1]
|
||||||
|
else
|
||||||
|
channel_names[bitand(ch_order,3)+1] = stick_names[4]
|
||||||
|
ch_order = math.floor(ch_order/4)
|
||||||
|
channel_names[bitand(ch_order,3)+1] = stick_names[2]
|
||||||
|
ch_order = math.floor(ch_order/4)
|
||||||
|
channel_names[bitand(ch_order,3)+1] = stick_names[3]
|
||||||
|
ch_order = math.floor(ch_order/4)
|
||||||
|
channel_names[bitand(ch_order,3)+1] = stick_names[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
--Exceptions on first 4 channels...
|
||||||
|
if ( protocol == 73 or (protocol == 74 and sub_protocol == 0) ) then -- Kyosho or RadioLink Surface
|
||||||
|
channel_names[1] = "ST"
|
||||||
|
channel_names[2] = "THR"
|
||||||
|
channel_names[3] = "CH3"
|
||||||
|
channel_names[4] = "CH4"
|
||||||
|
end
|
||||||
|
|
||||||
|
--Check MultiChan.txt
|
||||||
|
local f = io.open("/SCRIPTS/TOOLS/MultiChan.txt", "r")
|
||||||
|
if f == nil then return end
|
||||||
|
file_ok = 1
|
||||||
|
io.close(f)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Main
|
||||||
|
local function Multi_Run(event)
|
||||||
|
if event == nil then
|
||||||
|
error("Cannot be run as a model script!")
|
||||||
|
return 2
|
||||||
|
else
|
||||||
|
Multi_Draw_LCD(event)
|
||||||
|
if event == EVT_VIRTUAL_EXIT then
|
||||||
|
return 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
return { init=Multi_Init, run=Multi_Run }
|
||||||
34
Lua_scripts/README.md
Normal file
34
Lua_scripts/README.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# Multiprotocol TX Module OpenTX LUA scripts
|
||||||
|
<img align="right" width=300 src="../docs/images/multi.png" />
|
||||||
|
|
||||||
|
If you like this project and want to support further development please consider making a [donation](../docs/Donations.md).
|
||||||
|
|
||||||
|
<table cellspacing=0>
|
||||||
|
<tr>
|
||||||
|
<td align=center width=200><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=VF2K9T23DRY56&lc=US&item_name=DIY%20Multiprotocol¤cy_code=EUR&amount=5&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img src="../docs/images/donate_button.png" border="0" name="submit" title="PayPal - Donate €5" alt="Donate €5"/></a><br><b>€5</b></td>
|
||||||
|
<td align=center width=200><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=VF2K9T23DRY56&lc=US&item_name=DIY%20Multiprotocol¤cy_code=EUR&amount=10&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img src="../docs/images/donate_button.png" border="0" name="submit" title="PayPal - Donate €10" alt="Donate €10"/></a><br><b>€10</b></td>
|
||||||
|
<td align=center width=200><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=VF2K9T23DRY56&lc=US&item_name=DIY%20Multiprotocol¤cy_code=EUR&amount=15&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img src="../docs/images/donate_button.png" border="0" name="submit" title="PayPal - Donate €15" alt="Donate €10"/></a><br><b>€15</b></td>
|
||||||
|
<td align=center width=200><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=VF2K9T23DRY56&lc=US&item_name=DIY%20Multiprotocol¤cy_code=EUR&amount=25&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img src="../docs/images/donate_button.png" border="0" name="submit" title="PayPal - Donate €25" alt="Donate €25"/></a><br><b>€25</b></td>
|
||||||
|
<td align=center width=200><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=VF2K9T23DRY56&lc=US&item_name=DIY%20Multiprotocol¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img src="../docs/images/donate_button.png" border="0" name="submit" title="PayPal - Donate" alt="Donate"/></a><br><b>Other</b></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## MultiChannelsUpdater.lua
|
||||||
|
|
||||||
|
Automatically name the channels based on the loaded Multi protocol and sub protocol including the module channel order convention.
|
||||||
|
|
||||||
|
Need OpenTX 2.3.9 or above. Located on the radio SD card under \SCRIPTS\TOOLS. This script needs MultiChan.txt to be present in the same folder.
|
||||||
|
|
||||||
|
[](https://www.youtube.com/watch?v=L58ayXuewyA)
|
||||||
|
|
||||||
|
## Graupner HoTT.ua
|
||||||
|
|
||||||
|
Enable text configuration of the HoTT RX and sensors: Vario, GPS, ESC, GAM and EAM.
|
||||||
|
|
||||||
|
Need OpenTX 2.3.9 or above. Located on the radio SD card under \SCRIPTS\TOOLS.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- Menu is used to cycle through the detected sensors.
|
||||||
|
- It's normal to lose the telemetry feed while using the text mode configuration. Telemetry will resume properly if the script is exited by doing a short press on the exit button.
|
||||||
|
|
||||||
|
[](https://www.youtube.com/watch?v=81wd8NlF3Qw)
|
||||||
@@ -192,9 +192,9 @@ void A7105_AdjustLOBaseFreq(uint8_t cmd)
|
|||||||
offset=(int16_t)FORCE_FLYSKY_TUNING;
|
offset=(int16_t)FORCE_FLYSKY_TUNING;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case PROTO_FLYZONE:
|
case PROTO_HEIGHT:
|
||||||
#ifdef FORCE_FLYZONE_TUNING
|
#ifdef FORCE_HEIGHT_TUNING
|
||||||
offset=(int16_t)FORCE_FLYZONE_TUNING;
|
offset=(int16_t)FORCE_HEIGHT_TUNING;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case PROTO_PELIKAN:
|
case PROTO_PELIKAN:
|
||||||
@@ -202,6 +202,11 @@ void A7105_AdjustLOBaseFreq(uint8_t cmd)
|
|||||||
offset=(int16_t)FORCE_PELIKAN_TUNING;
|
offset=(int16_t)FORCE_PELIKAN_TUNING;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case PROTO_KYOSHO:
|
||||||
|
#ifdef FORCE_KYOSHO_TUNING
|
||||||
|
offset=(int16_t)FORCE_KYOSHO_TUNING;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
case PROTO_AFHDS2A:
|
case PROTO_AFHDS2A:
|
||||||
case PROTO_AFHDS2A_RX:
|
case PROTO_AFHDS2A_RX:
|
||||||
#ifdef FORCE_AFHDS2A_TUNING
|
#ifdef FORCE_AFHDS2A_TUNING
|
||||||
@@ -282,8 +287,8 @@ const uint8_t PROGMEM FLYSKY_A7105_regs[] = {
|
|||||||
0x01, 0x0f // 30 - 31
|
0x01, 0x0f // 30 - 31
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#ifdef FLYZONE_A7105_INO
|
#ifdef HEIGHT_A7105_INO
|
||||||
const uint8_t PROGMEM FLYZONE_A7105_regs[] = {
|
const uint8_t PROGMEM HEIGHT_A7105_regs[] = {
|
||||||
0xff, 0x42, 0x00, 0x07, 0x00, 0xff, 0xff ,0x00, 0x00, 0x00, 0x00, 0x01, 0x21, 0x05, 0x01, 0x50, // 00 - 0f
|
0xff, 0x42, 0x00, 0x07, 0x00, 0xff, 0xff ,0x00, 0x00, 0x00, 0x00, 0x01, 0x21, 0x05, 0x01, 0x50, // 00 - 0f
|
||||||
0x9e, 0x4b, 0x00, 0x02, 0x16, 0x2b, 0x12, 0x00, 0x62, 0x80, 0x80, 0x00, 0x0a, 0x32, 0xc3, 0x1f, // 10 - 1f
|
0x9e, 0x4b, 0x00, 0x02, 0x16, 0x2b, 0x12, 0x00, 0x62, 0x80, 0x80, 0x00, 0x0a, 0x32, 0xc3, 0x1f, // 10 - 1f
|
||||||
0x12, 0x00, 0x00, 0xff, 0x00, 0x00, 0x3a, 0x00, 0x3f, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, // 20 - 2f
|
0x12, 0x00, 0x00, 0xff, 0x00, 0x00, 0x3a, 0x00, 0x3f, 0x47, 0x80, 0x03, 0x01, 0x45, 0x18, 0x00, // 20 - 2f
|
||||||
@@ -306,6 +311,14 @@ const uint8_t PROGMEM PELIKAN_A7105_regs[] = {
|
|||||||
0x01, 0x0f // 30 - 31
|
0x01, 0x0f // 30 - 31
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef KYOSHO_A7105_INO
|
||||||
|
const uint8_t PROGMEM KYOSHO_A7105_regs[] = {
|
||||||
|
0xff, 0x42, 0xff, 0x25, 0x00, 0xff, 0xff ,0x00, 0x00, 0x00, 0x00, 0x01, 0x21, 0x05, 0x00, 0x50, // 00 - 0f
|
||||||
|
0x9e, 0x4b, 0x00, 0x02, 0x16, 0x2b, 0x12, 0x40, 0x62, 0x80, 0x80, 0x00, 0x0a, 0x32, 0x03, 0x1f, // 10 - 1f
|
||||||
|
0x1e, 0x00, 0x00, 0xff, 0x00, 0x00, 0x23, 0x70, 0x1F, 0x47, 0x80, 0x57, 0x01, 0x45, 0x19, 0x00, // 20 - 2f
|
||||||
|
0x01, 0x0f // 30 - 31
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ID_NORMAL 0x55201041
|
#define ID_NORMAL 0x55201041
|
||||||
#define ID_PLUS 0xAA201041
|
#define ID_PLUS 0xAA201041
|
||||||
@@ -314,10 +327,10 @@ void A7105_Init(void)
|
|||||||
uint8_t *A7105_Regs=0;
|
uint8_t *A7105_Regs=0;
|
||||||
uint8_t vco_calibration0, vco_calibration1;
|
uint8_t vco_calibration0, vco_calibration1;
|
||||||
|
|
||||||
#ifdef FLYZONE_A7105_INO
|
#ifdef HEIGHT_A7105_INO
|
||||||
if(protocol==PROTO_FLYZONE)
|
if(protocol==PROTO_HEIGHT)
|
||||||
{
|
{
|
||||||
A7105_Regs=(uint8_t*)FLYZONE_A7105_regs;
|
A7105_Regs=(uint8_t*)HEIGHT_A7105_regs;
|
||||||
A7105_WriteID(0x25A53C45);
|
A7105_WriteID(0x25A53C45);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -348,13 +361,15 @@ void A7105_Init(void)
|
|||||||
#ifdef FLYSKY_A7105_INO
|
#ifdef FLYSKY_A7105_INO
|
||||||
if(protocol==PROTO_FLYSKY)
|
if(protocol==PROTO_FLYSKY)
|
||||||
A7105_Regs=(uint8_t*)FLYSKY_A7105_regs;
|
A7105_Regs=(uint8_t*)FLYSKY_A7105_regs;
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
#if defined(AFHDS2A_A7105_INO) || defined(AFHDS2A_RX_A7105_INO)
|
#if defined(AFHDS2A_A7105_INO) || defined(AFHDS2A_RX_A7105_INO)
|
||||||
|
if(protocol==PROTO_AFHDS2A)
|
||||||
A7105_Regs=(uint8_t*)AFHDS2A_A7105_regs;
|
A7105_Regs=(uint8_t*)AFHDS2A_A7105_regs;
|
||||||
#endif
|
#endif
|
||||||
}
|
#ifdef KYOSHO_A7105_INO
|
||||||
|
if(protocol==PROTO_KYOSHO)
|
||||||
|
A7105_Regs=(uint8_t*)KYOSHO_A7105_regs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 0x32; i++)
|
for (uint8_t i = 0; i < 0x32; i++)
|
||||||
@@ -368,11 +383,28 @@ void A7105_Init(void)
|
|||||||
if(i==0x20) val=0x1E;
|
if(i==0x20) val=0x1E;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HEIGHT_A7105_INO
|
||||||
|
if(protocol==PROTO_HEIGHT && sub_protocol==HEIGHT_8CH)
|
||||||
|
if(i==0x03) val=0x0A;
|
||||||
|
#endif
|
||||||
if( val != 0xFF)
|
if( val != 0xFF)
|
||||||
A7105_WriteReg(i, val);
|
A7105_WriteReg(i, val);
|
||||||
}
|
}
|
||||||
A7105_Strobe(A7105_STANDBY);
|
A7105_Strobe(A7105_STANDBY);
|
||||||
|
|
||||||
|
if(protocol==PROTO_KYOSHO)
|
||||||
|
{//strange calibration...
|
||||||
|
//IF Filter Bank Calibration
|
||||||
|
A7105_WriteReg(A7105_02_CALC,0x0F);
|
||||||
|
while(A7105_ReadReg(A7105_02_CALC)); // Wait for calibration to end
|
||||||
|
// A7105_ReadReg(A7105_22_IF_CALIB_I);
|
||||||
|
// A7105_ReadReg(A7105_24_VCO_CURCAL);
|
||||||
|
// A7105_ReadReg(25_VCO_SBCAL_I);
|
||||||
|
// A7105_ReadReg(1A_RX_GAIN_II);
|
||||||
|
// A7105_ReadReg(1B_RX_GAIN_III);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//IF Filter Bank Calibration
|
//IF Filter Bank Calibration
|
||||||
A7105_WriteReg(A7105_02_CALC,1);
|
A7105_WriteReg(A7105_02_CALC,1);
|
||||||
while(A7105_ReadReg(A7105_02_CALC)); // Wait for calibration to end
|
while(A7105_ReadReg(A7105_02_CALC)); // Wait for calibration to end
|
||||||
@@ -409,7 +441,7 @@ void A7105_Init(void)
|
|||||||
case PROTO_FLYSKY:
|
case PROTO_FLYSKY:
|
||||||
vco_calibration1=0x08;
|
vco_calibration1=0x08;
|
||||||
break;
|
break;
|
||||||
case PROTO_FLYZONE:
|
case PROTO_HEIGHT:
|
||||||
vco_calibration1=0x02;
|
vco_calibration1=0x02;
|
||||||
break;
|
break;
|
||||||
case PROTO_PELIKAN:
|
case PROTO_PELIKAN:
|
||||||
@@ -421,6 +453,7 @@ void A7105_Init(void)
|
|||||||
}
|
}
|
||||||
A7105_WriteReg(A7105_25_VCO_SBCAL_I,vco_calibration1); //Reset VCO Band calibration
|
A7105_WriteReg(A7105_25_VCO_SBCAL_I,vco_calibration1); //Reset VCO Band calibration
|
||||||
}
|
}
|
||||||
|
}
|
||||||
A7105_SetTxRxMode(TX_EN);
|
A7105_SetTxRxMode(TX_EN);
|
||||||
A7105_SetPower();
|
A7105_SetPower();
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ static void __attribute__((unused)) AFHDS2A_Rx_build_telemetry_packet()
|
|||||||
packet_in[idx++] = 14; // number of channels in packet
|
packet_in[idx++] = 14; // number of channels in packet
|
||||||
// pack channels
|
// pack channels
|
||||||
for (uint8_t i = 0; i < 14; i++) {
|
for (uint8_t i = 0; i < 14; i++) {
|
||||||
uint32_t val = packet[9+i*2] | (packet[10+i*2] << 8);
|
uint32_t val = packet[9+i*2] | ((packet[10+i*2] << 8)&0x0F);
|
||||||
if (val < 860)
|
if (val < 860)
|
||||||
val = 860;
|
val = 860;
|
||||||
// convert ppm (860-2140) to Multi (0-2047)
|
// convert ppm (860-2140) to Multi (0-2047)
|
||||||
@@ -90,8 +90,6 @@ uint16_t initAFHDS2A_Rx()
|
|||||||
|
|
||||||
uint16_t AFHDS2A_Rx_callback()
|
uint16_t AFHDS2A_Rx_callback()
|
||||||
{
|
{
|
||||||
static uint32_t pps_timer = 0;
|
|
||||||
static uint16_t pps_counter = 0;
|
|
||||||
static int8_t read_retry;
|
static int8_t read_retry;
|
||||||
int16_t temp;
|
int16_t temp;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
#define AFHDS2A_RXPACKET_SIZE 37
|
#define AFHDS2A_RXPACKET_SIZE 37
|
||||||
#define AFHDS2A_NUMFREQ 16
|
#define AFHDS2A_NUMFREQ 16
|
||||||
|
|
||||||
|
#if not defined TELEMETRY
|
||||||
|
uint8_t RX_LQI=0;
|
||||||
|
#endif
|
||||||
|
|
||||||
enum{
|
enum{
|
||||||
AFHDS2A_PACKET_STICKS,
|
AFHDS2A_PACKET_STICKS,
|
||||||
AFHDS2A_PACKET_SETTINGS,
|
AFHDS2A_PACKET_SETTINGS,
|
||||||
@@ -65,7 +69,6 @@ static void AFHDS2A_calc_channels()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(AFHDS2A_FW_TELEMETRY) || defined(AFHDS2A_HUB_TELEMETRY)
|
|
||||||
// telemetry sensors ID
|
// telemetry sensors ID
|
||||||
enum{
|
enum{
|
||||||
AFHDS2A_SENSOR_RX_VOLTAGE = 0x00,
|
AFHDS2A_SENSOR_RX_VOLTAGE = 0x00,
|
||||||
@@ -76,10 +79,9 @@ enum{
|
|||||||
AFHDS2A_SENSOR_A3_VOLTAGE = 0x03,
|
AFHDS2A_SENSOR_A3_VOLTAGE = 0x03,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(AFHDS2A_FW_TELEMETRY) || defined(AFHDS2A_HUB_TELEMETRY)
|
||||||
static void AFHDS2A_update_telemetry()
|
static void AFHDS2A_update_telemetry()
|
||||||
{
|
{
|
||||||
if(packet[0]==0xAA && packet[9]==0xFD)
|
|
||||||
return; // ignore packets which contain the RX configuration: FD FF 32 00 01 00 FF FF FF 05 DC 05 DE FA FF FF FF FF FF FF FF FF FF FF FF FF FF FF
|
|
||||||
// Read TX RSSI
|
// Read TX RSSI
|
||||||
int16_t temp=256-(A7105_ReadReg(A7105_1D_RSSI_THOLD)*8)/5; // value from A7105 is between 8 for maximum signal strength to 160 or less
|
int16_t temp=256-(A7105_ReadReg(A7105_1D_RSSI_THOLD)*8)/5; // value from A7105 is between 8 for maximum signal strength to 160 or less
|
||||||
if(temp<0) temp=0;
|
if(temp<0) temp=0;
|
||||||
@@ -183,33 +185,60 @@ static void AFHDS2A_build_packet(uint8_t type)
|
|||||||
{
|
{
|
||||||
case AFHDS2A_PACKET_STICKS:
|
case AFHDS2A_PACKET_STICKS:
|
||||||
packet[0] = 0x58;
|
packet[0] = 0x58;
|
||||||
for(uint8_t ch=0; ch<14; ch++)
|
//16 channels + RX_LQI on channel 17
|
||||||
|
for(uint8_t ch=0; ch<num_ch; ch++)
|
||||||
{
|
{
|
||||||
uint16_t channelMicros = convert_channel_ppm(CH_AETR[ch]);
|
if(ch == 16 // CH17=RX_LQI
|
||||||
packet[9 + ch*2] = channelMicros&0xFF;
|
|
||||||
packet[10 + ch*2] = (channelMicros>>8)&0xFF;
|
|
||||||
}
|
|
||||||
#ifdef AFHDS2A_LQI_CH
|
#ifdef AFHDS2A_LQI_CH
|
||||||
// override channel with LQI
|
|| ch == (AFHDS2A_LQI_CH-1) // override channel with LQI
|
||||||
val = 2000 - 10*RX_LQI;
|
|
||||||
packet[9+((AFHDS2A_LQI_CH-1)*2)] = val & 0xff;
|
|
||||||
packet[10+((AFHDS2A_LQI_CH-1)*2)] = (val >> 8) & 0xff;
|
|
||||||
#endif
|
#endif
|
||||||
|
)
|
||||||
|
val = 2000 - 10*RX_LQI;
|
||||||
|
else
|
||||||
|
val = convert_channel_ppm(CH_AETR[ch]);
|
||||||
|
if(ch<14)
|
||||||
|
{
|
||||||
|
packet[9 + ch*2] = val;
|
||||||
|
packet[10 + ch*2] = (val>>8)&0x0F;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet[10 + (ch-14)*6] |= (val)<<4;
|
||||||
|
packet[12 + (ch-14)*6] |= (val)&0xF0;
|
||||||
|
packet[14 + (ch-14)*6] |= (val>>4)&0xF0;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AFHDS2A_PACKET_FAILSAFE:
|
case AFHDS2A_PACKET_FAILSAFE:
|
||||||
packet[0] = 0x56;
|
packet[0] = 0x56;
|
||||||
for(uint8_t ch=0; ch<14; ch++)
|
for(uint8_t ch=0; ch<num_ch; ch++)
|
||||||
{
|
{
|
||||||
#ifdef FAILSAFE_ENABLE
|
#ifdef FAILSAFE_ENABLE
|
||||||
uint16_t failsafeMicros = Failsafe_data[CH_AETR[ch]];
|
if(ch<16)
|
||||||
if( failsafeMicros!=FAILSAFE_CHANNEL_HOLD && failsafeMicros!=FAILSAFE_CHANNEL_NOPULSES)
|
val = Failsafe_data[CH_AETR[ch]];
|
||||||
|
else
|
||||||
|
val = FAILSAFE_CHANNEL_NOPULSES;
|
||||||
|
if(val!=FAILSAFE_CHANNEL_HOLD && val!=FAILSAFE_CHANNEL_NOPULSES)
|
||||||
{ // Failsafe values
|
{ // Failsafe values
|
||||||
failsafeMicros = (((failsafeMicros<<2)+failsafeMicros)>>3)+860;
|
val = (((val<<2)+val)>>3)+860;
|
||||||
packet[9 + ch*2] = failsafeMicros & 0xff;
|
if(ch<14)
|
||||||
packet[10+ ch*2] = ( failsafeMicros >> 8) & 0xff;
|
{
|
||||||
|
packet[9 + ch*2] = val;
|
||||||
|
packet[10 + ch*2] = (val>>8)&0x0F;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet[10 + (ch-14)*6] &= 0x0F;
|
||||||
|
packet[10 + (ch-14)*6] |= (val)<<4;
|
||||||
|
packet[12 + (ch-14)*6] &= 0x0F;
|
||||||
|
packet[12 + (ch-14)*6] |= (val)&0xF0;
|
||||||
|
packet[14 + (ch-14)*6] &= 0x0F;
|
||||||
|
packet[14 + (ch-14)*6] |= (val>>4)&0xF0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
if(ch<14)
|
||||||
{ // no values
|
{ // no values
|
||||||
packet[9 + ch*2] = 0xff;
|
packet[9 + ch*2] = 0xff;
|
||||||
packet[10+ ch*2] = 0xff;
|
packet[10+ ch*2] = 0xff;
|
||||||
@@ -224,17 +253,14 @@ static void AFHDS2A_build_packet(uint8_t type)
|
|||||||
if(val<50 || val>400) val=50; // default is 50Hz
|
if(val<50 || val>400) val=50; // default is 50Hz
|
||||||
packet[11]= val;
|
packet[11]= val;
|
||||||
packet[12]= val >> 8;
|
packet[12]= val >> 8;
|
||||||
if(sub_protocol == PPM_IBUS || sub_protocol == PPM_SBUS)
|
packet[13] = sub_protocol & 0x01; // 1 -> PPM output enabled
|
||||||
packet[13] = 0x01; // PPM output enabled
|
|
||||||
else
|
|
||||||
packet[13] = 0x00;
|
|
||||||
packet[14]= 0x00;
|
packet[14]= 0x00;
|
||||||
for(uint8_t i=15; i<37; i++)
|
for(uint8_t i=15; i<37; i++)
|
||||||
packet[i] = 0xff;
|
packet[i] = 0xff;
|
||||||
packet[18] = 0x05; // ?
|
packet[18] = 0x05; // ?
|
||||||
packet[19] = 0xdc; // ?
|
packet[19] = 0xdc; // ?
|
||||||
packet[20] = 0x05; // ?
|
packet[20] = 0x05; // ?
|
||||||
if(sub_protocol == PWM_SBUS || sub_protocol == PPM_SBUS)
|
if(sub_protocol&2)
|
||||||
packet[21] = 0xdd; // SBUS output enabled
|
packet[21] = 0xdd; // SBUS output enabled
|
||||||
else
|
else
|
||||||
packet[21] = 0xde; // IBUS
|
packet[21] = 0xde; // IBUS
|
||||||
@@ -352,13 +378,10 @@ uint16_t ReadAFHDS2A()
|
|||||||
if(packet[0] == 0xAA && packet[9] == 0xFC)
|
if(packet[0] == 0xAA && packet[9] == 0xFC)
|
||||||
packet_type=AFHDS2A_PACKET_SETTINGS; // RX is asking for settings
|
packet_type=AFHDS2A_PACKET_SETTINGS; // RX is asking for settings
|
||||||
else
|
else
|
||||||
if(packet[0] == 0xAA || packet[0] == 0xAC)
|
if((packet[0] == 0xAA && packet[9]!=0xFD) || packet[0] == 0xAC)
|
||||||
{
|
{// Normal telemetry packet, ignore packets which contain the RX configuration: AA FD FF 32 00 01 00 FF FF FF 05 DC 05 DE FA FF FF FF FF FF FF FF FF FF FF FF FF FF FF
|
||||||
if(!memcmp(&packet[1], rx_tx_addr, 4))
|
if(!memcmp(&packet[1], rx_tx_addr, 4))
|
||||||
{ // TX address validated
|
{ // TX address validated
|
||||||
#ifdef AFHDS2A_LQI_CH
|
|
||||||
if(packet[0]==0xAA && packet[9]!=0xFD)
|
|
||||||
{// Normal telemetry packet
|
|
||||||
for(uint8_t sensor=0; sensor<7; sensor++)
|
for(uint8_t sensor=0; sensor<7; sensor++)
|
||||||
{//read LQI value for RX output
|
{//read LQI value for RX output
|
||||||
uint8_t index = 9+(4*sensor);
|
uint8_t index = 9+(4*sensor);
|
||||||
@@ -368,8 +391,6 @@ uint16_t ReadAFHDS2A()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if defined(AFHDS2A_FW_TELEMETRY) || defined(AFHDS2A_HUB_TELEMETRY)
|
#if defined(AFHDS2A_FW_TELEMETRY) || defined(AFHDS2A_HUB_TELEMETRY)
|
||||||
AFHDS2A_update_telemetry();
|
AFHDS2A_update_telemetry();
|
||||||
#endif
|
#endif
|
||||||
@@ -416,6 +437,10 @@ uint16_t initAFHDS2A()
|
|||||||
rx_id[i]=eeprom_read_byte((EE_ADDR)(addr+i));
|
rx_id[i]=eeprom_read_byte((EE_ADDR)(addr+i));
|
||||||
}
|
}
|
||||||
hopping_frequency_no = 0;
|
hopping_frequency_no = 0;
|
||||||
|
if(sub_protocol&0x04)
|
||||||
|
num_ch=17;
|
||||||
|
else
|
||||||
|
num_ch=14;
|
||||||
return 50000;
|
return 50000;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -126,8 +126,6 @@ uint16_t Bayang_Rx_callback()
|
|||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
static int8_t read_retry;
|
static int8_t read_retry;
|
||||||
static uint16_t pps_counter;
|
|
||||||
static uint32_t pps_timer = 0;
|
|
||||||
|
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case BAYANG_RX_BIND:
|
case BAYANG_RX_BIND:
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ Multiprotocol is distributed in the hope that it will be useful,
|
|||||||
#include "iface_cyrf6936.h"
|
#include "iface_cyrf6936.h"
|
||||||
|
|
||||||
//#define DSM_DEBUG_RF
|
//#define DSM_DEBUG_RF
|
||||||
|
//#define DSM_DEBUG_CH
|
||||||
|
|
||||||
uint8_t DSM_rx_type;
|
uint8_t DSM_rx_type;
|
||||||
|
|
||||||
@@ -85,6 +86,11 @@ static uint8_t __attribute__((unused)) DSM_Rx_check_packet()
|
|||||||
packet[0] ^= 0xff;
|
packet[0] ^= 0xff;
|
||||||
packet[1] ^= 0xff;
|
packet[1] ^= 0xff;
|
||||||
}
|
}
|
||||||
|
#ifdef DSM_DEBUG_CH
|
||||||
|
for(uint8_t i=0;i<len;i++)
|
||||||
|
debug("%02X ",packet[i]);
|
||||||
|
debugln("");
|
||||||
|
#endif
|
||||||
if(packet[0] == cyrfmfg_id[2] && packet[1] == cyrfmfg_id[3])
|
if(packet[0] == cyrfmfg_id[2] && packet[1] == cyrfmfg_id[3])
|
||||||
return 0x02; // Packet ok
|
return 0x02; // Packet ok
|
||||||
}
|
}
|
||||||
@@ -111,14 +117,15 @@ static void __attribute__((unused)) DSM_Rx_build_telemetry_packet()
|
|||||||
uint16_t value=(packet[i*2+2]<<8) | packet[i*2+3];
|
uint16_t value=(packet[i*2+2]<<8) | packet[i*2+3];
|
||||||
if(value!=0xFFFF)
|
if(value!=0xFFFF)
|
||||||
{
|
{
|
||||||
idx=(value&0x7FFF)>>nbr_bits; // retrieve channel index 0..12
|
idx=(value&0x7FFF)>>nbr_bits; // retrieve channel index
|
||||||
|
#ifdef DSM_DEBUG_CH
|
||||||
|
debugln("i=%d,v=%d,u=%X",idx,value&0x7FF,value&0x8000);
|
||||||
|
#endif
|
||||||
if(idx<13)
|
if(idx<13)
|
||||||
{
|
{
|
||||||
if(nbr_bits==10) value <<= 1; // switch to 11 bits
|
if(nbr_bits==10) value <<= 1; // switch to 11 bits
|
||||||
value &= 0x7FF;
|
value &= 0x7FF;
|
||||||
rx_rc_chan[CH_TAER[idx]]=convert_channel_DSM_nolimit(value);
|
rx_rc_chan[CH_TAER[idx]]=convert_channel_DSM_nolimit(value);
|
||||||
if(IS_DISABLE_CH_MAP_off && (CH_TAER[idx]==AILERON || CH_TAER[idx]==RUDDER))
|
|
||||||
rx_rc_chan[CH_TAER[idx]]=2047-rx_rc_chan[CH_TAER[idx]]; // Reverse AILERON and RUDDER channels
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,12 +209,15 @@ uint16_t DSM_Rx_callback()
|
|||||||
{
|
{
|
||||||
uint8_t rx_status;
|
uint8_t rx_status;
|
||||||
static uint8_t read_retry=0;
|
static uint8_t read_retry=0;
|
||||||
static uint16_t pps_counter;
|
|
||||||
static uint32_t pps_timer = 0;
|
|
||||||
|
|
||||||
switch (phase)
|
switch (phase)
|
||||||
{
|
{
|
||||||
case DSM_RX_BIND1:
|
case DSM_RX_BIND1:
|
||||||
|
if(IS_BIND_DONE) // Abort bind
|
||||||
|
{
|
||||||
|
phase = DSM_RX_DATA_PREP;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(packet_count==0)
|
if(packet_count==0)
|
||||||
read_retry=0;
|
read_retry=0;
|
||||||
//Check received data
|
//Check received data
|
||||||
@@ -238,11 +248,11 @@ uint16_t DSM_Rx_callback()
|
|||||||
if(num_ch>12) num_ch=12;
|
if(num_ch>12) num_ch=12;
|
||||||
//check DSM_rx_type
|
//check DSM_rx_type
|
||||||
/*packet[12] 1 byte -> max DSM type allowed:
|
/*packet[12] 1 byte -> max DSM type allowed:
|
||||||
0x01 => 22ms 1024 DSM2 1 packet => number of channels is <8 and no telemetry
|
0x01 => 22ms 1024 DSM2 1 packet => number of channels is <8
|
||||||
0x02 => 22ms 1024 DSM2 2 packets => either a number of channel >7 or telemetry enable RX
|
0x02 => 22ms 1024 DSM2 2 packets => either a number of channel >7
|
||||||
0x12 => 11ms 2048 DSM2 2 packets => can be any number of channels with/without telemetry
|
0x12 => 11ms 2048 DSM2 2 packets => can be any number of channels
|
||||||
0xA2 => 22ms 2048 DSMX 1 packet => number of channels is <8 and no telemetry
|
0xA2 => 22ms 2048 DSMX 1 packet => number of channels is <8
|
||||||
0xB2 => 11ms 2048 DSMX => can be any number of channels with/without telemetry
|
0xB2 => 11ms 2048 DSMX => can be any number of channels
|
||||||
(0x01 or 0xA2) and num_ch < 7 => 22ms else 11ms
|
(0x01 or 0xA2) and num_ch < 7 => 22ms else 11ms
|
||||||
&0x80 => false=DSM2, true=DSMX
|
&0x80 => false=DSM2, true=DSMX
|
||||||
&0xF0 => false=1024, true=2048 */
|
&0xF0 => false=1024, true=2048 */
|
||||||
@@ -277,7 +287,7 @@ uint16_t DSM_Rx_callback()
|
|||||||
}
|
}
|
||||||
DSM_abort_channel_rx(0); // Abort RX operation and receive
|
DSM_abort_channel_rx(0); // Abort RX operation and receive
|
||||||
if(read_retry==0)
|
if(read_retry==0)
|
||||||
read_retry=4;
|
read_retry=8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if(rx_status & 0x02) // RX error
|
if(rx_status & 0x02) // RX error
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
#include "iface_cyrf6936.h"
|
#include "iface_cyrf6936.h"
|
||||||
|
|
||||||
|
//#define DSM_GR300
|
||||||
|
|
||||||
#define DSM_BIND_CHANNEL 0x0d //13 This can be any odd channel
|
#define DSM_BIND_CHANNEL 0x0d //13 This can be any odd channel
|
||||||
|
|
||||||
//During binding we will send BIND_COUNT/2 packets
|
//During binding we will send BIND_COUNT/2 packets
|
||||||
@@ -43,7 +45,8 @@ enum {
|
|||||||
//
|
//
|
||||||
uint8_t ch_map[14];
|
uint8_t ch_map[14];
|
||||||
const uint8_t PROGMEM DSM_ch_map_progmem[][14] = {
|
const uint8_t PROGMEM DSM_ch_map_progmem[][14] = {
|
||||||
//22+11ms for 4..7 channels
|
//22+11ms for 3..7 channels
|
||||||
|
{1, 0, 2, 0xff, 0xff, 0xff, 0xff, 1, 0, 2, 0xff, 0xff, 0xff, 0xff}, //3ch - Guess
|
||||||
{1, 0, 2, 3, 0xff, 0xff, 0xff, 1, 0, 2, 3, 0xff, 0xff, 0xff}, //4ch - Guess
|
{1, 0, 2, 3, 0xff, 0xff, 0xff, 1, 0, 2, 3, 0xff, 0xff, 0xff}, //4ch - Guess
|
||||||
{1, 0, 2, 3, 4, 0xff, 0xff, 1, 0, 2, 3, 4, 0xff, 0xff}, //5ch - Guess
|
{1, 0, 2, 3, 4, 0xff, 0xff, 1, 0, 2, 3, 4, 0xff, 0xff}, //5ch - Guess
|
||||||
{1, 5, 2, 3, 0, 4, 0xff, 1, 5, 2, 3, 0, 4, 0xff}, //6ch - HP6DSM
|
{1, 5, 2, 3, 0, 4, 0xff, 1, 5, 2, 3, 0, 4, 0xff}, //6ch - HP6DSM
|
||||||
@@ -53,11 +56,12 @@ const uint8_t PROGMEM DSM_ch_map_progmem[][14] = {
|
|||||||
{1, 5, 2, 3, 6, 0xff, 0xff, 4, 0, 7, 8, 0xff, 0xff, 0xff}, //9ch - Guess
|
{1, 5, 2, 3, 6, 0xff, 0xff, 4, 0, 7, 8, 0xff, 0xff, 0xff}, //9ch - Guess
|
||||||
{1, 5, 2, 3, 6, 0xff, 0xff, 4, 0, 7, 8, 9, 0xff, 0xff}, //10ch - Guess
|
{1, 5, 2, 3, 6, 0xff, 0xff, 4, 0, 7, 8, 9, 0xff, 0xff}, //10ch - Guess
|
||||||
{1, 5, 2, 3, 6, 10, 0xff, 4, 0, 7, 8, 9, 0xff, 0xff}, //11ch - Guess
|
{1, 5, 2, 3, 6, 10, 0xff, 4, 0, 7, 8, 9, 0xff, 0xff}, //11ch - Guess
|
||||||
{1, 5, 2, 4, 6, 10, 0xff, 0, 7, 3, 8, 9 , 11 , 0xff}, //12ch - DX18
|
{1, 5, 2, 4, 6, 10, 0xff, 0, 7, 3, 8, 9 , 11 , 0xff}, //12ch - DX18/DX8G2
|
||||||
//11ms for 8..12 channels
|
//11ms for 8..11 channels
|
||||||
{1, 5, 2, 3, 6, 7, 0xff, 1, 5, 2, 4, 0, 0xff, 0xff}, //8ch - DX7
|
{1, 5, 2, 3, 6, 7, 0xff, 1, 5, 2, 4, 0, 0xff, 0xff}, //8ch - DX7
|
||||||
{1, 5, 2, 3, 6, 7, 0xff, 1, 5, 2, 4, 0, 8, 0xff}, //9ch - Guess
|
{1, 5, 2, 3, 6, 7, 0xff, 1, 5, 2, 4, 0, 8, 0xff}, //9ch - Guess
|
||||||
{1, 5, 2, 3, 4, 8, 9, 1, 5, 2, 3, 0, 7, 6 }, //10ch - DX18
|
{1, 5, 2, 3, 4, 8, 9, 1, 5, 2, 3, 0, 7, 6 }, //10ch - DX18
|
||||||
|
{1, 5, 2, 3, 4, 8, 9, 1, 10, 2, 3, 0, 7, 6 }, //11ch - Guess
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __attribute__((unused)) DSM_build_bind_packet()
|
static void __attribute__((unused)) DSM_build_bind_packet()
|
||||||
@@ -77,20 +81,23 @@ static void __attribute__((unused)) DSM_build_bind_packet()
|
|||||||
packet[8] = sum >> 8;
|
packet[8] = sum >> 8;
|
||||||
packet[9] = sum & 0xff;
|
packet[9] = sum & 0xff;
|
||||||
packet[10] = 0x01; // ???
|
packet[10] = 0x01; // ???
|
||||||
|
if(sub_protocol==DSM_AUTO)
|
||||||
|
packet[11] = 12;
|
||||||
|
else
|
||||||
packet[11] = num_ch;
|
packet[11] = num_ch;
|
||||||
|
|
||||||
if (sub_protocol==DSM2_22)
|
if (sub_protocol==DSM2_22)
|
||||||
packet[12]=num_ch<8?0x01:0x02; // DSM2/1024 1 or 2 packets depending on the number of channels
|
packet[12]=num_ch<8?0x01:0x02; // DSM2/1024 1 or 2 packets depending on the number of channels
|
||||||
if(sub_protocol==DSM2_11)
|
else if(sub_protocol==DSM2_11)
|
||||||
packet[12]=0x12; // DSM2/2048 2 packets
|
packet[12]=0x12; // DSM2/2048 2 packets
|
||||||
if(sub_protocol==DSMX_22)
|
else if(sub_protocol==DSMX_22)
|
||||||
#if defined DSM_TELEMETRY
|
#if defined DSM_TELEMETRY
|
||||||
packet[12] = 0xb2; // DSMX/2048 2 packets
|
packet[12] = 0xb2; // DSMX/2048 2 packets
|
||||||
#else
|
#else
|
||||||
packet[12] = num_ch<8? 0xa2 : 0xb2; // DSMX/2048 1 or 2 packets depending on the number of channels
|
packet[12] = num_ch<8? 0xa2 : 0xb2; // DSMX/2048 1 or 2 packets depending on the number of channels
|
||||||
#endif
|
#endif
|
||||||
if(sub_protocol==DSMX_11 || sub_protocol==DSM_AUTO) // Force DSMX/1024 in mode Auto
|
else // DSMX_11 && DSM_AUTO
|
||||||
packet[12]=0xb2; // DSMX/1024 2 packets
|
packet[12]=0xb2; // DSMX/2048 2 packets
|
||||||
|
|
||||||
packet[13] = 0x00; //???
|
packet[13] = 0x00; //???
|
||||||
for(i = 8; i < 14; i++)
|
for(i = 8; i < 14; i++)
|
||||||
@@ -112,17 +119,15 @@ static void __attribute__((unused)) DSM_initialize_bind_phase()
|
|||||||
static void __attribute__((unused)) DSM_update_channels()
|
static void __attribute__((unused)) DSM_update_channels()
|
||||||
{
|
{
|
||||||
prev_option=option;
|
prev_option=option;
|
||||||
if(sub_protocol==DSM_AUTO)
|
num_ch=option & 0x0F; // Remove flags 0x80=max_throw, 0x40=11ms
|
||||||
num_ch=12; // Force 12 channels in mode Auto
|
|
||||||
else
|
if(num_ch<3 || num_ch>12)
|
||||||
num_ch=option & 0x7F; // Remove the Max Throw flag
|
|
||||||
if(num_ch<4 || num_ch>12)
|
|
||||||
num_ch=6; // Default to 6 channels if invalid choice...
|
num_ch=6; // Default to 6 channels if invalid choice...
|
||||||
|
|
||||||
// Create channel map based on number of channels and refresh rate
|
// Create channel map based on number of channels and refresh rate
|
||||||
uint8_t idx=num_ch-4;
|
uint8_t idx=num_ch-3;
|
||||||
if(num_ch>7 && num_ch<11 && (sub_protocol==DSM2_11 || sub_protocol==DSMX_11))
|
if((option & 0x40) && num_ch>7 && num_ch<12)
|
||||||
idx+=5; // In 11ms mode change index only for channels 8..10
|
idx+=5; // In 11ms mode change index only for channels 8..11
|
||||||
for(uint8_t i=0;i<14;i++)
|
for(uint8_t i=0;i<14;i++)
|
||||||
ch_map[i]=pgm_read_byte_near(&DSM_ch_map_progmem[idx][i]);
|
ch_map[i]=pgm_read_byte_near(&DSM_ch_map_progmem[idx][i]);
|
||||||
}
|
}
|
||||||
@@ -135,12 +140,12 @@ static void __attribute__((unused)) DSM_build_data_packet(uint8_t upper)
|
|||||||
DSM_update_channels();
|
DSM_update_channels();
|
||||||
|
|
||||||
if (sub_protocol==DSMX_11 || sub_protocol==DSMX_22 )
|
if (sub_protocol==DSMX_11 || sub_protocol==DSMX_22 )
|
||||||
{
|
{//DSMX
|
||||||
packet[0] = cyrfmfg_id[2];
|
packet[0] = cyrfmfg_id[2];
|
||||||
packet[1] = cyrfmfg_id[3];
|
packet[1] = cyrfmfg_id[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{//DSM2
|
||||||
packet[0] = (0xff ^ cyrfmfg_id[2]);
|
packet[0] = (0xff ^ cyrfmfg_id[2]);
|
||||||
packet[1] = (0xff ^ cyrfmfg_id[3]);
|
packet[1] = (0xff ^ cyrfmfg_id[3]);
|
||||||
if(sub_protocol==DSM2_22)
|
if(sub_protocol==DSM2_22)
|
||||||
@@ -152,7 +157,9 @@ static void __attribute__((unused)) DSM_build_data_packet(uint8_t upper)
|
|||||||
for (uint8_t i = 0; i < 7; i++)
|
for (uint8_t i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
uint8_t idx = ch_map[(upper?7:0) + i]; // 1,5,2,3,0,4
|
uint8_t idx = ch_map[(upper?7:0) + i]; // 1,5,2,3,0,4
|
||||||
uint16_t value = 0xffff;;
|
uint16_t value = 0xffff;
|
||||||
|
if((option&0x40) == 0 && num_ch < 8 && upper)
|
||||||
|
idx=0xff; // in 22ms do not transmit upper channels if <8, is it the right method???
|
||||||
if (idx != 0xff)
|
if (idx != 0xff)
|
||||||
{
|
{
|
||||||
/* Spektrum own remotes transmit normal values during bind and actually use this (e.g. Nano CP X) to
|
/* Spektrum own remotes transmit normal values during bind and actually use this (e.g. Nano CP X) to
|
||||||
@@ -174,7 +181,7 @@ static void __attribute__((unused)) DSM_build_data_packet(uint8_t upper)
|
|||||||
if(option & 0x80)
|
if(option & 0x80)
|
||||||
value=Channel_data[CH_TAER[idx]]; // -100%..+100% => 1024..1976us and -125%..+125% => 904..2096us based on Redcon 6 channel DSM2 RX
|
value=Channel_data[CH_TAER[idx]]; // -100%..+100% => 1024..1976us and -125%..+125% => 904..2096us based on Redcon 6 channel DSM2 RX
|
||||||
else
|
else
|
||||||
value=convert_channel_16b_nolimit(CH_TAER[idx],0x150,0x6B0); // -100%..+100% => 1100..1900us and -125%..+125% => 1000..2000us based on Redcon 6 channel DSM2 RX
|
value=convert_channel_16b_nolimit(CH_TAER[idx],0x156,0x6AA); // -100%..+100% => 1100..1900us and -125%..+125% => 1000..2000us based on a DX8 G2 dump
|
||||||
#endif
|
#endif
|
||||||
if(bits==10) value>>=1;
|
if(bits==10) value>>=1;
|
||||||
value |= (upper && i==0 ? 0x8000 : 0) | (idx << bits);
|
value |= (upper && i==0 ? 0x8000 : 0) | (idx << bits);
|
||||||
@@ -216,6 +223,11 @@ uint16_t ReadDsm()
|
|||||||
#endif
|
#endif
|
||||||
uint8_t start;
|
uint8_t start;
|
||||||
|
|
||||||
|
#ifdef DSM_GR300
|
||||||
|
uint16_t timing=5000+(convert_channel_8b(CH13)*100);
|
||||||
|
debugln("T=%u",timing);
|
||||||
|
#endif
|
||||||
|
|
||||||
switch(phase)
|
switch(phase)
|
||||||
{
|
{
|
||||||
case DSM_BIND_WRITE:
|
case DSM_BIND_WRITE:
|
||||||
@@ -249,7 +261,14 @@ uint16_t ReadDsm()
|
|||||||
CYRF_ReadDataPacketLen(packet_in+1, 10);
|
CYRF_ReadDataPacketLen(packet_in+1, 10);
|
||||||
if(DSM_Check_RX_packet())
|
if(DSM_Check_RX_packet())
|
||||||
{
|
{
|
||||||
|
debug("Bind");
|
||||||
|
for(uint8_t i=0;i<10;i++)
|
||||||
|
debug(" %02X",packet_in[i+1]);
|
||||||
|
debugln("");
|
||||||
packet_in[0]=0x80;
|
packet_in[0]=0x80;
|
||||||
|
packet_in[6]&=0x0F; // It looks like there is a flag 0x40 being added by some receivers
|
||||||
|
if(packet_in[6]>12) packet_in[6]=12;
|
||||||
|
else if(packet_in[6]<3) packet_in[6]=6;
|
||||||
telemetry_link=1; // Send received data on serial
|
telemetry_link=1; // Send received data on serial
|
||||||
phase++;
|
phase++;
|
||||||
return 2000;
|
return 2000;
|
||||||
@@ -293,6 +312,11 @@ uint16_t ReadDsm()
|
|||||||
DSM_build_data_packet(phase == DSM_CH1_WRITE_B||phase == DSM_CH2_WRITE_B); // build lower or upper channels
|
DSM_build_data_packet(phase == DSM_CH1_WRITE_B||phase == DSM_CH2_WRITE_B); // build lower or upper channels
|
||||||
CYRF_ReadRegister(CYRF_04_TX_IRQ_STATUS); // clear IRQ flags
|
CYRF_ReadRegister(CYRF_04_TX_IRQ_STATUS); // clear IRQ flags
|
||||||
CYRF_WriteDataPacket(packet);
|
CYRF_WriteDataPacket(packet);
|
||||||
|
#if 0
|
||||||
|
for(uint8_t i=0;i<16;i++)
|
||||||
|
debug(" %02X", packet[i]);
|
||||||
|
debugln("");
|
||||||
|
#endif
|
||||||
phase++; // change from WRITE to CHECK mode
|
phase++; // change from WRITE to CHECK mode
|
||||||
return DSM_WRITE_DELAY;
|
return DSM_WRITE_DELAY;
|
||||||
case DSM_CH1_CHECK_A:
|
case DSM_CH1_CHECK_A:
|
||||||
@@ -326,6 +350,10 @@ uint16_t ReadDsm()
|
|||||||
phase++; // change from CH2_CHECK to CH2_READ
|
phase++; // change from CH2_CHECK to CH2_READ
|
||||||
CYRF_SetTxRxMode(RX_EN); //Receive mode
|
CYRF_SetTxRxMode(RX_EN); //Receive mode
|
||||||
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x87); //0x80??? //Prepare to receive
|
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x87); //0x80??? //Prepare to receive
|
||||||
|
#ifdef DSM_GR300
|
||||||
|
if(num_ch==3)
|
||||||
|
return timing - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY - DSM_READ_DELAY;
|
||||||
|
#endif
|
||||||
return 11000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY - DSM_READ_DELAY;
|
return 11000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY - DSM_READ_DELAY;
|
||||||
case DSM_CH2_READ_A:
|
case DSM_CH2_READ_A:
|
||||||
case DSM_CH2_READ_B:
|
case DSM_CH2_READ_B:
|
||||||
@@ -350,6 +378,10 @@ uint16_t ReadDsm()
|
|||||||
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x00); // Clear abort RX operation
|
CYRF_WriteRegister(CYRF_29_RX_ABORT, 0x00); // Clear abort RX operation
|
||||||
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x87); //0x80??? //Prepare to receive
|
CYRF_WriteRegister(CYRF_05_RX_CTRL, 0x87); //0x80??? //Prepare to receive
|
||||||
phase = DSM_CH2_READ_B;
|
phase = DSM_CH2_READ_B;
|
||||||
|
#ifdef DSM_GR300
|
||||||
|
if(num_ch==3)
|
||||||
|
return timing;
|
||||||
|
#endif
|
||||||
return 11000;
|
return 11000;
|
||||||
}
|
}
|
||||||
if (phase == DSM_CH2_READ_A)
|
if (phase == DSM_CH2_READ_A)
|
||||||
@@ -370,11 +402,19 @@ uint16_t ReadDsm()
|
|||||||
else
|
else
|
||||||
{ //Normal mode 22ms
|
{ //Normal mode 22ms
|
||||||
phase = DSM_CH1_WRITE_A; // change from CH2_CHECK_A to CH1_WRITE_A (ie no upper)
|
phase = DSM_CH1_WRITE_A; // change from CH2_CHECK_A to CH1_WRITE_A (ie no upper)
|
||||||
|
#ifdef DSM_GR300
|
||||||
|
if(num_ch==3)
|
||||||
|
return timing - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
|
||||||
|
#endif
|
||||||
return 22000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
|
return 22000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
phase = DSM_CH1_WRITE_A; // change from CH2_CHECK_B to CH1_WRITE_A (upper already transmitted so transmit lower)
|
phase = DSM_CH1_WRITE_A; // change from CH2_CHECK_B to CH1_WRITE_A (upper already transmitted so transmit lower)
|
||||||
|
#ifdef DSM_GR300
|
||||||
|
if(num_ch==3)
|
||||||
|
return timing - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
|
||||||
|
#endif
|
||||||
return 11000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY;
|
return 11000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ static void __attribute__((unused)) DEVO_build_data_pkt()
|
|||||||
DEVO_add_pkt_suffix();
|
DEVO_add_pkt_suffix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined DEVO_HUB_TELEMETRY
|
||||||
static void __attribute__((unused)) DEVO_parse_telemetry_packet()
|
static void __attribute__((unused)) DEVO_parse_telemetry_packet()
|
||||||
{
|
{
|
||||||
DEVO_scramble_pkt(); //This will unscramble the packet
|
DEVO_scramble_pkt(); //This will unscramble the packet
|
||||||
@@ -186,6 +187,7 @@ static void __attribute__((unused)) DEVO_parse_telemetry_packet()
|
|||||||
v_lipo2 = packet[3] << 1;
|
v_lipo2 = packet[3] << 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void __attribute__((unused)) DEVO_cyrf_set_bound_sop_code()
|
static void __attribute__((unused)) DEVO_cyrf_set_bound_sop_code()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,8 +17,9 @@
|
|||||||
/** FrSky D and X routines **/
|
/** FrSky D and X routines **/
|
||||||
/******************************/
|
/******************************/
|
||||||
|
|
||||||
#if defined(FRSKYD_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYL_CC2500_INO) || defined(FRSKY_RX_CC2500_INO) || defined(FRSKYR9_SX1276_INO)
|
#if defined(FRSKYD_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYL_CC2500_INO) || defined(FRSKY_RX_CC2500_INO) || defined(FRSKYR9_SX1276_INO)
|
||||||
uint8_t FrSkyFormat=0;
|
uint8_t FrSkyFormat=0;
|
||||||
|
uint8_t FrSkyX_chanskip;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FRSKYX_CC2500_INO) || defined(FRSKYL_CC2500_INO) || defined(FRSKY_RX_CC2500_INO) || defined(FRSKYR9_SX1276_INO)
|
#if defined(FRSKYX_CC2500_INO) || defined(FRSKYL_CC2500_INO) || defined(FRSKY_RX_CC2500_INO) || defined(FRSKYR9_SX1276_INO)
|
||||||
@@ -33,7 +34,7 @@ static uint16_t __attribute__((unused)) FrSkyX_CRCTable(uint8_t val)
|
|||||||
val /= 16 ;
|
val /= 16 ;
|
||||||
return word ^ (0x1081 * val) ;
|
return word ^ (0x1081 * val) ;
|
||||||
}
|
}
|
||||||
uint16_t FrSkyX_crc(uint8_t *data, uint8_t len, uint8_t init=0)
|
uint16_t FrSkyX_crc(uint8_t *data, uint8_t len, uint16_t init=0)
|
||||||
{
|
{
|
||||||
uint16_t crc = init;
|
uint16_t crc = init;
|
||||||
for(uint8_t i=0; i < len; i++)
|
for(uint8_t i=0; i < len; i++)
|
||||||
@@ -69,14 +70,18 @@ static void __attribute__((unused)) FrSkyX_channels(uint8_t offset)
|
|||||||
FAILSAFE_VALUES_off;
|
FAILSAFE_VALUES_off;
|
||||||
}
|
}
|
||||||
failsafe_count++;
|
failsafe_count++;
|
||||||
packet[7] = FS_flag;
|
if(protocol==PROTO_FRSKY_R9)
|
||||||
|
failsafe_count++; // R9 is 20ms, X is 9ms
|
||||||
|
packet[offset] = FS_flag;
|
||||||
#else
|
#else
|
||||||
packet[7] = 0;
|
packet[offset] = 0;
|
||||||
#endif
|
#endif
|
||||||
//
|
//
|
||||||
|
packet[offset+1] = 0; //??
|
||||||
|
//
|
||||||
uint8_t chan_index = chan_start;
|
uint8_t chan_index = chan_start;
|
||||||
uint16_t ch1,ch2;
|
uint16_t ch1,ch2;
|
||||||
for(uint8_t i = offset; i < 12+offset ; i+=3)
|
for(uint8_t i = offset+2; i < 12+offset+2 ; i+=3)
|
||||||
{//12 bytes of channel data
|
{//12 bytes of channel data
|
||||||
#ifdef FAILSAFE_ENABLE
|
#ifdef FAILSAFE_ENABLE
|
||||||
if( (FS_flag & 0x10) && ((failsafe_chan & 0x07) == (chan_index & 0x07)) )
|
if( (FS_flag & 0x10) && ((failsafe_chan & 0x07) == (chan_index & 0x07)) )
|
||||||
@@ -180,11 +185,18 @@ void Frsky_init_clone(void)
|
|||||||
else if(protocol==PROTO_FRSKYX2)
|
else if(protocol==PROTO_FRSKYX2)
|
||||||
temp=FRSKYX2_CLONE_EEPROM_OFFSET;
|
temp=FRSKYX2_CLONE_EEPROM_OFFSET;
|
||||||
FrSkyFormat=eeprom_read_byte((EE_ADDR)temp++);
|
FrSkyFormat=eeprom_read_byte((EE_ADDR)temp++);
|
||||||
|
/* FRSKY_RX_D8 =0,
|
||||||
|
FRSKY_RX_D16FCC =1,
|
||||||
|
FRSKY_RX_D16LBT =2,
|
||||||
|
FRSKY_RX_D16v2FCC =3,
|
||||||
|
FRSKY_RX_D16v2LBT =4,*/
|
||||||
if(protocol==PROTO_FRSKYX)
|
if(protocol==PROTO_FRSKYX)
|
||||||
FrSkyFormat >>= 1;
|
FrSkyFormat >>= 1;
|
||||||
else
|
else
|
||||||
FrSkyFormat >>= 2;
|
FrSkyFormat >>= 2;
|
||||||
FrSkyFormat <<= 1; //FCC_16/LBT_16
|
FrSkyFormat <<= 1; //FCC_16/LBT_16
|
||||||
|
if(sub_protocol==XCLONE_8)
|
||||||
|
FrSkyFormat++; //FCC_8/LBT_8
|
||||||
rx_tx_addr[3] = eeprom_read_byte((EE_ADDR)temp++);
|
rx_tx_addr[3] = eeprom_read_byte((EE_ADDR)temp++);
|
||||||
rx_tx_addr[2] = eeprom_read_byte((EE_ADDR)temp++);
|
rx_tx_addr[2] = eeprom_read_byte((EE_ADDR)temp++);
|
||||||
rx_tx_addr[1] = eeprom_read_byte((EE_ADDR)temp++);
|
rx_tx_addr[1] = eeprom_read_byte((EE_ADDR)temp++);
|
||||||
@@ -275,7 +287,7 @@ void Frsky_init_clone(void)
|
|||||||
//FRSKYX
|
//FRSKYX
|
||||||
/*02_IOCFG0*/ 0x06 ,
|
/*02_IOCFG0*/ 0x06 ,
|
||||||
/*00_IOCFG2*/ 0x06 ,
|
/*00_IOCFG2*/ 0x06 ,
|
||||||
/*17_MCSM1*/ 0x0c , //X2->0x0E -> Go/Stay in RX mode
|
/*17_MCSM1*/ 0x0c , //X2->0x0E -> RX stays in RX and TX stays in TX???
|
||||||
/*18_MCSM0*/ 0x18 ,
|
/*18_MCSM0*/ 0x18 ,
|
||||||
/*06_PKTLEN*/ 0x1E ,
|
/*06_PKTLEN*/ 0x1E ,
|
||||||
/*07_PKTCTRL1*/ 0x04 ,
|
/*07_PKTCTRL1*/ 0x04 ,
|
||||||
@@ -376,8 +388,7 @@ void Frsky_init_clone(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FRSKYX_CC2500_INO) || defined(FRSKYL_CC2500_INO)
|
#if defined(FRSKYX_CC2500_INO) || defined(FRSKYR9_SX1276_INO)
|
||||||
uint8_t FrSkyX_chanskip;
|
|
||||||
uint8_t FrSkyX_TX_Seq, FrSkyX_TX_IN_Seq;
|
uint8_t FrSkyX_TX_Seq, FrSkyX_TX_IN_Seq;
|
||||||
uint8_t FrSkyX_RX_Seq ;
|
uint8_t FrSkyX_RX_Seq ;
|
||||||
|
|
||||||
@@ -391,6 +402,106 @@ uint8_t FrSkyX_RX_Seq ;
|
|||||||
struct t_FrSkyX_TX_Frame FrSkyX_TX_Frames[4] ;
|
struct t_FrSkyX_TX_Frame FrSkyX_TX_Frames[4] ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void __attribute__((unused)) FrSkyX_seq_sport(uint8_t start, uint8_t end)
|
||||||
|
{
|
||||||
|
for (uint8_t i=start+1;i<=end;i++)
|
||||||
|
packet[i]=0;
|
||||||
|
packet[start] = FrSkyX_RX_Seq << 4; //TX=8 at startup
|
||||||
|
#ifdef SPORT_SEND
|
||||||
|
if (FrSkyX_TX_IN_Seq!=0xFF)
|
||||||
|
{//RX has replied at least once
|
||||||
|
if (FrSkyX_TX_IN_Seq & 0x08)
|
||||||
|
{//Request init
|
||||||
|
//debugln("Init");
|
||||||
|
FrSkyX_TX_Seq = 0 ;
|
||||||
|
for(uint8_t i=0;i<4;i++)
|
||||||
|
FrSkyX_TX_Frames[i].count=0; //Discard frames in current output buffer
|
||||||
|
}
|
||||||
|
else if (FrSkyX_TX_IN_Seq & 0x04)
|
||||||
|
{//Retransmit the requested packet
|
||||||
|
debugln("Retry:%d",FrSkyX_TX_IN_Seq&0x03);
|
||||||
|
packet[start] |= FrSkyX_TX_IN_Seq&0x03;
|
||||||
|
packet[start+1] = FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq&0x03].count;
|
||||||
|
for (uint8_t i=start+2;i<start+2+FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq&0x03].count;i++)
|
||||||
|
packet[i] = FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq&0x03].payload[i];
|
||||||
|
}
|
||||||
|
else if ( FrSkyX_TX_Seq != 0x08 )
|
||||||
|
{
|
||||||
|
if(FrSkyX_TX_Seq==FrSkyX_TX_IN_Seq)
|
||||||
|
{//Send packet from the incoming radio buffer
|
||||||
|
//debugln("Send:%d",FrSkyX_TX_Seq);
|
||||||
|
packet[start] |= FrSkyX_TX_Seq;
|
||||||
|
uint8_t nbr_bytes=0;
|
||||||
|
for (uint8_t i=start+2;i<=end;i++)
|
||||||
|
{
|
||||||
|
if(SportHead==SportTail)
|
||||||
|
break; //buffer empty
|
||||||
|
packet[i]=SportData[SportHead];
|
||||||
|
FrSkyX_TX_Frames[FrSkyX_TX_Seq].payload[i-start+2]=SportData[SportHead];
|
||||||
|
SportHead=(SportHead+1) & (MAX_SPORT_BUFFER-1);
|
||||||
|
nbr_bytes++;
|
||||||
|
}
|
||||||
|
packet[start+1]=nbr_bytes;
|
||||||
|
FrSkyX_TX_Frames[FrSkyX_TX_Seq].count=nbr_bytes;
|
||||||
|
if(nbr_bytes)
|
||||||
|
{//Check the buffer status
|
||||||
|
uint8_t used = SportTail;
|
||||||
|
if ( SportHead > SportTail )
|
||||||
|
used += MAX_SPORT_BUFFER - SportHead ;
|
||||||
|
else
|
||||||
|
used -= SportHead ;
|
||||||
|
if ( used < (MAX_SPORT_BUFFER>>1) )
|
||||||
|
{
|
||||||
|
DATA_BUFFER_LOW_off;
|
||||||
|
debugln("Ok buf:%d",used);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FrSkyX_TX_Seq = ( FrSkyX_TX_Seq + 1 ) & 0x03 ; //Next iteration send next packet
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//Not in sequence somehow, transmit what the receiver wants but why not asking for retransmit...
|
||||||
|
//debugln("RX_Seq:%d,TX:%d",FrSkyX_TX_IN_Seq,FrSkyX_TX_Seq);
|
||||||
|
packet[start] |= FrSkyX_TX_IN_Seq;
|
||||||
|
packet[start+1] = FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq].count;
|
||||||
|
for (uint8_t i=start+2;i<start+2+FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq].count;i++)
|
||||||
|
packet[i] = FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq].payload[i-start+2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
packet[start] |= 0x08 ; //FrSkyX_TX_Seq=8 at startup
|
||||||
|
}
|
||||||
|
if(packet[start+1])
|
||||||
|
{//Debug
|
||||||
|
debug("SP: ");
|
||||||
|
for(uint8_t i=0;i<packet[start+1];i++)
|
||||||
|
debug("%02X ",packet[start+2+i]);
|
||||||
|
debugln("");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
packet[start] |= FrSkyX_TX_Seq ;//TX=8 at startup
|
||||||
|
if ( !(FrSkyX_TX_IN_Seq & 0xF8) )
|
||||||
|
FrSkyX_TX_Seq = ( FrSkyX_TX_Seq + 1 ) & 0x03 ; // Next iteration send next packet
|
||||||
|
#endif // SPORT_SEND
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) FrSkyX_telem_init(void)
|
||||||
|
{
|
||||||
|
FrSkyX_TX_Seq = 0x08 ; // Request init
|
||||||
|
#ifdef SPORT_SEND
|
||||||
|
FrSkyX_TX_IN_Seq = 0xFF ; // No sequence received yet
|
||||||
|
for(uint8_t i=0;i<4;i++)
|
||||||
|
FrSkyX_TX_Frames[i].count=0;// discard frames in current output buffer
|
||||||
|
SportHead=SportTail=0; // empty data buffer
|
||||||
|
#endif
|
||||||
|
FrSkyX_RX_Seq = 0 ; // Seq 0 to start with
|
||||||
|
#ifdef TELEMETRY
|
||||||
|
telemetry_lost=1;
|
||||||
|
telemetry_link=0; //Stop sending telemetry
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(FRSKYX_CC2500_INO) || defined(FRSKYL_CC2500_INO)
|
||||||
static void __attribute__((unused)) FrSkyX_set_start(uint8_t ch )
|
static void __attribute__((unused)) FrSkyX_set_start(uint8_t ch )
|
||||||
{
|
{
|
||||||
CC2500_Strobe(CC2500_SIDLE);
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
@@ -409,7 +520,7 @@ static void __attribute__((unused)) FrSkyX_init()
|
|||||||
CC2500_WriteReg(CC2500_08_PKTCTRL0, 0x05); // Enable CRC
|
CC2500_WriteReg(CC2500_08_PKTCTRL0, 0x05); // Enable CRC
|
||||||
if(!(FrSkyFormat&2))
|
if(!(FrSkyFormat&2))
|
||||||
{ // FCC
|
{ // FCC
|
||||||
CC2500_WriteReg(CC2500_17_MCSM1, 0x0E); // Go/Stay in RX mode
|
CC2500_WriteReg(CC2500_17_MCSM1, 0x0E); //0x0E -> RX stays in RX and TX stays in TX???
|
||||||
CC2500_WriteReg(CC2500_11_MDMCFG3, 0x84); // bitrate 70K->77K
|
CC2500_WriteReg(CC2500_11_MDMCFG3, 0x84); // bitrate 70K->77K
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ static void __attribute__((unused)) frsky2way_build_bind_packet()
|
|||||||
packet[14] = 0x00;
|
packet[14] = 0x00;
|
||||||
packet[15] = 0x00;
|
packet[15] = 0x00;
|
||||||
packet[16] = 0x00;
|
packet[16] = 0x00;
|
||||||
packet[17] = 0x01;
|
packet[17] = rx_tx_addr[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) frsky2way_data_frame()
|
static void __attribute__((unused)) frsky2way_data_frame()
|
||||||
@@ -71,7 +71,7 @@ static void __attribute__((unused)) frsky2way_data_frame()
|
|||||||
packet[4] = 0x00;
|
packet[4] = 0x00;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
packet[5] = 0x01;
|
packet[5] = rx_tx_addr[1];
|
||||||
//
|
//
|
||||||
packet[10] = 0;
|
packet[10] = 0;
|
||||||
packet[11] = 0;
|
packet[11] = 0;
|
||||||
@@ -100,6 +100,7 @@ uint16_t initFrSky_2way()
|
|||||||
if (sub_protocol==DCLONE)
|
if (sub_protocol==DCLONE)
|
||||||
Frsky_init_clone();
|
Frsky_init_clone();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
for(uint8_t i=0;i<50;i++)
|
for(uint8_t i=0;i<50;i++)
|
||||||
{
|
{
|
||||||
uint8_t freq = (i * 0x1e) % 0xeb;
|
uint8_t freq = (i * 0x1e) % 0xeb;
|
||||||
@@ -109,6 +110,8 @@ uint16_t initFrSky_2way()
|
|||||||
freq=0;
|
freq=0;
|
||||||
hopping_frequency[i]=freq;
|
hopping_frequency[i]=freq;
|
||||||
}
|
}
|
||||||
|
rx_tx_addr[1]=1; // keep compatibility with already bound RXs
|
||||||
|
}
|
||||||
|
|
||||||
packet_count=0;
|
packet_count=0;
|
||||||
if(IS_BIND_IN_PROGRESS)
|
if(IS_BIND_IN_PROGRESS)
|
||||||
@@ -178,7 +181,7 @@ uint16_t ReadFrSky_2way()
|
|||||||
if(packet_in[len-1] & 0x80)
|
if(packet_in[len-1] & 0x80)
|
||||||
{//with valid crc
|
{//with valid crc
|
||||||
packet_count=0;
|
packet_count=0;
|
||||||
frsky_check_telemetry(packet_in,len); //check if valid telemetry packets and buffer them.
|
frsky_process_telemetry(packet_in,len); //check if valid telemetry packets and buffer them.
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,96 +1,194 @@
|
|||||||
#if defined(FRSKYR9_SX1276_INO)
|
#if defined(FRSKYR9_SX1276_INO)
|
||||||
#include "iface_sx1276.h"
|
#include "iface_sx1276.h"
|
||||||
|
|
||||||
#define FREQ_MAP_SIZE 29
|
#define DISP_FREQ_TABLE
|
||||||
|
|
||||||
// TODO the channel spacing is equal, consider calculating the new channel instead of using lookup tables (first_chan + index * step)
|
#define FLEX_FREQ 29
|
||||||
|
#define FCC_FREQ 43
|
||||||
|
#define EU_FREQ 19
|
||||||
|
|
||||||
static uint32_t FrSkyR9_freq_map_915[FREQ_MAP_SIZE] =
|
enum {
|
||||||
{
|
FRSKYR9_FREQ=0,
|
||||||
914472960,
|
FRSKYR9_DATA,
|
||||||
914972672,
|
FRSKYR9_RX1,
|
||||||
915472384,
|
FRSKYR9_RX2,
|
||||||
915972096,
|
|
||||||
916471808,
|
|
||||||
916971520,
|
|
||||||
917471232,
|
|
||||||
917970944,
|
|
||||||
918470656,
|
|
||||||
918970368,
|
|
||||||
919470080,
|
|
||||||
919969792,
|
|
||||||
920469504,
|
|
||||||
920969216,
|
|
||||||
921468928,
|
|
||||||
921968640,
|
|
||||||
922468352,
|
|
||||||
922968064,
|
|
||||||
923467776,
|
|
||||||
923967488,
|
|
||||||
924467200,
|
|
||||||
924966912,
|
|
||||||
925466624,
|
|
||||||
925966336,
|
|
||||||
926466048,
|
|
||||||
926965760,
|
|
||||||
927465472,
|
|
||||||
|
|
||||||
// last two determined by FrSkyR9_step
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint32_t FrSkyR9_freq_map_868[FREQ_MAP_SIZE] =
|
void FrSkyR9_set_frequency()
|
||||||
{
|
{
|
||||||
859504640,
|
uint8_t data[3];
|
||||||
860004352,
|
uint16_t num=0;
|
||||||
860504064,
|
hopping_frequency_no += FrSkyX_chanskip;
|
||||||
861003776,
|
switch(sub_protocol & 0xFD)
|
||||||
861503488,
|
{
|
||||||
862003200,
|
case R9_868:
|
||||||
862502912,
|
if(IS_BIND_DONE) // if bind is in progress use R9_915 instead
|
||||||
863002624,
|
{
|
||||||
863502336,
|
hopping_frequency_no %= FLEX_FREQ;
|
||||||
864002048,
|
num=hopping_frequency_no;
|
||||||
864501760,
|
if(hopping_frequency_no>=FLEX_FREQ-2)
|
||||||
865001472,
|
num+=FrSkyX_chanskip-FLEX_FREQ+2; // the last 2 values are FrSkyX_chanskip and FrSkyX_chanskip+1
|
||||||
865501184,
|
num <<= 5;
|
||||||
866000896,
|
num += 0xD700;
|
||||||
866500608,
|
break;
|
||||||
867000320,
|
}//else use R9_915
|
||||||
867500032,
|
case R9_915:
|
||||||
867999744,
|
hopping_frequency_no %= FLEX_FREQ;
|
||||||
868499456,
|
num=hopping_frequency_no;
|
||||||
868999168,
|
if(hopping_frequency_no>=FLEX_FREQ-2)
|
||||||
869498880,
|
num+=FrSkyX_chanskip-FLEX_FREQ+2; // the last 2 values are FrSkyX_chanskip and FrSkyX_chanskip+1
|
||||||
869998592,
|
num <<= 5;
|
||||||
870498304,
|
num += 0xE4C0;
|
||||||
870998016,
|
break;
|
||||||
871497728,
|
case R9_FCC:
|
||||||
871997440,
|
hopping_frequency_no %= FCC_FREQ;
|
||||||
872497152,
|
num=hopping_frequency_no;
|
||||||
|
num <<= 5;
|
||||||
|
num += 0xE200;
|
||||||
|
break;
|
||||||
|
case R9_EU:
|
||||||
|
hopping_frequency_no %= EU_FREQ;
|
||||||
|
num=hopping_frequency_no;
|
||||||
|
num <<= 4;
|
||||||
|
num += 0xD7D0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
data[0] = num>>8;
|
||||||
|
data[1] = num&0xFF;
|
||||||
|
data[2] = 0x00;
|
||||||
|
|
||||||
// last two determined by FrSkyR9_step
|
#ifdef DISP_FREQ_TABLE
|
||||||
0,
|
if(phase==0xFF)
|
||||||
0
|
debugln("F%d=%02X%02X%02X=%lu", hopping_frequency_no, data[0], data[1], data[2], (uint32_t)((data[0]<<16)+(data[1]<<8)+data[2])*61);
|
||||||
};
|
#endif
|
||||||
|
SX1276_WriteRegisterMulti(SX1276_06_FRFMSB, data, 3);
|
||||||
|
}
|
||||||
|
|
||||||
static uint8_t FrSkyR9_step = 1;
|
static void __attribute__((unused)) FrSkyR9_build_packet()
|
||||||
static uint32_t* FrSkyR9_freq_map = FrSkyR9_freq_map_915;
|
{
|
||||||
|
//ID
|
||||||
|
packet[0] = rx_tx_addr[1];
|
||||||
|
packet[1] = rx_tx_addr[2];
|
||||||
|
packet[2] = rx_tx_addr[3];
|
||||||
|
|
||||||
|
//Hopping
|
||||||
|
packet[3] = hopping_frequency_no; // current channel index
|
||||||
|
packet[4] = FrSkyX_chanskip; // step size and last 2 channels start index
|
||||||
|
|
||||||
|
//RX number
|
||||||
|
packet[5] = RX_num; // receiver number from OpenTX
|
||||||
|
|
||||||
|
//Channels
|
||||||
|
FrSkyX_channels(6); // Set packet[6]=failsafe, packet[7]=0?? and packet[8..19]=channels data
|
||||||
|
|
||||||
|
//Bind
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
{// 915 0x01=CH1-8_TELEM_ON 0x41=CH1-8_TELEM_OFF 0xC1=CH9-16_TELEM_OFF 0x81=CH9-16_TELEM_ON
|
||||||
|
packet[6] = 0x01; // bind indicator
|
||||||
|
if(sub_protocol & 1)
|
||||||
|
packet[6] |= 0x20; // 868
|
||||||
|
if(binding_idx&0x01)
|
||||||
|
packet[6] |= 0x40; // telem OFF
|
||||||
|
if(binding_idx&0x02)
|
||||||
|
packet[6] |= 0x80; // ch9-16
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sequence and send SPort
|
||||||
|
FrSkyX_seq_sport(20,23); //20=RX|TXseq, 21=bytes count, 22&23=data
|
||||||
|
|
||||||
|
//CRC
|
||||||
|
uint16_t crc = FrSkyX_crc(packet, 24);
|
||||||
|
packet[24] = crc; // low byte
|
||||||
|
packet[25] = crc >> 8; // high byte
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t __attribute__((unused)) FrSkyR9_CRC8(uint8_t *p, uint8_t l)
|
||||||
|
{
|
||||||
|
uint8_t crc = 0xFF;
|
||||||
|
for (uint8_t i = 0; i < l; i++)
|
||||||
|
{
|
||||||
|
crc = crc ^ p[i];
|
||||||
|
for ( uint8_t j = 0; j < 8; j++ )
|
||||||
|
if ( crc & 0x80 )
|
||||||
|
{
|
||||||
|
crc <<= 1;
|
||||||
|
crc ^= 0x07;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
crc <<= 1;
|
||||||
|
}
|
||||||
|
return crc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) FrSkyR9_build_EU_packet()
|
||||||
|
{
|
||||||
|
//ID
|
||||||
|
packet[0] = rx_tx_addr[1];
|
||||||
|
packet[1] = rx_tx_addr[2];
|
||||||
|
packet[2] = rx_tx_addr[3];
|
||||||
|
|
||||||
|
//Hopping
|
||||||
|
packet[3] = FrSkyX_chanskip; // step size and last 2 channels start index
|
||||||
|
|
||||||
|
//RX number
|
||||||
|
packet[4] = RX_num; // receiver number from OpenTX
|
||||||
|
|
||||||
|
//Channels
|
||||||
|
//TODO FrSkyX_channels(5,4); // Set packet[5]=failsafe and packet[6..11]=4 channels data
|
||||||
|
|
||||||
|
//Bind
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
{
|
||||||
|
packet[5] = 0x01; // bind indicator
|
||||||
|
if((sub_protocol & 2) == 0)
|
||||||
|
packet[5] |= 0x10; // 16CH
|
||||||
|
// if(sub_protocol & 1)
|
||||||
|
// packet[5] |= 0x20; // 868
|
||||||
|
if(binding_idx&0x01)
|
||||||
|
packet[5] |= 0x40; // telem OFF
|
||||||
|
if(binding_idx&0x02)
|
||||||
|
packet[5] |= 0x80; // ch9-16
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sequence and send SPort
|
||||||
|
packet[12] = (FrSkyX_RX_Seq << 4)|0x08; //TX=8 at startup
|
||||||
|
|
||||||
|
//CRC
|
||||||
|
packet[13] = FrSkyR9_CRC8(packet, 13);
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t initFrSkyR9()
|
uint16_t initFrSkyR9()
|
||||||
{
|
{
|
||||||
|
//Check frequencies
|
||||||
|
#ifdef DISP_FREQ_TABLE
|
||||||
|
phase=0xFF;
|
||||||
|
FrSkyX_chanskip=1;
|
||||||
|
hopping_frequency_no=0xFF;
|
||||||
|
for(uint8_t i=0;i<FCC_FREQ;i++)
|
||||||
|
FrSkyR9_set_frequency();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//Reset ID
|
||||||
set_rx_tx_addr(MProtocol_id_master);
|
set_rx_tx_addr(MProtocol_id_master);
|
||||||
|
|
||||||
if(sub_protocol & 0x01)
|
//FrSkyX_chanskip
|
||||||
FrSkyR9_freq_map = FrSkyR9_freq_map_868;
|
FrSkyX_chanskip = 1 + (random(0xfefefefe) % 24);
|
||||||
|
debugln("chanskip=%d", FrSkyX_chanskip);
|
||||||
|
|
||||||
|
//Set FrSkyFormat
|
||||||
|
if((sub_protocol & 0x02) == 0)
|
||||||
|
FrSkyFormat=0; // 16 channels
|
||||||
else
|
else
|
||||||
FrSkyR9_freq_map = FrSkyR9_freq_map_915;
|
FrSkyFormat=1; // 8 channels
|
||||||
|
debugln("%dCH", FrSkyFormat&1 ? 8:16);
|
||||||
|
|
||||||
FrSkyR9_step = 1 + (random(0xfefefefe) % 24);
|
//EU packet length
|
||||||
FrSkyR9_freq_map[27] = FrSkyR9_freq_map[FrSkyR9_step];
|
if( (sub_protocol & 0xFD) == R9_EU )
|
||||||
FrSkyR9_freq_map[28] = FrSkyR9_freq_map[FrSkyR9_step+1];
|
packet_length=14;
|
||||||
|
else
|
||||||
|
packet_length=26;
|
||||||
|
|
||||||
|
//SX1276 Init
|
||||||
SX1276_SetMode(true, false, SX1276_OPMODE_SLEEP);
|
SX1276_SetMode(true, false, SX1276_OPMODE_SLEEP);
|
||||||
SX1276_SetMode(true, false, SX1276_OPMODE_STDBY);
|
SX1276_SetMode(true, false, SX1276_OPMODE_STDBY);
|
||||||
|
|
||||||
@@ -106,103 +204,103 @@ uint16_t initFrSkyR9()
|
|||||||
SX1276_SetPreambleLength(9);
|
SX1276_SetPreambleLength(9);
|
||||||
SX1276_SetDetectionThreshold(SX1276_MODEM_DETECTION_THRESHOLD_SF6);
|
SX1276_SetDetectionThreshold(SX1276_MODEM_DETECTION_THRESHOLD_SF6);
|
||||||
SX1276_SetLna(1, true);
|
SX1276_SetLna(1, true);
|
||||||
SX1276_SetHopPeriod(0); // 0 = disabled, we hope frequencies manually
|
SX1276_SetHopPeriod(0); // 0 = disabled, we hop frequencies manually
|
||||||
SX1276_SetPaDac(true);
|
SX1276_SetPaDac(true);
|
||||||
|
SX1276_SetTxRxMode(TX_EN); // Set RF switch to TX
|
||||||
|
|
||||||
|
FrSkyX_telem_init();
|
||||||
|
|
||||||
hopping_frequency_no=0;
|
hopping_frequency_no=0;
|
||||||
|
phase=FRSKYR9_FREQ;
|
||||||
// TODO this can probably be shorter
|
return 20000; // Start calling FrSkyR9_callback in 20 milliseconds
|
||||||
return 20000; // start calling FrSkyR9_callback in 20 milliseconds
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t FrSkyR9_callback()
|
uint16_t FrSkyR9_callback()
|
||||||
{
|
{
|
||||||
|
switch (phase)
|
||||||
|
{
|
||||||
|
case FRSKYR9_FREQ:
|
||||||
|
//Force standby
|
||||||
SX1276_SetMode(true, false, SX1276_OPMODE_STDBY);
|
SX1276_SetMode(true, false, SX1276_OPMODE_STDBY);
|
||||||
|
//Set frequency
|
||||||
//SX1276_WriteReg(SX1276_11_IRQFLAGSMASK, 0xbf); // use only RxDone interrupt
|
FrSkyR9_set_frequency(); // Set current center frequency
|
||||||
|
//Set power
|
||||||
// uint8_t buffer[2];
|
|
||||||
// buffer[0] = 0x00;
|
|
||||||
// buffer[1] = 0x00;
|
|
||||||
// SX1276_WriteRegisterMulti(SX1276_40_DIOMAPPING1, buffer, 2); // RxDone interrupt mapped to DIO0 (the rest are not used because of the REG_IRQ_FLAGS_MASK)
|
|
||||||
|
|
||||||
// SX1276_WriteReg(REG_PAYLOAD_LENGTH, 13);
|
|
||||||
|
|
||||||
// SX1276_WriteReg(REG_FIFO_ADDR_PTR, 0x00);
|
|
||||||
|
|
||||||
// SX1276_WriteReg(SX1276_01_OPMODE, 0x85); // RXCONTINUOUS
|
|
||||||
// delay(10); // 10 ms
|
|
||||||
|
|
||||||
// SX1276_WriteReg(SX1276_01_OPMODE, 0x81); // STDBY
|
|
||||||
|
|
||||||
//SX1276_WriteReg(SX1276_09_PACONFIG, 0xF0);
|
|
||||||
|
|
||||||
// max power: 15dBm (10.8 + 0.6 * MaxPower [dBm])
|
// max power: 15dBm (10.8 + 0.6 * MaxPower [dBm])
|
||||||
// output_power: 2 dBm (17-(15-OutputPower) (if pa_boost_pin == true))
|
// output_power: 2 dBm (17-(15-OutputPower) (if pa_boost_pin == true))
|
||||||
SX1276_SetPaConfig(true, 7, 0);
|
SX1276_SetPaConfig(true, 7, 0); // Lowest power for the T18
|
||||||
SX1276_SetFrequency(FrSkyR9_freq_map[hopping_frequency_no]); // set current center frequency
|
//Build packet
|
||||||
|
if( packet_length == 26 )
|
||||||
delayMicroseconds(500);
|
FrSkyR9_build_packet();
|
||||||
|
|
||||||
packet[0] = 0x3C; // ????
|
|
||||||
packet[1] = rx_tx_addr[3]; // unique radio id
|
|
||||||
packet[2] = rx_tx_addr[2]; // unique radio id
|
|
||||||
packet[3] = hopping_frequency_no; // current channel index
|
|
||||||
packet[4] = FrSkyR9_step; // step size and last 2 channels start index
|
|
||||||
packet[5] = RX_num; // receiver number from OpenTX
|
|
||||||
|
|
||||||
// binding mode: 0x00 regular / 0x41 bind?
|
|
||||||
if(IS_BIND_IN_PROGRESS)
|
|
||||||
packet[6] = 0x41;
|
|
||||||
else
|
else
|
||||||
packet[6] = 0x00;
|
FrSkyR9_build_EU_packet();
|
||||||
|
phase++;
|
||||||
// TODO
|
return 460; // Frequency settle time
|
||||||
packet[7] = 0x00; // fail safe related (looks like the same sequence of numbers as FrskyX protocol)
|
case FRSKYR9_DATA:
|
||||||
|
//Set RF switch to TX
|
||||||
// two channel are spread over 3 bytes.
|
SX1276_SetTxRxMode(TX_EN);
|
||||||
// each channel is 11 bit + 1 bit (msb) that states whether
|
//Send packet
|
||||||
// it's part of the upper channels (9-16) or lower (1-8) (0 - lower 1 - upper)
|
SX1276_WritePayloadToFifo(packet, packet_length);
|
||||||
|
|
||||||
#define CH_POS 8
|
|
||||||
static uint8_t chan_start=0;
|
|
||||||
uint8_t chan_index = chan_start;
|
|
||||||
|
|
||||||
for(int i = 0; i < 12; i += 3)
|
|
||||||
{
|
|
||||||
// map channel values (0-2047) to (64-1984)
|
|
||||||
uint16_t ch1 = FrSkyX_scaleForPXX(chan_index);
|
|
||||||
uint16_t ch2 = FrSkyX_scaleForPXX(chan_index + 1);
|
|
||||||
|
|
||||||
packet[CH_POS + i] = ch1;
|
|
||||||
packet[CH_POS + i + 1] = (ch1 >> 8) | (ch2 << 4);
|
|
||||||
packet[CH_POS + i + 2] = (ch2 >> 4);
|
|
||||||
|
|
||||||
chan_index += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((sub_protocol & 0x02) == 0)
|
|
||||||
chan_start ^= 0x08; // Alternate between lower and upper when 16 channels is used
|
|
||||||
|
|
||||||
packet[20] = 0x08; // ????
|
|
||||||
packet[21] = 0x00; // ????
|
|
||||||
packet[22] = 0x00; // ????
|
|
||||||
packet[23] = 0x00; // ????
|
|
||||||
|
|
||||||
uint16_t crc = FrSkyX_crc(packet, 24);
|
|
||||||
|
|
||||||
packet[24] = crc; // low byte
|
|
||||||
packet[25] = crc >> 8; // high byte
|
|
||||||
|
|
||||||
SX1276_WritePayloadToFifo(packet, 26);
|
|
||||||
|
|
||||||
hopping_frequency_no = (hopping_frequency_no + FrSkyR9_step) % FREQ_MAP_SIZE;
|
|
||||||
|
|
||||||
SX1276_SetMode(true, false, SX1276_OPMODE_TX);
|
SX1276_SetMode(true, false, SX1276_OPMODE_TX);
|
||||||
|
#if not defined TELEMETRY
|
||||||
// need to clear RegIrqFlags?
|
phase=FRSKYR9_FREQ;
|
||||||
|
return 20000-460;
|
||||||
return 19400;
|
#else
|
||||||
|
phase++;
|
||||||
|
return 11140; // Packet send time
|
||||||
|
case FRSKYR9_RX1:
|
||||||
|
//Force standby
|
||||||
|
SX1276_SetMode(true, false, SX1276_OPMODE_STDBY);
|
||||||
|
//RX packet size is 13
|
||||||
|
SX1276_WriteReg(SX1276_22_PAYLOAD_LENGTH, 13);
|
||||||
|
//Reset pointer
|
||||||
|
SX1276_WriteReg(SX1276_0D_FIFOADDRPTR, 0x00);
|
||||||
|
//Set RF switch to RX
|
||||||
|
SX1276_SetTxRxMode(RX_EN);
|
||||||
|
//Switch to RX
|
||||||
|
SX1276_WriteReg(SX1276_01_OPMODE, 0x85);
|
||||||
|
phase++;
|
||||||
|
return 7400;
|
||||||
|
case FRSKYR9_RX2:
|
||||||
|
if( (SX1276_ReadReg(SX1276_12_REGIRQFLAGS)&0xF0) == (_BV(SX1276_REGIRQFLAGS_RXDONE) | _BV(SX1276_REGIRQFLAGS_VALIDHEADER)) )
|
||||||
|
{
|
||||||
|
if(SX1276_ReadReg(SX1276_13_REGRXNBBYTES)==13)
|
||||||
|
{
|
||||||
|
SX1276_ReadRegisterMulti(SX1276_00_FIFO,packet_in,13);
|
||||||
|
if( packet_in[9]==rx_tx_addr[1] && packet_in[10]==rx_tx_addr[2] && FrSkyX_crc(packet_in, 11, rx_tx_addr[1]+(rx_tx_addr[2]<<8))==(packet_in[11]+(packet_in[12]<<8)) )
|
||||||
|
{
|
||||||
|
if(packet_in[0]&0x80)
|
||||||
|
RX_RSSI=packet_in[0]<<1;
|
||||||
|
else
|
||||||
|
v_lipo1=(packet_in[0]<<1)+1;
|
||||||
|
//TX_LQI=~(SX1276_ReadReg(SX1276_19_PACKETSNR)>>2)+1;
|
||||||
|
TX_RSSI=SX1276_ReadReg(SX1276_1A_PACKETRSSI)-157;
|
||||||
|
for(uint8_t i=0;i<9;i++)
|
||||||
|
packet[4+i]=packet_in[i]; // Adjust buffer to match FrSkyX
|
||||||
|
frsky_process_telemetry(packet,len); // Process telemetry packet
|
||||||
|
pps_counter++;
|
||||||
|
if(TX_LQI==0)
|
||||||
|
TX_LQI++; // Recover telemetry right away
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (millis() - pps_timer >= 1000)
|
||||||
|
{//1 packet every 20ms
|
||||||
|
pps_timer = millis();
|
||||||
|
debugln("%d pps", pps_counter);
|
||||||
|
TX_LQI = pps_counter<<1; // Max=100%
|
||||||
|
pps_counter = 0;
|
||||||
|
}
|
||||||
|
if(TX_LQI==0)
|
||||||
|
FrSkyX_telem_init(); // Reset telemetry
|
||||||
|
else
|
||||||
|
telemetry_link=1; // Send telemetry out anyway
|
||||||
|
//Clear all flags
|
||||||
|
SX1276_WriteReg(SX1276_12_REGIRQFLAGS,0xFF);
|
||||||
|
phase=FRSKYR9_FREQ;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -98,89 +98,11 @@ static void __attribute__((unused)) FrSkyX_build_packet()
|
|||||||
packet[5] = FrSkyX_chanskip>>2;
|
packet[5] = FrSkyX_chanskip>>2;
|
||||||
packet[6] = RX_num;
|
packet[6] = RX_num;
|
||||||
|
|
||||||
packet[8] = 0; //??
|
//Channels
|
||||||
|
FrSkyX_channels(7); // Set packet[7]=failsafe, packet[8]=0?? and packet[9..20]=channels data
|
||||||
|
|
||||||
FrSkyX_channels(9); // Set packet[7] and packet[9..20] with channels data and failsafe
|
//Sequence and send SPort
|
||||||
|
FrSkyX_seq_sport(21,packet_size-2); //21=RX|TXseq, 22=bytes count, 23..packet_size-2=data
|
||||||
//sequence and send SPort
|
|
||||||
for (uint8_t i=22;i<packet_size-1;i++)
|
|
||||||
packet[i]=0;
|
|
||||||
packet[21] = FrSkyX_RX_Seq << 4; //TX=8 at startup
|
|
||||||
#ifdef SPORT_SEND
|
|
||||||
if (FrSkyX_TX_IN_Seq!=0xFF)
|
|
||||||
{//RX has replied at least once
|
|
||||||
if (FrSkyX_TX_IN_Seq & 0x08)
|
|
||||||
{//Request init
|
|
||||||
//debugln("Init");
|
|
||||||
FrSkyX_TX_Seq = 0 ;
|
|
||||||
for(uint8_t i=0;i<4;i++)
|
|
||||||
FrSkyX_TX_Frames[i].count=0; //Discard frames in current output buffer
|
|
||||||
}
|
|
||||||
else if (FrSkyX_TX_IN_Seq & 0x04)
|
|
||||||
{//Retransmit the requested packet
|
|
||||||
debugln("Retry:%d",FrSkyX_TX_IN_Seq&0x03);
|
|
||||||
packet[21] |= FrSkyX_TX_IN_Seq&0x03;
|
|
||||||
packet[22] = FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq&0x03].count;
|
|
||||||
for (uint8_t i=23;i<23+FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq&0x03].count;i++)
|
|
||||||
packet[i] = FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq&0x03].payload[i];
|
|
||||||
}
|
|
||||||
else if ( FrSkyX_TX_Seq != 0x08 )
|
|
||||||
{
|
|
||||||
if(FrSkyX_TX_Seq==FrSkyX_TX_IN_Seq)
|
|
||||||
{//Send packet from the incoming radio buffer
|
|
||||||
//debugln("Send:%d",FrSkyX_TX_Seq);
|
|
||||||
packet[21] |= FrSkyX_TX_Seq;
|
|
||||||
uint8_t nbr_bytes=0;
|
|
||||||
for (uint8_t i=23;i<packet_size-1;i++)
|
|
||||||
{
|
|
||||||
if(SportHead==SportTail)
|
|
||||||
break; //buffer empty
|
|
||||||
packet[i]=SportData[SportHead];
|
|
||||||
FrSkyX_TX_Frames[FrSkyX_TX_Seq].payload[i-23]=SportData[SportHead];
|
|
||||||
SportHead=(SportHead+1) & (MAX_SPORT_BUFFER-1);
|
|
||||||
nbr_bytes++;
|
|
||||||
}
|
|
||||||
packet[22]=nbr_bytes;
|
|
||||||
FrSkyX_TX_Frames[FrSkyX_TX_Seq].count=nbr_bytes;
|
|
||||||
if(nbr_bytes)
|
|
||||||
{//Check the buffer status
|
|
||||||
uint8_t used = SportTail;
|
|
||||||
if ( SportHead > SportTail )
|
|
||||||
used += MAX_SPORT_BUFFER - SportHead ;
|
|
||||||
else
|
|
||||||
used -= SportHead ;
|
|
||||||
if ( used < (MAX_SPORT_BUFFER>>1) )
|
|
||||||
{
|
|
||||||
DATA_BUFFER_LOW_off;
|
|
||||||
debugln("Ok buf:%d",used);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FrSkyX_TX_Seq = ( FrSkyX_TX_Seq + 1 ) & 0x03 ; //Next iteration send next packet
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{//Not in sequence somehow, transmit what the receiver wants but why not asking for retransmit...
|
|
||||||
//debugln("RX_Seq:%d,TX:%d",FrSkyX_TX_IN_Seq,FrSkyX_TX_Seq);
|
|
||||||
packet[21] |= FrSkyX_TX_IN_Seq;
|
|
||||||
packet[22] = FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq].count;
|
|
||||||
for (uint8_t i=23;i<23+FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq].count;i++)
|
|
||||||
packet[i] = FrSkyX_TX_Frames[FrSkyX_TX_IN_Seq].payload[i-23];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
packet[21] |= 0x08 ; //FrSkyX_TX_Seq=8 at startup
|
|
||||||
}
|
|
||||||
if(packet[22])
|
|
||||||
{//Debug
|
|
||||||
debug("SP: ");
|
|
||||||
for(uint8_t i=0;i<packet[22];i++)
|
|
||||||
debug("%02X ",packet[23+i]);
|
|
||||||
debugln("");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
packet[21] |= FrSkyX_TX_Seq ;//TX=8 at startup
|
|
||||||
if ( !(FrSkyX_TX_IN_Seq & 0xF8) )
|
|
||||||
FrSkyX_TX_Seq = ( FrSkyX_TX_Seq + 1 ) & 0x03 ; // Next iteration send next packet
|
|
||||||
#endif // SPORT_SEND
|
|
||||||
|
|
||||||
//CRC
|
//CRC
|
||||||
uint16_t lcrc = FrSkyX_crc(&packet[3], packet_size-4);
|
uint16_t lcrc = FrSkyX_crc(&packet[3], packet_size-4);
|
||||||
@@ -231,7 +153,7 @@ uint16_t ReadFrSkyX()
|
|||||||
{// LBT
|
{// LBT
|
||||||
CC2500_Strobe(CC2500_SRX); //Acquire RSSI
|
CC2500_Strobe(CC2500_SRX); //Acquire RSSI
|
||||||
state++;
|
state++;
|
||||||
return 400; // LBT v2.1
|
return 400; // LBT
|
||||||
}
|
}
|
||||||
case FRSKY_DATA2:
|
case FRSKY_DATA2:
|
||||||
if(FrSkyFormat & 2)
|
if(FrSkyFormat & 2)
|
||||||
@@ -252,72 +174,73 @@ uint16_t ReadFrSkyX()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CC2500_Strobe(CC2500_SIDLE);
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
CC2500_Strobe(CC2500_SFTX);
|
CC2500_Strobe(CC2500_SFTX); //Flush the TXFIFO
|
||||||
CC2500_SetTxRxMode(TX_EN);
|
CC2500_SetTxRxMode(TX_EN);
|
||||||
CC2500_SetPower();
|
CC2500_SetPower();
|
||||||
hopping_frequency_no = (hopping_frequency_no+FrSkyX_chanskip)%47;
|
hopping_frequency_no = (hopping_frequency_no+FrSkyX_chanskip)%47;
|
||||||
CC2500_WriteData(packet, packet[0]+1);
|
CC2500_WriteData(packet, packet[0]+1);
|
||||||
state=FRSKY_DATA3;
|
state=FRSKY_DATA3;
|
||||||
if(FrSkyFormat & 2)
|
if(FrSkyFormat & 2)
|
||||||
return 4000; // LBT v2.1
|
return 4000; // LBT
|
||||||
else
|
else
|
||||||
return 5200; // FCC v2.1
|
return 5200; // FCC
|
||||||
case FRSKY_DATA3:
|
case FRSKY_DATA3:
|
||||||
CC2500_Strobe(CC2500_SIDLE);
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
|
CC2500_Strobe(CC2500_SFRX); //Flush the RXFIFO
|
||||||
CC2500_SetTxRxMode(RX_EN);
|
CC2500_SetTxRxMode(RX_EN);
|
||||||
CC2500_Strobe(CC2500_SRX);
|
CC2500_Strobe(CC2500_SRX);
|
||||||
state++;
|
state++;
|
||||||
if(FrSkyFormat & 2)
|
if(FrSkyFormat & 2)
|
||||||
return 4100; // LBT v2.1
|
return 4200; // LBT
|
||||||
else
|
else
|
||||||
return 3300; // FCC v2.1
|
return 3400; // FCC
|
||||||
case FRSKY_DATA4:
|
case FRSKY_DATA4:
|
||||||
#ifdef MULTI_SYNC
|
#ifdef MULTI_SYNC
|
||||||
telemetry_set_input_sync(9000);
|
telemetry_set_input_sync(9000);
|
||||||
#endif
|
#endif
|
||||||
#if defined TELEMETRY
|
#if defined TELEMETRY
|
||||||
telemetry_link=1; //Send telemetry out anyway
|
|
||||||
#endif
|
|
||||||
len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
|
len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
|
||||||
if (len && (len<=(0x0E + 3))) //Telemetry frame is 17
|
if (len && len <= 17) //Telemetry frame is 17 bytes
|
||||||
{
|
{
|
||||||
//debug("Telem:");
|
//debug("Telem:");
|
||||||
packet_count=0;
|
CC2500_ReadData(packet_in, len); //Read what has been received so far
|
||||||
CC2500_ReadData(packet_in, len);
|
if(len<17)
|
||||||
#if defined TELEMETRY
|
{//not all bytes were received
|
||||||
if(protocol==PROTO_FRSKYX || (protocol==PROTO_FRSKYX2 && (packet_in[len-1] & 0x80)) )
|
uint8_t last_len=CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
|
||||||
{//with valid crc for FRSKYX2
|
if(last_len==17) //All bytes received
|
||||||
|
{
|
||||||
|
CC2500_ReadData(packet_in+len, last_len-len); //Finish to read
|
||||||
|
len=17;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(len==17 && (protocol==PROTO_FRSKYX || (protocol==PROTO_FRSKYX2 && (packet_in[len-1] & 0x80))) )
|
||||||
|
{//Telemetry received with valid crc for FRSKYX2
|
||||||
//Debug
|
//Debug
|
||||||
//for(uint8_t i=0;i<len;i++)
|
//for(uint8_t i=0;i<len;i++)
|
||||||
// debug(" %02X",packet_in[i]);
|
// debug(" %02X",packet_in[i]);
|
||||||
frsky_check_telemetry(packet_in,len); //Check and parse telemetry packets
|
if(frsky_process_telemetry(packet_in,len)) //Check and process telemetry packet
|
||||||
|
{//good packet received
|
||||||
|
pps_counter++;
|
||||||
|
if(TX_LQI==0)
|
||||||
|
TX_LQI++; //Recover telemetry right away
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
//debugln("");
|
//debugln("");
|
||||||
}
|
}
|
||||||
|
if (millis() - pps_timer >= 900)
|
||||||
|
{//1 packet every 9ms
|
||||||
|
pps_timer = millis();
|
||||||
|
debugln("%d pps", pps_counter);
|
||||||
|
TX_LQI = pps_counter; //Max=100%
|
||||||
|
pps_counter = 0;
|
||||||
|
}
|
||||||
|
if(TX_LQI==0)
|
||||||
|
FrSkyX_telem_init(); //Reset telemetry
|
||||||
else
|
else
|
||||||
{
|
telemetry_link=1; //Send telemetry out anyway
|
||||||
packet_count++;
|
|
||||||
//debugln("M %d",packet_count);
|
|
||||||
// restart sequence on missed packet - might need count or timeout instead of one missed
|
|
||||||
if(packet_count>100)
|
|
||||||
{//~1sec
|
|
||||||
FrSkyX_TX_Seq = 0x08 ; //Request init
|
|
||||||
FrSkyX_TX_IN_Seq = 0xFF ; //No sequence received yet
|
|
||||||
#ifdef SPORT_SEND
|
|
||||||
for(uint8_t i=0;i<4;i++)
|
|
||||||
FrSkyX_TX_Frames[i].count=0; //Discard frames in current output buffer
|
|
||||||
#endif
|
#endif
|
||||||
packet_count=0;
|
|
||||||
#if defined TELEMETRY
|
|
||||||
telemetry_lost=1;
|
|
||||||
telemetry_link=0; //Stop sending telemetry
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
CC2500_Strobe(CC2500_SFRX); //Flush the RXFIFO
|
|
||||||
}
|
|
||||||
state = FRSKY_DATA1;
|
state = FRSKY_DATA1;
|
||||||
return 500; // FCC & LBT v2.1
|
return 400; // FCC & LBT
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -327,7 +250,7 @@ uint16_t initFrSkyX()
|
|||||||
set_rx_tx_addr(MProtocol_id_master);
|
set_rx_tx_addr(MProtocol_id_master);
|
||||||
FrSkyFormat = sub_protocol;
|
FrSkyFormat = sub_protocol;
|
||||||
|
|
||||||
if (sub_protocol==XCLONE)
|
if (sub_protocol==XCLONE_16||sub_protocol==XCLONE_8)
|
||||||
Frsky_init_clone();
|
Frsky_init_clone();
|
||||||
else if(protocol==PROTO_FRSKYX)
|
else if(protocol==PROTO_FRSKYX)
|
||||||
{
|
{
|
||||||
@@ -361,15 +284,7 @@ uint16_t initFrSkyX()
|
|||||||
state = FRSKY_DATA1;
|
state = FRSKY_DATA1;
|
||||||
FrSkyX_initialize_data(0);
|
FrSkyX_initialize_data(0);
|
||||||
}
|
}
|
||||||
FrSkyX_TX_Seq = 0x08 ; // Request init
|
FrSkyX_telem_init();
|
||||||
FrSkyX_TX_IN_Seq = 0xFF ; // No sequence received yet
|
|
||||||
#ifdef SPORT_SEND
|
|
||||||
for(uint8_t i=0;i<4;i++)
|
|
||||||
FrSkyX_TX_Frames[i].count=0; // discard frames in current output buffer
|
|
||||||
SportHead=SportTail=0; // empty data buffer
|
|
||||||
#endif
|
|
||||||
FrSkyX_RX_Seq = 0 ; // Seq 0 to start with
|
|
||||||
binding_idx=0; // CH1-8 and Telem on
|
|
||||||
return 10000;
|
return 10000;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -201,9 +201,10 @@ static uint8_t __attribute__((unused)) frskyx_rx_check_crc_id(bool bind,bool ini
|
|||||||
{//Save TXID
|
{//Save TXID
|
||||||
rx_tx_addr[3] = packet[3];
|
rx_tx_addr[3] = packet[3];
|
||||||
rx_tx_addr[2] = packet[4];
|
rx_tx_addr[2] = packet[4];
|
||||||
|
rx_tx_addr[1] = packet[17];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if(rx_tx_addr[3] != packet[offset] || rx_tx_addr[2] != packet[offset+1])
|
if(rx_tx_addr[3] != packet[offset] || rx_tx_addr[2] != packet[offset+1] || rx_tx_addr[1] != packet[bind?17:5])
|
||||||
return false; // Bad address
|
return false; // Bad address
|
||||||
return true; // Full match
|
return true; // Full match
|
||||||
}
|
}
|
||||||
@@ -378,8 +379,6 @@ uint16_t initFrSky_Rx()
|
|||||||
|
|
||||||
uint16_t FrSky_Rx_callback()
|
uint16_t FrSky_Rx_callback()
|
||||||
{
|
{
|
||||||
static uint32_t pps_timer=0;
|
|
||||||
static uint8_t pps_counter=0;
|
|
||||||
static int8_t read_retry = 0;
|
static int8_t read_retry = 0;
|
||||||
static int8_t tune_low, tune_high;
|
static int8_t tune_low, tune_high;
|
||||||
uint8_t len, ch;
|
uint8_t len, ch;
|
||||||
|
|||||||
@@ -274,10 +274,6 @@ static void __attribute__((unused)) HOTT_prep_data_packet()
|
|||||||
|
|
||||||
uint16_t ReadHOTT()
|
uint16_t ReadHOTT()
|
||||||
{
|
{
|
||||||
#ifdef HOTT_FW_TELEMETRY
|
|
||||||
static uint8_t pps_counter=0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch(phase)
|
switch(phase)
|
||||||
{
|
{
|
||||||
case HOTT_START:
|
case HOTT_START:
|
||||||
@@ -443,13 +439,18 @@ uint16_t ReadHOTT()
|
|||||||
HOTT_sensor_pages = 0x1E; // Switch to next sensor
|
HOTT_sensor_pages = 0x1E; // Switch to next sensor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(HOTT_sensor_valid && packet_in[11] ) // Valid & page !=0
|
if(packet_in[11])
|
||||||
|
{ //Page != 0
|
||||||
|
if(HOTT_sensor_valid) // Valid
|
||||||
{
|
{
|
||||||
packet_in[10] = HOTT_sensor_cur+9; // Marking telem with sensor ID
|
packet_in[10] = HOTT_sensor_cur+9; // Mark telem with sensor ID
|
||||||
HOTT_sensor_pages |= 1<<packet_in[11]; // Page received
|
HOTT_sensor_pages |= 1<<packet_in[11]; // Page received
|
||||||
}
|
}
|
||||||
if(packet_in[11] && !HOTT_sensor_valid)
|
else
|
||||||
send_telem=false;
|
send_telem=false; // Do not send
|
||||||
|
}
|
||||||
|
else
|
||||||
|
packet_in[10]=0; // Mark telem with sensor 0=RX
|
||||||
}
|
}
|
||||||
debug("T%d=",send_telem);
|
debug("T%d=",send_telem);
|
||||||
for(uint8_t i=10;i < HOTT_RX_PACKET_LEN; i++)
|
for(uint8_t i=10;i < HOTT_RX_PACKET_LEN; i++)
|
||||||
|
|||||||
@@ -14,16 +14,16 @@
|
|||||||
*/
|
*/
|
||||||
// Compatible with FZ-410 TX
|
// Compatible with FZ-410 TX
|
||||||
|
|
||||||
#if defined(FLYZONE_A7105_INO)
|
#if defined(HEIGHT_A7105_INO)
|
||||||
|
|
||||||
#include "iface_a7105.h"
|
#include "iface_a7105.h"
|
||||||
|
|
||||||
//#define FLYZONE_FORCEID
|
//#define HEIGHT_FORCEID
|
||||||
|
|
||||||
#define FLYZONE_BIND_COUNT 220 // 5 sec
|
#define HEIGHT_BIND_COUNT 220 // 5 sec
|
||||||
#define FLYZONE_BIND_CH 0x18 // TX, RX for bind end is 0x17
|
#define HEIGHT_BIND_CH 0x18 // TX, RX for bind end is 0x17
|
||||||
|
|
||||||
static void __attribute__((unused)) flyzone_build_packet()
|
static void __attribute__((unused)) HEIGHT_build_packet()
|
||||||
{
|
{
|
||||||
packet[0] = 0xA5;
|
packet[0] = 0xA5;
|
||||||
packet[1] = rx_tx_addr[2];
|
packet[1] = rx_tx_addr[2];
|
||||||
@@ -33,11 +33,17 @@ static void __attribute__((unused)) flyzone_build_packet()
|
|||||||
packet[5] = convert_channel_8b(THROTTLE); //00..FF
|
packet[5] = convert_channel_8b(THROTTLE); //00..FF
|
||||||
packet[6] = convert_channel_8b(RUDDER); //00..80..FF
|
packet[6] = convert_channel_8b(RUDDER); //00..80..FF
|
||||||
packet[7] = convert_channel_8b(CH5); //00..80..FF
|
packet[7] = convert_channel_8b(CH5); //00..80..FF
|
||||||
|
if(sub_protocol == HEIGHT_8CH)
|
||||||
|
{
|
||||||
|
packet[8] = convert_channel_8b(CH6); //00..80..FF
|
||||||
|
packet[9] = convert_channel_8b(CH7); //00..80..FF
|
||||||
|
packet[10] = convert_channel_8b(CH8); //00..80..FF
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ReadFlyzone()
|
uint16_t ReadHeight()
|
||||||
{
|
{
|
||||||
#ifndef FORCE_FLYZONE_TUNING
|
#ifndef FORCE_HEIGHT_TUNING
|
||||||
A7105_AdjustLOBaseFreq(1);
|
A7105_AdjustLOBaseFreq(1);
|
||||||
#endif
|
#endif
|
||||||
if(IS_BIND_IN_PROGRESS)
|
if(IS_BIND_IN_PROGRESS)
|
||||||
@@ -45,7 +51,7 @@ uint16_t ReadFlyzone()
|
|||||||
packet[0] = 0x1B;
|
packet[0] = 0x1B;
|
||||||
packet[1] = rx_tx_addr[2];
|
packet[1] = rx_tx_addr[2];
|
||||||
packet[2] = rx_tx_addr[3];
|
packet[2] = rx_tx_addr[3];
|
||||||
A7105_WriteData(3, FLYZONE_BIND_CH);
|
A7105_WriteData(3, HEIGHT_BIND_CH);
|
||||||
if (bind_counter--==0)
|
if (bind_counter--==0)
|
||||||
BIND_DONE;
|
BIND_DONE;
|
||||||
return 22700;
|
return 22700;
|
||||||
@@ -58,8 +64,8 @@ uint16_t ReadFlyzone()
|
|||||||
#ifdef MULTI_SYNC
|
#ifdef MULTI_SYNC
|
||||||
telemetry_set_input_sync(20*1500);
|
telemetry_set_input_sync(20*1500);
|
||||||
#endif
|
#endif
|
||||||
flyzone_build_packet();
|
HEIGHT_build_packet();
|
||||||
A7105_WriteData(8, hopping_frequency[0]);
|
A7105_WriteData(sub_protocol?11:8, hopping_frequency[0]);
|
||||||
A7105_SetPower();
|
A7105_SetPower();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -72,14 +78,14 @@ uint16_t ReadFlyzone()
|
|||||||
return 1500;
|
return 1500;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t initFlyzone()
|
uint16_t initHeight()
|
||||||
{
|
{
|
||||||
A7105_Init();
|
A7105_Init();
|
||||||
|
|
||||||
hopping_frequency[0]=((random(0xfefefefe) & 0x0F)+2)<<2;
|
hopping_frequency[0]=((random(0xfefefefe) & 0x0F)+2)<<2;
|
||||||
hopping_frequency[1]=hopping_frequency[0]+0x50;
|
hopping_frequency[1]=hopping_frequency[0]+0x50;
|
||||||
|
|
||||||
#ifdef FLYZONE_FORCEID
|
#ifdef HEIGHT_FORCEID
|
||||||
rx_tx_addr[2]=0x35;
|
rx_tx_addr[2]=0x35;
|
||||||
rx_tx_addr[3]=0xD0;
|
rx_tx_addr[3]=0xD0;
|
||||||
hopping_frequency[0]=0x18;
|
hopping_frequency[0]=0x18;
|
||||||
@@ -87,7 +93,7 @@ uint16_t initFlyzone()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
phase=255;
|
phase=255;
|
||||||
bind_counter = FLYZONE_BIND_COUNT;
|
bind_counter = HEIGHT_BIND_COUNT;
|
||||||
return 2400;
|
return 2400;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
116
Multiprotocol/Kyosho_a7105.ino
Normal file
116
Multiprotocol/Kyosho_a7105.ino
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
This project is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Multiprotocol is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(KYOSHO_A7105_INO)
|
||||||
|
|
||||||
|
#include "iface_a7105.h"
|
||||||
|
|
||||||
|
//#define KYOSHO_FORCE_ID
|
||||||
|
|
||||||
|
//Kyosho constants & variables
|
||||||
|
#define KYOSHO_BIND_COUNT 2500
|
||||||
|
|
||||||
|
static void __attribute__((unused)) kyosho_send_packet()
|
||||||
|
{
|
||||||
|
//ID
|
||||||
|
packet[1] = rx_tx_addr[0];
|
||||||
|
packet[2] = rx_tx_addr[1];
|
||||||
|
packet[3] = rx_tx_addr[2];
|
||||||
|
packet[4] = rx_tx_addr[3];
|
||||||
|
//unknown may be RX ID on some other remotes
|
||||||
|
memset(packet+5,0xFF,4);
|
||||||
|
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
{
|
||||||
|
packet[ 0] = 0xBC; // bind indicator
|
||||||
|
packet[ 9] &= 0x01;
|
||||||
|
packet[ 9] ^= 0x01; // high/ low part of the RF table
|
||||||
|
packet[10] = 0x00;
|
||||||
|
//RF table
|
||||||
|
for(uint8_t i=0; i<16;i++)
|
||||||
|
packet[i+11]=hopping_frequency[i+(packet[9]<<4)];
|
||||||
|
//unknwon
|
||||||
|
packet[27] = 0x05;
|
||||||
|
packet[28] = 0x00;
|
||||||
|
memset(packet+29,0xFF,8);
|
||||||
|
//frequency hop during bind
|
||||||
|
if(packet[9])
|
||||||
|
rf_ch_num=0x8C;
|
||||||
|
else
|
||||||
|
rf_ch_num=0x0D;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet[ 0] = 0x58; // normal packet
|
||||||
|
//14 channels: steering, throttle, ...
|
||||||
|
for(uint8_t i = 0; i < 14; i++)
|
||||||
|
{
|
||||||
|
uint16_t temp=convert_channel_ppm(i);
|
||||||
|
packet[9 + i*2]=temp&0xFF; // low byte of servo timing(1000-2000us)
|
||||||
|
packet[10 + i*2]=(temp>>8)&0xFF; // high byte of servo timing(1000-2000us)
|
||||||
|
}
|
||||||
|
rf_ch_num=hopping_frequency[hopping_frequency_no];
|
||||||
|
hopping_frequency_no++;
|
||||||
|
packet[34] |= (hopping_frequency_no&0x0F)<<4;
|
||||||
|
packet[36] |= (hopping_frequency_no&0xF0); // last byte is ending with F on the dumps so let's see
|
||||||
|
hopping_frequency_no &= 0x1F;
|
||||||
|
}
|
||||||
|
// debug("ch=%02X P=",rf_ch_num);
|
||||||
|
// for(uint8_t i=0; i<37; i++)
|
||||||
|
// debug("%02X ", packet[i]);
|
||||||
|
// debugln("");
|
||||||
|
A7105_WriteData(37, rf_ch_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t ReadKyosho()
|
||||||
|
{
|
||||||
|
#ifndef FORCE_KYOSHO_TUNING
|
||||||
|
A7105_AdjustLOBaseFreq(1);
|
||||||
|
#endif
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
{
|
||||||
|
bind_counter--;
|
||||||
|
if (bind_counter==0)
|
||||||
|
BIND_DONE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
A7105_SetPower();
|
||||||
|
#ifdef MULTI_SYNC
|
||||||
|
telemetry_set_input_sync(3852);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
kyosho_send_packet();
|
||||||
|
return 3852;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t initKyosho()
|
||||||
|
{
|
||||||
|
A7105_Init();
|
||||||
|
|
||||||
|
// compute 32 channels from ID
|
||||||
|
calc_fh_channels(32);
|
||||||
|
hopping_frequency_no=0;
|
||||||
|
|
||||||
|
#ifdef KYOSHO_FORCE_ID
|
||||||
|
memcpy(rx_tx_addr,"\x3A\x39\x37\x00",4);
|
||||||
|
memcpy(hopping_frequency,"\x29\x4C\x67\x92\x31\x1C\x77\x18\x23\x6E\x81\x5C\x8F\x5A\x51\x94\x7A\x12\x45\x6C\x7F\x1E\x0D\x88\x63\x8C\x4F\x37\x26\x61\x2C\x8A",32);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
bind_counter = KYOSHO_BIND_COUNT;
|
||||||
|
return 2000;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
2,Hubsan,H107,H301,H501
|
2,Hubsan,H107,H301,H501
|
||||||
3,FrskyD,D8,Cloned
|
3,FrskyD,D8,Cloned
|
||||||
4,Hisky,Hisky,HK310
|
4,Hisky,Hisky,HK310
|
||||||
5,V2x2,V2x2,JXD506
|
5,V2x2,V2x2,JXD506,MR101
|
||||||
6,DSM,DSM2-22,DSM2-11,DSMX-22,DSMX-11,AUTO
|
6,DSM,DSM2_1F,DSM2_2F,DSMX_1F,DSMX_2F,AUTO
|
||||||
7,Devo,8CH,10CH,12CH,6CH,7CH
|
7,Devo,8CH,10CH,12CH,6CH,7CH
|
||||||
8,YD717,YD717,SKYWLKR,SYMAX4,XINXUN,NIHUI
|
8,YD717,YD717,SKYWLKR,SYMAX4,XINXUN,NIHUI
|
||||||
9,KN,WLTOYS,FEILUN
|
9,KN,WLTOYS,FEILUN
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
12,CX10,GREEN,BLUE,DM007,---,J3015_1,J3015_2,MK33041
|
12,CX10,GREEN,BLUE,DM007,---,J3015_1,J3015_2,MK33041
|
||||||
13,CG023,CG023,YD829
|
13,CG023,CG023,YD829
|
||||||
14,Bayang,Bayang,H8S3D,X16_AH,IRDRONE,DHD_D4,QX100
|
14,Bayang,Bayang,H8S3D,X16_AH,IRDRONE,DHD_D4,QX100
|
||||||
15,FrskyX,CH_16,CH_8,EU_16,EU_8,Cloned
|
15,FrskyX,CH_16,CH_8,EU_16,EU_8,Cloned,Clon_8
|
||||||
16,ESky,Std,ET4
|
16,ESky,Std,ET4
|
||||||
17,MT99xx,MT,H7,YZ,LS,FY805
|
17,MT99xx,MT,H7,YZ,LS,FY805
|
||||||
18,MJXq,WLH08,X600,X800,H26D,E010,H26WH,PHOENIX
|
18,MJXq,WLH08,X600,X800,H26D,E010,H26WH,PHOENIX
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
25,FrskyV
|
25,FrskyV
|
||||||
26,HONTAI,HONTAI,JJRCX1,X5C1,FQ777_951
|
26,HONTAI,HONTAI,JJRCX1,X5C1,FQ777_951
|
||||||
27,OpnLrs
|
27,OpnLrs
|
||||||
28,AFHDS2A,PWM_IBUS,PPM_IBUS,PWM_SBUS,PPM_SBUS
|
28,AFHDS2A,PWM_IBUS,PPM_IBUS,PWM_SBUS,PPM_SBUS,PWM_IB16,PPM_IB16
|
||||||
29,Q2X2,Q222,Q242,Q282
|
29,Q2X2,Q222,Q242,Q282
|
||||||
30,WK2x01,WK2801,WK2401,W6_5_1,W6_6_1,W6_HEL,W6_HEL_I
|
30,WK2x01,WK2801,WK2401,W6_5_1,W6_6_1,W6_HEL,W6_HEL_I
|
||||||
31,Q303,Q303,CX35,CX10D,CX10WD
|
31,Q303,Q303,CX35,CX10D,CX10WD
|
||||||
@@ -45,12 +45,12 @@
|
|||||||
45,E01X,E012,E015,E016H
|
45,E01X,E012,E015,E016H
|
||||||
46,V911S,V911S,E119
|
46,V911S,V911S,E119
|
||||||
47,GD00x,GD_V1,GD_V2
|
47,GD00x,GD_V1,GD_V2
|
||||||
48,V761
|
48,V761,3CH,4CH
|
||||||
49,KF606
|
49,KF606
|
||||||
50,Redpine,Fast,Slow
|
50,Redpine,Fast,Slow
|
||||||
51,Potensic,A20
|
51,Potensic,A20
|
||||||
52,ZSX,280
|
52,ZSX,280
|
||||||
53,Flyzone,FZ-410
|
53,Height,5ch,8ch
|
||||||
54,Scanner
|
54,Scanner
|
||||||
55,Frsky_RX,RX,CloneTX
|
55,Frsky_RX,RX,CloneTX
|
||||||
56,AFHDS2A_RX
|
56,AFHDS2A_RX
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
62,XK,X450,X420
|
62,XK,X450,X420
|
||||||
63,XN_DUMP,250K,1M,2M,AUTO
|
63,XN_DUMP,250K,1M,2M,AUTO
|
||||||
64,FrskyX2,CH_16,CH_8,EU_16,EU_8,Cloned
|
64,FrskyX2,CH_16,CH_8,EU_16,EU_8,Cloned
|
||||||
65,FrSkyR9,915MHz,868MHz,915_8ch,868_8ch
|
65,FrSkyR9,915MHz,868MHz,915_8ch,868_8ch,FCC,--,FCC_8ch,--_8ch
|
||||||
66,PROPEL,74-Z
|
66,PROPEL,74-Z
|
||||||
67,LR12,LR12,LR12_6ch
|
67,LR12,LR12,LR12_6ch
|
||||||
68,Skyartec
|
68,Skyartec
|
||||||
@@ -70,3 +70,5 @@
|
|||||||
70,DSM_RX
|
70,DSM_RX
|
||||||
71,JJRC345
|
71,JJRC345
|
||||||
72,Q90C
|
72,Q90C
|
||||||
|
73,Kyosho
|
||||||
|
74,RadioLink,Surface
|
||||||
@@ -72,7 +72,7 @@ const char STR_KF606[] ="KF606";
|
|||||||
const char STR_REDPINE[] ="Redpine";
|
const char STR_REDPINE[] ="Redpine";
|
||||||
const char STR_POTENSIC[] ="Potensi";
|
const char STR_POTENSIC[] ="Potensi";
|
||||||
const char STR_ZSX[] ="ZSX";
|
const char STR_ZSX[] ="ZSX";
|
||||||
const char STR_FLYZONE[] ="FlyZone";
|
const char STR_HEIGHT[] ="Height";
|
||||||
const char STR_SCANNER[] ="Scanner";
|
const char STR_SCANNER[] ="Scanner";
|
||||||
const char STR_FRSKY_RX[] ="FrSkyRX";
|
const char STR_FRSKY_RX[] ="FrSkyRX";
|
||||||
const char STR_AFHDS2A_RX[] ="FS2A_RX";
|
const char STR_AFHDS2A_RX[] ="FS2A_RX";
|
||||||
@@ -86,15 +86,18 @@ const char STR_XN297DUMP[] ="XN297DP";
|
|||||||
const char STR_FRSKYR9[] ="FrSkyR9";
|
const char STR_FRSKYR9[] ="FrSkyR9";
|
||||||
const char STR_PROPEL[] ="Propel";
|
const char STR_PROPEL[] ="Propel";
|
||||||
const char STR_SKYARTEC[] ="Skyartc";
|
const char STR_SKYARTEC[] ="Skyartc";
|
||||||
|
const char STR_KYOSHO[] ="Kyosho";
|
||||||
|
const char STR_RLINK[] ="RadLink";
|
||||||
const char STR_TEST[] ="Test";
|
const char STR_TEST[] ="Test";
|
||||||
|
const char STR_FAKE[] ="Fake";
|
||||||
|
|
||||||
const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20";
|
const char STR_SUBTYPE_FLYSKY[] = "\x04""Std\0""V9x9""V6x6""V912""CX20";
|
||||||
const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501";
|
const char STR_SUBTYPE_HUBSAN[] = "\x04""H107""H301""H501";
|
||||||
const char STR_SUBTYPE_FRSKYD[] = "\x06""D8\0 ""Cloned";
|
const char STR_SUBTYPE_FRSKYD[] = "\x06""D8\0 ""Cloned";
|
||||||
const char STR_SUBTYPE_FRSKYX[] = "\x07""D16\0 ""D16 8ch""LBT(EU)""LBT 8ch""Cloned\0";
|
const char STR_SUBTYPE_FRSKYX[] = "\x07""D16\0 ""D16 8ch""LBT(EU)""LBT 8ch""Cloned\0""Clo 8ch";
|
||||||
const char STR_SUBTYPE_HISKY[] = "\x05""Std\0 ""HK310";
|
const char STR_SUBTYPE_HISKY[] = "\x05""Std\0 ""HK310";
|
||||||
const char STR_SUBTYPE_V2X2[] = "\x06""Std\0 ""JXD506";
|
const char STR_SUBTYPE_V2X2[] = "\x06""Std\0 ""JXD506""MR101\0";
|
||||||
const char STR_SUBTYPE_DSM[] = "\x06""2 22ms""2 11ms""X 22ms""X 11ms";
|
const char STR_SUBTYPE_DSM[] = "\x04""2 1F""2 2F""X 1F""X 2F""Auto";
|
||||||
const char STR_SUBTYPE_DEVO[] = "\x04""8ch\0""10ch""12ch""6ch\0""7ch\0";
|
const char STR_SUBTYPE_DEVO[] = "\x04""8ch\0""10ch""12ch""6ch\0""7ch\0";
|
||||||
const char STR_SUBTYPE_YD717[] = "\x07""Std\0 ""SkyWlkr""Syma X4""XINXUN\0""NIHUI\0 ";
|
const char STR_SUBTYPE_YD717[] = "\x07""Std\0 ""SkyWlkr""Syma X4""XINXUN\0""NIHUI\0 ";
|
||||||
const char STR_SUBTYPE_KN[] = "\x06""WLtoys""FeiLun";
|
const char STR_SUBTYPE_KN[] = "\x06""WLtoys""FeiLun";
|
||||||
@@ -107,7 +110,7 @@ const char STR_SUBTYPE_MT99[] = "\x06""MT99\0 ""H7\0 ""YZ\0 ""LS\0 "
|
|||||||
const char STR_SUBTYPE_MJXQ[] = "\x07""WLH08\0 ""X600\0 ""X800\0 ""H26D\0 ""E010\0 ""H26WH\0 ""Phoenix";
|
const char STR_SUBTYPE_MJXQ[] = "\x07""WLH08\0 ""X600\0 ""X800\0 ""H26D\0 ""E010\0 ""H26WH\0 ""Phoenix";
|
||||||
const char STR_SUBTYPE_FY326[] = "\x05""Std\0 ""FY319";
|
const char STR_SUBTYPE_FY326[] = "\x05""Std\0 ""FY319";
|
||||||
const char STR_SUBTYPE_HONTAI[] = "\x07""Std\0 ""JJRC X1""X5C1\0 ""FQ_951";
|
const char STR_SUBTYPE_HONTAI[] = "\x07""Std\0 ""JJRC X1""X5C1\0 ""FQ_951";
|
||||||
const char STR_SUBTYPE_AFHDS2A[] = "\x08""PWM,IBUS""PPM,IBUS""PWM,SBUS""PPM,SBUS";
|
const char STR_SUBTYPE_AFHDS2A[] = "\x08""PWM,IBUS""PPM,IBUS""PWM,SBUS""PPM,SBUS""PWM,IB16""PPM,IB16";
|
||||||
const char STR_SUBTYPE_Q2X2[] = "\x04""Q222""Q242""Q282";
|
const char STR_SUBTYPE_Q2X2[] = "\x04""Q222""Q242""Q282";
|
||||||
const char STR_SUBTYPE_WK2x01[] = "\x06""WK2801""WK2401""W6_5_1""W6_6_1""W6_HeL""W6_HeI";
|
const char STR_SUBTYPE_WK2x01[] = "\x06""WK2801""WK2401""W6_5_1""W6_6_1""W6_HeL""W6_HeI";
|
||||||
const char STR_SUBTYPE_Q303[] = "\x06""Std\0 ""CX35\0 ""CX10D\0""CX10WD";
|
const char STR_SUBTYPE_Q303[] = "\x06""Std\0 ""CX35\0 ""CX10D\0""CX10WD";
|
||||||
@@ -122,14 +125,14 @@ const char STR_SUBTYPE_GD00X[] = "\x05""GD_V1""GD_V2";
|
|||||||
const char STR_SUBTYPE_REDPINE[] = "\x04""Fast""Slow";
|
const char STR_SUBTYPE_REDPINE[] = "\x04""Fast""Slow";
|
||||||
const char STR_SUBTYPE_POTENSIC[] = "\x03""A20";
|
const char STR_SUBTYPE_POTENSIC[] = "\x03""A20";
|
||||||
const char STR_SUBTYPE_ZSX[] = "\x07""280JJRC";
|
const char STR_SUBTYPE_ZSX[] = "\x07""280JJRC";
|
||||||
const char STR_SUBTYPE_FLYZONE[] = "\x05""FZ410";
|
const char STR_SUBTYPE_HEIGHT[] = "\x03""5ch""8ch";
|
||||||
const char STR_SUBTYPE_FX816[] = "\x03""P38";
|
const char STR_SUBTYPE_FX816[] = "\x03""P38";
|
||||||
const char STR_SUBTYPE_XN297DUMP[] = "\x07""250Kbps""1Mbps\0 ""2Mbps\0 ""Auto\0 ";
|
const char STR_SUBTYPE_XN297DUMP[] = "\x07""250Kbps""1Mbps\0 ""2Mbps\0 ""Auto\0 ""NRF\0 ";
|
||||||
const char STR_SUBTYPE_ESKY150[] = "\x03""4ch""7ch";
|
const char STR_SUBTYPE_ESKY150[] = "\x03""4ch""7ch";
|
||||||
const char STR_SUBTYPE_ESKY150V2[] = "\x05""150V2";
|
const char STR_SUBTYPE_ESKY150V2[] = "\x05""150V2";
|
||||||
const char STR_SUBTYPE_V911S[] = "\x05""V911S""E119\0";
|
const char STR_SUBTYPE_V911S[] = "\x05""V911S""E119\0";
|
||||||
const char STR_SUBTYPE_XK[] = "\x04""X450""X420";
|
const char STR_SUBTYPE_XK[] = "\x04""X450""X420";
|
||||||
const char STR_SUBTYPE_FRSKYR9[] = "\x07""915MHz\0""868MHz\0""915 8ch""868 8ch";
|
const char STR_SUBTYPE_FRSKYR9[] = "\x07""915MHz\0""868MHz\0""915 8ch""868 8ch""FCC\0 ""--\0 ""FCC 8ch""-- 8ch\0";
|
||||||
const char STR_SUBTYPE_ESKY[] = "\x03""Std""ET4";
|
const char STR_SUBTYPE_ESKY[] = "\x03""Std""ET4";
|
||||||
const char STR_SUBTYPE_PROPEL[] = "\x04""74-Z";
|
const char STR_SUBTYPE_PROPEL[] = "\x04""74-Z";
|
||||||
const char STR_SUBTYPE_FRSKY_RX[] = "\x07""RX\0 ""CloneTX";
|
const char STR_SUBTYPE_FRSKY_RX[] = "\x07""RX\0 ""CloneTX";
|
||||||
@@ -137,6 +140,8 @@ const char STR_SUBTYPE_FRSKYL[] = "\x08""LR12\0 ""LR12 6ch";
|
|||||||
const char STR_SUBTYPE_WFLY[] = "\x06""WFR0xS";
|
const char STR_SUBTYPE_WFLY[] = "\x06""WFR0xS";
|
||||||
const char STR_SUBTYPE_HOTT[] = "\x07""Sync\0 ""No_Sync";
|
const char STR_SUBTYPE_HOTT[] = "\x07""Sync\0 ""No_Sync";
|
||||||
const char STR_SUBTYPE_PELIKAN[] = "\x04""Pro\0""Lite";
|
const char STR_SUBTYPE_PELIKAN[] = "\x04""Pro\0""Lite";
|
||||||
|
const char STR_SUBTYPE_V761[] = "\x03""3ch""4ch";
|
||||||
|
const char STR_SUBTYPE_RLINK[] = "\x07""Surface""Air\0 ";
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -148,7 +153,8 @@ enum
|
|||||||
OPTION_TELEM,
|
OPTION_TELEM,
|
||||||
OPTION_SRVFREQ,
|
OPTION_SRVFREQ,
|
||||||
OPTION_MAXTHR,
|
OPTION_MAXTHR,
|
||||||
OPTION_RFCHAN
|
OPTION_RFCHAN,
|
||||||
|
OPTION_RFPOWER,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NO_SUBTYPE nullptr
|
#define NO_SUBTYPE nullptr
|
||||||
@@ -192,7 +198,7 @@ const mm_protocol_definition multi_protocols[] = {
|
|||||||
{PROTO_DM002, STR_DM002, 0, NO_SUBTYPE, OPTION_NONE },
|
{PROTO_DM002, STR_DM002, 0, NO_SUBTYPE, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(DSM_CYRF6936_INO)
|
#if defined(DSM_CYRF6936_INO)
|
||||||
{PROTO_DSM, STR_DSM, 4, STR_SUBTYPE_DSM, OPTION_MAXTHR },
|
{PROTO_DSM, STR_DSM, 5, STR_SUBTYPE_DSM, OPTION_MAXTHR },
|
||||||
#endif
|
#endif
|
||||||
#if defined(DSM_RX_CYRF6936_INO)
|
#if defined(DSM_RX_CYRF6936_INO)
|
||||||
{PROTO_DSM_RX, STR_DSM_RX, 0, NO_SUBTYPE, OPTION_NONE },
|
{PROTO_DSM_RX, STR_DSM_RX, 0, NO_SUBTYPE, OPTION_NONE },
|
||||||
@@ -213,13 +219,13 @@ const mm_protocol_definition multi_protocols[] = {
|
|||||||
{PROTO_FLYSKY, STR_FLYSKY, 5, STR_SUBTYPE_FLYSKY, OPTION_NONE },
|
{PROTO_FLYSKY, STR_FLYSKY, 5, STR_SUBTYPE_FLYSKY, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(AFHDS2A_A7105_INO)
|
#if defined(AFHDS2A_A7105_INO)
|
||||||
{PROTO_AFHDS2A, STR_AFHDS2A, 4, STR_SUBTYPE_AFHDS2A, OPTION_SRVFREQ },
|
{PROTO_AFHDS2A, STR_AFHDS2A, 6, STR_SUBTYPE_AFHDS2A, OPTION_SRVFREQ },
|
||||||
#endif
|
#endif
|
||||||
#if defined(AFHDS2A_RX_A7105_INO)
|
#if defined(AFHDS2A_RX_A7105_INO)
|
||||||
{PROTO_AFHDS2A_RX, STR_AFHDS2A_RX,0, NO_SUBTYPE, OPTION_NONE },
|
{PROTO_AFHDS2A_RX, STR_AFHDS2A_RX,0, NO_SUBTYPE, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(FLYZONE_A7105_INO)
|
#if defined(HEIGHT_A7105_INO)
|
||||||
{PROTO_FLYZONE, STR_FLYZONE, 1, STR_SUBTYPE_FLYZONE, OPTION_NONE },
|
{PROTO_HEIGHT, STR_HEIGHT, 2, STR_SUBTYPE_HEIGHT, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(FQ777_NRF24L01_INO)
|
#if defined(FQ777_NRF24L01_INO)
|
||||||
{PROTO_FQ777, STR_FQ777, 0, NO_SUBTYPE, OPTION_NONE },
|
{PROTO_FQ777, STR_FQ777, 0, NO_SUBTYPE, OPTION_NONE },
|
||||||
@@ -235,15 +241,15 @@ const mm_protocol_definition multi_protocols[] = {
|
|||||||
{PROTO_FRSKYV, STR_FRSKYV, 0, NO_SUBTYPE, OPTION_RFTUNE },
|
{PROTO_FRSKYV, STR_FRSKYV, 0, NO_SUBTYPE, OPTION_RFTUNE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(FRSKYX_CC2500_INO)
|
#if defined(FRSKYX_CC2500_INO)
|
||||||
{PROTO_FRSKYX, STR_FRSKYX, 5, STR_SUBTYPE_FRSKYX, OPTION_RFTUNE },
|
{PROTO_FRSKYX, STR_FRSKYX, 6, STR_SUBTYPE_FRSKYX, OPTION_RFTUNE },
|
||||||
{PROTO_FRSKYX2, STR_FRSKYX2, 5, STR_SUBTYPE_FRSKYX, OPTION_RFTUNE },
|
{PROTO_FRSKYX2, STR_FRSKYX2, 6, STR_SUBTYPE_FRSKYX, OPTION_RFTUNE },
|
||||||
#endif
|
#endif
|
||||||
//OpenTX 2.3.x issue: DO NOT CHANGE ORDER above
|
//OpenTX 2.3.x issue: DO NOT CHANGE ORDER above
|
||||||
#if defined(FRSKYL_CC2500_INO)
|
#if defined(FRSKYL_CC2500_INO)
|
||||||
{PROTO_FRSKYL, STR_FRSKYL, 2, STR_SUBTYPE_FRSKYL, OPTION_RFTUNE },
|
{PROTO_FRSKYL, STR_FRSKYL, 2, STR_SUBTYPE_FRSKYL, OPTION_RFTUNE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(FRSKYR9_SX1276_INO)
|
#if defined(FRSKYR9_SX1276_INO)
|
||||||
{PROTO_FRSKY_R9, STR_FRSKYR9, 4, STR_SUBTYPE_FRSKYR9, OPTION_NONE },
|
{PROTO_FRSKY_R9, STR_FRSKYR9, 8, STR_SUBTYPE_FRSKYR9, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(FX816_NRF24L01_INO)
|
#if defined(FX816_NRF24L01_INO)
|
||||||
{PROTO_FX816, STR_FX816, 1, STR_SUBTYPE_FX816, OPTION_NONE },
|
{PROTO_FX816, STR_FX816, 1, STR_SUBTYPE_FX816, OPTION_NONE },
|
||||||
@@ -287,6 +293,9 @@ const mm_protocol_definition multi_protocols[] = {
|
|||||||
#if defined(KN_NRF24L01_INO)
|
#if defined(KN_NRF24L01_INO)
|
||||||
{PROTO_KN, STR_KN, 2, STR_SUBTYPE_KN, OPTION_NONE },
|
{PROTO_KN, STR_KN, 2, STR_SUBTYPE_KN, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(KYOSHO_A7105_INO)
|
||||||
|
{PROTO_KYOSHO, STR_KYOSHO, 0, NO_SUBTYPE, OPTION_NONE },
|
||||||
|
#endif
|
||||||
#if defined(MJXQ_NRF24L01_INO)
|
#if defined(MJXQ_NRF24L01_INO)
|
||||||
{PROTO_MJXQ, STR_MJXQ, 7, STR_SUBTYPE_MJXQ, OPTION_RFTUNE },
|
{PROTO_MJXQ, STR_MJXQ, 7, STR_SUBTYPE_MJXQ, OPTION_RFTUNE },
|
||||||
#endif
|
#endif
|
||||||
@@ -317,6 +326,9 @@ const mm_protocol_definition multi_protocols[] = {
|
|||||||
#if defined(REDPINE_CC2500_INO)
|
#if defined(REDPINE_CC2500_INO)
|
||||||
{PROTO_REDPINE, STR_REDPINE, 2, STR_SUBTYPE_REDPINE, OPTION_RFTUNE },
|
{PROTO_REDPINE, STR_REDPINE, 2, STR_SUBTYPE_REDPINE, OPTION_RFTUNE },
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(RLINK_CC2500_INO)
|
||||||
|
{PROTO_RLINK, STR_RLINK, 2, STR_SUBTYPE_RLINK, OPTION_RFTUNE },
|
||||||
|
#endif
|
||||||
#if defined(SCANNER_CC2500_INO)
|
#if defined(SCANNER_CC2500_INO)
|
||||||
// {PROTO_SCANNER, STR_SCANNER, 0, NO_SUBTYPE, OPTION_NONE },
|
// {PROTO_SCANNER, STR_SCANNER, 0, NO_SUBTYPE, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
@@ -342,10 +354,10 @@ const mm_protocol_definition multi_protocols[] = {
|
|||||||
{PROTO_TRAXXAS, STR_TRAXXAS, 1, STR_SUBTYPE_TRAXXAS, OPTION_NONE },
|
{PROTO_TRAXXAS, STR_TRAXXAS, 1, STR_SUBTYPE_TRAXXAS, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(V2X2_NRF24L01_INO)
|
#if defined(V2X2_NRF24L01_INO)
|
||||||
{PROTO_V2X2, STR_V2X2, 2, STR_SUBTYPE_V2X2, OPTION_NONE },
|
{PROTO_V2X2, STR_V2X2, 3, STR_SUBTYPE_V2X2, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(V761_NRF24L01_INO)
|
#if defined(V761_NRF24L01_INO)
|
||||||
{PROTO_V761, STR_V761, 0, NO_SUBTYPE, OPTION_NONE },
|
{PROTO_V761, STR_V761, 2, STR_SUBTYPE_V761, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(V911S_NRF24L01_INO)
|
#if defined(V911S_NRF24L01_INO)
|
||||||
{PROTO_V911S, STR_V911S, 2, STR_SUBTYPE_V911S, OPTION_RFTUNE },
|
{PROTO_V911S, STR_V911S, 2, STR_SUBTYPE_V911S, OPTION_RFTUNE },
|
||||||
@@ -360,7 +372,7 @@ const mm_protocol_definition multi_protocols[] = {
|
|||||||
{PROTO_XK, STR_XK , 2, STR_SUBTYPE_XK, OPTION_RFTUNE },
|
{PROTO_XK, STR_XK , 2, STR_SUBTYPE_XK, OPTION_RFTUNE },
|
||||||
#endif
|
#endif
|
||||||
#if defined(XN297DUMP_NRF24L01_INO)
|
#if defined(XN297DUMP_NRF24L01_INO)
|
||||||
{PROTO_XN297DUMP, STR_XN297DUMP, 4, STR_SUBTYPE_XN297DUMP, OPTION_RFCHAN },
|
{PROTO_XN297DUMP, STR_XN297DUMP, 5, STR_SUBTYPE_XN297DUMP, OPTION_RFCHAN },
|
||||||
#endif
|
#endif
|
||||||
#if defined(YD717_NRF24L01_INO)
|
#if defined(YD717_NRF24L01_INO)
|
||||||
{PROTO_YD717, STR_YD717, 5, STR_SUBTYPE_YD717, OPTION_NONE },
|
{PROTO_YD717, STR_YD717, 5, STR_SUBTYPE_YD717, OPTION_NONE },
|
||||||
@@ -370,6 +382,9 @@ const mm_protocol_definition multi_protocols[] = {
|
|||||||
#endif
|
#endif
|
||||||
#if defined(TEST_CC2500_INO)
|
#if defined(TEST_CC2500_INO)
|
||||||
{PROTO_TEST, STR_TEST, 0, NO_SUBTYPE, OPTION_RFTUNE },
|
{PROTO_TEST, STR_TEST, 0, NO_SUBTYPE, OPTION_RFTUNE },
|
||||||
|
#endif
|
||||||
|
#if defined(FAKE_NRF24L01_INO)
|
||||||
|
{PROTO_FAKE, STR_FAKE, 0, NO_SUBTYPE, OPTION_NONE },
|
||||||
#endif
|
#endif
|
||||||
{0x00, nullptr, 0, nullptr, 0 }
|
{0x00, nullptr, 0, nullptr, 0 }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_REVISION 1
|
#define VERSION_REVISION 1
|
||||||
#define VERSION_PATCH_LEVEL 9
|
#define VERSION_PATCH_LEVEL 49
|
||||||
|
|
||||||
//******************
|
//******************
|
||||||
// Protocols
|
// Protocols
|
||||||
@@ -79,7 +79,7 @@ enum PROTOCOLS
|
|||||||
PROTO_REDPINE = 50, // =>CC2500
|
PROTO_REDPINE = 50, // =>CC2500
|
||||||
PROTO_POTENSIC = 51, // =>NRF24L01
|
PROTO_POTENSIC = 51, // =>NRF24L01
|
||||||
PROTO_ZSX = 52, // =>NRF24L01
|
PROTO_ZSX = 52, // =>NRF24L01
|
||||||
PROTO_FLYZONE = 53, // =>A7105
|
PROTO_HEIGHT = 53, // =>A7105
|
||||||
PROTO_SCANNER = 54, // =>CC2500
|
PROTO_SCANNER = 54, // =>CC2500
|
||||||
PROTO_FRSKY_RX = 55, // =>CC2500
|
PROTO_FRSKY_RX = 55, // =>CC2500
|
||||||
PROTO_AFHDS2A_RX= 56, // =>A7105
|
PROTO_AFHDS2A_RX= 56, // =>A7105
|
||||||
@@ -99,7 +99,10 @@ enum PROTOCOLS
|
|||||||
PROTO_DSM_RX = 70, // =>CYRF6936
|
PROTO_DSM_RX = 70, // =>CYRF6936
|
||||||
PROTO_JJRC345 = 71, // =>NRF24L01
|
PROTO_JJRC345 = 71, // =>NRF24L01
|
||||||
PROTO_Q90C = 72, // =>NRF24L01 or CC2500
|
PROTO_Q90C = 72, // =>NRF24L01 or CC2500
|
||||||
|
PROTO_KYOSHO = 73, // =>A7105
|
||||||
|
PROTO_RLINK = 74, // =>CC2500
|
||||||
|
|
||||||
|
PROTO_FAKE = 126, // =>CC2500+NRF24L01
|
||||||
PROTO_TEST = 127, // =>CC2500
|
PROTO_TEST = 127, // =>CC2500
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -111,7 +114,7 @@ enum Flysky
|
|||||||
V912 = 3,
|
V912 = 3,
|
||||||
CX20 = 4,
|
CX20 = 4,
|
||||||
};
|
};
|
||||||
enum Flyzone
|
enum Height
|
||||||
{
|
{
|
||||||
FZ410 = 0,
|
FZ410 = 0,
|
||||||
};
|
};
|
||||||
@@ -127,6 +130,8 @@ enum AFHDS2A
|
|||||||
PPM_IBUS = 1,
|
PPM_IBUS = 1,
|
||||||
PWM_SBUS = 2,
|
PWM_SBUS = 2,
|
||||||
PPM_SBUS = 3,
|
PPM_SBUS = 3,
|
||||||
|
PWM_IB16 = 4,
|
||||||
|
PPM_IB16 = 5,
|
||||||
};
|
};
|
||||||
enum Hisky
|
enum Hisky
|
||||||
{
|
{
|
||||||
@@ -228,7 +233,8 @@ enum FRSKYX
|
|||||||
CH_8 = 1,
|
CH_8 = 1,
|
||||||
EU_16 = 2,
|
EU_16 = 2,
|
||||||
EU_8 = 3,
|
EU_8 = 3,
|
||||||
XCLONE = 4,
|
XCLONE_16 = 4,
|
||||||
|
XCLONE_8 = 5,
|
||||||
};
|
};
|
||||||
enum HONTAI
|
enum HONTAI
|
||||||
{
|
{
|
||||||
@@ -241,6 +247,7 @@ enum V2X2
|
|||||||
{
|
{
|
||||||
V2X2 = 0,
|
V2X2 = 0,
|
||||||
JXD506 = 1,
|
JXD506 = 1,
|
||||||
|
V2X2_MR101 = 2,
|
||||||
};
|
};
|
||||||
enum FY326
|
enum FY326
|
||||||
{
|
{
|
||||||
@@ -342,6 +349,10 @@ enum FRSKY_R9
|
|||||||
R9_868 = 1,
|
R9_868 = 1,
|
||||||
R9_915_8CH = 2,
|
R9_915_8CH = 2,
|
||||||
R9_868_8CH = 3,
|
R9_868_8CH = 3,
|
||||||
|
R9_FCC = 4,
|
||||||
|
R9_EU = 5,
|
||||||
|
R9_FCC_8CH = 6,
|
||||||
|
R9_EU_8CH = 7,
|
||||||
};
|
};
|
||||||
enum ESKY
|
enum ESKY
|
||||||
{
|
{
|
||||||
@@ -373,6 +384,18 @@ enum PELIKAN
|
|||||||
PELIKAN_LITE= 1,
|
PELIKAN_LITE= 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum V761
|
||||||
|
{
|
||||||
|
V761_3CH = 0,
|
||||||
|
V761_4CH = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum HEIGHT
|
||||||
|
{
|
||||||
|
HEIGHT_5CH = 0,
|
||||||
|
HEIGHT_8CH = 1,
|
||||||
|
};
|
||||||
|
|
||||||
#define NONE 0
|
#define NONE 0
|
||||||
#define P_HIGH 1
|
#define P_HIGH 1
|
||||||
#define P_LOW 0
|
#define P_LOW 0
|
||||||
@@ -764,7 +787,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
REDPINE 50
|
REDPINE 50
|
||||||
POTENSIC 51
|
POTENSIC 51
|
||||||
ZSX 52
|
ZSX 52
|
||||||
FLYZONE 53
|
HEIGHT 53
|
||||||
SCANNER 54
|
SCANNER 54
|
||||||
FRSKY_RX 55
|
FRSKY_RX 55
|
||||||
AFHDS2A_RX 56
|
AFHDS2A_RX 56
|
||||||
@@ -784,6 +807,8 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
DSM_RX 70
|
DSM_RX 70
|
||||||
JJRC345 71
|
JJRC345 71
|
||||||
Q90C 72
|
Q90C 72
|
||||||
|
KYOSHO 73
|
||||||
|
RLINK 74
|
||||||
BindBit=> 0x80 1=Bind/0=No
|
BindBit=> 0x80 1=Bind/0=No
|
||||||
AutoBindBit=> 0x40 1=Yes /0=No
|
AutoBindBit=> 0x40 1=Yes /0=No
|
||||||
RangeCheck=> 0x20 1=Yes /0=No
|
RangeCheck=> 0x20 1=Yes /0=No
|
||||||
@@ -881,9 +906,12 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
PPM_IBUS 1
|
PPM_IBUS 1
|
||||||
PWM_SBUS 2
|
PWM_SBUS 2
|
||||||
PPM_SBUS 3
|
PPM_SBUS 3
|
||||||
|
PWM_IB16 4
|
||||||
|
PPM_IB16 5
|
||||||
sub_protocol==V2X2
|
sub_protocol==V2X2
|
||||||
V2X2 0
|
V2X2 0
|
||||||
JXD506 1
|
JXD506 1
|
||||||
|
V2X2_MR101 2
|
||||||
sub_protocol==FY326
|
sub_protocol==FY326
|
||||||
FY326 0
|
FY326 0
|
||||||
FY319 1
|
FY319 1
|
||||||
@@ -949,6 +977,10 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
R9_868 1
|
R9_868 1
|
||||||
R9_915_8CH 2
|
R9_915_8CH 2
|
||||||
R9_868_8CH 3
|
R9_868_8CH 3
|
||||||
|
R9_FCC 4
|
||||||
|
R9_EU 5
|
||||||
|
R9_FCC_8CH 6
|
||||||
|
R9_EU_8CH 7
|
||||||
sub_protocol==ESKY
|
sub_protocol==ESKY
|
||||||
ESKY_STD 0
|
ESKY_STD 0
|
||||||
ESKY_ET4 1
|
ESKY_ET4 1
|
||||||
@@ -964,6 +996,12 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
sub_protocol==PELIKAN
|
sub_protocol==PELIKAN
|
||||||
PELIKAN_PRO 0
|
PELIKAN_PRO 0
|
||||||
PELIKAN_LITE 1
|
PELIKAN_LITE 1
|
||||||
|
sub_protocol==V761
|
||||||
|
V761_3CH 0
|
||||||
|
V761_4CH 1
|
||||||
|
sub_protocol==HEIGHT
|
||||||
|
HEIGHT_5CH 0
|
||||||
|
HEIGHT_8CH 1
|
||||||
|
|
||||||
Power value => 0x80 0=High/1=Low
|
Power value => 0x80 0=High/1=Low
|
||||||
Stream[3] = option_protocol;
|
Stream[3] = option_protocol;
|
||||||
@@ -1070,6 +1108,7 @@ Serial: 100000 Baud 8e2 _ xxxx xxxx p --
|
|||||||
OPTION_SRVFREQ 6
|
OPTION_SRVFREQ 6
|
||||||
OPTION_MAXTHR 7
|
OPTION_MAXTHR 7
|
||||||
OPTION_RFCHAN 8
|
OPTION_RFCHAN 8
|
||||||
|
OPTION_RFPOWER 9
|
||||||
[19&0x0F] Number of sub protocols
|
[19&0x0F] Number of sub protocols
|
||||||
[20..27] Sub protocol name [8], not null terminated if sub prototcol len == 8
|
[20..27] Sub protocol name [8], not null terminated if sub prototcol len == 8
|
||||||
If the current protocol is invalid [12..27] are all 0x00.
|
If the current protocol is invalid [12..27] are all 0x00.
|
||||||
|
|||||||
@@ -119,6 +119,8 @@ uint16_t state;
|
|||||||
uint8_t len;
|
uint8_t len;
|
||||||
uint8_t armed, arm_flags, arm_channel_previous;
|
uint8_t armed, arm_flags, arm_channel_previous;
|
||||||
uint8_t num_ch;
|
uint8_t num_ch;
|
||||||
|
uint32_t pps_timer;
|
||||||
|
uint16_t pps_counter;
|
||||||
|
|
||||||
#ifdef CC2500_INSTALLED
|
#ifdef CC2500_INSTALLED
|
||||||
#ifdef SCANNER_CC2500_INO
|
#ifdef SCANNER_CC2500_INO
|
||||||
@@ -336,6 +338,15 @@ void setup()
|
|||||||
pinMode(S3_pin,INPUT_PULLUP);
|
pinMode(S3_pin,INPUT_PULLUP);
|
||||||
pinMode(S4_pin,INPUT_PULLUP);
|
pinMode(S4_pin,INPUT_PULLUP);
|
||||||
|
|
||||||
|
#ifdef MULTI_5IN1_INTERNAL
|
||||||
|
//pinMode(SX1276_RST_pin,OUTPUT); // already done by LED2_pin
|
||||||
|
pinMode(SX1276_TXEN_pin,OUTPUT); // PB0
|
||||||
|
pinMode(SX1276_DIO0_pin,INPUT_PULLUP);
|
||||||
|
#else
|
||||||
|
//Random pin
|
||||||
|
pinMode(RND_pin, INPUT_ANALOG); // set up PB0 pin for analog input
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined ENABLE_DIRECT_INPUTS
|
#if defined ENABLE_DIRECT_INPUTS
|
||||||
#if defined (DI1_PIN)
|
#if defined (DI1_PIN)
|
||||||
pinMode(DI1_PIN,INPUT_PULLUP);
|
pinMode(DI1_PIN,INPUT_PULLUP);
|
||||||
@@ -351,9 +362,6 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Random pins
|
|
||||||
pinMode(PB0, INPUT_ANALOG); // set up pin for analog input
|
|
||||||
|
|
||||||
//Timers
|
//Timers
|
||||||
init_HWTimer(); //0.5us
|
init_HWTimer(); //0.5us
|
||||||
#else
|
#else
|
||||||
@@ -410,6 +418,10 @@ void setup()
|
|||||||
#ifdef NRF_CSN_pin
|
#ifdef NRF_CSN_pin
|
||||||
NRF_CSN_on;
|
NRF_CSN_on;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SPI_CSN_pin
|
||||||
|
SPI_CSN_on;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set SPI lines
|
// Set SPI lines
|
||||||
#ifdef STM32_BOARD
|
#ifdef STM32_BOARD
|
||||||
initSPI2();
|
initSPI2();
|
||||||
@@ -473,7 +485,12 @@ void setup()
|
|||||||
#ifdef STM32_BOARD
|
#ifdef STM32_BOARD
|
||||||
uint32_t seed=0;
|
uint32_t seed=0;
|
||||||
for(uint8_t i=0;i<4;i++)
|
for(uint8_t i=0;i<4;i++)
|
||||||
seed=(seed<<8) | (analogRead(PB0)& 0xFF);
|
#ifdef RND_pin
|
||||||
|
seed=(seed<<8) | (analogRead(RND_pin)& 0xFF);
|
||||||
|
#else
|
||||||
|
//TODO find something to randomize...
|
||||||
|
seed=(seed<<8);
|
||||||
|
#endif
|
||||||
randomSeed(seed);
|
randomSeed(seed);
|
||||||
#else
|
#else
|
||||||
//Init the seed with a random value created from watchdog timer for all protocols requiring random values
|
//Init the seed with a random value created from watchdog timer for all protocols requiring random values
|
||||||
@@ -519,7 +536,7 @@ void setup()
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#if defined(FORCE_FRSKYX_TUNING) && defined(FRSKYX_CC2500_INO)
|
#if defined(FORCE_FRSKYX_TUNING) && defined(FRSKYX_CC2500_INO)
|
||||||
if(protocol==PROTO_FRSKYX)
|
if(protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2)
|
||||||
option = FORCE_FRSKYX_TUNING; // Use config-defined tuning value for FrSkyX
|
option = FORCE_FRSKYX_TUNING; // Use config-defined tuning value for FrSkyX
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -543,6 +560,11 @@ void setup()
|
|||||||
option = FORCE_REDPINE_TUNING; // Use config-defined tuning value for REDPINE
|
option = FORCE_REDPINE_TUNING; // Use config-defined tuning value for REDPINE
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(FORCE_RADIOLINK_TUNING) && defined(RADIOLINK_CC2500_INO)
|
||||||
|
if (protocol==PROTO_RADIOLINK)
|
||||||
|
option = FORCE_RADIOLINK_TUNING; // Use config-defined tuning value for RADIOLINK
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#if defined(FORCE_HITEC_TUNING) && defined(HITEC_CC2500_INO)
|
#if defined(FORCE_HITEC_TUNING) && defined(HITEC_CC2500_INO)
|
||||||
if (protocol==PROTO_HITEC)
|
if (protocol==PROTO_HITEC)
|
||||||
option = FORCE_HITEC_TUNING; // Use config-defined tuning value for HITEC
|
option = FORCE_HITEC_TUNING; // Use config-defined tuning value for HITEC
|
||||||
@@ -597,8 +619,8 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
#endif //ENABLE_SERIAL
|
#endif //ENABLE_SERIAL
|
||||||
}
|
}
|
||||||
LED2_on;
|
|
||||||
debugln("Init complete");
|
debugln("Init complete");
|
||||||
|
LED2_on;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main
|
// Main
|
||||||
@@ -751,7 +773,7 @@ bool Update_All()
|
|||||||
update_led_status();
|
update_led_status();
|
||||||
#if defined(TELEMETRY)
|
#if defined(TELEMETRY)
|
||||||
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
|
#if ( !( defined(MULTI_TELEMETRY) || defined(MULTI_STATUS) ) )
|
||||||
if((protocol == PROTO_BAYANG_RX) || (protocol == PROTO_AFHDS2A_RX) || (protocol == PROTO_FRSKY_RX) || (protocol == PROTO_SCANNER) || (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_NCC1701) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC) || (protocol==PROTO_HOTT) || (protocol==PROTO_FRSKYX2) || (protocol==PROTO_PROPEL) || (protocol==PROTO_DEVO) || (protocol==PROTO_DSM_RX))
|
if((protocol == PROTO_BAYANG_RX) || (protocol == PROTO_AFHDS2A_RX) || (protocol == PROTO_FRSKY_RX) || (protocol == PROTO_SCANNER) || (protocol==PROTO_FRSKYD) || (protocol==PROTO_BAYANG) || (protocol==PROTO_NCC1701) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_FRSKYX) || (protocol==PROTO_FRSKYX2) || (protocol==PROTO_DSM) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC) || (protocol==PROTO_HOTT) || (protocol==PROTO_PROPEL) || (protocol==PROTO_DEVO) || (protocol==PROTO_DSM_RX) || (protocol==PROTO_FRSKY_R9) || (protocol==PROTO_RLINK))
|
||||||
#endif
|
#endif
|
||||||
if(IS_DISABLE_TELEM_off)
|
if(IS_DISABLE_TELEM_off)
|
||||||
TelemetryUpdate();
|
TelemetryUpdate();
|
||||||
@@ -767,8 +789,8 @@ bool Update_All()
|
|||||||
{ // Autobind is on and BIND_CH went down
|
{ // Autobind is on and BIND_CH went down
|
||||||
BIND_CH_PREV_off;
|
BIND_CH_PREV_off;
|
||||||
//Request protocol to terminate bind
|
//Request protocol to terminate bind
|
||||||
#if defined(FRSKYD_CC2500_INO) || defined(FRSKYL_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYV_CC2500_INO) || defined(AFHDS2A_A7105_INO)
|
#if defined(FRSKYD_CC2500_INO) || defined(FRSKYL_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYV_CC2500_INO) || defined(AFHDS2A_A7105_INO) || defined(FRSKYR9_SX1276_INO)
|
||||||
if(protocol==PROTO_FRSKYD || protocol==PROTO_FRSKYL || protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKYV || protocol==PROTO_AFHDS2A )
|
if(protocol==PROTO_FRSKYD || protocol==PROTO_FRSKYL || protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKYV || protocol==PROTO_AFHDS2A || protocol==PROTO_FRSKY_R9)
|
||||||
BIND_DONE;
|
BIND_DONE;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -1026,6 +1048,8 @@ static void protocol_init()
|
|||||||
#endif
|
#endif
|
||||||
tx_pause();
|
tx_pause();
|
||||||
init_frskyd_link_telemetry();
|
init_frskyd_link_telemetry();
|
||||||
|
pps_timer=millis();
|
||||||
|
pps_counter=0;
|
||||||
#ifdef BASH_SERIAL
|
#ifdef BASH_SERIAL
|
||||||
TIMSK0 = 0 ; // Stop all timer 0 interrupts
|
TIMSK0 = 0 ; // Stop all timer 0 interrupts
|
||||||
#ifdef INVERT_SERIAL
|
#ifdef INVERT_SERIAL
|
||||||
@@ -1048,6 +1072,7 @@ static void protocol_init()
|
|||||||
rx_rc_chan[ch] = 1024;
|
rx_rc_chan[ch] = 1024;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
binding_idx=0;
|
||||||
|
|
||||||
//Set global ID and rx_tx_addr
|
//Set global ID and rx_tx_addr
|
||||||
MProtocol_id = RX_num + MProtocol_id_master;
|
MProtocol_id = RX_num + MProtocol_id_master;
|
||||||
@@ -1095,11 +1120,11 @@ static void protocol_init()
|
|||||||
remote_callback = ReadBUGS;
|
remote_callback = ReadBUGS;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(FLYZONE_A7105_INO)
|
#if defined(HEIGHT_A7105_INO)
|
||||||
case PROTO_FLYZONE:
|
case PROTO_HEIGHT:
|
||||||
PE1_off; //antenna RF1
|
PE1_off; //antenna RF1
|
||||||
next_callback = initFlyzone();
|
next_callback = initHeight();
|
||||||
remote_callback = ReadFlyzone;
|
remote_callback = ReadHeight;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(AFHDS2A_RX_A7105_INO)
|
#if defined(AFHDS2A_RX_A7105_INO)
|
||||||
@@ -1116,6 +1141,13 @@ static void protocol_init()
|
|||||||
remote_callback = ReadPelikan;
|
remote_callback = ReadPelikan;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(KYOSHO_A7105_INO)
|
||||||
|
case PROTO_KYOSHO:
|
||||||
|
PE1_off; //antenna RF1
|
||||||
|
next_callback = initKyosho();
|
||||||
|
remote_callback = ReadKyosho;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef CC2500_INSTALLED
|
#ifdef CC2500_INSTALLED
|
||||||
#if defined(FRSKYD_CC2500_INO)
|
#if defined(FRSKYD_CC2500_INO)
|
||||||
@@ -1145,6 +1177,10 @@ static void protocol_init()
|
|||||||
#if defined(FRSKYX_CC2500_INO)
|
#if defined(FRSKYX_CC2500_INO)
|
||||||
case PROTO_FRSKYX:
|
case PROTO_FRSKYX:
|
||||||
case PROTO_FRSKYX2:
|
case PROTO_FRSKYX2:
|
||||||
|
#ifdef EU_MODULE
|
||||||
|
if(sub_protocol<2)
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
PE1_off; //antenna RF2
|
PE1_off; //antenna RF2
|
||||||
PE2_on;
|
PE2_on;
|
||||||
next_callback = initFrSkyX();
|
next_callback = initFrSkyX();
|
||||||
@@ -1223,6 +1259,14 @@ static void protocol_init()
|
|||||||
remote_callback = ESKY150V2_callback;
|
remote_callback = ESKY150V2_callback;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(RLINK_CC2500_INO)
|
||||||
|
case PROTO_RLINK:
|
||||||
|
PE1_off;
|
||||||
|
PE2_on; //antenna RF2
|
||||||
|
next_callback = initRLINK();
|
||||||
|
remote_callback = RLINK_callback;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef CYRF6936_INSTALLED
|
#ifdef CYRF6936_INSTALLED
|
||||||
#if defined(DSM_CYRF6936_INO)
|
#if defined(DSM_CYRF6936_INO)
|
||||||
@@ -1560,6 +1604,12 @@ static void protocol_init()
|
|||||||
remote_callback = TEST_callback;
|
remote_callback = TEST_callback;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(FAKE_NRF24L01_INO)
|
||||||
|
case PROTO_FAKE:
|
||||||
|
next_callback=initFAKE();
|
||||||
|
remote_callback = FAKE_callback;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef SX1276_INSTALLED
|
#ifdef SX1276_INSTALLED
|
||||||
#if defined(FRSKYR9_SX1276_INO)
|
#if defined(FRSKYR9_SX1276_INO)
|
||||||
@@ -1682,7 +1732,7 @@ void update_serial_data()
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#if defined(FORCE_FRSKYX_TUNING) && defined(FRSKYX_CC2500_INO)
|
#if defined(FORCE_FRSKYX_TUNING) && defined(FRSKYX_CC2500_INO)
|
||||||
if(protocol==PROTO_FRSKYX)
|
if(protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2)
|
||||||
option=FORCE_FRSKYX_TUNING; // Use config-defined tuning value for FrSkyX
|
option=FORCE_FRSKYX_TUNING; // Use config-defined tuning value for FrSkyX
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -1706,6 +1756,11 @@ void update_serial_data()
|
|||||||
option=FORCE_REDPINE_TUNING; // Use config-defined tuning value for REDPINE
|
option=FORCE_REDPINE_TUNING; // Use config-defined tuning value for REDPINE
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(FORCE_RADIOLINK_TUNING) && defined(RADIOLINK_CC2500_INO)
|
||||||
|
if (protocol==PROTO_RADIOLINK)
|
||||||
|
option = FORCE_RADIOLINK_TUNING; // Use config-defined tuning value for RADIOLINK
|
||||||
|
else
|
||||||
|
#endif
|
||||||
#if defined(FORCE_HITEC_TUNING) && defined(HITEC_CC2500_INO)
|
#if defined(FORCE_HITEC_TUNING) && defined(HITEC_CC2500_INO)
|
||||||
if (protocol==PROTO_HITEC)
|
if (protocol==PROTO_HITEC)
|
||||||
option=FORCE_HITEC_TUNING; // Use config-defined tuning value for HITEC
|
option=FORCE_HITEC_TUNING; // Use config-defined tuning value for HITEC
|
||||||
@@ -1793,8 +1848,8 @@ void update_serial_data()
|
|||||||
else
|
else
|
||||||
if( ((rx_ok_buff[1]&0x80)==0) && ((cur_protocol[1]&0x80)!=0) ) // Bind flag has been reset
|
if( ((rx_ok_buff[1]&0x80)==0) && ((cur_protocol[1]&0x80)!=0) ) // Bind flag has been reset
|
||||||
{ // Request protocol to end bind
|
{ // Request protocol to end bind
|
||||||
#if defined(FRSKYD_CC2500_INO) || defined(FRSKYL_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYV_CC2500_INO) || defined(AFHDS2A_A7105_INO) || defined(FRSKYR9_SX1276_INO)
|
#if defined(FRSKYD_CC2500_INO) || defined(FRSKYL_CC2500_INO) || defined(FRSKYX_CC2500_INO) || defined(FRSKYV_CC2500_INO) || defined(AFHDS2A_A7105_INO) || defined(FRSKYR9_SX1276_INO) || defined(DSM_RX_CYRF6936_INO)
|
||||||
if(protocol==PROTO_FRSKYD || protocol==PROTO_FRSKYL || protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKYV || protocol==PROTO_AFHDS2A || protocol==PROTO_FRSKY_R9 )
|
if(protocol==PROTO_FRSKYD || protocol==PROTO_FRSKYL || protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKYV || protocol==PROTO_AFHDS2A || protocol==PROTO_FRSKY_R9 || protocol==PROTO_DSM_RX)
|
||||||
BIND_DONE;
|
BIND_DONE;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -1853,14 +1908,14 @@ void update_serial_data()
|
|||||||
#endif
|
#endif
|
||||||
if(rx_len>27)
|
if(rx_len>27)
|
||||||
{ // Data available for the current protocol
|
{ // Data available for the current protocol
|
||||||
#if defined FRSKYX_CC2500_INO
|
#if defined(FRSKYX_CC2500_INO) || defined(FRSKYR9_SX1276_INO)
|
||||||
if((protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2) && rx_len==28)
|
if((protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKY_R9) && rx_len==28)
|
||||||
{//Protocol waiting for 1 byte during bind
|
{//Protocol waiting for 1 byte during bind
|
||||||
binding_idx=rx_ok_buff[27];
|
binding_idx=rx_ok_buff[27];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef SPORT_SEND
|
#ifdef SPORT_SEND
|
||||||
if((protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2) && rx_len==35)
|
if((protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2 || protocol==PROTO_FRSKY_R9) && rx_len==35)
|
||||||
{//Protocol waiting for 8 bytes
|
{//Protocol waiting for 8 bytes
|
||||||
#define BYTE_STUFF 0x7D
|
#define BYTE_STUFF 0x7D
|
||||||
#define STUFF_MASK 0x20
|
#define STUFF_MASK 0x20
|
||||||
@@ -2154,7 +2209,7 @@ void pollBoot()
|
|||||||
#if defined(TELEMETRY)
|
#if defined(TELEMETRY)
|
||||||
void PPM_Telemetry_serial_init()
|
void PPM_Telemetry_serial_init()
|
||||||
{
|
{
|
||||||
if( (protocol==PROTO_FRSKYD) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_BAYANG)|| (protocol==PROTO_NCC1701) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_PROPEL)
|
if( (protocol==PROTO_FRSKYD) || (protocol==PROTO_HUBSAN) || (protocol==PROTO_AFHDS2A) || (protocol==PROTO_BAYANG)|| (protocol==PROTO_NCC1701) || (protocol==PROTO_CABELL) || (protocol==PROTO_HITEC) || (protocol==PROTO_BUGS) || (protocol==PROTO_BUGSMINI) || (protocol==PROTO_PROPEL) || (protocol==PROTO_RLINK)
|
||||||
#ifdef TELEMETRY_FRSKYX_TO_FRSKYD
|
#ifdef TELEMETRY_FRSKYX_TO_FRSKYD
|
||||||
|| (protocol==PROTO_FRSKYX) || (protocol==PROTO_FRSKYX2)
|
|| (protocol==PROTO_FRSKYX) || (protocol==PROTO_FRSKYX2)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ uint16_t ReadPelikan()
|
|||||||
if(sub_protocol==PELIKAN_PRO)
|
if(sub_protocol==PELIKAN_PRO)
|
||||||
A7105_WriteReg(A7105_03_FIFOI,0x28);
|
A7105_WriteReg(A7105_03_FIFOI,0x28);
|
||||||
else//PELIKAN_LITE
|
else//PELIKAN_LITE
|
||||||
A7105_WriteID((rx_tx_addr[0]<<24)|(rx_tx_addr[1]<<16)|(rx_tx_addr[2]<<8)|(rx_tx_addr[3]));
|
A7105_WriteID(MProtocol_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef MULTI_SYNC
|
#ifdef MULTI_SYNC
|
||||||
@@ -281,8 +281,9 @@ uint16_t initPelikan()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MProtocol_id=((uint32_t)rx_tx_addr[0]<<24)|((uint32_t)rx_tx_addr[1]<<16)|((uint32_t)rx_tx_addr[2]<<8)|(rx_tx_addr[3]);
|
||||||
if(sub_protocol==PELIKAN_LITE && IS_BIND_DONE)
|
if(sub_protocol==PELIKAN_LITE && IS_BIND_DONE)
|
||||||
A7105_WriteID((rx_tx_addr[0]<<24)|(rx_tx_addr[1]<<16)|(rx_tx_addr[2]<<8)|(rx_tx_addr[3]));
|
A7105_WriteID(MProtocol_id);
|
||||||
|
|
||||||
hopping_frequency_no=PELIKAN_NUM_RF_CHAN;
|
hopping_frequency_no=PELIKAN_NUM_RF_CHAN;
|
||||||
packet_count=5;
|
packet_count=5;
|
||||||
|
|||||||
@@ -223,6 +223,8 @@
|
|||||||
#define S3_pin PA6
|
#define S3_pin PA6
|
||||||
#define S4_pin PA7
|
#define S4_pin PA7
|
||||||
//
|
//
|
||||||
|
#define RND_pin PB0
|
||||||
|
//
|
||||||
#define PE1_pin PB4 //PE1
|
#define PE1_pin PB4 //PE1
|
||||||
#define PE2_pin PB5 //PE2
|
#define PE2_pin PB5 //PE2
|
||||||
//CS pins
|
//CS pins
|
||||||
@@ -313,6 +315,20 @@
|
|||||||
#define DEBUG_PIN_toggle
|
#define DEBUG_PIN_toggle
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MULTI_5IN1_INTERNAL
|
||||||
|
#undef RND_pin
|
||||||
|
#define SX1276_RST_pin PA2 //LED2 on other modules
|
||||||
|
#define SX1276_TXEN_pin PB0 //Random gen on other modules
|
||||||
|
#define SX1276_DIO0_pin PC13 //Unused on other modules
|
||||||
|
|
||||||
|
#define SX1276_RST_on digitalWrite(SX1276_RST_pin,HIGH)
|
||||||
|
#define SX1276_RST_off digitalWrite(SX1276_RST_pin,LOW)
|
||||||
|
#define SX1276_TXEN_on digitalWrite(SX1276_TXEN_pin,HIGH)
|
||||||
|
#define SX1276_RXEN_on digitalWrite(SX1276_TXEN_pin,LOW)
|
||||||
|
#define IS_DIO0_on ( digitalRead(SX1276_DIO0_pin)==HIGH )
|
||||||
|
#define IS_DIO0_off ( digitalRead(SX1276_DIO0_pin)==LOW )
|
||||||
|
#endif
|
||||||
|
|
||||||
#define cli() noInterrupts()
|
#define cli() noInterrupts()
|
||||||
#define sei() interrupts()
|
#define sei() interrupts()
|
||||||
#define delayMilliseconds(x) delay(x)
|
#define delayMilliseconds(x) delay(x)
|
||||||
|
|||||||
@@ -252,6 +252,7 @@ uint16_t PROPEL_callback()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROPEL_DATA1:
|
case PROPEL_DATA1:
|
||||||
|
#ifdef PROPEL_HUB_TELEMETRY
|
||||||
if (_BV(NRF24L01_07_RX_DR) & NRF24L01_ReadReg(NRF24L01_07_STATUS))
|
if (_BV(NRF24L01_07_RX_DR) & NRF24L01_ReadReg(NRF24L01_07_STATUS))
|
||||||
{// data received from the model
|
{// data received from the model
|
||||||
NRF24L01_ReadPayload(packet_in, PROPEL_PACKET_SIZE);
|
NRF24L01_ReadPayload(packet_in, PROPEL_PACKET_SIZE);
|
||||||
@@ -264,7 +265,6 @@ uint16_t PROPEL_callback()
|
|||||||
telemetry_link=1;
|
telemetry_link=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PROPEL_data_packet();
|
|
||||||
packet_count++;
|
packet_count++;
|
||||||
if(packet_count>=100)
|
if(packet_count>=100)
|
||||||
{//LQI calculation
|
{//LQI calculation
|
||||||
@@ -274,6 +274,8 @@ uint16_t PROPEL_callback()
|
|||||||
telemetry_counter = 0;
|
telemetry_counter = 0;
|
||||||
telemetry_lost=0;
|
telemetry_lost=0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
PROPEL_data_packet();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return PROPEL_PACKET_PERIOD;
|
return PROPEL_PACKET_PERIOD;
|
||||||
|
|||||||
@@ -18,16 +18,18 @@ Multiprotocol is distributed in the hope that it will be useful,
|
|||||||
|
|
||||||
#include "iface_nrf250k.h"
|
#include "iface_nrf250k.h"
|
||||||
|
|
||||||
#define FORCE_Q90C_ORIGINAL_ID
|
//#define FORCE_Q90C_ORIGINAL_ID
|
||||||
|
|
||||||
#define Q90C_BIND_COUNT 250
|
#define Q90C_BIND_COUNT 250
|
||||||
#define Q90C_PACKET_PERIOD 7336
|
#define Q90C_PACKET_PERIOD 7336 // 6200 on saimat's TX...
|
||||||
#define Q90C_INITIAL_WAIT 500
|
#define Q90C_INITIAL_WAIT 500
|
||||||
#define Q90C_PACKET_SIZE 12
|
#define Q90C_PACKET_SIZE 12
|
||||||
#define Q90C_RF_BIND_CHANNEL 0x33
|
#define Q90C_RF_BIND_CHANNEL 0x33
|
||||||
#define Q90C_RF_NUM_CHANNELS 3
|
#define Q90C_RF_NUM_CHANNELS 3
|
||||||
#define Q90C_ADDRESS_LENGTH 5
|
#define Q90C_ADDRESS_LENGTH 5
|
||||||
|
|
||||||
|
bool Q90C_VTX;
|
||||||
|
|
||||||
int16_t Q90C_channel(uint8_t num, int16_t in_min,int16_t in_max, int16_t out_min,int16_t out_max)
|
int16_t Q90C_channel(uint8_t num, int16_t in_min,int16_t in_max, int16_t out_min,int16_t out_max)
|
||||||
{
|
{
|
||||||
int32_t val=Channel_data[num];
|
int32_t val=Channel_data[num];
|
||||||
@@ -43,10 +45,9 @@ static void __attribute__((unused)) Q90C_send_packet()
|
|||||||
{
|
{
|
||||||
memcpy(packet, rx_tx_addr, 4);
|
memcpy(packet, rx_tx_addr, 4);
|
||||||
memcpy(&packet[4], hopping_frequency, 3);
|
memcpy(&packet[4], hopping_frequency, 3);
|
||||||
packet[7] = 0x1e;
|
//packet[7] = 0x1e; // 2e on Saimat 1???
|
||||||
packet[8] = 0;
|
packet[10] = 0x4B;
|
||||||
packet[9] = 0;
|
packet[11] = 0x4E;
|
||||||
packet[10] = rx_tx_addr[4];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -77,21 +78,35 @@ static void __attribute__((unused)) Q90C_send_packet()
|
|||||||
packet[4] = 0x1e; // T trim 00-1e-3c
|
packet[4] = 0x1e; // T trim 00-1e-3c
|
||||||
packet[5] = 0x1e; // R trim 3c-1e-00
|
packet[5] = 0x1e; // R trim 3c-1e-00
|
||||||
packet[6] = 0x1e; // E trim 00-1e-3c
|
packet[6] = 0x1e; // E trim 00-1e-3c
|
||||||
packet[7] = 0x1e; // A trim 00-1e-3c
|
//packet[7] = 0x1e; // A trim 00-1e-3c
|
||||||
packet[8] = 0x00; // flags: 3 position flight mode (Angle - Horizon - Acro), VTX Toggle HIGH = next vTX frequency
|
packet[8] |= 0x02; // Rudder rate 0=min,1,2=max
|
||||||
packet[9] = 0x00;
|
if(state!=Channel_data[CH5])
|
||||||
|
{
|
||||||
|
state=Channel_data[CH5];
|
||||||
|
if(state<CHANNEL_MIN_COMMAND)
|
||||||
|
packet[8] ^= 0x04; // Angle
|
||||||
|
else if(state>CHANNEL_MAX_COMMAND)
|
||||||
|
packet[8] ^= 0x10; // Acro
|
||||||
|
else
|
||||||
|
packet[8] ^= 0x08; // Horizon
|
||||||
|
}
|
||||||
|
if(!Q90C_VTX && CH6_SW)
|
||||||
|
packet[8] ^= 0x20; // VTX+
|
||||||
|
Q90C_VTX=CH6_SW;
|
||||||
|
|
||||||
|
debugln("8=%02X",packet[8]);
|
||||||
packet[10] = packet_count++;
|
packet[10] = packet_count++;
|
||||||
}
|
}
|
||||||
|
packet[7] = 0x1e; // bind 1e or 2e, normal: A trim 00-1e-3c
|
||||||
|
|
||||||
uint8_t sum=0;
|
|
||||||
// checksum
|
// checksum
|
||||||
for (uint8_t i = 0; i < Q90C_PACKET_SIZE - 1; i++)
|
if(IS_BIND_DONE)
|
||||||
{
|
{
|
||||||
|
uint8_t sum=0;
|
||||||
|
for (uint8_t i = 0; i < Q90C_PACKET_SIZE - 1; i++)
|
||||||
sum += packet[i];
|
sum += packet[i];
|
||||||
debug("%02X ", packet[i]);
|
packet[11] = sum ^ crc8;
|
||||||
}
|
}
|
||||||
packet[11] = sum ^ (IS_BIND_IN_PROGRESS? 0xc6 : 0xa4);
|
|
||||||
debugln("%02X",packet[11]);
|
|
||||||
|
|
||||||
XN297L_SetFreqOffset(); // Set frequency offset
|
XN297L_SetFreqOffset(); // Set frequency offset
|
||||||
XN297L_SetPower(); // Set tx_power
|
XN297L_SetPower(); // Set tx_power
|
||||||
@@ -101,10 +116,19 @@ static void __attribute__((unused)) Q90C_send_packet()
|
|||||||
static void __attribute__((unused)) Q90C_initialize_txid()
|
static void __attribute__((unused)) Q90C_initialize_txid()
|
||||||
{
|
{
|
||||||
calc_fh_channels(Q90C_RF_NUM_CHANNELS);
|
calc_fh_channels(Q90C_RF_NUM_CHANNELS);
|
||||||
|
rx_tx_addr[4]=0x4B;
|
||||||
#ifdef FORCE_Q90C_ORIGINAL_ID
|
#ifdef FORCE_Q90C_ORIGINAL_ID
|
||||||
memcpy(rx_tx_addr, (uint8_t*)"\x24\x03\x01\x82\x4B", Q90C_ADDRESS_LENGTH);
|
//24 03 01 82 18 26 37 1E 00 00 4B 4E
|
||||||
|
memcpy(rx_tx_addr, (uint8_t*)"\x24\x03\x01\x82\x4B", Q90C_ADDRESS_LENGTH); //Goebish
|
||||||
|
memcpy(hopping_frequency, (uint8_t*)"\x18\x26\x37", Q90C_RF_NUM_CHANNELS);
|
||||||
|
//4C 0A 02 01 17 24 36 2E 00 00 4B 4E
|
||||||
|
memcpy(rx_tx_addr, (uint8_t*)"\x4C\x0A\x02\x01\x4B", Q90C_ADDRESS_LENGTH); //Saimat 1
|
||||||
|
memcpy(hopping_frequency, (uint8_t*)"\x17\x24\x36", Q90C_RF_NUM_CHANNELS);
|
||||||
|
//34 13 02 01 18 26 37 1E 00 00 4B 4E
|
||||||
|
memcpy(rx_tx_addr, (uint8_t*)"\x34\x13\x02\x01\x4B", Q90C_ADDRESS_LENGTH); //Saimat 2
|
||||||
memcpy(hopping_frequency, (uint8_t*)"\x18\x26\x37", Q90C_RF_NUM_CHANNELS);
|
memcpy(hopping_frequency, (uint8_t*)"\x18\x26\x37", Q90C_RF_NUM_CHANNELS);
|
||||||
#endif
|
#endif
|
||||||
|
crc8=rx_tx_addr[0]^rx_tx_addr[1]^rx_tx_addr[2]^rx_tx_addr[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) Q90C_init()
|
static void __attribute__((unused)) Q90C_init()
|
||||||
@@ -140,6 +164,12 @@ uint16_t initQ90C()
|
|||||||
hopping_frequency_no = 0;
|
hopping_frequency_no = 0;
|
||||||
packet_count = 0;
|
packet_count = 0;
|
||||||
bind_counter=Q90C_BIND_COUNT;
|
bind_counter=Q90C_BIND_COUNT;
|
||||||
|
|
||||||
|
//features
|
||||||
|
state=Channel_data[CH5];
|
||||||
|
Q90C_VTX=CH6_SW;
|
||||||
|
packet[8] = 0x00;
|
||||||
|
packet[9] = 0x00;
|
||||||
return Q90C_INITIAL_WAIT;
|
return Q90C_INITIAL_WAIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
336
Multiprotocol/RadioLink_cc2500.ino
Normal file
336
Multiprotocol/RadioLink_cc2500.ino
Normal file
@@ -0,0 +1,336 @@
|
|||||||
|
/*
|
||||||
|
This project is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Multiprotocol is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Multiprotocol. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
// Radiolink surface protocol. TXs: RC4GS,RC6GS. Compatible RXs:R7FG(Std),R6FG,R6F,R8EF,R8FM,R8F,R4FGM
|
||||||
|
|
||||||
|
#if defined(RLINK_CC2500_INO)
|
||||||
|
|
||||||
|
#include "iface_cc2500.h"
|
||||||
|
|
||||||
|
//#define RLINK_FORCE_ID
|
||||||
|
|
||||||
|
#define RLINK_TX_PACKET_LEN 33
|
||||||
|
#define RLINK_RX_PACKET_LEN 15
|
||||||
|
#define RLINK_TX_ID_LEN 4
|
||||||
|
#define RLINK_HOP 16
|
||||||
|
|
||||||
|
enum {
|
||||||
|
RLINK_DATA = 0x00,
|
||||||
|
RLINK_RX1 = 0x01,
|
||||||
|
RLINK_RX2 = 0x02,
|
||||||
|
};
|
||||||
|
|
||||||
|
const PROGMEM uint8_t RLINK_hopping[][8] = {
|
||||||
|
/* 4C494E4B */ { 0xBC, 0x5A, 0x70, 0x4E, 0xDF, 0x32, 0x16, 0x89 },
|
||||||
|
/* 4D494E4B */ { 0x4C, 0xF3, 0xEA, 0x5B, 0x62, 0x9D, 0x01, 0x87 },
|
||||||
|
/* 4E494E4B */ { 0x86, 0xEA, 0xD0, 0xC9, 0x2B, 0x53, 0x7F, 0x41 },
|
||||||
|
/* 4F494E4B */ { 0xAC, 0x91, 0x7D, 0x48, 0xE0, 0xB5, 0x32, 0xF6 },
|
||||||
|
/* 50494E4B */ { 0xD6, 0x7C, 0xA4, 0x93, 0x5F, 0xE1, 0x02, 0xB8 },
|
||||||
|
/* 51494E4B */ { 0xED, 0x04, 0x73, 0xC8, 0x56, 0xB9, 0x1F, 0xA2 },
|
||||||
|
/* 52494E4B */ { 0xA7, 0xF0, 0x36, 0xB2, 0x95, 0x4E, 0x1C, 0xD8 },
|
||||||
|
/* 53494E4B */ { 0x76, 0x8B, 0xA0, 0x3E, 0x51, 0x4C, 0x9D, 0x2F },
|
||||||
|
/* 54494E4B */ { 0x07, 0x23, 0x16, 0xFD, 0xC9, 0x5B, 0x84, 0xAE },
|
||||||
|
/* 55494E4B */ { 0xD3, 0xA0, 0x69, 0xBF, 0x12, 0x8C, 0x4E, 0x57 },
|
||||||
|
/* 56494E4B */ { 0xA6, 0xBE, 0x91, 0xD3, 0x7C, 0x4F, 0x82, 0x50 },
|
||||||
|
/* 57494E4B */ { 0x91, 0xDA, 0xBC, 0x75, 0x82, 0x36, 0x4E, 0xF0 },
|
||||||
|
/* 58494E4B */ { 0x9A, 0x27, 0x5C, 0xF4, 0xD8, 0xB0, 0x36, 0xE1 },
|
||||||
|
/* 59494E4B */ { 0x92, 0xF1, 0x34, 0xA7, 0x5B, 0x0C, 0xED, 0x86 },
|
||||||
|
/* 5A494E4B */ { 0x8C, 0x2B, 0x51, 0xF9, 0x3E, 0x4A, 0x67, 0xD0 },
|
||||||
|
/* 5B494E4B */ { 0x5E, 0x3D, 0x67, 0x9B, 0xA2, 0x84, 0xFC, 0x01 },
|
||||||
|
/* 5C494E4B */ { 0xF9, 0x35, 0xBD, 0x78, 0x26, 0x1C, 0x0E, 0xA4 },
|
||||||
|
/* 5D494E4B */ { 0xD9, 0x7B, 0x48, 0x0E, 0x2A, 0xCF, 0x13, 0x65 },
|
||||||
|
/* 5E494E4B */ { 0x07, 0xE4, 0xF9, 0x8A, 0x3C, 0x21, 0xB5, 0xD6 },
|
||||||
|
/* 5F494E4B */ { 0xEB, 0xFA, 0x29, 0xD1, 0x54, 0x3C, 0x07, 0x86 },
|
||||||
|
/* 60494E4B */ { 0xDF, 0xCE, 0x0A, 0x32, 0x71, 0x5B, 0x96, 0x48 },
|
||||||
|
/* 61494E4B */ { 0x19, 0x86, 0xF5, 0x3A, 0x27, 0xDC, 0x0E, 0xB4 },
|
||||||
|
/* 62494E4B */ { 0xF8, 0x47, 0x9C, 0xE0, 0x2D, 0xBA, 0x15, 0x36 },
|
||||||
|
/* 63494E4B */ { 0xED, 0x78, 0x01, 0xA3, 0x2B, 0x6C, 0x45, 0xF9 },
|
||||||
|
/* 64494E4B */ { 0xE0, 0xA2, 0xD4, 0x6B, 0xF5, 0x18, 0x3C, 0x79 },
|
||||||
|
/* 65494E4B */ { 0x26, 0x90, 0x8B, 0x5D, 0x31, 0xCF, 0xE7, 0x4A },
|
||||||
|
/* 66494E4B */ { 0x7B, 0x12, 0xA8, 0x4F, 0xC0, 0x65, 0xD9, 0x3E },
|
||||||
|
/* 67494E4B */ { 0x35, 0xA2, 0x14, 0xBE, 0x06, 0x7D, 0x98, 0xFC },
|
||||||
|
/* 68494E4B */ { 0xD2, 0xA9, 0x7E, 0x40, 0x6F, 0x83, 0x5C, 0xB1 },
|
||||||
|
/* 69494E4B */ { 0xE5, 0xB9, 0xC1, 0x04, 0x83, 0x27, 0xA6, 0xFD },
|
||||||
|
/* 6A494E4B */ { 0x8E, 0x0C, 0x4A, 0x51, 0xFB, 0x63, 0x92, 0x7D },
|
||||||
|
/* 6B494E4B */ { 0xC7, 0x1D, 0x02, 0x93, 0x45, 0xF8, 0xA6, 0xBE },
|
||||||
|
/* 6C494E4B */ { 0xC1, 0x64, 0x59, 0x0A, 0x7D, 0x3F, 0x28, 0xEB },
|
||||||
|
/* 6D494E4B */ { 0xEF, 0x75, 0xAB, 0x94, 0xD2, 0x83, 0x1C, 0x60 },
|
||||||
|
/* 6E494E4B */ { 0xA1, 0x20, 0x54, 0x68, 0x9E, 0x7B, 0x3D, 0xFC },
|
||||||
|
/* 6F494E4B */ { 0x3E, 0x60, 0x28, 0xFC, 0xDA, 0x45, 0x9B, 0x71 },
|
||||||
|
/* 70494E4B */ { 0xB7, 0x0E, 0xA8, 0x23, 0xFC, 0x65, 0x4D, 0x91 },
|
||||||
|
/* 71494E4B */ { 0x29, 0x34, 0x51, 0x7C, 0xB8, 0xFD, 0x0E, 0x6A },
|
||||||
|
/* 72494E4B */ { 0x1B, 0x06, 0x3C, 0x89, 0xF5, 0x2A, 0x7E, 0xD4 },
|
||||||
|
/* 73494E4B */ { 0xF2, 0xC9, 0x63, 0x57, 0x0A, 0xB1, 0x48, 0xDE },
|
||||||
|
/* 74494E4B */ { 0x24, 0xAE, 0x0C, 0x19, 0x53, 0x7B, 0xF6, 0x8D },
|
||||||
|
/* 75494E4B */ { 0xEC, 0xD8, 0xF2, 0x4B, 0xA3, 0x51, 0x09, 0x76 },
|
||||||
|
/* 76494E4B */ { 0x98, 0x71, 0x5E, 0xAD, 0xFC, 0x04, 0x3B, 0x62 },
|
||||||
|
/* 77494E4B */ { 0xAE, 0xF6, 0xB7, 0x01, 0x52, 0x34, 0x9D, 0x8C },
|
||||||
|
/* 78494E4B */ { 0x69, 0x48, 0xF1, 0x3C, 0xDB, 0x0E, 0x25, 0xA7 },
|
||||||
|
/* 79494E4B */ { 0xCF, 0x60, 0x94, 0xAD, 0xB1, 0x82, 0x73, 0xE5 },
|
||||||
|
/* 7A494E4B */ { 0xFA, 0xC1, 0xD7, 0xB0, 0x53, 0x92, 0x6E, 0x48 },
|
||||||
|
/* 7B494E4B */ { 0xAC, 0x7D, 0xE5, 0x8B, 0x41, 0x96, 0x2F, 0x30 },
|
||||||
|
/* 7C494E4B */ { 0xFD, 0xC1, 0xB9, 0x02, 0xE4, 0x87, 0x56, 0x3A },
|
||||||
|
/* 7D494E4B */ { 0x30, 0xDA, 0x4F, 0x8E, 0x5C, 0xB9, 0x26, 0x71 },
|
||||||
|
/* 7E494E4B */ { 0xDC, 0xF9, 0x57, 0x30, 0x82, 0x1E, 0x6A, 0x4B },
|
||||||
|
/* 7F494E4B */ { 0x84, 0x1D, 0x7E, 0x29, 0x3C, 0x65, 0xA0, 0xBF },
|
||||||
|
/* 80494E4B */ { 0x01, 0xA3, 0xF6, 0xE2, 0x4C, 0x8B, 0x5D, 0x79 },
|
||||||
|
/* 81494E4B */ { 0xA1, 0x32, 0xE7, 0x08, 0x4D, 0x5B, 0x9F, 0x6C },
|
||||||
|
/* 82494E4B */ { 0x31, 0x40, 0x67, 0x8F, 0xBA, 0x95, 0x2C, 0xED },
|
||||||
|
/* 83494E4B */ { 0x91, 0x76, 0xFA, 0x83, 0x20, 0x4B, 0xEC, 0x5D },
|
||||||
|
/* 84494E4B */ { 0xDB, 0x54, 0xC2, 0x61, 0xF0, 0xA9, 0x87, 0x3E },
|
||||||
|
/* 85494E4B */ { 0xC0, 0xB4, 0x61, 0xD3, 0x7A, 0x5F, 0x82, 0x9E },
|
||||||
|
/* 86494E4B */ { 0xD6, 0xCF, 0x9B, 0x75, 0xE1, 0x42, 0x3A, 0x80 },
|
||||||
|
/* 87494E4B */ { 0xFE, 0xA2, 0xB4, 0x9C, 0x10, 0x7D, 0x56, 0x83 },
|
||||||
|
/* 88494E4B */ { 0xD2, 0x79, 0x54, 0xEF, 0xC8, 0x0B, 0x36, 0xA1 },
|
||||||
|
/* 89494E4B */ { 0x8D, 0xCF, 0x23, 0x64, 0xE5, 0x0B, 0x1A, 0x97 },
|
||||||
|
/* 8A494E4B */ { 0x07, 0xC4, 0xEF, 0x9A, 0x61, 0xD8, 0xB3, 0x52 },
|
||||||
|
/* 8B494E4B */ { 0x45, 0x6E, 0xBF, 0x8C, 0x9A, 0x2D, 0x31, 0x70 },
|
||||||
|
#ifdef RLINK_FORCE_ID
|
||||||
|
/* 3A99223A */ { 0x1F, 0x89, 0x25, 0x06, 0x4E, 0xBD, 0x3A, 0xC7 },
|
||||||
|
/* FC110D20 */ { 0xBC, 0xFE, 0x59, 0x84, 0x37, 0xA1, 0xD0, 0x62 }
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
static void __attribute__((unused)) RLINK_load_hopp(uint8_t num)
|
||||||
|
{
|
||||||
|
uint8_t inc=3*(rx_tx_addr[0]&3);
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < RLINK_HOP>>1; i++)
|
||||||
|
{
|
||||||
|
uint8_t val=pgm_read_byte_near(&RLINK_hopping[num][i]);
|
||||||
|
hopping_frequency[ i<<1 ]=12*(val>>4 )+inc;
|
||||||
|
hopping_frequency[(i<<1)+1]=12*(val&0x0F)+inc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace one of the channel randomely
|
||||||
|
rf_ch_num=random(0xfefefefe)%0x11; // 0x00..0x10
|
||||||
|
if(inc==9) inc=6; // frequency exception
|
||||||
|
hopping_frequency[rf_ch_num]=12*16+inc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) RLINK_init()
|
||||||
|
{
|
||||||
|
// channels order depend on ID and currently unknown so using a table of 64 entries...
|
||||||
|
uint8_t id=rx_tx_addr[3]&0x3F;
|
||||||
|
memcpy(rx_tx_addr,"\x4C\x49\x4E\x4B",RLINK_TX_ID_LEN);
|
||||||
|
rx_tx_addr[0] += id;
|
||||||
|
RLINK_load_hopp(id);
|
||||||
|
|
||||||
|
#ifdef RLINK_FORCE_ID
|
||||||
|
//surface RC6GS
|
||||||
|
memcpy(rx_tx_addr,"\x3A\x99\x22\x3A",RLINK_TX_ID_LEN);
|
||||||
|
RLINK_load_hopp(64);
|
||||||
|
//air T8FB
|
||||||
|
//memcpy(rx_tx_addr,"\xFC\x11\x0D\x20",RLINK_TX_ID_LEN);
|
||||||
|
//RLINK_load_hopp(65);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* debug("ID:");
|
||||||
|
for(uint8_t i=0;i<RLINK_TX_ID_LEN;i++)
|
||||||
|
debug(" 0x%02X",rx_tx_addr[i]);
|
||||||
|
debugln("");
|
||||||
|
debug("Hop(%d):", rf_ch_num);
|
||||||
|
for(uint8_t i=0;i<RLINK_HOP;i++)
|
||||||
|
debug(" 0x%02X",hopping_frequency[i]);
|
||||||
|
debugln("");
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
const PROGMEM uint8_t RLINK_init_values[] = {
|
||||||
|
/* 00 */ 0x5B, 0x06, 0x5C, 0x07, 0xAB, 0xCD, 0x40, 0x04,
|
||||||
|
/* 08 */ 0x45, 0x00, 0x00, 0x06, 0x00, 0x5C, 0x62, 0x76,
|
||||||
|
/* 10 */ 0x7A, 0x7F, 0x13, 0x23, 0xF8, 0x44, 0x07, 0x30,
|
||||||
|
/* 18 */ 0x18, 0x16, 0x6C, 0x43, 0x40, 0x91, 0x87, 0x6B,
|
||||||
|
/* 20 */ 0xF8, 0x56, 0x10, 0xA9, 0x0A, 0x00, 0x11
|
||||||
|
};
|
||||||
|
|
||||||
|
static void __attribute__((unused)) RLINK_rf_init()
|
||||||
|
{
|
||||||
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < 39; ++i)
|
||||||
|
CC2500_WriteReg(i, pgm_read_byte_near(&RLINK_init_values[i]));
|
||||||
|
|
||||||
|
prev_option = option;
|
||||||
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
|
||||||
|
|
||||||
|
CC2500_SetTxRxMode(TX_EN);
|
||||||
|
CC2500_SetPower();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) RLINK_tune_freq()
|
||||||
|
{
|
||||||
|
if ( prev_option != option )
|
||||||
|
{
|
||||||
|
CC2500_WriteReg(CC2500_0C_FSCTRL0, option);
|
||||||
|
prev_option = option ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __attribute__((unused)) RLINK_TIMING_RFSEND_packet()
|
||||||
|
{
|
||||||
|
static uint32_t pseudo=0;
|
||||||
|
uint32_t bits = 0;
|
||||||
|
uint8_t bitsavailable = 0;
|
||||||
|
uint8_t idx = 6;
|
||||||
|
|
||||||
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
|
|
||||||
|
// packet length
|
||||||
|
packet[0] = RLINK_TX_PACKET_LEN;
|
||||||
|
// header
|
||||||
|
if(sub_protocol)
|
||||||
|
packet[1] = 0x21; //air 0x21 on dump but it looks to support telemetry at least RSSI
|
||||||
|
else
|
||||||
|
{//surface
|
||||||
|
packet[1] = 0x01;
|
||||||
|
//radiolink additionnal ID which is working only on a small set of RXs
|
||||||
|
//if(RX_num) packet[1] |= ((RX_num+2)<<4)+4; // RX number limited to 10 values, 0 is a wildcard
|
||||||
|
}
|
||||||
|
if(packet_count>3)
|
||||||
|
packet[1] |= 0x02; // 0x02 telemetry request flag
|
||||||
|
|
||||||
|
// ID
|
||||||
|
memcpy(&packet[2],rx_tx_addr,RLINK_TX_ID_LEN);
|
||||||
|
|
||||||
|
// pack 16 channels on 11 bits values between 170 and 1876, 1023 middle. The last 8 channels are failsafe values associated to the first 8 values.
|
||||||
|
for (uint8_t i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
uint32_t val = convert_channel_16b_nolimit(i,170,1876); // allow extended limits
|
||||||
|
if (val & 0x8000)
|
||||||
|
val = 0;
|
||||||
|
else if (val > 2047)
|
||||||
|
val=2047;
|
||||||
|
|
||||||
|
bits |= val << bitsavailable;
|
||||||
|
bitsavailable += 11;
|
||||||
|
while (bitsavailable >= 8) {
|
||||||
|
packet[idx++] = bits & 0xff;
|
||||||
|
bits >>= 8;
|
||||||
|
bitsavailable -= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// hop
|
||||||
|
pseudo=((pseudo * 0xAA) + 0x03) % 0x7673; // calc next pseudo random value
|
||||||
|
CC2500_WriteReg(CC2500_0A_CHANNR, hopping_frequency[pseudo & 0x0F]);
|
||||||
|
packet[28]= pseudo;
|
||||||
|
packet[29]= pseudo >> 8;
|
||||||
|
packet[30]= 0x00; // unknown
|
||||||
|
packet[31]= 0x00; // unknown
|
||||||
|
packet[32]= rf_ch_num; // index of value changed in the RF table
|
||||||
|
|
||||||
|
// check
|
||||||
|
uint8_t sum=0;
|
||||||
|
for(uint8_t i=1;i<33;i++)
|
||||||
|
sum+=packet[i];
|
||||||
|
packet[33]=sum;
|
||||||
|
|
||||||
|
// send packet
|
||||||
|
CC2500_WriteData(packet, RLINK_TX_PACKET_LEN+1);
|
||||||
|
|
||||||
|
// packets type
|
||||||
|
packet_count++;
|
||||||
|
if(packet_count>5) packet_count=0;
|
||||||
|
|
||||||
|
//debugln("C= 0x%02X",hopping_frequency[pseudo & 0x0F]);
|
||||||
|
//debug("P=");
|
||||||
|
//for(uint8_t i=1;i<RLINK_TX_PACKET_LEN+1;i++)
|
||||||
|
// debug(" 0x%02X",packet[i]);
|
||||||
|
//debugln("");
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RLINK_TIMING_PROTO 20000-100 // -100 for compatibility with R8EF
|
||||||
|
#define RLINK_TIMING_RFSEND 10500
|
||||||
|
#define RLINK_TIMING_CHECK 2000
|
||||||
|
uint16_t RLINK_callback()
|
||||||
|
{
|
||||||
|
switch(phase)
|
||||||
|
{
|
||||||
|
case RLINK_DATA:
|
||||||
|
#ifdef MULTI_SYNC
|
||||||
|
telemetry_set_input_sync(RLINK_TIMING_PROTO);
|
||||||
|
#endif
|
||||||
|
RLINK_tune_freq();
|
||||||
|
RLINK_TIMING_RFSEND_packet();
|
||||||
|
#if not defined RLINK_HUB_TELEMETRY
|
||||||
|
return RLINK_TIMING_PROTO;
|
||||||
|
#else
|
||||||
|
if(!(packet[1]&0x02))
|
||||||
|
return RLINK_TIMING_PROTO; //Normal packet
|
||||||
|
//Telemetry packet
|
||||||
|
phase++; // RX1
|
||||||
|
return RLINK_TIMING_RFSEND;
|
||||||
|
case RLINK_RX1:
|
||||||
|
CC2500_Strobe(CC2500_SIDLE);
|
||||||
|
CC2500_Strobe(CC2500_SFRX);
|
||||||
|
CC2500_SetTxRxMode(RX_EN);
|
||||||
|
CC2500_Strobe(CC2500_SRX);
|
||||||
|
phase++; // RX2
|
||||||
|
return RLINK_TIMING_PROTO-RLINK_TIMING_RFSEND-RLINK_TIMING_CHECK;
|
||||||
|
case RLINK_RX2:
|
||||||
|
len = CC2500_ReadReg(CC2500_3B_RXBYTES | CC2500_READ_BURST) & 0x7F;
|
||||||
|
if (len == RLINK_RX_PACKET_LEN + 1 + 2) //Telemetry frame is 15 bytes + 1 byte for length + 2 bytes for RSSI&LQI&CRC
|
||||||
|
{
|
||||||
|
//debug("Telem:");
|
||||||
|
CC2500_ReadData(packet_in, len);
|
||||||
|
if(packet_in[0]==RLINK_RX_PACKET_LEN && (packet_in[len-1] & 0x80) && memcmp(&packet[2],rx_tx_addr,RLINK_TX_ID_LEN)==0 && packet_in[6]==packet[1])
|
||||||
|
{//Correct telemetry received: length, CRC, ID and type
|
||||||
|
//Debug
|
||||||
|
//for(uint8_t i=0;i<len;i++)
|
||||||
|
// debug(" %02X",packet_in[i]);
|
||||||
|
TX_RSSI = packet_in[len-2];
|
||||||
|
if(TX_RSSI >=128)
|
||||||
|
TX_RSSI -= 128;
|
||||||
|
else
|
||||||
|
TX_RSSI += 128;
|
||||||
|
RX_RSSI=packet_in[7]; //Should be packet_in[7]-256 but since it's an uint8_t...
|
||||||
|
v_lipo1=packet_in[8]<<1; //RX Batt
|
||||||
|
v_lipo2=packet_in[9]<<1; //Batt
|
||||||
|
telemetry_link=1; //Send telemetry out
|
||||||
|
pps_counter++;
|
||||||
|
packet_count=0;
|
||||||
|
}
|
||||||
|
//debugln("");
|
||||||
|
}
|
||||||
|
if (millis() - pps_timer >= 2000)
|
||||||
|
{//1 telemetry packet every 100ms
|
||||||
|
pps_timer = millis();
|
||||||
|
if(pps_counter<20)
|
||||||
|
pps_counter*=5;
|
||||||
|
else
|
||||||
|
pps_counter=100;
|
||||||
|
debugln("%d pps", pps_counter);
|
||||||
|
TX_LQI = pps_counter; //0..100%
|
||||||
|
pps_counter = 0;
|
||||||
|
}
|
||||||
|
CC2500_SetTxRxMode(TX_EN);
|
||||||
|
phase=RLINK_DATA; // DATA
|
||||||
|
return RLINK_TIMING_CHECK;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t initRLINK()
|
||||||
|
{
|
||||||
|
BIND_DONE; // Not a TX bind protocol
|
||||||
|
RLINK_init();
|
||||||
|
RLINK_rf_init();
|
||||||
|
packet_count = 0;
|
||||||
|
phase = RLINK_DATA;
|
||||||
|
return 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifdef SX1276_INSTALLED
|
#ifdef SX1276_INSTALLED
|
||||||
#include "iface_sx1276.h"
|
#include "iface_sx1276.h"
|
||||||
|
|
||||||
|
bool SX1276_Mode_LoRa=false;
|
||||||
|
|
||||||
void SX1276_WriteReg(uint8_t address, uint8_t data)
|
void SX1276_WriteReg(uint8_t address, uint8_t data)
|
||||||
{
|
{
|
||||||
SPI_CSN_off;
|
SPI_CSN_off;
|
||||||
@@ -16,7 +18,6 @@ uint8_t SX1276_ReadReg(uint8_t address)
|
|||||||
SPI_Write(address & 0x7F);
|
SPI_Write(address & 0x7F);
|
||||||
uint8_t result = SPI_Read();
|
uint8_t result = SPI_Read();
|
||||||
SPI_CSN_on;
|
SPI_CSN_on;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,20 +32,78 @@ void SX1276_WriteRegisterMulti(uint8_t address, const uint8_t* data, uint8_t len
|
|||||||
SPI_CSN_on;
|
SPI_CSN_on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SX1276_ReadRegisterMulti(uint8_t address, uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
SPI_CSN_off;
|
||||||
|
SPI_Write(address & 0x7F);
|
||||||
|
|
||||||
|
for(uint8_t i = 0; i < length; i++)
|
||||||
|
data[i]=SPI_Read();
|
||||||
|
|
||||||
|
SPI_CSN_on;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t SX1276_Reset()
|
uint8_t SX1276_Reset()
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO when pin is not wired
|
||||||
|
#ifdef SX1276_RST_pin
|
||||||
|
SX1276_RST_off;
|
||||||
|
delayMicroseconds(200);
|
||||||
|
SX1276_RST_on;
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SX1276_DetectChip() //to be called after reset, verfies the chip has been detected
|
||||||
|
{
|
||||||
|
#define SX1276_Detect_MaxAttempts 5
|
||||||
|
uint8_t i = 0;
|
||||||
|
bool chipFound = false;
|
||||||
|
while ((i < SX1276_Detect_MaxAttempts) && !chipFound)
|
||||||
|
{
|
||||||
|
uint8_t ChipVersion = SX1276_ReadReg(SX1276_42_VERSION);
|
||||||
|
if (ChipVersion == 0x12)
|
||||||
|
{
|
||||||
|
debugln("SX1276 reg version=%d", ChipVersion);
|
||||||
|
chipFound = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
debug("SX1276 not found! attempts: %d", i);
|
||||||
|
debug(" of ");
|
||||||
|
debugln("%d SX1276 reg version=%d", SX1276_Detect_MaxAttempts, ChipVersion);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!chipFound)
|
||||||
|
{
|
||||||
|
debugln("SX1276 not detected!!!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
debugln("Found SX1276 Device!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SX1276_SetTxRxMode(uint8_t mode)
|
||||||
|
{
|
||||||
|
#ifdef SX1276_TXEN_pin
|
||||||
|
if(mode == TX_EN)
|
||||||
|
SX1276_TXEN_on;
|
||||||
|
else
|
||||||
|
SX1276_RXEN_on;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void SX1276_SetFrequency(uint32_t frequency)
|
void SX1276_SetFrequency(uint32_t frequency)
|
||||||
{
|
{
|
||||||
uint32_t f = frequency / 61;
|
uint32_t f = frequency / 61;
|
||||||
uint8_t data[3];
|
uint8_t data[3];
|
||||||
data[0] = (f & (0xFF << 16)) >> 16;
|
data[0] = f >> 16;
|
||||||
data[1] = (f & (0xFF << 8)) >> 8;
|
data[1] = f >> 8;
|
||||||
data[2] = f & 0xFF;
|
data[2] = f;
|
||||||
|
|
||||||
SX1276_WriteRegisterMulti(SX1276_06_FRFMSB, data, 3);
|
SX1276_WriteRegisterMulti(SX1276_06_FRFMSB, data, 3);
|
||||||
}
|
}
|
||||||
@@ -53,6 +112,8 @@ void SX1276_SetMode(bool lora, bool low_freq_mode, uint8_t mode)
|
|||||||
{
|
{
|
||||||
uint8_t data = 0x00;
|
uint8_t data = 0x00;
|
||||||
|
|
||||||
|
SX1276_Mode_LoRa=lora;
|
||||||
|
|
||||||
if(lora)
|
if(lora)
|
||||||
{
|
{
|
||||||
data = data | (1 << 7);
|
data = data | (1 << 7);
|
||||||
@@ -89,6 +150,14 @@ void SX1276_ConfigModem1(uint8_t bandwidth, uint8_t coding_rate, bool implicit_h
|
|||||||
data = data | implicit_header_mode;
|
data = data | implicit_header_mode;
|
||||||
|
|
||||||
SX1276_WriteReg(SX1276_1D_MODEMCONFIG1, data);
|
SX1276_WriteReg(SX1276_1D_MODEMCONFIG1, data);
|
||||||
|
|
||||||
|
if (bandwidth == SX1276_MODEM_CONFIG1_BW_500KHZ) //datasheet errata reconmendation http://caxapa.ru/thumbs/972894/SX1276_77_8_ErrataNote_1.1_STD.pdf
|
||||||
|
{
|
||||||
|
SX1276_WriteReg(SX1276_36_LORA_REGHIGHBWOPTIMIZE1, 0x02);
|
||||||
|
SX1276_WriteReg(SX1276_3A_LORA_REGHIGHBWOPTIMIZE2, 0x64);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SX1276_WriteReg(SX1276_36_LORA_REGHIGHBWOPTIMIZE1, 0x03);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SX1276_ConfigModem2(uint8_t spreading_factor, bool tx_continuous_mode, bool rx_payload_crc_on)
|
void SX1276_ConfigModem2(uint8_t spreading_factor, bool tx_continuous_mode, bool rx_payload_crc_on)
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ uint8_t RetrySequence ;
|
|||||||
#if defined SPORT_TELEMETRY
|
#if defined SPORT_TELEMETRY
|
||||||
#define FRSKY_SPORT_PACKET_SIZE 8
|
#define FRSKY_SPORT_PACKET_SIZE 8
|
||||||
#define FX_BUFFERS 4
|
#define FX_BUFFERS 4
|
||||||
uint8_t RxBt = 0;
|
|
||||||
uint8_t Sport_Data = 0;
|
uint8_t Sport_Data = 0;
|
||||||
uint8_t pktx1[FRSKY_SPORT_PACKET_SIZE*FX_BUFFERS];
|
uint8_t pktx1[FRSKY_SPORT_PACKET_SIZE*FX_BUFFERS];
|
||||||
|
|
||||||
@@ -148,7 +147,7 @@ static void multi_send_status()
|
|||||||
else if(sub_protocol&0x07)
|
else if(sub_protocol&0x07)
|
||||||
{
|
{
|
||||||
uint8_t nbr=multi_protocols[multi_protocols_index].nbrSubProto;
|
uint8_t nbr=multi_protocols[multi_protocols_index].nbrSubProto;
|
||||||
if(protocol==PROTO_DSM) nbr++; //Auto sub_protocol
|
//if(protocol==PROTO_DSM) nbr++; //Auto sub_protocol
|
||||||
if((sub_protocol&0x07)>=nbr)
|
if((sub_protocol&0x07)>=nbr)
|
||||||
flags &= ~0x04; //Invalid sub protocol
|
flags &= ~0x04; //Invalid sub protocol
|
||||||
}
|
}
|
||||||
@@ -348,26 +347,28 @@ void frskySendStuffed()
|
|||||||
Serial_write(START_STOP);
|
Serial_write(START_STOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void frsky_check_telemetry(uint8_t *packet_in,uint8_t len)
|
bool frsky_process_telemetry(uint8_t *buffer,uint8_t len)
|
||||||
{
|
{
|
||||||
if(packet_in[1] != rx_tx_addr[3] || packet_in[2] != rx_tx_addr[2] || len != packet_in[0] + 3 )
|
if(protocol!=PROTO_FRSKY_R9)
|
||||||
return; // Bad address or length...
|
{
|
||||||
|
if(buffer[1] != rx_tx_addr[3] || buffer[2] != rx_tx_addr[2] || len != buffer[0] + 3 )
|
||||||
telemetry_link|=1; // Telemetry data is available
|
return false; // Bad address or length...
|
||||||
// RSSI and LQI are the 2 last bytes
|
// RSSI and LQI are the 2 last bytes
|
||||||
TX_RSSI = packet_in[len-2];
|
TX_RSSI = buffer[len-2];
|
||||||
if(TX_RSSI >=128)
|
if(TX_RSSI >=128)
|
||||||
TX_RSSI -= 128;
|
TX_RSSI -= 128;
|
||||||
else
|
else
|
||||||
TX_RSSI += 128;
|
TX_RSSI += 128;
|
||||||
TX_LQI = packet_in[len-1]&0x7F;
|
}
|
||||||
|
telemetry_link|=1; // Telemetry data is available
|
||||||
|
|
||||||
#if defined FRSKYD_CC2500_INO
|
#if defined FRSKYD_CC2500_INO
|
||||||
if (protocol==PROTO_FRSKYD)
|
if (protocol==PROTO_FRSKYD)
|
||||||
{
|
{
|
||||||
|
TX_LQI = buffer[len-1]&0x7F;
|
||||||
//Save current buffer
|
//Save current buffer
|
||||||
for (uint8_t i=3;i<len-2;i++)
|
for (uint8_t i=3;i<len-2;i++)
|
||||||
telemetry_in_buffer[i]=packet_in[i]; // Buffer telemetry values to be sent
|
telemetry_in_buffer[i]=buffer[i]; // Buffer telemetry values to be sent
|
||||||
|
|
||||||
//Check incoming telemetry sequence
|
//Check incoming telemetry sequence
|
||||||
if(telemetry_in_buffer[6]>0 && telemetry_in_buffer[6]<=10)
|
if(telemetry_in_buffer[6]>0 && telemetry_in_buffer[6]<=10)
|
||||||
@@ -392,7 +393,7 @@ void frsky_check_telemetry(uint8_t *packet_in,uint8_t len)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined SPORT_TELEMETRY && defined FRSKYX_CC2500_INO
|
#if defined SPORT_TELEMETRY && (defined FRSKYX_CC2500_INO || defined FRSKYR9_SX1276_INO)
|
||||||
if (protocol==PROTO_FRSKYX||protocol==PROTO_FRSKYX2)
|
if (protocol==PROTO_FRSKYX||protocol==PROTO_FRSKYX2)
|
||||||
{
|
{
|
||||||
/*Telemetry frames(RF) SPORT info
|
/*Telemetry frames(RF) SPORT info
|
||||||
@@ -413,29 +414,30 @@ void frsky_check_telemetry(uint8_t *packet_in,uint8_t len)
|
|||||||
[12] STRM6 D1 D1 D0 D0
|
[12] STRM6 D1 D1 D0 D0
|
||||||
[13] CHKSUM1 --|2 CRC bytes sent by RX (calculated on RX side crc16/table)
|
[13] CHKSUM1 --|2 CRC bytes sent by RX (calculated on RX side crc16/table)
|
||||||
[14] CHKSUM2 --|*/
|
[14] CHKSUM2 --|*/
|
||||||
telemetry_lost=0;
|
//len=17 -> len-7=10 -> 3..12
|
||||||
|
uint16_t lcrc = FrSkyX_crc(&buffer[3], len-7 ) ;
|
||||||
|
if ( ( (lcrc >> 8) != buffer[len-4]) || ( (lcrc & 0x00FF ) != buffer[len-3]) )
|
||||||
|
return false; // Bad CRC
|
||||||
|
|
||||||
uint16_t lcrc = FrSkyX_crc(&packet_in[3], len-7 ) ;
|
if(buffer[4] & 0x80)
|
||||||
if ( ( (lcrc >> 8) != packet_in[len-4]) || ( (lcrc & 0x00FF ) != packet_in[len-3]) )
|
RX_RSSI=buffer[4] & 0x7F ;
|
||||||
return; // Bad CRC
|
|
||||||
|
|
||||||
if(packet_in[4] & 0x80)
|
|
||||||
RX_RSSI=packet_in[4] & 0x7F ;
|
|
||||||
else
|
else
|
||||||
RxBt = (packet_in[4]<<1) + 1 ;
|
v_lipo1 = (buffer[4]<<1) + 1 ;
|
||||||
#if defined(TELEMETRY_FRSKYX_TO_FRSKYD) && defined(ENABLE_PPM)
|
#if defined(TELEMETRY_FRSKYX_TO_FRSKYD) && defined(ENABLE_PPM)
|
||||||
if(mode_select != MODE_SERIAL)
|
if(mode_select != MODE_SERIAL)
|
||||||
{//PPM
|
return true;
|
||||||
v_lipo1=RxBt;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
if (protocol==PROTO_FRSKYX||protocol==PROTO_FRSKYX2||protocol==PROTO_FRSKY_R9)
|
||||||
|
{
|
||||||
|
telemetry_lost=0;
|
||||||
|
|
||||||
//Save outgoing telemetry sequence
|
//Save outgoing telemetry sequence
|
||||||
FrSkyX_TX_IN_Seq=packet_in[5] >> 4;
|
FrSkyX_TX_IN_Seq=buffer[5] >> 4;
|
||||||
|
|
||||||
//Check incoming telemetry sequence
|
//Check incoming telemetry sequence
|
||||||
uint8_t packet_seq=packet_in[5] & 0x03;
|
uint8_t packet_seq=buffer[5] & 0x03;
|
||||||
if ( packet_in[5] & 0x08 )
|
if ( buffer[5] & 0x08 )
|
||||||
{//Request init
|
{//Request init
|
||||||
FrSkyX_RX_Seq = 0x08 ;
|
FrSkyX_RX_Seq = 0x08 ;
|
||||||
FrSkyX_RX_NextFrame = 0x00 ;
|
FrSkyX_RX_NextFrame = 0x00 ;
|
||||||
@@ -448,17 +450,17 @@ void frsky_check_telemetry(uint8_t *packet_in,uint8_t len)
|
|||||||
{//In sequence
|
{//In sequence
|
||||||
struct t_FrSkyX_RX_Frame *p ;
|
struct t_FrSkyX_RX_Frame *p ;
|
||||||
uint8_t count ;
|
uint8_t count ;
|
||||||
// packet_in[4] RSSI
|
// buffer[4] RSSI
|
||||||
// packet_in[5] sequence control
|
// buffer[5] sequence control
|
||||||
// packet_in[6] payload count
|
// buffer[6] payload count
|
||||||
// packet_in[7-12] payload
|
// buffer[7-12] payload
|
||||||
p = &FrSkyX_RX_Frames[packet_seq] ;
|
p = &FrSkyX_RX_Frames[packet_seq] ;
|
||||||
count = packet_in[6]; // Payload length
|
count = buffer[6]; // Payload length
|
||||||
if ( count <= 6 )
|
if ( count <= 6 )
|
||||||
{//Store payload
|
{//Store payload
|
||||||
p->count = count ;
|
p->count = count ;
|
||||||
for ( uint8_t i = 0 ; i < count ; i++ )
|
for ( uint8_t i = 0 ; i < count ; i++ )
|
||||||
p->payload[i] = packet_in[i+7] ;
|
p->payload[i] = buffer[i+7] ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
p->count = 0 ; // Discard
|
p->count = 0 ; // Discard
|
||||||
@@ -477,19 +479,19 @@ void frsky_check_telemetry(uint8_t *packet_in,uint8_t len)
|
|||||||
{//Not in sequence
|
{//Not in sequence
|
||||||
struct t_FrSkyX_RX_Frame *q ;
|
struct t_FrSkyX_RX_Frame *q ;
|
||||||
uint8_t count ;
|
uint8_t count ;
|
||||||
// packet_in[4] RSSI
|
// buffer[4] RSSI
|
||||||
// packet_in[5] sequence control
|
// buffer[5] sequence control
|
||||||
// packet_in[6] payload count
|
// buffer[6] payload count
|
||||||
// packet_in[7-12] payload
|
// buffer[7-12] payload
|
||||||
if ( packet_seq == ( ( FrSkyX_RX_Seq +1 ) & 3 ) )
|
if ( packet_seq == ( ( FrSkyX_RX_Seq +1 ) & 3 ) )
|
||||||
{//Received next sequence -> save it
|
{//Received next sequence -> save it
|
||||||
q = &FrSkyX_RX_Frames[packet_seq] ;
|
q = &FrSkyX_RX_Frames[packet_seq] ;
|
||||||
count = packet_in[6]; // Payload length
|
count = buffer[6]; // Payload length
|
||||||
if ( count <= 6 )
|
if ( count <= 6 )
|
||||||
{//Store payload
|
{//Store payload
|
||||||
q->count = count ;
|
q->count = count ;
|
||||||
for ( uint8_t i = 0 ; i < count ; i++ )
|
for ( uint8_t i = 0 ; i < count ; i++ )
|
||||||
q->payload[i] = packet_in[i+7] ;
|
q->payload[i] = buffer[i+7] ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
q->count = 0 ;
|
q->count = 0 ;
|
||||||
@@ -501,6 +503,7 @@ void frsky_check_telemetry(uint8_t *packet_in,uint8_t len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_frskyd_link_telemetry()
|
void init_frskyd_link_telemetry()
|
||||||
@@ -528,7 +531,7 @@ void frsky_link_frame()
|
|||||||
telemetry_link |= 2 ; // Send hub if available
|
telemetry_link |= 2 ; // Send hub if available
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//PROTO_HUBSAN, PROTO_AFHDS2A, PROTO_BAYANG, PROTO_NCC1701, PROTO_CABELL, PROTO_HITEC, PROTO_BUGS, PROTO_BUGSMINI, PROTO_FRSKYX, PROTO_FRSKYX2, PROTO_PROPEL, PROTO_DEVO
|
{//PROTO_HUBSAN, PROTO_AFHDS2A, PROTO_BAYANG, PROTO_NCC1701, PROTO_CABELL, PROTO_HITEC, PROTO_BUGS, PROTO_BUGSMINI, PROTO_FRSKYX, PROTO_FRSKYX2, PROTO_PROPEL, PROTO_DEVO, PROTO_RLINK
|
||||||
frame[1] = v_lipo1;
|
frame[1] = v_lipo1;
|
||||||
frame[2] = v_lipo2;
|
frame[2] = v_lipo2;
|
||||||
frame[3] = RX_RSSI;
|
frame[3] = RX_RSSI;
|
||||||
@@ -740,7 +743,7 @@ void sportSendFrame()
|
|||||||
case 4: //BATT
|
case 4: //BATT
|
||||||
frame[2] = 0x04;
|
frame[2] = 0x04;
|
||||||
frame[3] = 0xf1;
|
frame[3] = 0xf1;
|
||||||
frame[4] = RxBt;//a1;
|
frame[4] = v_lipo1; //a1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(Sport_Data)
|
if(Sport_Data)
|
||||||
@@ -870,7 +873,7 @@ void TelemetryUpdate()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined SPORT_TELEMETRY
|
#if defined SPORT_TELEMETRY
|
||||||
if ((protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2) && telemetry_link
|
if ((protocol==PROTO_FRSKYX || protocol==PROTO_FRSKYX2||protocol==PROTO_FRSKY_R9) && telemetry_link
|
||||||
#ifdef TELEMETRY_FRSKYX_TO_FRSKYD
|
#ifdef TELEMETRY_FRSKYX_TO_FRSKYD
|
||||||
&& mode_select==MODE_SERIAL
|
&& mode_select==MODE_SERIAL
|
||||||
#endif
|
#endif
|
||||||
@@ -949,7 +952,7 @@ void TelemetryUpdate()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( telemetry_link & 1 )
|
if( telemetry_link & 1 )
|
||||||
{ // FrSkyD + Hubsan + AFHDS2A + Bayang + Cabell + Hitec + Bugs + BugsMini + NCC1701 + PROPEL
|
{ // FrSkyD + Hubsan + AFHDS2A + Bayang + Cabell + Hitec + Bugs + BugsMini + NCC1701 + PROPEL + RLINK
|
||||||
// FrSkyX telemetry if in PPM
|
// FrSkyX telemetry if in PPM
|
||||||
frsky_link_frame();
|
frsky_link_frame();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "iface_nrf24l01.h"
|
#include "iface_nrf24l01.h"
|
||||||
|
#define V2X2_MR101_FORCE_ID
|
||||||
|
|
||||||
#define V2X2_BIND_COUNT 1000
|
#define V2X2_BIND_COUNT 1000
|
||||||
// Timeout for callback in uSec, 4ms=4000us for V202
|
// Timeout for callback in uSec, 4ms=4000us for V202
|
||||||
@@ -51,14 +51,6 @@ enum {
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
enum {
|
|
||||||
V202_INIT2 = 0,
|
|
||||||
V202_INIT2_NO_BIND,//1
|
|
||||||
V202_BIND1,//2
|
|
||||||
V202_BIND2,//3
|
|
||||||
V202_DATA//4
|
|
||||||
};
|
|
||||||
|
|
||||||
// This is frequency hopping table for V202 protocol
|
// This is frequency hopping table for V202 protocol
|
||||||
// The table is the first 4 rows of 32 frequency hopping
|
// The table is the first 4 rows of 32 frequency hopping
|
||||||
// patterns, all other rows are derived from the first 4.
|
// patterns, all other rows are derived from the first 4.
|
||||||
@@ -87,39 +79,29 @@ static void __attribute__((unused)) v202_init()
|
|||||||
NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00); // No Auto Acknoledgement
|
NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00); // No Auto Acknoledgement
|
||||||
NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x3F); // Enable all data pipes
|
NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x3F); // Enable all data pipes
|
||||||
NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03); // 5-byte RX/TX address
|
NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, 0x03); // 5-byte RX/TX address
|
||||||
NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0xFF); // 4ms retransmit t/o, 15 tries
|
// NRF24L01_WriteReg(NRF24L01_04_SETUP_RETR, 0xFF); // 4ms retransmit t/o, 15 tries
|
||||||
NRF24L01_WriteReg(NRF24L01_05_RF_CH, 0x08); // Channel 8
|
// NRF24L01_WriteReg(NRF24L01_05_RF_CH, 0x08); // Channel 8
|
||||||
NRF24L01_SetBitrate(NRF24L01_BR_1M); // 1Mbps
|
NRF24L01_SetBitrate(sub_protocol==V2X2_MR101?NRF24L01_BR_250K:NRF24L01_BR_1M);
|
||||||
NRF24L01_SetPower();
|
NRF24L01_SetPower();
|
||||||
|
|
||||||
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // Clear data ready, data sent, and retransmit
|
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // Clear data ready, data sent, and retransmit
|
||||||
// NRF24L01_WriteReg(NRF24L01_08_OBSERVE_TX, 0x00); // no write bits in this field
|
// NRF24L01_WriteReg(NRF24L01_08_OBSERVE_TX, 0x00); // no write bits in this field
|
||||||
// NRF24L01_WriteReg(NRF24L01_00_CD, 0x00); // same
|
// NRF24L01_WriteReg(NRF24L01_00_CD, 0x00); // same
|
||||||
NRF24L01_WriteReg(NRF24L01_0C_RX_ADDR_P2, 0xC3); // LSB byte of pipe 2 receive address
|
// NRF24L01_WriteReg(NRF24L01_0C_RX_ADDR_P2, 0xC3); // LSB byte of pipe 2 receive address
|
||||||
NRF24L01_WriteReg(NRF24L01_0D_RX_ADDR_P3, 0xC4);
|
// NRF24L01_WriteReg(NRF24L01_0D_RX_ADDR_P3, 0xC4);
|
||||||
NRF24L01_WriteReg(NRF24L01_0E_RX_ADDR_P4, 0xC5);
|
// NRF24L01_WriteReg(NRF24L01_0E_RX_ADDR_P4, 0xC5);
|
||||||
NRF24L01_WriteReg(NRF24L01_0F_RX_ADDR_P5, 0xC6);
|
// NRF24L01_WriteReg(NRF24L01_0F_RX_ADDR_P5, 0xC6);
|
||||||
NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, V2X2_PAYLOADSIZE); // bytes of data payload for pipe 1
|
// NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, V2X2_PAYLOADSIZE); // bytes of data payload for pipe 1
|
||||||
NRF24L01_WriteReg(NRF24L01_12_RX_PW_P1, V2X2_PAYLOADSIZE);
|
// NRF24L01_WriteReg(NRF24L01_12_RX_PW_P1, V2X2_PAYLOADSIZE);
|
||||||
NRF24L01_WriteReg(NRF24L01_13_RX_PW_P2, V2X2_PAYLOADSIZE);
|
// NRF24L01_WriteReg(NRF24L01_13_RX_PW_P2, V2X2_PAYLOADSIZE);
|
||||||
NRF24L01_WriteReg(NRF24L01_14_RX_PW_P3, V2X2_PAYLOADSIZE);
|
// NRF24L01_WriteReg(NRF24L01_14_RX_PW_P3, V2X2_PAYLOADSIZE);
|
||||||
NRF24L01_WriteReg(NRF24L01_15_RX_PW_P4, V2X2_PAYLOADSIZE);
|
// NRF24L01_WriteReg(NRF24L01_15_RX_PW_P4, V2X2_PAYLOADSIZE);
|
||||||
NRF24L01_WriteReg(NRF24L01_16_RX_PW_P5, V2X2_PAYLOADSIZE);
|
// NRF24L01_WriteReg(NRF24L01_16_RX_PW_P5, V2X2_PAYLOADSIZE);
|
||||||
NRF24L01_WriteReg(NRF24L01_17_FIFO_STATUS, 0x00); // Just in case, no real bits to write here
|
// NRF24L01_WriteReg(NRF24L01_17_FIFO_STATUS, 0x00); // Just in case, no real bits to write here
|
||||||
NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, (uint8_t *)"\x66\x88\x68\x68\x68", 5);
|
NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, (uint8_t *)"\x66\x88\x68\x68\x68", 5);
|
||||||
NRF24L01_WriteRegisterMulti(NRF24L01_0B_RX_ADDR_P1, (uint8_t *)"\x88\x66\x86\x86\x86", 5);
|
// NRF24L01_WriteRegisterMulti(NRF24L01_0B_RX_ADDR_P1, (uint8_t *)"\x88\x66\x86\x86\x86", 5);
|
||||||
NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, (uint8_t *)"\x66\x88\x68\x68\x68", 5);
|
NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, (uint8_t *)"\x66\x88\x68\x68\x68", 5);
|
||||||
}
|
|
||||||
|
|
||||||
static void __attribute__((unused)) V202_init2()
|
|
||||||
{
|
|
||||||
NRF24L01_FlushTx();
|
|
||||||
packet_sent = 0;
|
|
||||||
hopping_frequency_no = 0;
|
|
||||||
|
|
||||||
// Turn radio power on
|
|
||||||
NRF24L01_SetTxRxMode(TX_EN);
|
NRF24L01_SetTxRxMode(TX_EN);
|
||||||
//Done by TX_EN??? => NRF24L01_WriteReg(NRF24L01_00_CONFIG, _BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) V2X2_set_tx_id(void)
|
static void __attribute__((unused)) V2X2_set_tx_id(void)
|
||||||
@@ -135,20 +117,27 @@ static void __attribute__((unused)) V2X2_set_tx_id(void)
|
|||||||
// Strange avoidance of channels divisible by 16
|
// Strange avoidance of channels divisible by 16
|
||||||
hopping_frequency[i] = (val & 0x0f) ? val : val - 3;
|
hopping_frequency[i] = (val & 0x0f) ? val : val - 3;
|
||||||
}
|
}
|
||||||
|
#ifdef V2X2_MR101_FORCE_ID
|
||||||
|
if(sub_protocol==V2X2_MR101)
|
||||||
|
{
|
||||||
|
rx_tx_addr[1]=0x83;
|
||||||
|
rx_tx_addr[2]=0x03;
|
||||||
|
rx_tx_addr[3]=0xAE;
|
||||||
|
memcpy(hopping_frequency,"\x05\x12\x08\x0C\x04\x0E\x10",7);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused)) V2X2_add_pkt_checksum()
|
static void __attribute__((unused)) V2X2_send_packet()
|
||||||
{
|
{
|
||||||
uint8_t sum = 0;
|
uint8_t rf_ch = hopping_frequency[hopping_frequency_no >> 1];
|
||||||
for (uint8_t i = 0; i < 15; ++i)
|
hopping_frequency_no = (hopping_frequency_no + 1) & 0x1F;
|
||||||
sum += packet[i];
|
if(sub_protocol==V2X2_MR101 && hopping_frequency_no>13)
|
||||||
packet[15] = sum;
|
hopping_frequency_no=0;
|
||||||
}
|
NRF24L01_WriteReg(NRF24L01_05_RF_CH, rf_ch);
|
||||||
|
|
||||||
static void __attribute__((unused)) V2X2_send_packet(uint8_t bind)
|
|
||||||
{
|
|
||||||
uint8_t flags2=0;
|
uint8_t flags2=0;
|
||||||
if (bind)
|
if (IS_BIND_IN_PROGRESS)
|
||||||
{
|
{
|
||||||
flags = V2X2_FLAG_BIND;
|
flags = V2X2_FLAG_BIND;
|
||||||
packet[0] = 0;
|
packet[0] = 0;
|
||||||
@@ -174,6 +163,9 @@ static void __attribute__((unused)) V2X2_send_packet(uint8_t bind)
|
|||||||
flags=0;
|
flags=0;
|
||||||
// Channel 5
|
// Channel 5
|
||||||
if (CH5_SW) flags = V2X2_FLAG_FLIP;
|
if (CH5_SW) flags = V2X2_FLAG_FLIP;
|
||||||
|
|
||||||
|
if(sub_protocol!=V2X2_MR101)
|
||||||
|
{//V2X2 & JXD506
|
||||||
// Channel 6
|
// Channel 6
|
||||||
if (CH6_SW) flags |= V2X2_FLAG_LIGHT;
|
if (CH6_SW) flags |= V2X2_FLAG_LIGHT;
|
||||||
// Channel 7
|
// Channel 7
|
||||||
@@ -192,7 +184,7 @@ static void __attribute__((unused)) V2X2_send_packet(uint8_t bind)
|
|||||||
flags2 |= V2X2_FLAG_EMERGENCY;
|
flags2 |= V2X2_FLAG_EMERGENCY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{//V2X2
|
||||||
// Channel 10
|
// Channel 10
|
||||||
if (CH10_SW)
|
if (CH10_SW)
|
||||||
flags2 |= V2X2_FLAG_MAG_CAL_X;
|
flags2 |= V2X2_FLAG_MAG_CAL_X;
|
||||||
@@ -201,6 +193,7 @@ static void __attribute__((unused)) V2X2_send_packet(uint8_t bind)
|
|||||||
flags2 |= V2X2_FLAG_MAG_CAL_Y;
|
flags2 |= V2X2_FLAG_MAG_CAL_Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// TX id
|
// TX id
|
||||||
packet[7] = rx_tx_addr[1];
|
packet[7] = rx_tx_addr[1];
|
||||||
packet[8] = rx_tx_addr[2];
|
packet[8] = rx_tx_addr[2];
|
||||||
@@ -223,16 +216,26 @@ static void __attribute__((unused)) V2X2_send_packet(uint8_t bind)
|
|||||||
packet[12] = 0x40;
|
packet[12] = 0x40;
|
||||||
packet[13] = 0x40;
|
packet[13] = 0x40;
|
||||||
}
|
}
|
||||||
packet[14] = flags;
|
else if(sub_protocol==V2X2_MR101)
|
||||||
V2X2_add_pkt_checksum();
|
{
|
||||||
|
|
||||||
|
if (CH10_SW) packet[11] = 0x04; // Motors start/stop
|
||||||
|
if (CH11_SW) packet[11] |= 0x40; // Auto Land=-100% Takeoff=+100%
|
||||||
|
if (CH7_SW) flags |= 0x02; // Picture
|
||||||
|
if (CH8_SW) flags |= 0x01; // Video
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
flags = 0x80;
|
||||||
|
flags |= (hopping_frequency_no & 0x01)<<6;
|
||||||
|
}
|
||||||
|
packet[14] = flags;
|
||||||
|
uint8_t sum = packet[0];
|
||||||
|
for (uint8_t i = 1; i < 15; ++i)
|
||||||
|
sum += packet[i];
|
||||||
|
packet[15] = sum;
|
||||||
|
|
||||||
packet_sent = 0;
|
|
||||||
uint8_t rf_ch = hopping_frequency[hopping_frequency_no >> 1];
|
|
||||||
hopping_frequency_no = (hopping_frequency_no + 1) & 0x1F;
|
|
||||||
NRF24L01_WriteReg(NRF24L01_05_RF_CH, rf_ch);
|
|
||||||
NRF24L01_FlushTx();
|
NRF24L01_FlushTx();
|
||||||
NRF24L01_WritePayload(packet, V2X2_PAYLOADSIZE);
|
NRF24L01_WritePayload(packet, V2X2_PAYLOADSIZE);
|
||||||
packet_sent = 1;
|
//packet_sent = 1;
|
||||||
|
|
||||||
if (! hopping_frequency_no)
|
if (! hopping_frequency_no)
|
||||||
NRF24L01_SetPower();
|
NRF24L01_SetPower();
|
||||||
@@ -240,35 +243,26 @@ static void __attribute__((unused)) V2X2_send_packet(uint8_t bind)
|
|||||||
|
|
||||||
uint16_t ReadV2x2()
|
uint16_t ReadV2x2()
|
||||||
{
|
{
|
||||||
switch (phase) {
|
//if (packet_sent && NRF24L01_packet_ack() != PKT_ACKED)
|
||||||
case V202_INIT2:
|
// return V2X2_PACKET_CHKTIME;
|
||||||
V202_init2();
|
|
||||||
phase = V202_BIND2;
|
|
||||||
return 150;
|
|
||||||
break;
|
|
||||||
case V202_INIT2_NO_BIND:
|
|
||||||
V202_init2();
|
|
||||||
phase = V202_DATA;
|
|
||||||
return 150;
|
|
||||||
break;
|
|
||||||
case V202_BIND2:
|
|
||||||
if (packet_sent && NRF24L01_packet_ack() != PKT_ACKED)
|
|
||||||
return V2X2_PACKET_CHKTIME;
|
|
||||||
V2X2_send_packet(1);
|
|
||||||
if (--bind_counter == 0)
|
|
||||||
{
|
|
||||||
phase = V202_DATA;
|
|
||||||
BIND_DONE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case V202_DATA:
|
|
||||||
if (packet_sent && NRF24L01_packet_ack() != PKT_ACKED)
|
|
||||||
return V2X2_PACKET_CHKTIME;
|
|
||||||
#ifdef MULTI_SYNC
|
#ifdef MULTI_SYNC
|
||||||
telemetry_set_input_sync(V2X2_PACKET_PERIOD);
|
telemetry_set_input_sync(V2X2_PACKET_PERIOD);
|
||||||
#endif
|
#endif
|
||||||
V2X2_send_packet(0);
|
V2X2_send_packet();
|
||||||
break;
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
{
|
||||||
|
if (--bind_counter == 0)
|
||||||
|
{
|
||||||
|
BIND_DONE;
|
||||||
|
if(sub_protocol==V2X2_MR101)
|
||||||
|
{
|
||||||
|
#ifdef V2X2_MR101_FORCE_ID
|
||||||
|
NRF24L01_WriteRegisterMulti(NRF24L01_10_TX_ADDR, (uint8_t *)"\xC9\x59\xD2\x65\x34", 5);
|
||||||
|
memcpy(hopping_frequency,"\x03\x05\x15\x0D\x06\x14\x0B",7);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
hopping_frequency_no = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Packet every 4ms
|
// Packet every 4ms
|
||||||
return V2X2_PACKET_PERIOD;
|
return V2X2_PACKET_PERIOD;
|
||||||
@@ -276,15 +270,13 @@ uint16_t ReadV2x2()
|
|||||||
|
|
||||||
uint16_t initV2x2()
|
uint16_t initV2x2()
|
||||||
{
|
{
|
||||||
v202_init();
|
if(sub_protocol==V2X2_MR101)
|
||||||
//
|
BIND_IN_PROGRESS;
|
||||||
if (IS_BIND_IN_PROGRESS)
|
//packet_sent = 0;
|
||||||
{
|
hopping_frequency_no = 0;
|
||||||
bind_counter = V2X2_BIND_COUNT;
|
bind_counter = V2X2_BIND_COUNT;
|
||||||
phase = V202_INIT2;
|
|
||||||
}
|
v202_init();
|
||||||
else
|
|
||||||
phase = V202_INIT2_NO_BIND;
|
|
||||||
V2X2_set_tx_id();
|
V2X2_set_tx_id();
|
||||||
return 50000;
|
return 50000;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ static void __attribute__((unused)) V761_set_checksum()
|
|||||||
|
|
||||||
static void __attribute__((unused)) V761_send_packet()
|
static void __attribute__((unused)) V761_send_packet()
|
||||||
{
|
{
|
||||||
|
static bool calib=false, prev_ch6=false;
|
||||||
|
|
||||||
if(phase != V761_DATA)
|
if(phase != V761_DATA)
|
||||||
{
|
{
|
||||||
packet[0] = rx_tx_addr[0];
|
packet[0] = rx_tx_addr[0];
|
||||||
@@ -66,14 +68,23 @@ static void __attribute__((unused)) V761_send_packet()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
packet[0] = convert_channel_8b(THROTTLE); // throttle
|
packet[0] = convert_channel_8b(THROTTLE); // Throttle
|
||||||
packet[1] = convert_channel_8b(RUDDER)>>1; // rudder
|
packet[2] = convert_channel_8b(ELEVATOR)>>1; // Elevator
|
||||||
packet[2] = convert_channel_8b(ELEVATOR)>>1; // elevator
|
|
||||||
packet[3] = convert_channel_8b(AILERON)>>1; // aileron
|
if(sub_protocol==V761_3CH)
|
||||||
packet[5] = (packet_count++ / 3)<<6;
|
{
|
||||||
packet[4] = (packet[5] == 0x40) ? 0x1a : 0x20;
|
packet[1] = convert_channel_8b(RUDDER)>>1; // Rudder
|
||||||
|
packet[3] = convert_channel_8b(AILERON)>>1; // Aileron
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet[1] = convert_channel_8b(AILERON)>>1; // Aileron
|
||||||
|
packet[3] = convert_channel_8b(RUDDER)>>1; // Rudder
|
||||||
|
}
|
||||||
|
|
||||||
|
packet[5] = (packet_count++ / 3)<<6;
|
||||||
|
packet[4] = (packet[5] == 0x40) ? 0x1a : 0x20; // ?
|
||||||
|
|
||||||
// Channel 5 - Gyro mode is packet 5
|
|
||||||
if(CH5_SW) // Mode Expert Gyro off
|
if(CH5_SW) // Mode Expert Gyro off
|
||||||
flags = 0x0c;
|
flags = 0x0c;
|
||||||
else
|
else
|
||||||
@@ -81,8 +92,20 @@ static void __attribute__((unused)) V761_send_packet()
|
|||||||
flags = 0x08; // Beginer mode (Gyro on, yaw and pitch rate limited)
|
flags = 0x08; // Beginer mode (Gyro on, yaw and pitch rate limited)
|
||||||
else
|
else
|
||||||
flags = 0x0a; // Mid Mode ( Gyro on no rate limits)
|
flags = 0x0a; // Mid Mode ( Gyro on no rate limits)
|
||||||
|
|
||||||
|
if(!prev_ch6 && CH6_SW) // -100% -> 100% launch gyro calib
|
||||||
|
calib=!calib;
|
||||||
|
prev_ch6 = CH6_SW;
|
||||||
|
if(calib)
|
||||||
|
flags |= 0x01; // Gyro calibration
|
||||||
|
|
||||||
packet[5] |= flags;
|
packet[5] |= flags;
|
||||||
packet[6] = 0x80; // unknown
|
|
||||||
|
packet[6] = GET_FLAG(CH7_SW, 0x20) // Flip
|
||||||
|
|GET_FLAG(CH8_SW, 0x08) // RTH activation
|
||||||
|
|GET_FLAG(CH9_SW, 0x10); // RTH on/off
|
||||||
|
if(sub_protocol==V761_3CH)
|
||||||
|
packet[6] |= 0x80; // unknown, set on original V761-1 dump but not on eachine dumps, keeping for compatibility
|
||||||
|
|
||||||
//packet counter
|
//packet counter
|
||||||
if(packet_count >= 12)
|
if(packet_count >= 12)
|
||||||
@@ -120,22 +143,30 @@ static void __attribute__((unused)) V761_init()
|
|||||||
|
|
||||||
static void __attribute__((unused)) V761_initialize_txid()
|
static void __attribute__((unused)) V761_initialize_txid()
|
||||||
{
|
{
|
||||||
// TODO: try arbitrary rx_tx_addr & frequencies (except hopping_frequency[0])
|
switch(RX_num%5)
|
||||||
switch(RX_num%3)
|
|
||||||
{
|
{
|
||||||
case 1: //Dump from air on Protonus TX
|
case 1: //Dump from air on Protonus TX
|
||||||
memcpy(rx_tx_addr,(uint8_t *)"\xE8\xE4\x45\x09",4);
|
memcpy(rx_tx_addr,(uint8_t *)"\xE8\xE4\x45\x09",4);
|
||||||
memcpy(hopping_frequency,(uint8_t *)"\x0D\x21\x44",3);
|
memcpy(hopping_frequency,(uint8_t *)"\x0D\x21",2);
|
||||||
break;
|
break;
|
||||||
case 2: //Dump from air on mshagg2 TX
|
case 2: //Dump from air on mshagg2 TX
|
||||||
memcpy(rx_tx_addr,(uint8_t *)"\xAE\xD1\x45\x09",4);
|
memcpy(rx_tx_addr,(uint8_t *)"\xAE\xD1\x45\x09",4);
|
||||||
memcpy(hopping_frequency,(uint8_t *)"\x13\x1D\x4A",3);
|
memcpy(hopping_frequency,(uint8_t *)"\x13\x1D",2);
|
||||||
|
break;
|
||||||
|
case 3: //Dump from air on MikeHRC Eachine TX
|
||||||
|
memcpy(rx_tx_addr,(uint8_t *)"\x08\x03\x00\xA0",4); // To be checked
|
||||||
|
memcpy(hopping_frequency,(uint8_t *)"\x0D\x21",2); // To be checked
|
||||||
|
break;
|
||||||
|
case 4: //Dump from air on Crashanium Eachine TX
|
||||||
|
memcpy(rx_tx_addr,(uint8_t *)"\x58\x08\x00\xA0",4); // To be checked
|
||||||
|
memcpy(hopping_frequency,(uint8_t *)"\x0D\x31",3); // To be checked
|
||||||
break;
|
break;
|
||||||
default: //Dump from SPI
|
default: //Dump from SPI
|
||||||
memcpy(rx_tx_addr,(uint8_t *)"\x6f\x2c\xb1\x93",4);
|
memcpy(rx_tx_addr,(uint8_t *)"\x6f\x2c\xb1\x93",4);
|
||||||
memcpy(hopping_frequency,(uint8_t *)"\x14\x1e\x4b",3);
|
memcpy(hopping_frequency,(uint8_t *)"\x14\x1e",3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
hopping_frequency[2]=hopping_frequency[0]+0x37;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t V761_callback()
|
uint16_t V761_callback()
|
||||||
@@ -185,10 +216,14 @@ uint16_t V761_callback()
|
|||||||
|
|
||||||
uint16_t initV761(void)
|
uint16_t initV761(void)
|
||||||
{
|
{
|
||||||
BIND_IN_PROGRESS;
|
|
||||||
bind_counter = V761_BIND_COUNT;
|
|
||||||
V761_initialize_txid();
|
V761_initialize_txid();
|
||||||
|
if(IS_BIND_IN_PROGRESS)
|
||||||
|
{
|
||||||
|
bind_counter = V761_BIND_COUNT;
|
||||||
phase = V761_BIND1;
|
phase = V761_BIND1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
phase = V761_DATA;
|
||||||
V761_init();
|
V761_init();
|
||||||
hopping_frequency_no = 0;
|
hopping_frequency_no = 0;
|
||||||
packet_count = 0;
|
packet_count = 0;
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#if not defined (ORANGE_TX) && not defined (STM32_BOARD)
|
#if not defined (ORANGE_TX) && not defined (STM32_BOARD)
|
||||||
//Atmega328p
|
//Atmega328p
|
||||||
#if not defined(ARDUINO_AVR_PRO) && not defined(ARDUINO_MULTI_NO_BOOT) && not defined(ARDUINO_MULTI_FLASH_FROM_TX) && not defined(ARDUINO_AVR_MINI) && not defined(ARDUINO_AVR_NANO)
|
#if not defined(ARDUINO_AVR_PRO) && not defined(ARDUINO_MULTI_NO_BOOT) && not defined(ARDUINO_MULTI_FLASH_FROM_TX) && not defined(ARDUINO_AVR_MINI) && not defined(ARDUINO_AVR_NANO) && not defined(ARDUINO_AVR_DUEMILANOVE)
|
||||||
#error You must select one of these boards: "Multi 4-in-1", "Arduino Pro or Pro Mini" or "Arduino Mini"
|
#error You must select one of these boards: "Multi 4-in-1", "Arduino Pro or Pro Mini" or "Arduino Mini"
|
||||||
#endif
|
#endif
|
||||||
#if F_CPU != 16000000L || not defined(__AVR_ATmega328P__)
|
#if F_CPU != 16000000L || not (defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__))
|
||||||
#error You must select the processor type "ATmega328(5V, 16MHz)"
|
#error You must select the processor type "ATmega328(5V, 16MHz)"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -109,6 +109,11 @@
|
|||||||
#error "The REDPINE forced frequency tuning value is outside of the range -127..127."
|
#error "The REDPINE forced frequency tuning value is outside of the range -127..127."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FORCE_RADIOLINK_TUNING
|
||||||
|
#if ( FORCE_RADIOLINK_TUNING < -127 ) || ( FORCE_RADIOLINK_TUNING > 127 )
|
||||||
|
#error "The RADIOLINK forced frequency tuning value is outside of the range -127..127."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#ifdef FORCE_SFHSS_TUNING
|
#ifdef FORCE_SFHSS_TUNING
|
||||||
#if ( FORCE_SFHSS_TUNING < -127 ) || ( FORCE_SFHSS_TUNING > 127 )
|
#if ( FORCE_SFHSS_TUNING < -127 ) || ( FORCE_SFHSS_TUNING > 127 )
|
||||||
#error "The SFHSS forced frequency tuning value is outside of the range -127..127."
|
#error "The SFHSS forced frequency tuning value is outside of the range -127..127."
|
||||||
@@ -135,9 +140,9 @@
|
|||||||
#error "The Flysky forced frequency tuning value is outside of the range -300..300."
|
#error "The Flysky forced frequency tuning value is outside of the range -300..300."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef FORCE_FLYZONE_TUNING
|
#ifdef FORCE_HEIGHT_TUNING
|
||||||
#if ( FORCE_FLYZONE_TUNING < -300 ) || ( FORCE_FLYZONE_TUNING > 300 )
|
#if ( FORCE_HEIGHT_TUNING < -300 ) || ( FORCE_HEIGHT_TUNING > 300 )
|
||||||
#error "The Flyzone forced frequency tuning value is outside of the range -300..300."
|
#error "The Height forced frequency tuning value is outside of the range -300..300."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef FORCE_PELIKAN_TUNING
|
#ifdef FORCE_PELIKAN_TUNING
|
||||||
@@ -150,6 +155,11 @@
|
|||||||
#error "The Hubsan forced frequency tuning value is outside of the range -300..300."
|
#error "The Hubsan forced frequency tuning value is outside of the range -300..300."
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FORCE_KYOSHO_TUNING
|
||||||
|
#if ( FORCE_KYOSHO_TUNING < -300 ) || ( FORCE_KYOSHO_TUNING > 300 )
|
||||||
|
#error "The Kyosho forced frequency tuning value is outside of the range -300..300."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef USE_A7105_CH15_TUNING
|
#ifndef USE_A7105_CH15_TUNING
|
||||||
#ifndef FORCE_BUGS_TUNING
|
#ifndef FORCE_BUGS_TUNING
|
||||||
@@ -158,12 +168,15 @@
|
|||||||
#ifndef FORCE_FLYSKY_TUNING
|
#ifndef FORCE_FLYSKY_TUNING
|
||||||
#define FORCE_FLYSKY_TUNING 0
|
#define FORCE_FLYSKY_TUNING 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef FORCE_FLYZONE_TUNING
|
#ifndef FORCE_HEIGHT_TUNING
|
||||||
#define FORCE_FLYZONE_TUNING 0
|
#define FORCE_HEIGHT_TUNING 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef FORCE_PELIKAN_TUNING
|
#ifndef FORCE_PELIKAN_TUNING
|
||||||
#define FORCE_PELIKAN_TUNING 0
|
#define FORCE_PELIKAN_TUNING 0
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FORCE_KYOSHO_TUNING
|
||||||
|
#define FORCE_KYOSHO_TUNING 0
|
||||||
|
#endif
|
||||||
#ifndef FORCE_HUBSAN_TUNING
|
#ifndef FORCE_HUBSAN_TUNING
|
||||||
#define FORCE_HUBSAN_TUNING 0
|
#define FORCE_HUBSAN_TUNING 0
|
||||||
#endif
|
#endif
|
||||||
@@ -185,27 +198,40 @@
|
|||||||
#undef CC25_CSN_pin
|
#undef CC25_CSN_pin
|
||||||
#undef NRF24L01_INSTALLED // Disable NRF for OrangeTX module
|
#undef NRF24L01_INSTALLED // Disable NRF for OrangeTX module
|
||||||
#undef NRF_CSN_pin
|
#undef NRF_CSN_pin
|
||||||
#undef SX1276_INSTALLED // Disable NRF for OrangeTX module
|
#undef SX1276_INSTALLED // Disable SX1276 for OrangeTX module
|
||||||
#define TELEMETRY // Enable telemetry
|
#define TELEMETRY // Enable telemetry
|
||||||
#define INVERT_TELEMETRY // Enable invert telemetry
|
#define INVERT_TELEMETRY // Enable invert telemetry
|
||||||
#define DSM_TELEMETRY // Enable DSM telemetry
|
#define DSM_TELEMETRY // Enable DSM telemetry
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//Change/Force RF chip configuration if MULTI_5IN1_INTERNAL
|
||||||
|
#ifdef MULTI_5IN1_INTERNAL
|
||||||
|
#if not defined(STM32_BOARD)
|
||||||
|
#error "Error MULTI_5IN1_INTERNAL is only for STM32 boards."
|
||||||
|
#endif
|
||||||
|
#define A7105_INSTALLED
|
||||||
|
#define CYRF6936_INSTALLED
|
||||||
|
#define CC2500_INSTALLED
|
||||||
|
#define NRF24L01_INSTALLED
|
||||||
|
#define SX1276_INSTALLED
|
||||||
|
#undef ENABLE_PPM
|
||||||
|
#endif
|
||||||
|
|
||||||
//Make sure protocols are selected correctly
|
//Make sure protocols are selected correctly
|
||||||
#ifndef A7105_INSTALLED
|
#ifndef A7105_INSTALLED
|
||||||
#undef AFHDS2A_A7105_INO
|
#undef AFHDS2A_A7105_INO
|
||||||
#undef AFHDS2A_RX_A7105_INO
|
#undef AFHDS2A_RX_A7105_INO
|
||||||
#undef BUGS_A7105_INO
|
#undef BUGS_A7105_INO
|
||||||
#undef FLYSKY_A7105_INO
|
#undef FLYSKY_A7105_INO
|
||||||
#undef FLYZONE_A7105_INO
|
#undef HEIGHT_A7105_INO
|
||||||
#undef HUBSAN_A7105_INO
|
#undef HUBSAN_A7105_INO
|
||||||
|
#undef KYOSHO_A7105_INO
|
||||||
#undef PELIKAN_A7105_INO
|
#undef PELIKAN_A7105_INO
|
||||||
#endif
|
#endif
|
||||||
#ifndef CYRF6936_INSTALLED
|
#ifndef CYRF6936_INSTALLED
|
||||||
#undef DEVO_CYRF6936_INO
|
#undef DEVO_CYRF6936_INO
|
||||||
#undef DSM_CYRF6936_INO
|
#undef DSM_CYRF6936_INO
|
||||||
#undef DSM_RX_CYRF6936_INO
|
#undef DSM_RX_CYRF6936_INO
|
||||||
#undef HOTT_CC2500_INO
|
|
||||||
#undef J6PRO_CYRF6936_INO
|
#undef J6PRO_CYRF6936_INO
|
||||||
#undef TRAXXAS_CYRF6936_INO
|
#undef TRAXXAS_CYRF6936_INO
|
||||||
#undef WFLY_CYRF6936_INO
|
#undef WFLY_CYRF6936_INO
|
||||||
@@ -222,6 +248,7 @@
|
|||||||
#undef HITEC_CC2500_INO
|
#undef HITEC_CC2500_INO
|
||||||
#undef HOTT_CC2500_INO
|
#undef HOTT_CC2500_INO
|
||||||
#undef REDPINE_CC2500_INO
|
#undef REDPINE_CC2500_INO
|
||||||
|
#undef RLINK_CC2500_INO
|
||||||
#undef SCANNER_CC2500_INO
|
#undef SCANNER_CC2500_INO
|
||||||
#undef SFHSS_CC2500_INO
|
#undef SFHSS_CC2500_INO
|
||||||
#undef SKYARTEC_CC2500_INO
|
#undef SKYARTEC_CC2500_INO
|
||||||
@@ -310,6 +337,8 @@
|
|||||||
#undef BAYANG_RX_TELEMETRY
|
#undef BAYANG_RX_TELEMETRY
|
||||||
#undef BAYANG_RX_NRF24L01_INO
|
#undef BAYANG_RX_NRF24L01_INO
|
||||||
#undef DEVO_HUB_TELEMETRY
|
#undef DEVO_HUB_TELEMETRY
|
||||||
|
#undef PROPEL_HUB_TELEMETRY
|
||||||
|
#undef RLINK_HUB_TELEMETRY
|
||||||
#undef DSM_RX_CYRF6936_INO
|
#undef DSM_RX_CYRF6936_INO
|
||||||
#else
|
#else
|
||||||
#if defined(MULTI_TELEMETRY) && defined(MULTI_STATUS)
|
#if defined(MULTI_TELEMETRY) && defined(MULTI_STATUS)
|
||||||
@@ -337,6 +366,9 @@
|
|||||||
#if not defined(DEVO_CYRF6936_INO)
|
#if not defined(DEVO_CYRF6936_INO)
|
||||||
#undef DEVO_HUB_TELEMETRY
|
#undef DEVO_HUB_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
|
#if not defined(PROPEL_NRF24L01_INO)
|
||||||
|
#undef PROPEL_HUB_TELEMETRY
|
||||||
|
#endif
|
||||||
#if not defined(NCC1701_NRF24L01_INO)
|
#if not defined(NCC1701_NRF24L01_INO)
|
||||||
#undef NCC1701_HUB_TELEMETRY
|
#undef NCC1701_HUB_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
@@ -346,6 +378,9 @@
|
|||||||
#if not defined(CABELL_NRF24L01_INO)
|
#if not defined(CABELL_NRF24L01_INO)
|
||||||
#undef CABELL_HUB_TELEMETRY
|
#undef CABELL_HUB_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
|
#if not defined(RLINK_CC2500_INO)
|
||||||
|
#undef RLINK_HUB_TELEMETRY
|
||||||
|
#endif
|
||||||
#if not defined(HUBSAN_A7105_INO)
|
#if not defined(HUBSAN_A7105_INO)
|
||||||
#undef HUBSAN_HUB_TELEMETRY
|
#undef HUBSAN_HUB_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
@@ -360,7 +395,7 @@
|
|||||||
#if not defined(FRSKYD_CC2500_INO)
|
#if not defined(FRSKYD_CC2500_INO)
|
||||||
#undef HUB_TELEMETRY
|
#undef HUB_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
#if not defined(FRSKYX_CC2500_INO)
|
#if not defined(FRSKYX_CC2500_INO) && not defined(FRSKYR9_SX1276_INO)
|
||||||
#undef SPORT_TELEMETRY
|
#undef SPORT_TELEMETRY
|
||||||
#undef SPORT_SEND
|
#undef SPORT_SEND
|
||||||
#endif
|
#endif
|
||||||
@@ -373,7 +408,7 @@
|
|||||||
#if not defined(HOTT_CC2500_INO)
|
#if not defined(HOTT_CC2500_INO)
|
||||||
#undef HOTT_FW_TELEMETRY
|
#undef HOTT_FW_TELEMETRY
|
||||||
#endif
|
#endif
|
||||||
#if not defined(HOTT_FW_TELEMETRY) && not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BUGS_HUB_TELEMETRY) && not defined(NCC1701_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS) && not defined(HITEC_HUB_TELEMETRY) && not defined(HITEC_FW_TELEMETRY) && not defined(SCANNER_TELEMETRY) && not defined(FRSKY_RX_TELEMETRY) && not defined(AFHDS2A_RX_TELEMETRY) && not defined(BAYANG_RX_TELEMETRY) && not defined(DEVO_HUB_TELEMETRY)
|
#if not defined(HOTT_FW_TELEMETRY) && not defined(DSM_TELEMETRY) && not defined(SPORT_TELEMETRY) && not defined(HUB_TELEMETRY) && not defined(HUBSAN_HUB_TELEMETRY) && not defined(BUGS_HUB_TELEMETRY) && not defined(NCC1701_HUB_TELEMETRY) && not defined(BAYANG_HUB_TELEMETRY) && not defined(CABELL_HUB_TELEMETRY) && not defined(RLINK_HUB_TELEMETRY) && not defined(AFHDS2A_HUB_TELEMETRY) && not defined(AFHDS2A_FW_TELEMETRY) && not defined(MULTI_TELEMETRY) && not defined(MULTI_STATUS) && not defined(HITEC_HUB_TELEMETRY) && not defined(HITEC_FW_TELEMETRY) && not defined(SCANNER_TELEMETRY) && not defined(FRSKY_RX_TELEMETRY) && not defined(AFHDS2A_RX_TELEMETRY) && not defined(BAYANG_RX_TELEMETRY) && not defined(DEVO_HUB_TELEMETRY) && not defined(PROPEL_HUB_TELEMETRY)
|
||||||
#undef TELEMETRY
|
#undef TELEMETRY
|
||||||
#undef INVERT_TELEMETRY
|
#undef INVERT_TELEMETRY
|
||||||
#undef MULTI_TELEMETRY
|
#undef MULTI_TELEMETRY
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ static uint16_t XN297Dump_callback()
|
|||||||
XN297Dump_overflow();
|
XN297Dump_overflow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if(sub_protocol==XN297DUMP_AUTO)
|
||||||
{
|
{
|
||||||
switch(phase)
|
switch(phase)
|
||||||
{
|
{
|
||||||
@@ -414,7 +414,7 @@ static uint16_t XN297Dump_callback()
|
|||||||
packet_count=0;
|
packet_count=0;
|
||||||
bind_counter=0;
|
bind_counter=0;
|
||||||
debugln("Time between CH:%d and CH:%d",hopping_frequency[0],hopping_frequency[hopping_frequency_no]);
|
debugln("Time between CH:%d and CH:%d",hopping_frequency[0],hopping_frequency[hopping_frequency_no]);
|
||||||
time_rf[hopping_frequency_no]=-1;
|
time_rf[hopping_frequency_no]=0xFFFFFFFF;
|
||||||
NRF24L01_WriteReg(NRF24L01_05_RF_CH,hopping_frequency[0]);
|
NRF24L01_WriteReg(NRF24L01_05_RF_CH,hopping_frequency[0]);
|
||||||
uint16_t timeL=TCNT1;
|
uint16_t timeL=TCNT1;
|
||||||
if(TIMER2_BASE->SR & TIMER_SR_UIF)
|
if(TIMER2_BASE->SR & TIMER_SR_UIF)
|
||||||
@@ -504,7 +504,7 @@ static uint16_t XN297Dump_callback()
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
time=time_rf[i];
|
time=time_rf[i];
|
||||||
if(time!=-1)
|
if(time!=0xFFFFFFFF)
|
||||||
{
|
{
|
||||||
next=i;
|
next=i;
|
||||||
for(uint8_t j=2;j<rf_ch_num;j++)
|
for(uint8_t j=2;j<rf_ch_num;j++)
|
||||||
@@ -624,6 +624,79 @@ static uint16_t XN297Dump_callback()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(phase==0)
|
||||||
|
{
|
||||||
|
address_length=5;
|
||||||
|
memcpy(rx_tx_addr, (uint8_t *)"\xC9\x59\xD2\x65\x34", 5);
|
||||||
|
bitrate=XN297DUMP_250K;
|
||||||
|
packet_length=16;
|
||||||
|
hopping_frequency_no=0x03;
|
||||||
|
|
||||||
|
NRF24L01_Initialize();
|
||||||
|
NRF24L01_SetTxRxMode(TXRX_OFF);
|
||||||
|
NRF24L01_SetTxRxMode(RX_EN);
|
||||||
|
NRF24L01_FlushTx();
|
||||||
|
NRF24L01_FlushRx();
|
||||||
|
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // Clear data ready, data sent, and retransmit
|
||||||
|
NRF24L01_WriteReg(NRF24L01_01_EN_AA, 0x00); // No Auto Acknowledgment on all data pipes
|
||||||
|
NRF24L01_WriteReg(NRF24L01_02_EN_RXADDR, 0x01); // Enable data pipe 0 only
|
||||||
|
NRF24L01_WriteReg(NRF24L01_03_SETUP_AW, address_length-2); // RX/TX address length
|
||||||
|
NRF24L01_WriteRegisterMulti(NRF24L01_0A_RX_ADDR_P0, rx_tx_addr, address_length); // set up RX address
|
||||||
|
NRF24L01_WriteReg(NRF24L01_11_RX_PW_P0, packet_length); // Enable rx pipe 0
|
||||||
|
NRF24L01_WriteReg(NRF24L01_05_RF_CH, hopping_frequency_no);
|
||||||
|
|
||||||
|
debug("NRF dump, len=%d, rf=%d, address length=%d, bitrate=",packet_length,hopping_frequency_no,address_length);
|
||||||
|
switch(bitrate)
|
||||||
|
{
|
||||||
|
case XN297DUMP_250K:
|
||||||
|
NRF24L01_SetBitrate(NRF24L01_BR_250K);
|
||||||
|
debugln("250K");
|
||||||
|
break;
|
||||||
|
case XN297DUMP_2M:
|
||||||
|
NRF24L01_SetBitrate(NRF24L01_BR_2M);
|
||||||
|
debugln("2M");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
NRF24L01_SetBitrate(NRF24L01_BR_1M);
|
||||||
|
debugln("1M");
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
NRF24L01_Activate(0x73); // Activate feature register
|
||||||
|
NRF24L01_WriteReg(NRF24L01_1C_DYNPD, 0x00); // Disable dynamic payload length on all pipes
|
||||||
|
NRF24L01_WriteReg(NRF24L01_1D_FEATURE, 0x01);
|
||||||
|
NRF24L01_Activate(0x73);
|
||||||
|
NRF24L01_SetPower();
|
||||||
|
NRF24L01_WriteReg(NRF24L01_00_CONFIG, _BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP) | _BV(NRF24L01_00_PRIM_RX));
|
||||||
|
phase++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( NRF24L01_ReadReg(NRF24L01_07_STATUS) & _BV(NRF24L01_07_RX_DR))
|
||||||
|
{ // RX fifo data ready
|
||||||
|
if(NRF24L01_ReadReg(NRF24L01_09_CD))
|
||||||
|
{
|
||||||
|
NRF24L01_ReadPayload(packet, packet_length);
|
||||||
|
if(memcmp(packet_in,packet,packet_length))
|
||||||
|
{
|
||||||
|
debug("P:");
|
||||||
|
for(uint8_t i=0;i<packet_length;i++)
|
||||||
|
debug(" %02X",packet[i]);
|
||||||
|
debugln("");
|
||||||
|
memcpy(packet_in,packet,packet_length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// restart RX mode
|
||||||
|
NRF24L01_WriteReg(NRF24L01_07_STATUS, 0x70); // Clear data ready, data sent, and retransmit
|
||||||
|
NRF24L01_SetTxRxMode(TXRX_OFF);
|
||||||
|
NRF24L01_SetTxRxMode(RX_EN);
|
||||||
|
NRF24L01_FlushRx();
|
||||||
|
NRF24L01_WriteReg(NRF24L01_00_CONFIG, _BV(NRF24L01_00_EN_CRC) | _BV(NRF24L01_00_CRCO) | _BV(NRF24L01_00_PWR_UP) | _BV(NRF24L01_00_PRIM_RX));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
bind_counter++;
|
bind_counter++;
|
||||||
if(IS_RX_FLAG_on) // Let the radio update the protocol
|
if(IS_RX_FLAG_on) // Let the radio update the protocol
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,9 +69,10 @@
|
|||||||
/****************/
|
/****************/
|
||||||
/*** RF CHIPS ***/
|
/*** RF CHIPS ***/
|
||||||
/****************/
|
/****************/
|
||||||
//There are 4 RF components supported. If one of them is not installed you must comment it using "//".
|
//There are 5 RF components supported. If one of them is not installed you must comment it using "//".
|
||||||
//If a chip is not installed all associated protocols are automatically disabled.
|
//If a chip is not installed all associated protocols are automatically disabled.
|
||||||
//4-in-1 modules have all RF chips installed
|
//4-in-1 modules have the A7105, CYRF6936, CC2500 and NRF24L01 RF chips installed
|
||||||
|
//5-in-1 modules have all RF chips installed
|
||||||
//!!!If a RF chip is present it MUST be marked as installed!!! or weird things will happen you have been warned.
|
//!!!If a RF chip is present it MUST be marked as installed!!! or weird things will happen you have been warned.
|
||||||
#define A7105_INSTALLED
|
#define A7105_INSTALLED
|
||||||
#define CYRF6936_INSTALLED
|
#define CYRF6936_INSTALLED
|
||||||
@@ -79,6 +80,10 @@
|
|||||||
#define NRF24L01_INSTALLED
|
#define NRF24L01_INSTALLED
|
||||||
//#define SX1276_INSTALLED // only supported on STM32 modules
|
//#define SX1276_INSTALLED // only supported on STM32 modules
|
||||||
|
|
||||||
|
//Uncomment (remove //) if you have an internal 5-in-1 Multi module.
|
||||||
|
//All components are considered to be installed and specifics to that module are automatically configured
|
||||||
|
//#define MULTI_5IN1_INTERNAL
|
||||||
|
|
||||||
/** OrangeRX TX **/
|
/** OrangeRX TX **/
|
||||||
//If you compile for the OrangeRX TX module you need to select the correct board type.
|
//If you compile for the OrangeRX TX module you need to select the correct board type.
|
||||||
//By default the compilation is done for the GREEN board, to switch to a BLUE board uncomment the line below by removing the "//"
|
//By default the compilation is done for the GREEN board, to switch to a BLUE board uncomment the line below by removing the "//"
|
||||||
@@ -95,11 +100,12 @@
|
|||||||
//#define FORCE_FRSKYL_TUNING 0
|
//#define FORCE_FRSKYL_TUNING 0
|
||||||
//#define FORCE_FRSKYV_TUNING 0
|
//#define FORCE_FRSKYV_TUNING 0
|
||||||
//#define FORCE_FRSKYX_TUNING 0
|
//#define FORCE_FRSKYX_TUNING 0
|
||||||
//#define FORCE_SFHSS_TUNING 0
|
|
||||||
//#define FORCE_SKYARTEC_TUNING 0
|
|
||||||
//#define FORCE_HITEC_TUNING 0
|
//#define FORCE_HITEC_TUNING 0
|
||||||
//#define FORCE_HOTT_TUNING 0
|
//#define FORCE_HOTT_TUNING 0
|
||||||
|
//#define FORCE_RADIOLINK_TUNING 0
|
||||||
//#define FORCE_REDPINE_TUNING 0
|
//#define FORCE_REDPINE_TUNING 0
|
||||||
|
//#define FORCE_SFHSS_TUNING 0
|
||||||
|
//#define FORCE_SKYARTEC_TUNING 0
|
||||||
|
|
||||||
/** A7105 Fine Frequency Tuning **/
|
/** A7105 Fine Frequency Tuning **/
|
||||||
//This is required in rare cases where some A7105 modules and/or RXs have an inaccurate crystal oscillator.
|
//This is required in rare cases where some A7105 modules and/or RXs have an inaccurate crystal oscillator.
|
||||||
@@ -112,9 +118,10 @@
|
|||||||
//#define FORCE_AFHDS2A_TUNING 0
|
//#define FORCE_AFHDS2A_TUNING 0
|
||||||
//#define FORCE_BUGS_TUNING 0
|
//#define FORCE_BUGS_TUNING 0
|
||||||
//#define FORCE_FLYSKY_TUNING 0
|
//#define FORCE_FLYSKY_TUNING 0
|
||||||
//#define FORCE_FLYZONE_TUNING 0
|
//#define FORCE_HEIGHT_TUNING 0
|
||||||
//#define FORCE_PELIKAN_TUNING 0
|
|
||||||
//#define FORCE_HUBSAN_TUNING 0
|
//#define FORCE_HUBSAN_TUNING 0
|
||||||
|
//#define FORCE_KYOSHO_TUNING 0
|
||||||
|
//#define FORCE_PELIKAN_TUNING 0
|
||||||
|
|
||||||
/** CYRF6936 Fine Frequency Tuning **/
|
/** CYRF6936 Fine Frequency Tuning **/
|
||||||
//This is required in rare cases where some CYRF6936 modules and/or RXs have an inaccurate crystal oscillator.
|
//This is required in rare cases where some CYRF6936 modules and/or RXs have an inaccurate crystal oscillator.
|
||||||
@@ -163,8 +170,9 @@
|
|||||||
#define AFHDS2A_RX_A7105_INO
|
#define AFHDS2A_RX_A7105_INO
|
||||||
#define BUGS_A7105_INO
|
#define BUGS_A7105_INO
|
||||||
#define FLYSKY_A7105_INO
|
#define FLYSKY_A7105_INO
|
||||||
#define FLYZONE_A7105_INO
|
#define HEIGHT_A7105_INO
|
||||||
#define HUBSAN_A7105_INO
|
#define HUBSAN_A7105_INO
|
||||||
|
#define KYOSHO_A7105_INO
|
||||||
#define PELIKAN_A7105_INO
|
#define PELIKAN_A7105_INO
|
||||||
|
|
||||||
//The protocols below need a CYRF6936 to be installed
|
//The protocols below need a CYRF6936 to be installed
|
||||||
@@ -190,6 +198,7 @@
|
|||||||
#define SFHSS_CC2500_INO
|
#define SFHSS_CC2500_INO
|
||||||
#define SKYARTEC_CC2500_INO
|
#define SKYARTEC_CC2500_INO
|
||||||
#define REDPINE_CC2500_INO
|
#define REDPINE_CC2500_INO
|
||||||
|
#define RLINK_CC2500_INO
|
||||||
|
|
||||||
//The protocols below need a NRF24L01 to be installed
|
//The protocols below need a NRF24L01 to be installed
|
||||||
#define ASSAN_NRF24L01_INO
|
#define ASSAN_NRF24L01_INO
|
||||||
@@ -256,7 +265,6 @@
|
|||||||
//When enabled (remove the "//"), the below setting makes LQI (Link Quality Indicator) available on one of the RX ouput channel (5-14).
|
//When enabled (remove the "//"), the below setting makes LQI (Link Quality Indicator) available on one of the RX ouput channel (5-14).
|
||||||
//#define AFHDS2A_LQI_CH 14
|
//#define AFHDS2A_LQI_CH 14
|
||||||
|
|
||||||
|
|
||||||
/**************************/
|
/**************************/
|
||||||
/*** FAILSAFE SETTINGS ***/
|
/*** FAILSAFE SETTINGS ***/
|
||||||
/**************************/
|
/**************************/
|
||||||
@@ -305,7 +313,9 @@
|
|||||||
#define DEVO_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define DEVO_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define HUBSAN_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define HUBSAN_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define NCC1701_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define NCC1701_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
|
#define PROPEL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define CABELL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
#define CABELL_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
|
#define RLINK_HUB_TELEMETRY // Use FrSkyD Hub format to send telemetry to TX
|
||||||
#define HITEC_HUB_TELEMETRY // Use FrSkyD Hub format to send basic telemetry to the radios which can decode it like er9x, erskyTX and OpenTX
|
#define HITEC_HUB_TELEMETRY // Use FrSkyD Hub format to send basic telemetry to the radios which can decode it like er9x, erskyTX and OpenTX
|
||||||
#define HITEC_FW_TELEMETRY // Forward received telemetry packets to be decoded by erskyTX and OpenTX
|
#define HITEC_FW_TELEMETRY // Forward received telemetry packets to be decoded by erskyTX and OpenTX
|
||||||
#define SCANNER_TELEMETRY // Forward spectrum scanner data to TX
|
#define SCANNER_TELEMETRY // Forward spectrum scanner data to TX
|
||||||
@@ -500,6 +510,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
PPM_IBUS
|
PPM_IBUS
|
||||||
PWM_SBUS
|
PWM_SBUS
|
||||||
PPM_SBUS
|
PPM_SBUS
|
||||||
|
PWM_IB16
|
||||||
|
PPM_IB16
|
||||||
PROTO_AFHDS2A_RX
|
PROTO_AFHDS2A_RX
|
||||||
NONE
|
NONE
|
||||||
PROTO_ASSAN
|
PROTO_ASSAN
|
||||||
@@ -568,8 +580,6 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
V6X6
|
V6X6
|
||||||
V912
|
V912
|
||||||
CX20
|
CX20
|
||||||
PROTO_FLYZONE
|
|
||||||
FZ410
|
|
||||||
PROTO_FQ777
|
PROTO_FQ777
|
||||||
NONE
|
NONE
|
||||||
PROTO_FRSKY_RX
|
PROTO_FRSKY_RX
|
||||||
@@ -586,6 +596,10 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
R9_868
|
R9_868
|
||||||
R9_915_8CH
|
R9_915_8CH
|
||||||
R9_868_8CH
|
R9_868_8CH
|
||||||
|
R9_FCC
|
||||||
|
R9_EU
|
||||||
|
R9_FCC_8CH
|
||||||
|
R9_EU_8CH
|
||||||
PROTO_FRSKYV
|
PROTO_FRSKYV
|
||||||
NONE
|
NONE
|
||||||
PROTO_FRSKYX
|
PROTO_FRSKYX
|
||||||
@@ -593,7 +607,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
CH_8
|
CH_8
|
||||||
EU_16
|
EU_16
|
||||||
EU_8
|
EU_8
|
||||||
XCLONE
|
XCLONE_16
|
||||||
|
XCLONE_8
|
||||||
PROTO_FRSKYX2
|
PROTO_FRSKYX2
|
||||||
CH_16
|
CH_16
|
||||||
CH_8
|
CH_8
|
||||||
@@ -618,6 +633,9 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
H20H
|
H20H
|
||||||
H20MINI
|
H20MINI
|
||||||
H30MINI
|
H30MINI
|
||||||
|
PROTO_HEIGHT
|
||||||
|
HEIGHT_5CH
|
||||||
|
HEIGHT_8CH
|
||||||
PROTO_HISKY
|
PROTO_HISKY
|
||||||
Hisky
|
Hisky
|
||||||
HK310
|
HK310
|
||||||
@@ -646,6 +664,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
PROTO_KN
|
PROTO_KN
|
||||||
WLTOYS
|
WLTOYS
|
||||||
FEILUN
|
FEILUN
|
||||||
|
PROTO_KYOSHO
|
||||||
|
NONE
|
||||||
PROTO_MJXQ
|
PROTO_MJXQ
|
||||||
WLH08
|
WLH08
|
||||||
X600
|
X600
|
||||||
@@ -683,6 +703,8 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
PROTO_REDPINE
|
PROTO_REDPINE
|
||||||
RED_FAST
|
RED_FAST
|
||||||
RED_SLOW
|
RED_SLOW
|
||||||
|
PROTO_RLINK
|
||||||
|
NONE
|
||||||
PROTO_SCANNER
|
PROTO_SCANNER
|
||||||
NONE
|
NONE
|
||||||
PROTO_SFHSS
|
PROTO_SFHSS
|
||||||
@@ -707,8 +729,10 @@ const PPM_Parameters PPM_prot[14*NBR_BANKS]= {
|
|||||||
PROTO_V2X2
|
PROTO_V2X2
|
||||||
V2X2
|
V2X2
|
||||||
JXD506
|
JXD506
|
||||||
|
V2X2_MR101
|
||||||
PROTO_V761
|
PROTO_V761
|
||||||
NONE
|
V761_3CH
|
||||||
|
V761_4CH
|
||||||
PROTO_V911S
|
PROTO_V911S
|
||||||
V911S_STD
|
V911S_STD
|
||||||
V911S_E119
|
V911S_E119
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ enum
|
|||||||
SX1276_0D_FIFOADDRPTR = 0x0D,
|
SX1276_0D_FIFOADDRPTR = 0x0D,
|
||||||
SX1276_0E_FIFOTXBASEADDR = 0x0E,
|
SX1276_0E_FIFOTXBASEADDR = 0x0E,
|
||||||
SX1276_11_IRQFLAGSMASK = 0x11,
|
SX1276_11_IRQFLAGSMASK = 0x11,
|
||||||
|
SX1276_12_REGIRQFLAGS = 0x12,
|
||||||
|
SX1276_13_REGRXNBBYTES = 0x13,
|
||||||
|
SX1276_19_PACKETSNR = 0x19,
|
||||||
|
SX1276_1A_PACKETRSSI = 0x1A,
|
||||||
SX1276_1D_MODEMCONFIG1 = 0x1D,
|
SX1276_1D_MODEMCONFIG1 = 0x1D,
|
||||||
SX1276_1E_MODEMCONFIG2 = 0x1E,
|
SX1276_1E_MODEMCONFIG2 = 0x1E,
|
||||||
SX1276_20_PREAMBLEMSB = 0x20,
|
SX1276_20_PREAMBLEMSB = 0x20,
|
||||||
@@ -40,6 +44,24 @@ enum
|
|||||||
SX1276_4D_PADAC = 0x4D
|
SX1276_4D_PADAC = 0x4D
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SX1276_REGIRQFLAGS_CADDETECTED = 0,
|
||||||
|
SX1276_REGIRQFLAGS_FHSSCHANGECHANNEL = 1,
|
||||||
|
SX1276_REGIRQFLAGS_CADDONE = 2,
|
||||||
|
SX1276_REGIRQFLAGS_TXDONE = 3,
|
||||||
|
SX1276_REGIRQFLAGS_VALIDHEADER = 4,
|
||||||
|
SX1276_REGIRQFLAGS_PAYLOADCRCERROR = 5,
|
||||||
|
SX1276_REGIRQFLAGS_RXDONE = 6,
|
||||||
|
SX1276_REGIRQFLAGS_RXTIMEOUT = 7,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SX1276_36_LORA_REGHIGHBWOPTIMIZE1 = 0x36,
|
||||||
|
SX1276_3A_LORA_REGHIGHBWOPTIMIZE2 = 0x3A
|
||||||
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SX1276_OPMODE_SLEEP = 0,
|
SX1276_OPMODE_SLEEP = 0,
|
||||||
|
|||||||
@@ -6,24 +6,20 @@ Here are detailed descriptions of every supported protocols (sorted by RF module
|
|||||||
The Deviation project (on which this project was based) have a useful list of models and protocols [here](http://www.deviationtx.com/wiki/supported_models).
|
The Deviation project (on which this project was based) have a useful list of models and protocols [here](http://www.deviationtx.com/wiki/supported_models).
|
||||||
|
|
||||||
## Useful notes and definitions
|
## Useful notes and definitions
|
||||||
- **Extended limits supported** - A command range of -125%..+125% will be transmitted. Otherwise the default is -100%..+100% only.
|
- **Channel Order** - The channel order assumed in all the documentation is AETR. You can change this in the compilation settings or by using a precompiled firmware. The module will take whatever input channel order you have choosen and will rearrange them to match the output channel order required by the selected protocol.
|
||||||
- **Channel Order** - The channel order assumed in all the documentation is AETR. You can change this in the compilation settings. The module will take whatever input channel order and will rearrange them to match the output channel order required by the selected protocol.
|
- **Channel ranges** - A radio output of -100%..0%..+100% will match on the selected protocol -100%,0%,+100%. No convertion needs to be done.
|
||||||
|
- **Extended limits supported** - A channel range of -125%..+125% will be transmitted. Otherwise it will be truncated to -100%..+100%.
|
||||||
- **Italic numbers** are referring to protocol/sub_protocol numbers that you should use if the radio (serial mode only) is not displaying (yet) the protocol you want to access.
|
- **Italic numbers** are referring to protocol/sub_protocol numbers that you should use if the radio (serial mode only) is not displaying (yet) the protocol you want to access.
|
||||||
- **Autobind protocol**:
|
- **Autobind protocol** - The transmitter will automatically initiate a bind sequence on power up or model/protocol selection. This is for models where the receiver expects to rebind every time it is powered up. In these protocols you do not need to press the bind button at power up to bind, it will be done automatically. In case a protocol is not autobind but you want to enable it, change the "Autobind" or "Bind on channel" on OpenTX setting to Y for the specific model/entry.
|
||||||
|
|
||||||
1. The transmitter will automatically initiate a bind sequence on power up. This is for models where the receiver expects to rebind every time it is powered up. In these protocols you do not need to press the bind button at power up to bind, it will be done automatically. In case a protocol is not autobind but you want to enable it, change the "Autobind" (or "Bind at powerup" on OpenTX) setting to Y for the specific model/entry.
|
## Bind on channel feature
|
||||||
2. Enable Bind from channel feature:
|
* Bind on channel can be globally enabled/disabled in _config.h using ENABLE_BIND_CH. Any channel between 5 and 16 can be used by configuring BIND_CH in _config.h. Default is 16.
|
||||||
* Bind from channel can be globally enabled/disabled in _config.h using ENABLE_BIND_CH.
|
* Bind on channel can be locally enabled/disabled by setting "Bind on channel" or "Autobind" per model for serial or per dial switch number for ppm.
|
||||||
* Bind from channel can be locally enabled/disabled by setting Autobind to Y/N per model for serial or per dial switch number for ppm.
|
* Once activated, any bind will only happen if all these elements are happening at the same time:
|
||||||
* Bind channel can be choosen on any channel between 5 and 16 using BIND_CH in _config.h. Default is 16.
|
- Bind on channel = Y
|
||||||
* Bind will only happen if all these elements are happening at the same time:
|
|
||||||
- Autobind = Y
|
|
||||||
- Throttle = LOW (<-95%)
|
- Throttle = LOW (<-95%)
|
||||||
- Bind channel is going from -100% to +100%
|
- Bind channel (16 by default) is going from -100% to +100%
|
||||||
|
|
||||||
* Additional notes:
|
|
||||||
- **It's recommended to combine the bind switch with Throttle cut or throttle at -100% to drive the bind channel. This will prevent to launch a bind while flying** and enable you to use the bind switch for something else.
|
- **It's recommended to combine the bind switch with Throttle cut or throttle at -100% to drive the bind channel. This will prevent to launch a bind while flying** and enable you to use the bind switch for something else.
|
||||||
- Using channel 16 for the bind channel seems the most relevant as only one protocol so far is using 16 channels which is FrSkyX. But even on FrSkyX this feature won't have any impact since there is NO valid reason to have Autobind set to Y for such a protocol.
|
|
||||||
|
|
||||||
## Protocol selection in PPM mode
|
## Protocol selection in PPM mode
|
||||||
The protocol selection is based on 2 parameters:
|
The protocol selection is based on 2 parameters:
|
||||||
@@ -78,29 +74,29 @@ CFlie|38|CFlie||||||||NRF24L01|
|
|||||||
[CX10](Protocols_Details.md#CX10---12)|12|GREEN|BLUE|DM007|-|J3015_1|J3015_2|MK33041||NRF24L01|XN297
|
[CX10](Protocols_Details.md#CX10---12)|12|GREEN|BLUE|DM007|-|J3015_1|J3015_2|MK33041||NRF24L01|XN297
|
||||||
[Devo](Protocols_Details.md#DEVO---7)|7|Devo|8CH|10CH|12CH|6CH|7CH|||CYRF6936|
|
[Devo](Protocols_Details.md#DEVO---7)|7|Devo|8CH|10CH|12CH|6CH|7CH|||CYRF6936|
|
||||||
[DM002](Protocols_Details.md#DM002---33)|33|DM002||||||||NRF24L01|XN297
|
[DM002](Protocols_Details.md#DM002---33)|33|DM002||||||||NRF24L01|XN297
|
||||||
[DSM](Protocols_Details.md#DSM---6)|6|DSM2-22|DSM2-11|DSMX-22|DSMX-11|AUTO||||CYRF6936|
|
[DSM](Protocols_Details.md#DSM---6)|6|DSM2_1F|DSM2_2F|DSMX_1F|DSMX_2F|AUTO||||CYRF6936|
|
||||||
[DSM_RX](Protocols_Details.md#DSM_RX---70)|70|RX||||||||CYRF6936|
|
[DSM_RX](Protocols_Details.md#DSM_RX---70)|70|RX||||||||CYRF6936|
|
||||||
[E01X](Protocols_Details.md#E01X---45)|45|E012|E015|E016H||||||NRF24L01|XN297/HS6200
|
[E01X](Protocols_Details.md#E01X---45)|45|E012|E015|E016H||||||NRF24L01|XN297/HS6200
|
||||||
[ESky](Protocols_Details.md#ESKY---16)|16|ESky|ET4|||||||NRF24L01|
|
[ESky](Protocols_Details.md#ESKY---16)|16|ESky|ET4|||||||NRF24L01|
|
||||||
[ESky150](Protocols_Details.md#ESKY150---35)|35|ESKY150||||||||NRF24L01|
|
[ESky150](Protocols_Details.md#ESKY150---35)|35|ESKY150||||||||NRF24L01|
|
||||||
[ESky150V2](Protocols_Details.md#ESKY150V2---69)|69|ESky150V2||||||||CC2500|NRF24L01
|
[ESky150V2](Protocols_Details.md#ESKY150V2---69)|69|ESky150V2||||||||CC2500|NRF24L01
|
||||||
[Flysky](Protocols_Details.md#FLYSKY---1)|1|Flysky|V9x9|V6x6|V912|CX20||||A7105|
|
[Flysky](Protocols_Details.md#FLYSKY---1)|1|Flysky|V9x9|V6x6|V912|CX20||||A7105|
|
||||||
[Flysky AFHDS2A](Protocols_Details.md#FLYSKY-AFHDS2A---28)|28|PWM_IBUS|PPM_IBUS|PWM_SBUS|PPM_SBUS|||||A7105|
|
[Flysky AFHDS2A](Protocols_Details.md#FLYSKY-AFHDS2A---28)|28|PWM_IBUS|PPM_IBUS|PWM_SBUS|PPM_SBUS|PWM_IBUS16|PPM_IBUS16|||A7105|
|
||||||
[Flysky AFHDS2A RX](Protocols_Details.md#FLYSKY-AFHDS2A-RX---56)|56|RX||||||||A7105|
|
[Flysky AFHDS2A RX](Protocols_Details.md#FLYSKY-AFHDS2A-RX---56)|56|RX||||||||A7105|
|
||||||
[Flyzone](Protocols_Details.md#FLYZONE---53)|53|FZ410||||||||A7105|
|
|
||||||
[FQ777](Protocols_Details.md#FQ777---23)|23|FQ777||||||||NRF24L01|SSV7241
|
[FQ777](Protocols_Details.md#FQ777---23)|23|FQ777||||||||NRF24L01|SSV7241
|
||||||
[FrskyD](Protocols_Details.md#FRSKYD---3)|3|D8|Cloned|||||||CC2500|
|
[FrskyD](Protocols_Details.md#FRSKYD---3)|3|D8|Cloned|||||||CC2500|
|
||||||
[FrskyL](Protocols_Details.md#FRSKYL---67)|67|LR12|LR12 6CH|||||||CC2500|
|
[FrskyL](Protocols_Details.md#FRSKYL---67)|67|LR12|LR12 6CH|||||||CC2500|
|
||||||
[FrskyR9](Protocols_Details.md#FRSKYR9---65)|65|FrskyR9|R9_915|R9_868||||||SX1276|
|
[FrskyR9](Protocols_Details.md#FRSKYR9---65)|65|FrskyR9|R9_915|R9_868||||||SX1276|
|
||||||
[FrskyV](Protocols_Details.md#FRSKYV---25)|25|FrskyV||||||||CC2500|
|
[FrskyV](Protocols_Details.md#FRSKYV---25)|25|FrskyV||||||||CC2500|
|
||||||
[FrskyX](Protocols_Details.md#FRSKYX---15)|15|CH_16|CH_8|EU_16|EU_8|Cloned||||CC2500|
|
[FrskyX](Protocols_Details.md#FRSKYX---15)|15|CH_16|CH_8|EU_16|EU_8|Cloned|Cloned_8|||CC2500|
|
||||||
[FrskyX2](Protocols_Details.md#FRSKYX2---64)|64|CH_16|CH_8|EU_16|EU_8|Cloned||||CC2500|
|
[FrskyX2](Protocols_Details.md#FRSKYX2---64)|64|CH_16|CH_8|EU_16|EU_8|Cloned|Cloned_8|||CC2500|
|
||||||
[Frsky_RX](Protocols_Details.md#FRSKY_RX---55)|55|RX|CloneTX|||||||CC2500|
|
[Frsky_RX](Protocols_Details.md#FRSKY_RX---55)|55|RX|CloneTX|||||||CC2500|
|
||||||
[FX816](Protocols_Details.md#FX816---58)|28|FX816|P38|||||||NRF24L01|
|
[FX816](Protocols_Details.md#FX816---58)|28|FX816|P38|||||||NRF24L01|
|
||||||
[FY326](Protocols_Details.md#FY326---20)|20|FY326|FY319|||||||NRF24L01|
|
[FY326](Protocols_Details.md#FY326---20)|20|FY326|FY319|||||||NRF24L01|
|
||||||
[GD00X](Protocols_Details.md#GD00X---47)|47|GD_V1*|GD_V2*|||||||NRF24L01|
|
[GD00X](Protocols_Details.md#GD00X---47)|47|GD_V1*|GD_V2*|||||||NRF24L01|
|
||||||
[GW008](Protocols_Details.md#GW008---32)|32|GW008||||||||NRF24L01|XN297
|
[GW008](Protocols_Details.md#GW008---32)|32|GW008||||||||NRF24L01|XN297
|
||||||
[H8_3D](Protocols_Details.md#H8_3D---36)|36|H8_3D|H20H|H20Mini|H30Mini|||||NRF24L01|XN297
|
[H8_3D](Protocols_Details.md#H8_3D---36)|36|H8_3D|H20H|H20Mini|H30Mini|||||NRF24L01|XN297
|
||||||
|
[Height](Protocols_Details.md#HEIGHT---53)|53|5ch|8ch|||||||A7105|
|
||||||
[Hisky](Protocols_Details.md#HISKY---4)|4|Hisky|HK310|||||||NRF24L01|
|
[Hisky](Protocols_Details.md#HISKY---4)|4|Hisky|HK310|||||||NRF24L01|
|
||||||
[Hitec](Protocols_Details.md#HITEC---39)|39|OPT_FW|OPT_HUB|MINIMA||||||CC2500|
|
[Hitec](Protocols_Details.md#HITEC---39)|39|OPT_FW|OPT_HUB|MINIMA||||||CC2500|
|
||||||
[Hontai](Protocols_Details.md#HONTAI---26)|26|HONTAI|JJRCX1|X5C1|FQ777_951|||||NRF24L01|XN297
|
[Hontai](Protocols_Details.md#HONTAI---26)|26|HONTAI|JJRCX1|X5C1|FQ777_951|||||NRF24L01|XN297
|
||||||
@@ -110,6 +106,7 @@ CFlie|38|CFlie||||||||NRF24L01|
|
|||||||
[JJRC345](Protocols_Details.md#JJRC345---71)|71|JJRC345||||||||NRF24L01|XN297
|
[JJRC345](Protocols_Details.md#JJRC345---71)|71|JJRC345||||||||NRF24L01|XN297
|
||||||
[KF606](Protocols_Details.md#KF606---49)|49|KF606*||||||||NRF24L01|XN297
|
[KF606](Protocols_Details.md#KF606---49)|49|KF606*||||||||NRF24L01|XN297
|
||||||
[KN](Protocols_Details.md#KN---9)|9|WLTOYS|FEILUN|||||||NRF24L01|
|
[KN](Protocols_Details.md#KN---9)|9|WLTOYS|FEILUN|||||||NRF24L01|
|
||||||
|
[Kyosho](Protocols_Details.md#Kyosho---73)|73|||||||||A7105|
|
||||||
[MJXq](Protocols_Details.md#MJXQ---18)|18|WLH08|X600|X800|H26D|E010*|H26WH|PHOENIX*||NRF24L01|XN297
|
[MJXq](Protocols_Details.md#MJXQ---18)|18|WLH08|X600|X800|H26D|E010*|H26WH|PHOENIX*||NRF24L01|XN297
|
||||||
[MT99xx](Protocols_Details.md#MT99XX---17)|17|MT|H7|YZ|LS|FY805||||NRF24L01|XN297
|
[MT99xx](Protocols_Details.md#MT99XX---17)|17|MT|H7|YZ|LS|FY805||||NRF24L01|XN297
|
||||||
[NCC1701](Protocols_Details.md#NCC1701---44)|44|NCC1701||||||||NRF24L01|
|
[NCC1701](Protocols_Details.md#NCC1701---44)|44|NCC1701||||||||NRF24L01|
|
||||||
@@ -120,6 +117,7 @@ CFlie|38|CFlie||||||||NRF24L01|
|
|||||||
[Q2X2](Protocols_Details.md#Q2X2---29)|29|Q222|Q242|Q282||||||NRF24L01|
|
[Q2X2](Protocols_Details.md#Q2X2---29)|29|Q222|Q242|Q282||||||NRF24L01|
|
||||||
[Q303](Protocols_Details.md#Q303---31)|31|Q303|CX35|CX10D|CX10WD|||||NRF24L01|XN297
|
[Q303](Protocols_Details.md#Q303---31)|31|Q303|CX35|CX10D|CX10WD|||||NRF24L01|XN297
|
||||||
[Q90C](Protocols_Details.md#Q90C---72)|72|Q90C*||||||||NRF24L01|XN297
|
[Q90C](Protocols_Details.md#Q90C---72)|72|Q90C*||||||||NRF24L01|XN297
|
||||||
|
[RadioLink](Protocols_Details.md#RadioLink---74)|74|Surface|Air|||||||CC2500|
|
||||||
[Redpine](Protocols_Details.md#Redpine---50)|50|FAST|SLOW|||||||NRF24L01|
|
[Redpine](Protocols_Details.md#Redpine---50)|50|FAST|SLOW|||||||NRF24L01|
|
||||||
[Scanner](Protocols_Details.md#Scanner---54)|54|||||||||CC2500|
|
[Scanner](Protocols_Details.md#Scanner---54)|54|||||||||CC2500|
|
||||||
[SFHSS](Protocols_Details.md#SFHSS---21)|21|SFHSS||||||||CC2500|
|
[SFHSS](Protocols_Details.md#SFHSS---21)|21|SFHSS||||||||CC2500|
|
||||||
@@ -129,7 +127,7 @@ CFlie|38|CFlie||||||||NRF24L01|
|
|||||||
[SymaX](Protocols_Details.md#Symax---10)|10|SYMAX|SYMAX5C|||||||NRF24L01|
|
[SymaX](Protocols_Details.md#Symax---10)|10|SYMAX|SYMAX5C|||||||NRF24L01|
|
||||||
[Tiger](Protocols_Details.md#Tiger---61)|61|Tiger||||||||NRF24L01|XN297
|
[Tiger](Protocols_Details.md#Tiger---61)|61|Tiger||||||||NRF24L01|XN297
|
||||||
[Traxxas](Protocols_Details.md#Traxxas---43)|43|6519 RX||||||||CYRF6936|
|
[Traxxas](Protocols_Details.md#Traxxas---43)|43|6519 RX||||||||CYRF6936|
|
||||||
[V2x2](Protocols_Details.md#V2X2---5)|5|V2x2|JXD506|||||||NRF24L01|
|
[V2x2](Protocols_Details.md#V2X2---5)|5|V2x2|JXD506|MR101||||||NRF24L01|
|
||||||
[V761](Protocols_Details.md#V761---48)|48|V761||||||||NRF24L01|XN297
|
[V761](Protocols_Details.md#V761---48)|48|V761||||||||NRF24L01|XN297
|
||||||
[V911S](Protocols_Details.md#V911S---46)|46|V911S*|E119*|||||||NRF24L01|XN297
|
[V911S](Protocols_Details.md#V911S---46)|46|V911S*|E119*|||||||NRF24L01|XN297
|
||||||
[WFly](Protocols_Details.md#WFLY---40)|40|WFLY||||||||CYRF6936|
|
[WFly](Protocols_Details.md#WFLY---40)|40|WFLY||||||||CYRF6936|
|
||||||
@@ -143,6 +141,19 @@ CFlie|38|CFlie||||||||NRF24L01|
|
|||||||
|
|
||||||
If USE_A7105_CH15_TUNING is enabled, the value of channel 15 is used by all A7105 protocols for tuning the frequency. This is required in rare cases where some A7105 modules and/or RXs have an inaccurate crystal oscillator.
|
If USE_A7105_CH15_TUNING is enabled, the value of channel 15 is used by all A7105 protocols for tuning the frequency. This is required in rare cases where some A7105 modules and/or RXs have an inaccurate crystal oscillator.
|
||||||
|
|
||||||
|
## BUGS - *41*
|
||||||
|
Models: MJX Bugs 3, 6 and 8
|
||||||
|
|
||||||
|
Telemetry enabled for RX & TX RSSI, Battery voltage good/bad
|
||||||
|
|
||||||
|
**RX_Num is used to give a number to a given model. You must use a different RX_Num per MJX Bugs. A maximum of 16 Bugs are supported.**
|
||||||
|
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10
|
||||||
|
---|---|---|---|---|---|---|---|---|---
|
||||||
|
A|E|T|R|ARM|ANGLE|FLIP|PICTURE|VIDEO|LED
|
||||||
|
|
||||||
|
ANGLE: angle is +100%, acro is -100%
|
||||||
|
|
||||||
## FLYSKY - *1*
|
## FLYSKY - *1*
|
||||||
Extended limits supported
|
Extended limits supported
|
||||||
|
|
||||||
@@ -181,15 +192,12 @@ Extended limits and failsafe supported
|
|||||||
Telemetry enabled protocol:
|
Telemetry enabled protocol:
|
||||||
- by defaut using FrSky Hub protocol (for example er9x): RX(A1), battery voltage FS-CVT01(A2) and RX&TX RSSI
|
- by defaut using FrSky Hub protocol (for example er9x): RX(A1), battery voltage FS-CVT01(A2) and RX&TX RSSI
|
||||||
- if using erskyTX and OpenTX: full telemetry information available
|
- if using erskyTX and OpenTX: full telemetry information available
|
||||||
|
- if telemetry is incomplete (missing RX RSSI for example), it means that you have to upgrade your RX firmware to version 1.6 or later. You can do it from an original Flysky TX or using a STLink like explained in [this tutorial](https://www.rcgroups.com/forums/showthread.php?2677694-How-to-upgrade-Flysky-Turnigy-iA6B-RX-to-firmware-1-6-with-a-ST-Link).
|
||||||
|
|
||||||
Option is used to change the servo refresh rate. A value of 0 gives 50Hz (min), 70 gives 400Hz (max). Specific refresh rate value can be calculated like this option=(refresh_rate-50)/5.
|
Option is used to change the servo refresh rate. A value of 0 gives 50Hz (min), 70 gives 400Hz (max). Specific refresh rate value can be calculated like this option=(refresh_rate-50)/5.
|
||||||
|
|
||||||
**RX_Num is used to give a number a given RX. You must use a different RX_Num per RX. A maximum of 64 AFHDS2A RXs are supported.**
|
**RX_Num is used to give a number a given RX. You must use a different RX_Num per RX. A maximum of 64 AFHDS2A RXs are supported.**
|
||||||
|
|
||||||
OpenTX suggested RSSI alarm threshold settings (Telemetry tab): Low=15, Critical=12.
|
|
||||||
|
|
||||||
If telemetry is incomplete (missing RX RSSI for example), it means that you have to upgrade your RX firmware to version 1.6 or later. You can do it from an original Flysky TX or using a STLink like explained in [this tutorial](https://www.rcgroups.com/forums/showthread.php?2677694-How-to-upgrade-Flysky-Turnigy-iA6B-RX-to-firmware-1-6-with-a-ST-Link).
|
|
||||||
|
|
||||||
AFHDS2A_LQI_CH is a feature which is disabled by defaut in the _config.h file. When enabled, it makes LQI (Link Quality Indicator) available on one of the RX ouput channel (5-14).
|
AFHDS2A_LQI_CH is a feature which is disabled by defaut in the _config.h file. When enabled, it makes LQI (Link Quality Indicator) available on one of the RX ouput channel (5-14).
|
||||||
|
|
||||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14
|
||||||
@@ -202,6 +210,25 @@ Note that the RX ouput will be AETR whatever the input channel order is.
|
|||||||
### Sub_protocol PPM_IBUS - *1*
|
### Sub_protocol PPM_IBUS - *1*
|
||||||
### Sub_protocol PWM_SBUS - *2*
|
### Sub_protocol PWM_SBUS - *2*
|
||||||
### Sub_protocol PPM_SBUS - *3*
|
### Sub_protocol PPM_SBUS - *3*
|
||||||
|
### Sub_protocol PWM_IBUS16 - *4*
|
||||||
|
|
||||||
|
3 additional channels. Need recent or updated RXs.
|
||||||
|
|
||||||
|
CH15|CH16|CH17
|
||||||
|
---|---|---
|
||||||
|
CH15|CH16|LQI
|
||||||
|
|
||||||
|
LQI: Link Quality Indicator
|
||||||
|
|
||||||
|
### Sub_protocol PPM_IBUS16 - *5*
|
||||||
|
|
||||||
|
3 additional channels. Need recent or updated RXs.
|
||||||
|
|
||||||
|
CH15|CH16|CH17
|
||||||
|
---|---|---
|
||||||
|
CH15|CH16|LQI
|
||||||
|
|
||||||
|
LQI: Link Quality Indicator
|
||||||
|
|
||||||
## FLYSKY AFHDS2A RX - *56*
|
## FLYSKY AFHDS2A RX - *56*
|
||||||
The Flysky AFHDS2A receiver protocol enables master/slave trainning, separate access from 2 different radios to the same model,...
|
The Flysky AFHDS2A receiver protocol enables master/slave trainning, separate access from 2 different radios to the same model,...
|
||||||
@@ -212,14 +239,21 @@ Extended limits supported
|
|||||||
|
|
||||||
Low power: enable/disable the LNA stage on the RF component to use depending on the distance with the TX.
|
Low power: enable/disable the LNA stage on the RF component to use depending on the distance with the TX.
|
||||||
|
|
||||||
## FLYZONE - *53*
|
## HEIGHT - *53*
|
||||||
Models using the Flyzone FZ-410 TX: Fokker D.VII Micro EP RTF
|
|
||||||
|
|
||||||
Models using the old ARES TX (prior to Hitec RED): Tiger Moth, eRC Micro Stik
|
### Sub_protocol 5CH - *0*
|
||||||
|
Models from Height, Flyzone, Rage R/C, eRC and the old ARES (prior to Hitec RED).
|
||||||
|
|
||||||
CH1|CH2|CH3|CH4
|
CH1|CH2|CH3|CH4|CH5
|
||||||
---|---|---|---
|
---|---|---|---|---
|
||||||
A|E|T|R
|
A|E|T|R|Gear
|
||||||
|
|
||||||
|
### Sub_protocol 8CH - *1*
|
||||||
|
Models from Height and Rage R/C.
|
||||||
|
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
||||||
|
---|---|---|---|---|---|---|---
|
||||||
|
A|E|T|R|Gear|Gyro|Flap|Light
|
||||||
|
|
||||||
## HUBSAN - *2*
|
## HUBSAN - *2*
|
||||||
|
|
||||||
@@ -254,18 +288,12 @@ H122D: FLIP
|
|||||||
|
|
||||||
H123D: FMODES -> -100%=Sport mode 1,0%=Sport mode 2,+100%=Acro
|
H123D: FMODES -> -100%=Sport mode 1,0%=Sport mode 2,+100%=Acro
|
||||||
|
|
||||||
## BUGS - *41*
|
## Kyosho - *73*
|
||||||
Models: MJX Bugs 3, 6 and 8
|
Surface protocol called FHSS introduced in 2017. Transmitters: KT-531P, KT-431PT, Flysky Noble NB4 (fw>2.0.67)...
|
||||||
|
|
||||||
Telemetry enabled for RX & TX RSSI, Battery voltage good/bad
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14
|
||||||
|
---|---|---|---|---|---|---|---|---|----|----|----|----|----
|
||||||
**RX_Num is used to give a number to a given model. You must use a different RX_Num per MJX Bugs. A maximum of 16 Bugs are supported.**
|
STEERING|THROTTLE|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14
|
||||||
|
|
||||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10
|
|
||||||
---|---|---|---|---|---|---|---|---|---
|
|
||||||
A|E|T|R|ARM|ANGLE|FLIP|PICTURE|VIDEO|LED
|
|
||||||
|
|
||||||
ANGLE: angle is +100%, acro is -100%
|
|
||||||
|
|
||||||
## Pelikan - *60*
|
## Pelikan - *60*
|
||||||
Extended limits supported
|
Extended limits supported
|
||||||
@@ -416,6 +444,13 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
|||||||
### Sub_protocol Cloned - *4*
|
### Sub_protocol Cloned - *4*
|
||||||
Use the identifier learnt from another FrSky radio when binding with the FrSkyRX/CloneTX mode.
|
Use the identifier learnt from another FrSky radio when binding with the FrSkyRX/CloneTX mode.
|
||||||
|
|
||||||
|
16 channels.
|
||||||
|
|
||||||
|
### Sub_protocol Cloned_8 - *5*
|
||||||
|
Use the identifier learnt from another FrSky radio when binding with the FrSkyRX/CloneTX mode.
|
||||||
|
|
||||||
|
8 channels.
|
||||||
|
|
||||||
## FRSKYX2 - *64*
|
## FRSKYX2 - *64*
|
||||||
Same as [FrskyX](Protocols_Details.md#FRSKYX---15) but for D16 v2.1.0 FCC/LBT.
|
Same as [FrskyX](Protocols_Details.md#FRSKYX---15) but for D16 v2.1.0 FCC/LBT.
|
||||||
|
|
||||||
@@ -518,11 +553,40 @@ You should definitively upgrade your receivers/sensors to the latest firmware ve
|
|||||||
## Scanner - *54*
|
## Scanner - *54*
|
||||||
2.4GHz scanner accessible using the OpenTX 2.3 Spectrum Analyser tool.
|
2.4GHz scanner accessible using the OpenTX 2.3 Spectrum Analyser tool.
|
||||||
|
|
||||||
|
## RadioLink - *74*
|
||||||
|
|
||||||
|
Extended limits
|
||||||
|
|
||||||
|
**64 IDs available, use RX num to scroll through them**
|
||||||
|
|
||||||
|
Option for this protocol corresponds to fine frequency tuning. This value is different for each Module and **must** be accurate otherwise the link will not be stable.
|
||||||
|
Check the [Frequency Tuning page](/docs/Frequency_Tuning.md) to determine it.
|
||||||
|
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14|CH15|CH16
|
||||||
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|FS_CH1|FS_CH2|FS_CH3|FS_CH4|FS_CH5|FS_CH6|FS_CH7|FS_CH8
|
||||||
|
|
||||||
|
FS=FailSafe
|
||||||
|
|
||||||
|
### Sub_protocol Surface - *0*
|
||||||
|
Surface protocol. TXs: RC4GS,RC6GS. Compatible RXs:R7FG(Std),R6FG,R6F,R8EF,R8FM,R8F,R4FGM,R4F and more
|
||||||
|
|
||||||
|
CH1=Steering, CH2=Throttle, CH8=Gyro gain
|
||||||
|
|
||||||
|
Telemetry: RX_RSSI (for the original value add -256), TX_RSSI, TX_QLY (0..100%), A1=RX_Batt, A2=Batt
|
||||||
|
|
||||||
|
### Sub_protocol Air - *1*
|
||||||
|
Air protocol. TXs: T8FB,T8S. Compatible RXs:R8EF,R8FM,R8SM,R4FG,R4F and more
|
||||||
|
|
||||||
|
Telemetry: RX_RSSI (for the original value add -256), TX_RSSI, TX_QLY (0..100%)
|
||||||
|
|
||||||
## SFHSS - *21*
|
## SFHSS - *21*
|
||||||
Models: Futaba RXs and XK models.
|
Models: Futaba RXs and XK models.
|
||||||
|
|
||||||
Extended limits and failsafe supported
|
Extended limits and failsafe supported
|
||||||
|
|
||||||
|
RX output will match the Futaba standard AETR independently of the input configuration AETR, RETA... unless on OpenTX 2.3.3+ you use the "Disable channel mapping" feature on the GUI.
|
||||||
|
|
||||||
Option for this protocol corresponds to fine frequency tuning. This value is different for each Module and **must** be accurate otherwise the link will not be stable.
|
Option for this protocol corresponds to fine frequency tuning. This value is different for each Module and **must** be accurate otherwise the link will not be stable.
|
||||||
Check the [Frequency Tuning page](/docs/Frequency_Tuning.md) to determine it.
|
Check the [Frequency Tuning page](/docs/Frequency_Tuning.md) to determine it.
|
||||||
|
|
||||||
@@ -655,33 +719,31 @@ Extended limits supported
|
|||||||
|
|
||||||
Telemetry enabled for TSSI and plugins
|
Telemetry enabled for TSSI and plugins
|
||||||
|
|
||||||
option=number of channels from 4 to 12. An invalid option value will end up with 6 channels.
|
|
||||||
|
|
||||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|----|CH14
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|----|CH14
|
||||||
---|---|---|---|---|---|---|---|---|----|----|----|----|----
|
---|---|---|---|---|---|---|---|---|----|----|----|----|----
|
||||||
A|E|T|R|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|----|TH_KILL
|
A|E|T|R|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|----|TH_KILL
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- model/type/number of channels indicated on the RX can be different from what the RX is in fact wanting to see. So don't hesitate to test different combinations until you have something working. Using Auto is the best way to find these settings.
|
- The "AUTO" sub protocol is recommended to automatically select the best settings for your DSM RX. If the RX doesn't bind or work properly after bind, don't hesitate to test different combinations of sub protocol and number of channels until you have something working.
|
||||||
|
- Servo refresh rate is 22ms unless you select 11ms available in OpenTX 2.3.10+
|
||||||
- RX output will match the Spektrum standard TAER independently of the input configuration AETR, RETA... unless on OpenTX 2.3.3+ you use the "Disable channel mapping" feature on the GUI.
|
- RX output will match the Spektrum standard TAER independently of the input configuration AETR, RETA... unless on OpenTX 2.3.3+ you use the "Disable channel mapping" feature on the GUI.
|
||||||
- RX output will match the Spektrum standard throw (1500µs +/- 400µs -> 1100..1900µs) for a 100% input. This is true for both Serial and PPM input. For PPM, make sure the end points PPM_MIN_100 and PPM_MAX_100 in _config.h are matching your TX ouput. The maximum ouput is 1000..2000µs based on an input of 125%.
|
- RX output will match the Spektrum standard throw (1500µs +/- 400µs -> 1100..1900µs) for a 100% input. This is true for both Serial and PPM input. For PPM, make sure the end points PPM_MIN_100 and PPM_MAX_100 in _config.h are matching your TX ouput. The maximum ouput is 1000..2000µs based on an input of 125%.
|
||||||
- If you want to override the above and get maximum throw either uncomment in _config.h the line #define DSM_MAX_THROW or on OpenTX 2.3.3+ use the "Enable max throw" feature on the GUI (0=No,1=Yes). In this mode to achieve standard throw use a channel weight of 84%.
|
- If you want to override the above and get maximum throw either uncomment in _config.h the line #define DSM_MAX_THROW or on OpenTX 2.3.3+ use the "Enable max throw" feature on the GUI (0=No,1=Yes). In this mode to achieve standard throw use a channel weight of 84%.
|
||||||
- TH_KILL is a feature which is enabled on channel 14 by default (can be disabled/changed) in the _config.h file. Some models (X-Vert, Blade 230S...) require a special position to instant stop the motor(s). If the channel 14 is above -50% the throttle is untouched but if it is between -50% and -100%, the throttle output will be forced between -100% and -150%. For example, a value of -80% applied on channel 14 will instantly kill the motors on the X-Vert.
|
- TH_KILL is a feature which is enabled on channel 14 by default (can be disabled/changed) in the _config.h file. Some models (X-Vert, Blade 230S...) require a special position to instant stop the motor(s). If the channel 14 is above -50% the throttle is untouched but if it is between -50% and -100%, the throttle output will be forced between -100% and -150%. For example, a value of -80% applied on channel 14 will instantly kill the motors on the X-Vert.
|
||||||
|
- To allow SAFE to be ON with a switch assignment you must remove the bind plug after powering up the RX but before turning on the TX to bind. If you select Autodetect to bind, The MPM will choose DSMX 11ms and Channels 1-7 ( Change to 1-9 if you wish to assign switch above channel 7 ). Then in order to use the manuals diagram of both sticks "Down-Inside" to set a SAFE Select Switch Designation, you must have Throttle and Elevator channels set to Normal direction but the Aileron and Rudder set to Reverse direction. If setting up a new model with all channels set to Normal you can hold both sticks "Down- OUTSIDE" to assign the switch with 5x flips. Tested on a Mode2 radio.
|
||||||
|
|
||||||
### Sub_protocol DSM2_22 - *0*
|
Option=number of channels from 3 to 12. Option|0x80 enables Max Throw. Option|0x40 enables a servo refresh rate of 11ms.
|
||||||
DSM2, Resolution 1024, refresh rate 22ms
|
|
||||||
### Sub_protocol DSM2_11 - *1*
|
### Sub_protocol DSM2_1F - *0*
|
||||||
DSM2, Resolution 2048, refresh rate 11ms
|
DSM2, Resolution 1024, servo refresh rate can only be 22ms
|
||||||
### Sub_protocol DSMX_22 - *2*
|
### Sub_protocol DSM2_2F - *1*
|
||||||
DSMX, Resolution 2048, refresh rate 22ms
|
DSM2, Resolution 2048, servo refresh rate can be 22 or 11ms. 11ms won't be available on all servo outputs when more than 7 channels are used.
|
||||||
### Sub_protocol DSMX_11 - *3*
|
### Sub_protocol DSMX_1F - *2*
|
||||||
DSMX, Resolution 2048, refresh rate 11ms
|
DSMX, Resolution 2048, servo refresh rate can only be 22ms
|
||||||
|
### Sub_protocol DSMX_2F - *3*
|
||||||
|
DSMX, Resolution 2048, servo refresh rate can be 22 or 11ms. 11ms won't be available on all servo outputs when more than 7 channels are used.
|
||||||
### Sub_protocol AUTO - *4*
|
### Sub_protocol AUTO - *4*
|
||||||
The "AUTO" feature enables the TX to automatically choose what are the best settings for your DSM RX and update your model protocol settings accordingly.
|
"AUTO" is recommended to automatically select the best settings for your DSM RX.
|
||||||
|
|
||||||
The current radio firmware which are able to use the "AUTO" feature are erskyTX (9XR Pro, 9Xtreme, Taranis, ...), er9x for M128(9XR)&M2561 and OpenTX (mostly Taranis).
|
|
||||||
For these firmwares, you must have a telemetry enabled TX and you have to make sure you set the Telemetry "Usr proto" to "DSMx".
|
|
||||||
Also on er9x you will need to be sure to match the polarity of the telemetry serial (normal or inverted by bitbashing), while on erskyTX you can set "Invert COM1" accordinlgy.
|
|
||||||
|
|
||||||
## DSM_RX - *70*
|
## DSM_RX - *70*
|
||||||
The DSM receiver protocol enables master/slave trainning, separate access from 2 different radios to the same model,...
|
The DSM receiver protocol enables master/slave trainning, separate access from 2 different radios to the same model,...
|
||||||
@@ -1300,12 +1362,13 @@ This protocol is known to be problematic because it's using the xn297L emulation
|
|||||||
|
|
||||||
If the model does not respond well to inputs or hard to bind, you can try to switch the emulation from the default NRF24L01 RF component to the CC2500 by using an option value (freq tuning) different from 0. Option in this case is used for fine frequency tuning like any CC2500 protocols so check the [Frequency Tuning page](/docs/Frequency_Tuning.md).
|
If the model does not respond well to inputs or hard to bind, you can try to switch the emulation from the default NRF24L01 RF component to the CC2500 by using an option value (freq tuning) different from 0. Option in this case is used for fine frequency tuning like any CC2500 protocols so check the [Frequency Tuning page](/docs/Frequency_Tuning.md).
|
||||||
|
|
||||||
**Only 1 ID available. FMODE and VTX+ are not supported. If you have a TX then contact me on GitHub or RCGroups.**
|
|
||||||
|
|
||||||
CH1|CH2|CH3|CH4|CH5|CH6
|
CH1|CH2|CH3|CH4|CH5|CH6
|
||||||
---|---|---|---|---|---
|
---|---|---|---|---|---
|
||||||
A|E|T|R|FMODE|VTX+
|
A|E|T|R|FMODE|VTX+
|
||||||
|
|
||||||
|
FMODE: -100% angle, 0% horizon, +100% acro
|
||||||
|
VTX+: -100%->+100% channel+
|
||||||
|
|
||||||
## Redpine - *50*
|
## Redpine - *50*
|
||||||
[Link to the forum](https://www.rcgroups.com/forums/showthread.php?3236043-Redpine-Lowest-latency-RC-protocol)
|
[Link to the forum](https://www.rcgroups.com/forums/showthread.php?3236043-Redpine-Lowest-latency-RC-protocol)
|
||||||
|
|
||||||
@@ -1433,6 +1496,23 @@ CH10|CH11|CH12
|
|||||||
---|---|---
|
---|---|---
|
||||||
Start/Stop|EMERGENCY|CAMERA_UP/DN
|
Start/Stop|EMERGENCY|CAMERA_UP/DN
|
||||||
|
|
||||||
|
### Sub_protocol MR101 - *2*
|
||||||
|
TX: MR101, model: Dromida XL
|
||||||
|
|
||||||
|
**Only 1 ID** available. If you have a TX contact me on GitHub or RCGroups.
|
||||||
|
|
||||||
|
Autobind protocol
|
||||||
|
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11
|
||||||
|
---|---|---|---|---|---|---|---|---|----|----
|
||||||
|
A|E|T|R|FLIP||PICTURE|VIDEO||MOT_ON_OFF|AUTO
|
||||||
|
|
||||||
|
MOT_ON_OFF: momentary switch (you need to maintaint it for at least 1.5sec for on or off)
|
||||||
|
|
||||||
|
AUTO: Land=-100% Takeoff=+100%
|
||||||
|
|
||||||
|
The model can work with a none centered throttle.
|
||||||
|
|
||||||
## Tiger - *61*
|
## Tiger - *61*
|
||||||
Autobind protocol
|
Autobind protocol
|
||||||
|
|
||||||
@@ -1443,15 +1523,28 @@ CH1|CH2|CH3|CH4|CH5|CH6
|
|||||||
A|E|T|R|FLIP|LIGHT
|
A|E|T|R|FLIP|LIGHT
|
||||||
|
|
||||||
## V761 - *48*
|
## V761 - *48*
|
||||||
Model: Volantex V761 and may be other
|
|
||||||
|
|
||||||
Warning: Only 3 IDs, you can cycle through them using RX_Num.
|
Warning: **Only 5 IDs**, you can cycle through them using RX_Num.
|
||||||
|
|
||||||
CH1|CH2|CH3|CH4|CH5
|
|
||||||
---|---|---|---|---
|
|
||||||
-|E|T|R|GYRO
|
|
||||||
|
|
||||||
Gyro: -100%=Beginer mode (Gyro on, yaw and pitch rate limited), 0%=Mid Mode ( Gyro on no rate limits), +100%=Mode Expert Gyro off
|
Gyro: -100%=Beginer mode (Gyro on, yaw and pitch rate limited), 0%=Mid Mode ( Gyro on no rate limits), +100%=Mode Expert Gyro off
|
||||||
|
Calib: momentary switch, calib will happen one the channel goes from -100% to +100%
|
||||||
|
Flip: momentary switch: hold flip(+100%), indicate flip direction with Ele or Ail, release flip(-100%)
|
||||||
|
RTN_ACT and RTN: -100% disable, +100% enable
|
||||||
|
|
||||||
|
### Sub_protocol 3CH - *0*
|
||||||
|
Model: Volantex V761-1, V761-3 and may be others
|
||||||
|
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
|
||||||
|
---|---|---|---|---|---|---|---|---
|
||||||
|
-|E|T|R|GYRO|CALIB|FLIP|RTN_ACT|RTN
|
||||||
|
|
||||||
|
### Sub_protocol 4CH - *1*
|
||||||
|
Model: Volantex V761-4+ and Eachine P51-D, F4U, F22 and may be others
|
||||||
|
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9
|
||||||
|
---|---|---|---|---|---|---|---|---
|
||||||
|
A|E|T|R|GYRO|CALIB|FLIP|RTN_ACT|RTN
|
||||||
|
|
||||||
|
|
||||||
## V911S - *46*
|
## V911S - *46*
|
||||||
This protocol is known to be problematic because it's using the xn297L emulation with a transmission speed of 250kbps therefore it doesn't work very well with every modules, this is an hardware issue with the accuracy of the components.
|
This protocol is known to be problematic because it's using the xn297L emulation with a transmission speed of 250kbps therefore it doesn't work very well with every modules, this is an hardware issue with the accuracy of the components.
|
||||||
@@ -1512,7 +1605,16 @@ CH1|CH2|CH3|CH4|CH5
|
|||||||
# SX1276 RF Module
|
# SX1276 RF Module
|
||||||
|
|
||||||
## FRSKYR9 - *65*
|
## FRSKYR9 - *65*
|
||||||
Extended limits supported
|
**R9 RXs must be flashed with latest ACCST.**
|
||||||
|
|
||||||
|
Extended limits and failsafe supported.
|
||||||
|
|
||||||
|
Full telemetry supported.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- The choices of CH1-8/CH9-16 and Telem ON/OFF is available in OpenTX 2.3.10 nightlies. The default is CH1-8 Telem ON.
|
||||||
|
- Telemetry from TX to RX is available in OpenTX 2.3.10 nightlies.
|
||||||
|
- Power adjustment is not supported on the T18.
|
||||||
|
|
||||||
### Sub_protocol R9_915 - *0*
|
### Sub_protocol R9_915 - *0*
|
||||||
915MHz, 16 channels
|
915MHz, 16 channels
|
||||||
@@ -1542,8 +1644,21 @@ CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
|||||||
---|---|---|---|---|---|---|---
|
---|---|---|---|---|---|---|---
|
||||||
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
||||||
|
|
||||||
|
### Sub_protocol R9_FCC - *4*
|
||||||
|
FCC, 16 channels
|
||||||
|
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14|CH15|CH16
|
||||||
|
---|---|---|---|---|---|---|---|---|----|----|----|----|----|----|----
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8|CH9|CH10|CH11|CH12|CH13|CH14|CH15|CH16
|
||||||
|
|
||||||
|
### Sub_protocol R9_FCC_8CH - *6*
|
||||||
|
FCC, 8 channels
|
||||||
|
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
||||||
|
---|---|---|---|---|---|---|---
|
||||||
|
CH1|CH2|CH3|CH4|CH5|CH6|CH7|CH8
|
||||||
|
|
||||||
# OpenLRS module
|
# OpenLRS module
|
||||||
|
|
||||||
## OpenLRS - *27*
|
## OpenLRS - *27*
|
||||||
This is a reservation for OpenLRSng which is using Multi's serial protocol for their modules: https://openlrsng.org/. On the Multi side there is no protocol affected on 27 so it's just ignored.
|
This is a reservation for OpenLRSng which is using Multi's serial protocol for their modules: https://openlrsng.org/. On the Multi side there is no protocol affected on 27 so it's just ignored.
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ To get the XN297L dump feature working on your module you must know:
|
|||||||
|
|
||||||
Procedure to use the XN297L dump feature:
|
Procedure to use the XN297L dump feature:
|
||||||
1. Start the Multi module in serial debug mode with the Arduion IDE Serial Monitor open<br> <img src="images/Serial_Monitor_2.png" />
|
1. Start the Multi module in serial debug mode with the Arduion IDE Serial Monitor open<br> <img src="images/Serial_Monitor_2.png" />
|
||||||
1. Select the protocol 63 or "Custom 63" to enable the XN297L Dump protocol
|
1. Select the protocol XN297DP, 63 or "Custom 63" to enable the XN297L Dump protocol
|
||||||
1. This protocol parameters are:
|
1. This protocol parameters are:
|
||||||
* sub_protocol or type or the second number after "Custom 63" is used to set the transmission speed: 0=250Kbps, 1=1Mbps and 2=2Mbps. Any other value will default to 1Mbps.
|
* sub_protocol or type or the second number after "Custom 63" is used to set the transmission speed: 0=250Kbps, 1=1Mbps, 2=2Mbps and 3=Auto.
|
||||||
|
* Auto is the recommended mode since it gives many information like channels, timing, order as well as finding bytes meaning
|
||||||
* RX_num or Receiver number sets the address length 3, 4 or 5 bytes. Any other value will default to an address length of 5 bytes.
|
* RX_num or Receiver number sets the address length 3, 4 or 5 bytes. Any other value will default to an address length of 5 bytes.
|
||||||
* option sets the RF channel number used to receive packets between 0..84 . A value of -1 will automatically scan all channels one by one. Any other value will default to the RF channel 0.
|
* option sets the RF channel number used to receive packets between 0..84 . A value of -1 will automatically scan all channels one by one. Any other value will default to the RF channel 0.
|
||||||
|
|
||||||
|
|||||||
@@ -48,16 +48,16 @@ Connection is lost at -73 and +35; the median is -19:
|
|||||||
`(-73 + 35) / 2 = -19`
|
`(-73 + 35) / 2 = -19`
|
||||||
|
|
||||||
### Finally
|
### Finally
|
||||||
Once the **Freq** value is known it should be applied to all other models which use this protocol and, if they were previously bound, the receivers must be re-bound.
|
Usually all RXs using the same protocol&sub_protocol can use the same **Freq** value but it can't harm to do all of them.
|
||||||
|
If you change the Freq value it is best to rebind the receiver(s).
|
||||||
For convenience this can be applied once for all per protocol using the FORCE commands described below in `_Config.h` (or `_MyConfig.h`) configuration file.
|
|
||||||
|
|
||||||
#### Forced tuning values
|
#### Forced tuning values
|
||||||
Once known-good tuning values have been determined, they can be stored in the configuration file to be automatically applied to all models which use the given protocol.
|
For convenience the freq value can be applied once for all per protocol using the FORCE commands described below in `_Config.h` (or `_MyConfig.h`) configuration file.
|
||||||
|
|
||||||
These settings can also be used to force different tuning values for different multiprotocol modules, removing the need to alter the tuning option on the transmitter when swapping between modules. (Assuming that the modules also share a common hardware ID.)
|
These settings can also be used to force different tuning values for different multiprotocol modules, removing the need to alter the tuning option on the transmitter when swapping between modules. (Assuming that the modules also share a common hardware ID.)
|
||||||
|
|
||||||
**Note:** If a forced tuning value is set in the configuration, it cannot be overriden by the protocol's **Freq** option on the radio for any model.
|
Once known-good tuning values have been determined, they can be stored in the configuration file to be automatically applied to all models which use the given protocol.
|
||||||
|
|
||||||
|
**Note:** If a forced tuning value is set in the configuration, the protocol's **Freq** option on the radio GUI will be ignored whatever the value is set to.
|
||||||
|
|
||||||
```
|
```
|
||||||
/*******************************/
|
/*******************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user