Fix baudrate when module changed

Fix baudrate when module changed
This commit is contained in:
Theo Arends 2018-11-06 11:48:04 +01:00
parent 49acf4a7d3
commit 28c1eed302
1 changed files with 5 additions and 2 deletions

View File

@ -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
}