diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index f7a78c179..82c306c90 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -1068,7 +1068,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len) snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, Settings.switch_debounce); } else if (CMND_BAUDRATE == command_code) { - if (payload32 > 0) { + if (payload32 > 1200) { payload32 /= 1200; // Make it a valid baudrate baudrate = (1 == payload) ? APP_BAUDRATE : payload32 * 1200; SetSerialBaudrate(baudrate); diff --git a/sonoff/xdrv_08_serial_bridge.ino b/sonoff/xdrv_08_serial_bridge.ino index 0db7da58c..d39e7a6eb 100644 --- a/sonoff/xdrv_08_serial_bridge.ino +++ b/sonoff/xdrv_08_serial_bridge.ino @@ -150,7 +150,7 @@ bool SerialBridgeCommand(void) else if (CMND_SBAUDRATE == command_code) { char *p; int baud = strtol(XdrvMailbox.data, &p, 10); - if (baud > 0) { + if (baud >= 1200) { baud /= 1200; // Make it a valid baudrate Settings.sbaudrate = (1 == XdrvMailbox.payload) ? SOFT_BAUDRATE / 1200 : baud; SerialBridgeSerial->begin(Settings.sbaudrate * 1200); // Reinitialize serial port with new baud rate