From 7b9d016890df75a61ee6808fd27d0204aa00ea3e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 Jun 2024 22:04:12 +0200 Subject: [PATCH] fix downgradeability #2 --- mos.yml | 2 +- src/ShellyPlus2PM/shelly_init.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mos.yml b/mos.yml index c267f247..97af8901 100644 --- a/mos.yml +++ b/mos.yml @@ -727,7 +727,7 @@ conds: - ["shelly.name", "ShellyPlus2PM-??????"] - ["wifi.ap.ssid", "ShellyPlus2PM-??????"] - ["i2c.enable", true] - - ["i2c.sda_gpio", 26] + - ["i2c.sda_gpio", 33] - ["i2c.scl_gpio", 25] - ["sw1", "sw", {title: "SW1 settings"}] - ["sw1.name", "Shelly SW1"] diff --git a/src/ShellyPlus2PM/shelly_init.cpp b/src/ShellyPlus2PM/shelly_init.cpp index 70b6f2dd..9922f9d1 100644 --- a/src/ShellyPlus2PM/shelly_init.cpp +++ b/src/ShellyPlus2PM/shelly_init.cpp @@ -119,11 +119,13 @@ static Status PowerMeterInit(std::vector> *pms) { LOG(LL_INFO, ("Newer revision detected")); if (mgos_sys_config_get_i2c_sda_gpio() != 26) { mgos_sys_config_set_i2c_sda_gpio(26); + mgos_sys_config_save(&mgos_sys_config, false /* try_once */, NULL /* msg */); } reset_pin = 33; } else { if (mgos_sys_config_get_i2c_sda_gpio() != 33) { mgos_sys_config_set_i2c_sda_gpio(33); + mgos_sys_config_save(&mgos_sys_config, false /* try_once */, NULL /* msg */); } reset_pin = 0; // unknown? }