diff --git a/sonoff/settings.h b/sonoff/settings.h index 83a26e311..22f6d940d 100644 --- a/sonoff/settings.h +++ b/sonoff/settings.h @@ -163,6 +163,20 @@ typedef union { }; } Mcp230xxCfg; +typedef union { + uint8_t data; + struct { + uint8_t spare0 : 1; + uint8_t spare1 : 1; + uint8_t spare2 : 1; + uint8_t spare3 : 1; + uint8_t spare4 : 1; + uint8_t spare5 : 1; + uint8_t spare6 : 1; + uint8_t mhz19b_abc_disable : 1; // Disable ABC (Automatic Baseline Correction for MHZ19(B) (0 = Enabled (default), 1 = Disabled with Sensor15 command) + }; +} SensorCfg1; + /* struct SYSCFG { unsigned long cfg_holder; // 000 Pre v6 header @@ -311,8 +325,7 @@ struct SYSCFG { uint8_t knx_CB_param[MAX_KNX_CB]; // 6EC Type of Output (set relay, toggle relay, reply sensor value) Mcp230xxCfg mcp230xx_config[16]; // 6F6 uint8_t mcp230xx_int_prio; // 716 - - uint8_t free_717[1]; // 717 + SensorCfg1 SensorBits1; // 717 On/Off settings used by Sensor Commands uint16_t mcp230xx_int_timer; // 718 uint8_t rgbwwTable[5]; // 71A diff --git a/sonoff/settings.ino b/sonoff/settings.ino index 13634d541..55a73fc56 100644 --- a/sonoff/settings.ino +++ b/sonoff/settings.ino @@ -472,7 +472,7 @@ void SettingsLoad(void) if (Settings.save_flag > save_flag) { save_flag = Settings.save_flag; settings_location = flash_location; - if (Settings.flag.stop_flash_rotate) { + if (Settings.flag.stop_flash_rotate && (0 == i)) { // Stop only if eeprom area should be used and it is valid break; } } diff --git a/sonoff/sonoff_template.h b/sonoff/sonoff_template.h index e57cd54cf..6461c6ec1 100644 --- a/sonoff/sonoff_template.h +++ b/sonoff/sonoff_template.h @@ -297,6 +297,7 @@ enum SupportedModules { ZX2820, MI_DESK_LAMP, SP10, + WAGA, SYF05, MAXMODULE }; @@ -584,6 +585,7 @@ const uint8_t kModuleNiceList[MAXMODULE] PROGMEM = { DIGOO, KA10, SP10, + WAGA, NEO_COOLCAM, // Socket Relay Devices OBI, OBI2, @@ -1807,7 +1809,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { GPIO_ROT_B, // GPIO13 Rotary switch B pin 0, 0, 0, 0 }, - { "SP10", // Tuya SP10 (ESP8285 - BL0937 Energy Monitoring) + { "SP10", // Tuya SP10 (BL0937 Energy Monitoring) // https://www.aliexpress.com/item/Smart-Mini-WiFi-Plug-Outlet-Switch-Work-With-ForEcho-Alexa-Google-Home-Remote-EU-Smart-Socket/32963670423.html 0, // GPIO00 GPIO_PWM1, // GPIO01 Nightlight @@ -1823,9 +1825,29 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { // GPIO11 (SD_CMD Flash) GPIO_NRG_SEL_INV, // GPIO12 BL0937 Sel output (1 = Voltage) GPIO_LED1, // GPIO13 Blue LED - Link status - GPIO_REL1, // GPIO14 Relay 1 and red LED + GPIO_REL1, // GPIO14 Relay and red LED 0, 0, 0 }, + { "WAGA CHCZ02MB", // WAGA life CHCZ02MB (HJL-01 Energy Monitoring) + // https://www.ebay.com/itm/332595697006 + GPIO_LED2_INV, // GPIO00 Red LED + 0, // GPIO01 Serial TX + 0, // GPIO02 + GPIO_NRG_SEL_INV, // GPIO03 HJL-01 Sel output (1 = Voltage) + 0, // GPIO04 + GPIO_HJL_CF, // GPIO05 HJL-01 CF power + // GPIO06 (SD_CLK Flash) + // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) + // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) + 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285) + 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285) + // GPIO11 (SD_CMD Flash) + GPIO_REL1, // GPIO12 Relay + GPIO_KEY1, // GPIO13 Button + GPIO_NRG_CF1, // GPIO14 HJL-01 CF1 voltage / current + GPIO_LED1_INV, // GPIO15 Blue LED - Link status + 0, 0 + }, { "SYF05", // Sunyesmart SYF05 (a.k.a. Fcmila) = TYWE3S + SM16726 // Also works with Merkury 904 RGBW Bulbs with 13 set to GPIO_SM16716_SEL // https://www.flipkart.com/fc-mila-bxav-xs-ad-smart-bulb/p/itmf85zgs45fzr7n diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 1974e9128..daf45be9f 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -145,28 +145,31 @@ const char HTTP_SCRIPT_CONSOL[] PROGMEM = "return false;" "}" ""; - const char HTTP_SCRIPT_MODULE1[] PROGMEM = "var os;" "function sk(s,g){" // s = value, g = id and name - "var o=os.replace(\"value='\"+s+\"'\",\"selected value='\"+s+\"'\");" + "var o=os.replace(/}1/g,\"