Core: stop transmitting if serial or ppm signal disappears

This commit is contained in:
pascallanger 2016-12-04 18:58:29 +01:00
parent 54dd562d88
commit 8f0ecac842
3 changed files with 8 additions and 5 deletions

View File

@ -11,7 +11,7 @@
#include <avr/interrupt.h> #include <avr/interrupt.h>
static void protocol_init(void) ; static void protocol_init(void) ;
static void update_aux_flags(void) ; static void update_channels_aux(void) ;
static uint32_t random_id(uint16_t adress, uint8_t create_new) ; static uint32_t random_id(uint16_t adress, uint8_t create_new) ;
static void update_serial_data(void) ; static void update_serial_data(void) ;
static void Mprotocol_serial_init(void) ; static void Mprotocol_serial_init(void) ;

View File

@ -411,7 +411,10 @@ void loop()
{ {
TX_MAIN_PAUSE_on; TX_MAIN_PAUSE_on;
tx_pause(); tx_pause();
next_callback=remote_callback(); if(IS_INPUT_SIGNAL_on)
next_callback=remote_callback();
else
next_callback=2000; // No PPM/serial signal check again in 2ms...
TX_MAIN_PAUSE_off; TX_MAIN_PAUSE_off;
tx_resume(); tx_resume();
while(next_callback>4000) while(next_callback>4000)
@ -520,8 +523,8 @@ static void update_channels_aux(void)
static void update_led_status(void) static void update_led_status(void)
{ {
if(IS_INPUT_SIGNAL_on) if(IS_INPUT_SIGNAL_on)
if(millis()-last_signal>50) if(millis()-last_signal>70)
INPUT_SIGNAL_off; //no valid signal (PPM or Serial) received for 50ms INPUT_SIGNAL_off; //no valid signal (PPM or Serial) received for 70ms
if(blink<millis()) if(blink<millis())
{ {
if(IS_INPUT_SIGNAL_off) if(IS_INPUT_SIGNAL_off)

View File

@ -42,7 +42,7 @@ uint8_t frame[18];
#ifdef BASH_SERIAL #ifdef BASH_SERIAL
// For bit-bashed serial output // For bit-bashed serial output
struct t_serial_bash volatile struct t_serial_bash
{ {
uint8_t head ; uint8_t head ;
uint8_t tail ; uint8_t tail ;