Bugfix: serial power state executed on power-up irrespective of the serial mode selected.

This commit is contained in:
rotorman
2022-04-23 17:01:59 +02:00
parent bd80f7d454
commit fa5b718579
2 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -243,8 +243,8 @@ class SerialConfigWindow : public FormGroup
new CheckBox( new CheckBox(
this, grid.getFieldSlot(1, 0), this, grid.getFieldSlot(1, 0),
[=] { return serialGetPower(port_nr); }, [=] { return serialGetPower(port_nr); },
[=](int32_t newValue) { [=](int8_t newValue) {
serialSetPower(port_nr, newValue); serialSetPower(port_nr, (bool)newValue);
SET_DIRTY(); SET_DIRTY();
} }
); );
+7 -7
View File
@@ -321,7 +321,13 @@ void serialInit(uint8_t port_nr, int mode)
}; };
serialSetupPort(mode, params); serialSetupPort(mode, params);
#if defined(SWSERIALPOWER)
// Set power on/off
if (port_nr < SP_VCP)
serialSetPowerState(port_nr);
#endif
if (params.baudrate != 0) { if (params.baudrate != 0) {
state->mode = mode; state->mode = mode;
state->port = port; state->port = port;
@@ -329,12 +335,6 @@ void serialInit(uint8_t port_nr, int mode)
if (port) { if (port) {
if (port->uart && port->uart->init) if (port->uart && port->uart->init)
state->usart_ctx = port->uart->init(&params); state->usart_ctx = port->uart->init(&params);
#if defined(SWSERIALPOWER)
// Set power on/off
if (port_nr < SP_VCP)
serialSetPowerState(port_nr);
#endif
} }
// Update callbacks once the port is setup // Update callbacks once the port is setup