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(
this, grid.getFieldSlot(1, 0),
[=] { return serialGetPower(port_nr); },
[=](int32_t newValue) {
serialSetPower(port_nr, newValue);
[=](int8_t newValue) {
serialSetPower(port_nr, (bool)newValue);
SET_DIRTY();
}
);
+7 -7
View File
@@ -321,7 +321,13 @@ void serialInit(uint8_t port_nr, int mode)
};
serialSetupPort(mode, params);
#if defined(SWSERIALPOWER)
// Set power on/off
if (port_nr < SP_VCP)
serialSetPowerState(port_nr);
#endif
if (params.baudrate != 0) {
state->mode = mode;
state->port = port;
@@ -329,12 +335,6 @@ void serialInit(uint8_t port_nr, int mode)
if (port) {
if (port->uart && port->uart->init)
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