Skip to content

Commit

Permalink
LOLI: adjust timing
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Langer committed Jan 18, 2021
1 parent 52e8d87 commit 2bcebbd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
10 changes: 7 additions & 3 deletions Multiprotocol/LOLI_nrf24l01.ino
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static void __attribute__((unused)) LOLI_send_packet()
if(Channel_data[CH2+8] > CHANNEL_MAX_COMMAND)
P1|=LOLI_FLAG_PWM2;
//ch5: SBUS
if(Channel_data[CH7+8] > CHANNEL_SWITCH)
if(Channel_data[CH5+8] > CHANNEL_SWITCH)
P1|=LOLI_FLAG_SBUS;
//ch7: PWM
if(Channel_data[CH7+8] > CHANNEL_MAX_COMMAND)
Expand Down Expand Up @@ -167,6 +167,8 @@ enum{
LOLI_SET_FAILSAFE
};

#define LOLI_WRITE_TIME 1000

uint16_t LOLI_callback()
{
switch (phase)
Expand Down Expand Up @@ -270,15 +272,17 @@ uint16_t LOLI_callback()

#ifdef LOLI_HUB_TELEMETRY
phase ++;
return 2000;
return LOLI_WRITE_TIME;
case LOLI_DATA2:
// Wait for packet to be sent
while( (NRF24L01_ReadReg(NRF24L01_07_STATUS) & _BV(NRF24L01_07_TX_DS)) == 0);
// Switch to RX mode
NRF24L01_SetTxRxMode(TXRX_OFF);
NRF24L01_FlushRx();
NRF24L01_SetTxRxMode(RX_EN);
NRF24L01_WriteReg(NRF24L01_00_CONFIG, 0x3b); // 8bit CRC, RX
phase = LOLI_DATA1;
return 18000;
return 20000 - LOLI_WRITE_TIME;
#else
break;
#endif
Expand Down
2 changes: 1 addition & 1 deletion Multiprotocol/Multiprotocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_REVISION 2
#define VERSION_PATCH_LEVEL 5
#define VERSION_PATCH_LEVEL 6

//******************
// Protocols
Expand Down
14 changes: 7 additions & 7 deletions Multiprotocol/TX_Def.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@
#endif

//Channel MIN MAX values
#define CHANNEL_MAX_100 1844 // 100%
#define CHANNEL_MIN_100 204 // 100%
#define CHANNEL_MAX_125 2047 // 125%
#define CHANNEL_MIN_125 0 // 125%
#define CHANNEL_MAX_100 1844 // +100%
#define CHANNEL_MIN_100 204 // -100%
#define CHANNEL_MAX_125 2047 // +125%
#define CHANNEL_MIN_125 0 // -125%

#define CHANNEL_MID 1024

#define CHANNEL_MIN_COMMAND 784 // 1350us
#define CHANNEL_SWITCH 1104 // 1550us
#define CHANNEL_MAX_COMMAND 1424 // 1750us
#define CHANNEL_MIN_COMMAND 409 // -75%
#define CHANNEL_SWITCH 1106 // +10%
#define CHANNEL_MAX_COMMAND 1639 // +75%

//Channel definitions
#define CH1 0
Expand Down

0 comments on commit 2bcebbd

Please sign in to comment.