mirror of https://github.com/arendst/Tasmota.git
Fix exception caused by wrong baudrate selection
Fix exception caused by wrong baudrate selection
This commit is contained in:
parent
6c69b8d12d
commit
ffc1505872
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue