mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 19:48:11 +00:00
bc42dbf88a
Lot of changes in this new master ChangeLog: - Core: LED flashing when an invalid protocol has been selected - Core: Channels 5 to 12 available as switches for all protocols: code and size optimization - Documentation (readme.md): fully updated, all protocols/sub protocols/channels described, models example, many improvements - All protocols have been updated in some way, here are some highlights: * Bayang: added picture, video and inverted channels * CG023->H8_3D: added light and calibration channels * CX10: added sub protocols Q282, JC3015_1, JC3015_2, MK33041 * ESky: added new protocol - untested * Hubsan: added compatibility with the new Hubsan Plus protocol * KN: fully rewritten protocol: added sub protocols WLTOYS and FEILUN, 11 channels support New version successfully tested on all my models: Flysky RX/F939/V911 protocol Flysky, Frsky RX protocol Frsky, Hubsan X4 protocol Hubsan, Hisky HCP100/HCP80 protocol Hisky, HK-3000/HK3100 RX protocol Hisky/HK310, XINXUN X39 protocol YD717/XINXUN, Symax X5C-1 protocol SymaX/SYMAX, Cheerson CX-10A protocol CX10/BLUE, Eachine 3D-X4 protocol CG023. To access new protocols from er9x/ersky9x, you need to build a version from this github repository https://github.com/pascallanger/mbtx based on the latest er9x r820 and ersky9x r218.
64 lines
1.5 KiB
C
64 lines
1.5 KiB
C
/*
|
|
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/>.
|
|
*/
|
|
|
|
|
|
static void frskySendStuffed(uint8_t frame[])
|
|
{
|
|
Serial_write(0x7E);
|
|
for (uint8_t i = 0; i < 9; i++) {
|
|
if ((frame[i] == 0x7e) || (frame[i] == 0x7d)) {
|
|
Serial_write(0x7D);
|
|
frame[i] ^= 0x20;
|
|
}
|
|
Serial_write(frame[i]);
|
|
}
|
|
Serial_write(0x7E);
|
|
}
|
|
|
|
static void frskySendFrame()
|
|
{
|
|
uint8_t frame[9];
|
|
|
|
frame[0] = 0xfe;
|
|
if ((cur_protocol[0]&0x1F)==MODE_FRSKY)
|
|
{
|
|
compute_RSSIdbm();
|
|
frame[1] = pktt[3];
|
|
frame[2] = pktt[4];
|
|
frame[3] = (uint8_t)RSSI_dBm;
|
|
frame[4] = pktt[5]*2;//txrssi
|
|
frame[5] = frame[6] = frame[7] = frame[8] = 0;
|
|
}
|
|
else
|
|
if ((cur_protocol[0]&0x1F)==MODE_HUBSAN)
|
|
{
|
|
frame[1] = v_lipo*2;
|
|
frame[2] = 0;
|
|
frame[3] = 0x5A;//dummy value
|
|
frame[4] = 2 * 0x5A;//dummy value
|
|
frame[5] = frame[6] = frame[7] = frame[8] = 0;
|
|
}
|
|
frskySendStuffed(frame);
|
|
}
|
|
|
|
void frskyUpdate()
|
|
{
|
|
if(telemetry_link)
|
|
{
|
|
frskySendFrame();
|
|
telemetry_link=0;
|
|
}
|
|
}
|