From a95dab355bcf09fdb42b0cf086f33aade928b2b6 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 27 Sep 2017 22:38:02 +0200 Subject: [PATCH] minor changes --- crossbow.ino | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crossbow.ino b/crossbow.ino index 416e44f..f22b4cc 100644 --- a/crossbow.ino +++ b/crossbow.ino @@ -9,7 +9,7 @@ #include #define PPM_INPUT_PIN 2 -#define PPM_INPUT_INTERRUPT 0 +#define PPM_INPUT_INTERRUPT 1 //For Pro Micro 1, For Pro Mini 0 PPMReader ppmReader(PPM_INPUT_PIN, PPM_INPUT_INTERRUPT); @@ -173,6 +173,12 @@ uint8_t get10bitLowShift(uint8_t channel) { return 8 - get10bitHighShift(channel); } +void clearQspPayload() { + for (uint8_t i = 0; i < QSP_PAYLOAD_LENGTH; i++) { + qspPayload[i] = 0; + } +} + #endif void loop(void) { @@ -187,9 +193,7 @@ void loop(void) { uint8_t payloadBit = 0; uint8_t bitsToMove = 0; - for (uint8_t i = 0; i < QSP_PAYLOAD_LENGTH; i++) { - qspPayload[i] = 0; - } + clearQspPayload(); for (uint8_t i = 0; i < PPM_CHANNEL_COUNT; i++) { uint16_t channelValue10 = map(ppmReader.get(i), 1000, 2000, 0, 1000) & 0x03ff;