Skip to content

Commit e2876c7

Browse files
committed
Update SGF22_nrf24l01.ino
1 parent 7acfebc commit e2876c7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Multiprotocol/SGF22_nrf24l01.ino

+5-3
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ Multiprotocol is distributed in the hope that it will be useful,
3737
#define SGF22_FLAG_VERTICAL 0xC0
3838

3939
#define SGF22_J20_FLAG_HORIZONTAL 0x80
40+
//#define SGF22_J20_FLAG_SPEED 0x01 // Up/Down trim, not implemented
4041

4142
//packet[9]
42-
#define SGF22_FLAG_PHOTO 0x40 // #define SGF22_J20_FLAG_INVERT 0x40
43+
#define SGF22_FLAG_PHOTO 0x40 // #define SGF22_J20_FLAG_INVERT 0x40
4344
#define SGF22_FLAG_TRIMRESET 0x04
45+
#define SGF22_J20_FLAG_FIXHEIGHT 0x80
4446

4547
static void __attribute__((unused)) SGF22_send_packet()
4648
{
@@ -73,7 +75,7 @@ static void __attribute__((unused)) SGF22_send_packet()
7375
else if(Channel_data[CH5] > CHANNEL_MIN_COMMAND )
7476
packet[8] |= ( sub_protocol == SGF22_J20 ? SGF22_J20_FLAG_HORIZONTAL : SGF22_FLAG_6G ); // CH5 0%, F22 & F22S - 6G mode, J20 - Horizontal mode
7577
packet[9] = GET_FLAG(CH8_SW, SGF22_FLAG_PHOTO) // F22: photo, press in throttle trim in the stock TX, J20: invert flight
76-
| GET_FLAG(CH10_SW, SGF22_FLAG_TRIMRESET); // Both sticks down inwards in the stock TX
78+
| GET_FLAG(CH10_SW, ( sub_protocol == SGF22_J20 ? SGF22_J20_FLAG_FIXHEIGHT : SGF22_FLAG_TRIMRESET )) ; // F22: Both sticks down inwards in the stock TX, J20: Altitude hold
7779
packet[10] = 0x42; // no fine tune
7880
packet[11] = 0x10; // no fine tune
7981
}
@@ -140,7 +142,7 @@ static void __attribute__((unused)) SGF22_RF_init()
140142
{
141143
XN297_Configure(XN297_CRCEN, XN297_SCRAMBLED, XN297_1M);
142144
XN297_SetTXAddr((uint8_t*)"\xC7\x95\x3C\xBB\xA5", 5);
143-
const uint8_t bind_chan[SGF22_J20 + 1] = {SGF22_BIND_RF_CHANNEL, SGF22_F22S_BIND_RF_CHANNEL, SGF22_J20_BIND_RF_CHANNEL};
145+
const uint8_t bind_chan[] = {SGF22_BIND_RF_CHANNEL, SGF22_F22S_BIND_RF_CHANNEL, SGF22_J20_BIND_RF_CHANNEL};
144146
XN297_RFChannel(bind_chan[sub_protocol]); // Set bind channel
145147
}
146148

0 commit comments

Comments
 (0)