Cosmetics

This commit is contained in:
Bertrand Songis
2020-05-15 15:17:41 +02:00
parent 682f0f1b05
commit f7fc15d7b5
3 changed files with 21 additions and 15 deletions
+2 -1
View File
@@ -87,7 +87,8 @@ void menuModelFlightModeOne(event_t event)
int8_t editMode = s_editMode; int8_t editMode = s_editMode;
#if defined(GVARS) #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; k<LCD_LINES-1; k++) { for (uint8_t k=0; k<LCD_LINES-1; k++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH; coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
+11 -6
View File
@@ -1630,7 +1630,7 @@ static int luaSerialWrite(lua_State * L)
Reads characters from the serial port. The string is allowed to contain any character, including 0. Reads characters from the serial port. The string is allowed to contain any character, including 0.
@status current Introduced in TODO @status current Introduced in 2.3.8
*/ */
static int luaSerialRead(lua_State * L) static int luaSerialRead(lua_State * L)
{ {
@@ -1649,13 +1649,18 @@ static int luaSerialRead(lua_State * L)
while (luaRxFifo->pop(*p)) { while (luaRxFifo->pop(*p)) {
p++; // increment only when pop was successful p++; // increment only when pop was successful
if (p - str >= LUA_FIFO_SIZE) { if (p - str >= LUA_FIFO_SIZE) {
break; // Buffer full // buffer full
break;
} }
if (num == 0 && (*(p - 1) == '\n' || *(p - 1) == '\r')) { if (num == 0) {
break; // Found newline if (*(p - 1) == '\n' || *(p - 1) == '\r') {
// found newline
break;
}
} }
if (num > 0 && p - str >= num) { else if (p - str >= num) {
break; // Requested number of characters reached // requested number of characters reached
break;
} }
} }
lua_pushlstring(L, (const char*)str, p - str); lua_pushlstring(L, (const char*)str, p - str);
@@ -194,16 +194,16 @@ extern "C" void AUX_SERIAL_USART_IRQHandler(void)
#endif #endif
#if defined(LUA) && !defined(CLI) #if defined(LUA) && !defined(CLI)
if (luaRxFifo && auxSerialMode == UART_MODE_LUA) { if (luaRxFifo && auxSerialMode == UART_MODE_LUA) {
// Receive // Receive
uint32_t status = AUX_SERIAL_USART->SR; uint32_t status = AUX_SERIAL_USART->SR;
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) { while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
uint8_t data = AUX_SERIAL_USART->DR; uint8_t data = AUX_SERIAL_USART->DR;
if (!(status & USART_FLAG_ERRORS)) { if (!(status & USART_FLAG_ERRORS)) {
luaRxFifo->push(data); luaRxFifo->push(data);
}
status = AUX_SERIAL_USART->SR;
} }
status = AUX_SERIAL_USART->SR;
} }
}
#endif #endif
} }
#endif #endif