From 08db16d1ca5475a732ea1feadd4c313323a56b9e Mon Sep 17 00:00:00 2001 From: Markus Kirberg Date: Mon, 26 Aug 2024 07:06:13 +0200 Subject: [PATCH] new pinning --- Makefile | 4 ++-- fs_src/script.js | 5 +++-- mos.yml | 6 +++--- src/ShellyRGBW2/shelly_init.cpp | 22 +++++++++++++++++++--- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 36722648..9ea6dd4d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ MAKEFLAGS += --warn-undefined-variables --no-builtin-rules .PHONY: build check-format format release upload \ - Shelly1 Shelly1L Shelly1PM Shelly25 Shelly2 ShellyColorBulb ShellyDuo ShellyI3 ShellyPlug ShellyPlugS ShellyPlusPlugS ShellyPlus1 ShellyPlus1PM ShellyPlus2PM ShellyPlusI4 ShellyRGBW2 ShellyVintage ShellyU ShellyU25 ShellyUDuo ShellyURGBW2 ShellyUNI + Shelly1 Shelly1L Shelly1PM Shelly25 Shelly2 ShellyColorBulb ShellyDuo ShellyI3 ShellyPlug ShellyPlugS ShellyPlusPlugS ShellyPlus1 ShellyPlus1PM ShellyPlus2PM ShellyPlusI4 ShellyRGBW2 ShellyVintage ShellyU ShellyU25 ShellyUDuo ShellyURGBW2 ShellyUNI ShellyPlusRGBWPM .SUFFIXES: MOS ?= mos @@ -27,7 +27,7 @@ ifneq "$(VERBOSE)$(V)" "00" MOS_BUILD_FLAGS_FINAL += --verbose endif -build: Shelly1 Shelly1L Shelly1PM Shelly25 Shelly2 ShellyColorBulb ShellyDuo ShellyI3 ShellyPlug ShellyPlugS ShellyPlusPlugS ShellyPlus1 ShellyPlus1PM ShellyPlus2PM ShellyPlusI4 ShellyRGBW2 ShellyVintage ShellyU ShellyU25 ShellyURGBW2 ShellyUNI +build: Shelly1 Shelly1L Shelly1PM Shelly25 Shelly2 ShellyColorBulb ShellyDuo ShellyI3 ShellyPlug ShellyPlugS ShellyPlusPlugS ShellyPlus1 ShellyPlus1PM ShellyPlus2PM ShellyPlusI4 ShellyRGBW2 ShellyVintage ShellyU ShellyU25 ShellyURGBW2 ShellyUNI ShellyPlusRGBWPM release: $(MAKE) build CLEAN=1 RELEASE=1 diff --git a/fs_src/script.js b/fs_src/script.js index 2984fb51..cd798a49 100644 --- a/fs_src/script.js +++ b/fs_src/script.js @@ -746,7 +746,8 @@ function updateComponent(cd) { if (cd.type == Component_Type.kLightBulb) { if (cd.bulb_type == LightBulbController_BulbType.kCCT) { headText = "CCT"; - if (lastInfo.model == "ShellyRGBW2") { + if (lastInfo.model == "ShellyRGBW2" || + lastInfo.model == "ShellyPlusRGBWPM") { if (cd.id == 1) { headText += " R/G"; } else { @@ -937,7 +938,7 @@ function updateElement(key, value, info) { updateInnerText(el("uptime"), durationStr(value)); break; case "model": - if (value.endsWith("RGBW2")) { + if (value.endsWith("RGBW2") || value.endsWith("RGBWPM")) { el("sys_mode_container").style.display = "block"; if (el("sys_mode_0")) el("sys_mode_0").remove(); } else { diff --git a/mos.yml b/mos.yml index a3f7bea1..99f4d41e 100644 --- a/mos.yml +++ b/mos.yml @@ -634,14 +634,14 @@ conds: CONFIG_FREERTOS_UNICORE=y CONFIG_ESPTOOLPY_FLASHMODE_DIO=y cdefs: - LED_GPIO: 0 + LED_GPIO: 14 LED_ON: 0 - BTN_GPIO: 0 + BTN_GPIO: 22 BTN_DOWN: 0 GPIO_R: 25 GPIO_G: 26 GPIO_B: 27 - GPIO_W: 24 + GPIO_W: 4 GPIO_I1: 36 GPIO_I2: 37 GPIO_I3: 38 diff --git a/src/ShellyRGBW2/shelly_init.cpp b/src/ShellyRGBW2/shelly_init.cpp index 38ae4608..a96fd766 100644 --- a/src/ShellyRGBW2/shelly_init.cpp +++ b/src/ShellyRGBW2/shelly_init.cpp @@ -40,10 +40,26 @@ void CreatePeripherals(std::vector> *inputs, in->Init(); inputs->emplace_back(in); - // TODO: add more inputs for +RGBWPM +// TODO: add more inputs for +RGBWPM +#ifdef GPIO_I2 + in = new InputPin(2, GPIO_I2, 1, MGOS_GPIO_PULL_NONE, true); + in->AddHandler(std::bind(&HandleInputResetSequence, in, 0, _1, _2)); + in->Init(); + inputs->emplace_back(in); + + in = new InputPin(3, GPIO_I3, 1, MGOS_GPIO_PULL_NONE, true); + in->AddHandler(std::bind(&HandleInputResetSequence, in, 0, _1, _2)); + in->Init(); + inputs->emplace_back(in); + + in = new InputPin(4, GPIO_I4, 1, MGOS_GPIO_PULL_NONE, true); + in->AddHandler(std::bind(&HandleInputResetSequence, in, 0, _1, _2)); + in->Init(); + inputs->emplace_back(in); +#endif - // InitSysLED(LED_GPIO, LED_ON); - // InitSysBtn(BTN_GPIO, BTN_DOWN); + InitSysLED(LED_GPIO, LED_ON); + InitSysBtn(BTN_GPIO, BTN_DOWN); } void CreateComponents(std::vector> *comps,