Skip to content

Commit

Permalink
Fixed two bugs in SBUS code caused by previous incomplete merge of code
Browse files Browse the repository at this point in the history
Signed-off-by: Eberhard Rensch <eberhard@pleasantsoftware.com>
  • Loading branch information
zaggo committed Nov 5, 2011
1 parent 9f8117b commit 36b0e34
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MultiWii/RX.pde
@@ -1,4 +1,4 @@
volatile uint16_t rcValue[8] = {1502,1502,1502,1502,1502,1502,1502,1502}; // interval [1000;2000]
volatile uint16_t rcValue[18] = {1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502, 1502}; // interval [1000;2000]

#if defined(SERIAL_SUM_PPM)
static uint8_t rcChannel[8] = {SERIAL_SUM_PPM};
Expand Down Expand Up @@ -237,6 +237,9 @@ void readSBus(){

uint16_t readRawRC(uint8_t chan) {
uint16_t data;
#if defined(SBUS)
data = rcValue[rcChannel[chan]]; // Let's copy the data Atomically
#else
uint8_t oldSREG;
oldSREG = SREG; cli(); // Let's disable interrupts
data = rcValue[rcChannel[chan]]; // Let's copy the data Atomically
Expand Down Expand Up @@ -264,6 +267,7 @@ uint16_t readRawRC(uint8_t chan) {
#endif
}
#endif
#endif
return data; // We return the value correctly copied when the IRQ's where disabled
}

Expand All @@ -285,4 +289,4 @@ void computeRC() {
if ( rcDataMean[chan] > rcData[chan] +3) rcData[chan] = rcDataMean[chan]-2;
}
}


0 comments on commit 36b0e34

Please sign in to comment.