diff --git a/radio/src/gui/128x64/model_flightmodes.cpp b/radio/src/gui/128x64/model_flightmodes.cpp index b619121b6..cfe15842b 100644 --- a/radio/src/gui/128x64/model_flightmodes.cpp +++ b/radio/src/gui/128x64/model_flightmodes.cpp @@ -87,7 +87,8 @@ void menuModelFlightModeOne(event_t event) int8_t editMode = s_editMode; #if defined(GVARS) - if (s_currIdx == 0 && sub>=ITEM_MODEL_FLIGHT_MODE_SWITCH) sub += VERTICAL_SHIFT; + if (s_currIdx == 0 && sub>=ITEM_MODEL_FLIGHT_MODE_SWITCH) + sub += VERTICAL_SHIFT; for (uint8_t k=0; kpop(*p)) { p++; // increment only when pop was successful if (p - str >= LUA_FIFO_SIZE) { - break; // Buffer full + // buffer full + break; } - if (num == 0 && (*(p - 1) == '\n' || *(p - 1) == '\r')) { - break; // Found newline + if (num == 0) { + if (*(p - 1) == '\n' || *(p - 1) == '\r') { + // found newline + break; + } } - if (num > 0 && p - str >= num) { - break; // Requested number of characters reached + else if (p - str >= num) { + // requested number of characters reached + break; } } lua_pushlstring(L, (const char*)str, p - str); diff --git a/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp b/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp index 4ebef6790..bc0e54504 100644 --- a/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp +++ b/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp @@ -194,16 +194,16 @@ extern "C" void AUX_SERIAL_USART_IRQHandler(void) #endif #if defined(LUA) && !defined(CLI) if (luaRxFifo && auxSerialMode == UART_MODE_LUA) { - // Receive - uint32_t status = AUX_SERIAL_USART->SR; - while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) { - uint8_t data = AUX_SERIAL_USART->DR; - if (!(status & USART_FLAG_ERRORS)) { - luaRxFifo->push(data); - } - status = AUX_SERIAL_USART->SR; + // Receive + uint32_t status = AUX_SERIAL_USART->SR; + while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) { + uint8_t data = AUX_SERIAL_USART->DR; + if (!(status & USART_FLAG_ERRORS)) { + luaRxFifo->push(data); } + status = AUX_SERIAL_USART->SR; } + } #endif } #endif