Skip to content

Commit

Permalink
Merge pull request #94 from blckmn/sbus_fix_config
Browse files Browse the repository at this point in the history
Removed dependency on config from sbus.c now passed in as configuration param.
  • Loading branch information
rs2k committed Feb 17, 2016
2 parents c576abe + f59c086 commit c86eb1f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ void init(void)

failsafeInit(&masterConfig.rxConfig, masterConfig.flight3DConfig.deadband3d_throttle);

masterConfig.rxConfig.rxSerialInverted = feature(FEATURE_SBUS_INVERTER);
rxInit(&masterConfig.rxConfig, currentProfile->modeActivationConditions);

#ifdef GPS
Expand Down
1 change: 1 addition & 0 deletions src/main/rx/rx.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ typedef struct rxConfig_s {
rxFailsafeChannelConfiguration_t failsafe_channel_configurations[MAX_SUPPORTED_RC_CHANNEL_COUNT];

rxChannelRangeConfiguration_t channelRanges[NON_AUX_CHANNEL_COUNT];
bool rxSerialInverted;
} rxConfig_t;

#define REMAPPABLE_CHANNEL_COUNT (sizeof(((rxConfig_t *)0)->rcmap) / sizeof(((rxConfig_t *)0)->rcmap[0]))
Expand Down
7 changes: 2 additions & 5 deletions src/main/rx/sbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,13 @@

#include "drivers/system.h"

#include "drivers/gpio.h"
#include "drivers/inverter.h"

#include "drivers/serial.h"
#include "drivers/serial_uart.h"
#include "io/serial.h"

#include "rx/rx.h"
#include "rx/sbus.h"

#include "config/config.h"
/*
* Observations
*
Expand Down Expand Up @@ -99,7 +95,8 @@ bool sbusInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, rcReadRa
}

portOptions_t options = SBUS_PORT_OPTIONS;
if (!feature(FEATURE_SBUS_INVERTER)) options = options & ~SERIAL_INVERTED;
if (!rxConfig->rxSerialInverted)
options = options & ~SERIAL_INVERTED;
serialPort_t *sBusPort = openSerialPort(portConfig->identifier, FUNCTION_RX_SERIAL, sbusDataReceive, SBUS_BAUDRATE, MODE_RX, options);

return sBusPort != NULL;
Expand Down

0 comments on commit c86eb1f

Please sign in to comment.