Skip to content

Commit

Permalink
* little cleanup
Browse files Browse the repository at this point in the history
* fixed wrong return value conversion
  • Loading branch information
wimalopaan committed Apr 26, 2022
1 parent ba6fc3d commit 9eeb1ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion radio/src/lua/api_general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static Fifo<uint8_t, LUA_FIFO_SIZE>* luaRxFifo = nullptr;

static bool luaRxFifoGetByte(void*, uint8_t* data)
{
if (!luaRxFifo) return -1;
if (!luaRxFifo) return false;
return luaRxFifo->pop(*data);
}

Expand Down
4 changes: 2 additions & 2 deletions radio/src/sbus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
static bool (*_sbusAuxGetByte)(void*, uint8_t*) = nullptr;
static void* _sbusAuxGetByteCtx = nullptr;

void sbusSetAuxGetByte(void* ctx, bool (*fct)(void*, uint8_t*))
void sbusSetAuxGetByte(void* const ctx, bool (* const fct)(void*, uint8_t*))
{
_sbusAuxGetByteCtx = ctx;
_sbusAuxGetByte = fct;
}

bool sbusAuxGetByte(uint8_t* byte)
bool sbusAuxGetByte(uint8_t* const byte)
{
auto _getByte = _sbusAuxGetByte;
auto _ctx = _sbusAuxGetByteCtx;
Expand Down
8 changes: 0 additions & 8 deletions radio/src/serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ static void serialSetupPort(int mode, etx_serial_init& params)
params.parity = ETX_Parity_None;
params.stop_bits = ETX_StopBits_One;
params.rx_enable = true;
power_required = true;
break;

case UART_MODE_CRSF_TRAINER:
Expand All @@ -257,7 +256,6 @@ static void serialSetupPort(int mode, etx_serial_init& params)
params.parity = ETX_Parity_None;
params.stop_bits = ETX_StopBits_One;
params.rx_enable = true;
power_required = true;
break;

case UART_MODE_SUMD_TRAINER:
Expand All @@ -266,7 +264,6 @@ static void serialSetupPort(int mode, etx_serial_init& params)
params.parity = ETX_Parity_None;
params.stop_bits = ETX_StopBits_One;
params.rx_enable = true;
power_required = true;
break;

#if defined(LUA)
Expand Down Expand Up @@ -365,11 +362,6 @@ void serialInit(uint8_t port_nr, int mode)
if (port->uart && port->uart->init)
state->usart_ctx = port->uart->init(&params);

// Set power on/off
if (port->set_pwr) {
port->set_pwr(power_required);
}

#if !defined(BLUETOOTH) && defined(PCBHORUS) && defined(BT_EN_GPIO_PIN) && !defined(SIMU) && !defined(GTESTS)
if (port_nr == SP_AUX2) {
TRACE_DEBUG("disbale bt EN (set EN pin high)\n\r");
Expand Down

0 comments on commit 9eeb1ee

Please sign in to comment.