From a3b0b8b3d0769617c01f6846fbd2c4726cd81743 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Tue, 28 Jun 2022 12:33:00 +0200 Subject: [PATCH] Change on/off button for Sataicase usermod. --- .../Animated_Staircase/Animated_Staircase.h | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/usermods/Animated_Staircase/Animated_Staircase.h b/usermods/Animated_Staircase/Animated_Staircase.h index eed40b7c0..5aa64631d 100644 --- a/usermods/Animated_Staircase/Animated_Staircase.h +++ b/usermods/Animated_Staircase/Animated_Staircase.h @@ -406,6 +406,14 @@ class Animated_Staircase : public Usermod { } } + void appendConfigData() { + //oappend(SET_F("dd=addDropdown('staircase','selectfield');")); + //oappend(SET_F("addOption(dd,'1st value',0);")); + //oappend(SET_F("addOption(dd,'2nd value',1);")); + //oappend(SET_F("addInfo('staircase:selectfield',1,'additional info');")); // 0 is field type, 1 is actual field + } + + /* * Writes the configuration to internal flash memory. */ @@ -458,15 +466,11 @@ class Animated_Staircase : public Usermod { useUSSensorTop = top[FPSTR(_useTopUltrasoundSensor)] | useUSSensorTop; topPIRorTriggerPin = top[FPSTR(_topPIRorTrigger_pin)] | topPIRorTriggerPin; -// topPIRorTriggerPin = min(33,max(-1,(int)topPIRorTriggerPin)); // bounds check topEchoPin = top[FPSTR(_topEcho_pin)] | topEchoPin; -// topEchoPin = min(39,max(-1,(int)topEchoPin)); // bounds check useUSSensorBottom = top[FPSTR(_useBottomUltrasoundSensor)] | useUSSensorBottom; bottomPIRorTriggerPin = top[FPSTR(_bottomPIRorTrigger_pin)] | bottomPIRorTriggerPin; -// bottomPIRorTriggerPin = min(33,max(-1,(int)bottomPIRorTriggerPin)); // bounds check bottomEchoPin = top[FPSTR(_bottomEcho_pin)] | bottomEchoPin; -// bottomEchoPin = min(39,max(-1,(int)bottomEchoPin)); // bounds check topMaxDist = top[FPSTR(_topEchoCm)] | topMaxDist; topMaxDist = min(150,max(30,(int)topMaxDist)); // max distnace ~1.5m (a lag of 9ms may be expected) @@ -504,22 +508,22 @@ class Animated_Staircase : public Usermod { * tab of the web-UI. */ void addToJsonInfo(JsonObject& root) { - JsonObject staircase = root["u"]; - if (staircase.isNull()) { - staircase = root.createNestedObject("u"); + JsonObject user = root["u"]; + if (user.isNull()) { + user = root.createNestedObject("u"); } - JsonArray usermodEnabled = staircase.createNestedArray(F("Staircase")); // name - String btn = F(""); - usermodEnabled.add(btn); // value + JsonArray infoArr = user.createNestedArray(FPSTR(_name)); // name + + String uiDomString = F(""); + infoArr.add(uiDomString); } };