fix(lua): Re-implement luaSetSerialBaudrate (#4501)
This commit is contained in:
@@ -202,7 +202,7 @@ bool isSourceAvailable(int source)
|
||||
if (source >= MIXSRC_FIRST_SPACEMOUSE && source <= MIXSRC_LAST_SPACEMOUSE)
|
||||
return false;
|
||||
#elif defined(PCBHORUS) && defined(SPACEMOUSE)
|
||||
if ((hasSerialMode(UART_MODE_SPACEMOUSE) == -1) &&
|
||||
if ((serialGetModePort(UART_MODE_SPACEMOUSE) < 0) &&
|
||||
(source >= MIXSRC_FIRST_SPACEMOUSE && source <= MIXSRC_LAST_SPACEMOUSE))
|
||||
return false;
|
||||
#endif
|
||||
@@ -424,14 +424,6 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
return true;
|
||||
}
|
||||
|
||||
int hasSerialMode(int mode)
|
||||
{
|
||||
for (int p = 0; p < MAX_SERIAL_PORTS; p++) {
|
||||
if (serialGetMode(p) == mode) return p;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool isSerialModeAvailable(uint8_t port_nr, int mode)
|
||||
{
|
||||
#if defined(USB_SERIAL)
|
||||
@@ -492,7 +484,7 @@ bool isSerialModeAvailable(uint8_t port_nr, int mode)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
auto p = hasSerialMode(mode);
|
||||
auto p = serialGetModePort(mode);
|
||||
if (p >= 0 && p != port_nr) return false;
|
||||
return true;
|
||||
}
|
||||
@@ -1014,7 +1006,7 @@ bool isTrainerModeAvailable(int mode)
|
||||
|
||||
if (mode == TRAINER_MODE_MASTER_SERIAL) {
|
||||
#if defined(SBUS_TRAINER)
|
||||
return hasSerialMode(UART_MODE_SBUS_TRAINER) >= 0;
|
||||
return serialGetModePort(UART_MODE_SBUS_TRAINER) >= 0;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
@@ -1227,4 +1219,4 @@ uint8_t getPotType(int index)
|
||||
void setPotType(int index, int value)
|
||||
{
|
||||
g_eeGeneral.potsConfig = bfSet<potconfig_t>(g_eeGeneral.potsConfig, value, (POT_CFG_BITS * index), POT_CFG_TYPE_BITS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user