DSM: 3 ch timing on CH13

This commit is contained in:
Pascal Langer 2020-06-15 14:45:42 +02:00
parent 6e1701ecc5
commit 0a5fd72bdc

View File

@ -220,6 +220,8 @@ uint16_t ReadDsm()
uint8_t len; uint8_t len;
#endif #endif
uint8_t start; uint8_t start;
uint16_t timing=5000+(convert_channel_8b(CH13)*100);
//debugln("T=%u",timing);
switch(phase) switch(phase)
{ {
@ -344,7 +346,7 @@ uint16_t ReadDsm()
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
if(num_ch==3) if(num_ch==3)
return 8250 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY - DSM_READ_DELAY; return timing - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY - DSM_READ_DELAY;
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:
@ -370,7 +372,7 @@ uint16_t ReadDsm()
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;
if(num_ch==3) if(num_ch==3)
return 8250; return timing;
return 11000; return 11000;
} }
if (phase == DSM_CH2_READ_A) if (phase == DSM_CH2_READ_A)
@ -392,14 +394,14 @@ uint16_t ReadDsm()
{ //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)
if(num_ch==3) if(num_ch==3)
return 16500 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ; return timing - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
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)
if(num_ch==3) if(num_ch==3)
return 8250 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ; return timing - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY ;
return 11000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY; return 11000 - DSM_CH1_CH2_DELAY - DSM_WRITE_DELAY;
#endif #endif
} }