Revert "Fix exception caused by wrong baudrate selection"

This reverts commit ffc1505872.
This commit is contained in:
Theo Arends 2019-03-12 10:22:40 +01:00
parent ffc1505872
commit 2aaca4bc2b
2 changed files with 2 additions and 2 deletions

View File

@ -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 > 1200) {
if (payload32 > 0) {
payload32 /= 1200; // Make it a valid baudrate
baudrate = (1 == payload) ? APP_BAUDRATE : payload32 * 1200;
SetSerialBaudrate(baudrate);

View File

@ -150,7 +150,7 @@ bool SerialBridgeCommand(void)
else if (CMND_SBAUDRATE == command_code) {
char *p;
int baud = strtol(XdrvMailbox.data, &p, 10);
if (baud >= 1200) {
if (baud > 0) {
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