Skip to content

Commit 54bd657

Browse files
CopilotMRC3742
andauthored
Align CG022 NRF24 timing to LT8910 capture
Agent-Logs-Url: https://github.com/MRC3742/DIY-Multiprotocol-TX-Module/sessions/964699d0-3e00-4819-9118-d98f292f1108 Co-authored-by: MRC3742 <26642502+MRC3742@users.noreply.github.com>
1 parent 51011e4 commit 54bd657

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Multiprotocol/CG022_nrf24l01.ino

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717

1818
#include "iface_nrf24l01.h"
1919

20-
#define CG022_PACKET_PERIOD 2315
20+
#define CG022_PACKET_PERIOD 2310
21+
#define CG022_BIND_START_DELAY 15614
2122
#define CG022_BIND_COUNT 166
2223
#define CG022_PACKET_SIZE 10
2324
#define CG022_RF_CHANNEL_COUNT 8
2425

25-
static const uint8_t PROGMEM CG022_hop[] = { 0x0A, 0x32, 0x14, 0x3C, 0x1E, 0x46, 0x00, 0x28 };
26+
#define CG022_HOP_START_INDEX 1
27+
static const uint8_t PROGMEM CG022_hop[] = { 0x00, 0x28, 0x0A, 0x32, 0x14, 0x3C, 0x1E, 0x46 };
2628
static const uint8_t CG022_addr[] = { 0x5A, 0x5A, 0x00, 0x33 };
2729
static const uint8_t CG022_bind_id[] = { 0x00, 0x11, 0x22, 0x33 };
30+
static uint8_t CG022_startup_delay_done;
2831

2932
static uint8_t CG022_scale_channel(uint8_t channel)
3033
{
@@ -95,6 +98,11 @@ uint16_t CG022_callback()
9598
#ifdef MULTI_SYNC
9699
telemetry_set_input_sync(CG022_PACKET_PERIOD);
97100
#endif
101+
if (!CG022_startup_delay_done)
102+
{
103+
CG022_startup_delay_done = 1;
104+
return CG022_BIND_START_DELAY;
105+
}
98106
if (bind_counter)
99107
{
100108
bind_counter--;
@@ -109,7 +117,8 @@ void CG022_init(void)
109117
{
110118
BIND_IN_PROGRESS; // autobind protocol
111119
bind_counter = CG022_BIND_COUNT;
112-
hopping_frequency_no = 0;
120+
hopping_frequency_no = CG022_HOP_START_INDEX;
121+
CG022_startup_delay_done = 0;
113122
CG022_RF_init();
114123
packet_period = CG022_PACKET_PERIOD;
115124
}

0 commit comments

Comments
 (0)