From 28c1eed302544054f36585d56685dd4cd9a3c1f2 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 6 Nov 2018 11:48:04 +0100 Subject: [PATCH] Fix baudrate when module changed Fix baudrate when module changed --- sonoff/sonoff.ino | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 09e029a15..3ef470de4 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -2394,10 +2394,13 @@ void GpioInit() uint8_t key_no_pullup = 0; mytmplt def_module; - if (!Settings.module || (Settings.module >= MAXMODULE)) { + if (Settings.module >= MAXMODULE) { Settings.module = MODULE; Settings.last_module = MODULE; } + if (Settings.module != Settings.last_module) { + baudrate = APP_BAUDRATE; + } memcpy_P(&def_module, &kModules[Settings.module], sizeof(def_module)); strlcpy(my_module.name, def_module.name, sizeof(my_module.name)); @@ -2646,7 +2649,7 @@ void setup() } if (RtcReboot.fast_reboot_count > 4) { // Restarted 5 times Settings.module = SONOFF_BASIC; // Reset module to Sonoff Basic - Settings.last_module = SONOFF_BASIC; +// Settings.last_module = SONOFF_BASIC; for (byte i = 0; i < MAX_GPIO_PIN; i++) { Settings.my_gp.io[i] = GPIO_NONE; // Reset user defined GPIO disabling sensors }