From 1961579fe45f78ff4a01b7aeafd199c7d6f77b3c Mon Sep 17 00:00:00 2001 From: Andrew Shkolik Date: Mon, 30 Dec 2019 15:44:16 -0600 Subject: [PATCH] code cleanup --- Multiprotocol/Multiprotocol.ino | 40 ++++++++++++++++++++++++-------- Multiprotocol/Validate.h | 15 ++++++++++++ Multiprotocol/_Config.h | 41 +++++++++++++-------------------- 3 files changed, 62 insertions(+), 34 deletions(-) diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 43a15bb..de9ceb5 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -331,6 +331,21 @@ void setup() pinMode(S2_pin,INPUT_PULLUP); pinMode(S3_pin,INPUT_PULLUP); pinMode(S4_pin,INPUT_PULLUP); + + #if defined ENABLE_DIRECT_INPUTS + #if defined (DI1_PIN) + pinMode(DI1_PIN,INPUT_PULLUP); + #endif + #if defined (DI2_PIN) + pinMode(DI2_PIN,INPUT_PULLUP); + #endif + #if defined (DI3_PIN) + pinMode(DI3_PIN,INPUT_PULLUP); + #endif + #if defined (DI4_PIN) + pinMode(DI4_PIN,INPUT_PULLUP); + #endif + #endif //Random pins pinMode(PB0, INPUT_ANALOG); // set up pin for analog input @@ -666,23 +681,29 @@ bool Update_All() if(mode_select!=MODE_SERIAL && IS_PPM_FLAG_on) // PPM mode and a full frame has been received { uint32_t chan_or=chan_order; - uint8_t ch; - uint8_t channels_count = PPM_chan_max; - #ifdef ENABLE_DIRECT_INPUTS + uint8_t ch; + uint8_t channelsCount = PPM_chan_max; + + #ifdef ENABLE_DIRECT_INPUTS #ifdef DI_CH1_read - PPM_data[channels_count++] = DI_CH1_read + PPM_data[channelsCount] = DI_CH1_read; + channelsCount++; #endif #ifdef DI_CH2_read - PPM_data[channels_count++] = DI_CH2_read + PPM_data[channelsCount] = DI_CH2_read; + channelsCount++; #endif #ifdef DI_CH3_read - PPM_data[channels_count++] = DI_CH3_read + PPM_data[channelsCount] = DI_CH3_read; + channelsCount++; #endif #ifdef DI_CH4_read - PPM_data[channels_count++] = DI_CH4_read - #endif + PPM_data[channelsCount] = DI_CH4_read; + channelsCount++; + #endif #endif - for(uint8_t i=0;i