What is a good term to use for this?

I am making a counter that counts. (And loops at the end)
The option is I am wanting it to have two modes:
1 - When invoked subsequent times it starts at 1
2 - When invoked subsequent times it continues from the last value.

What is a good term to use to convey this mode?

Maybe Pause and Reset, Pause and Resume? Also available: Lap Time (display pauses, counter continues)

(Mind having a look at this?)

[{"id":"5b2f1c1e34d60f19","type":"subflow","name":"3 Press button","info":"","category":"","in":[{"x":70,"y":190,"wires":[{"id":"ec5080f153f43d22"}]}],"out":[{"x":840,"y":190,"wires":[{"id":"ee1c20a8875e36cc","port":0}]},{"x":840,"y":270,"wires":[{"id":"ccb64e30a758c6d0","port":0}]}],"env":[{"name":"topic","type":"str","value":""},{"name":"Message 1","type":"str","value":""},{"name":"Message 2","type":"str","value":""},{"name":"Message 3","type":"str","value":""},{"name":"colour 1","type":"str","value":""},{"name":"colour 2","type":"str","value":""},{"name":"colour 3","type":"str","value":""},{"name":"fontclr 1","type":"str","value":""},{"name":"fontclr 2","type":"str","value":""},{"name":"fontclr 3","type":"str","value":""},{"name":"hold","type":"bool","value":"true","ui":{"type":"input","opts":{"types":["bool"]}}}],"meta":{},"color":"#DDAA99"},{"id":"9c628490f5a7ab36","type":"switch","z":"5b2f1c1e34d60f19","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":230,"y":270,"wires":[["625edd1859414ac8"],["2ed89392aefd3ac3"],["75984bf53702c1ac"]]},{"id":"625edd1859414ac8","type":"change","z":"5b2f1c1e34d60f19","name":"1","rules":[{"t":"set","p":"text","pt":"msg","to":"Message 1","tot":"env"},{"t":"set","p":"bgc","pt":"msg","to":"colour 1","tot":"env"},{"t":"set","p":"fontclr","pt":"msg","to":"fontclr 1","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":230,"wires":[["ccb64e30a758c6d0"]]},{"id":"2ed89392aefd3ac3","type":"change","z":"5b2f1c1e34d60f19","name":"2","rules":[{"t":"set","p":"text","pt":"msg","to":"Message 2","tot":"env"},{"t":"set","p":"bgc","pt":"msg","to":"colour 2","tot":"env"},{"t":"set","p":"fontclr","pt":"msg","to":"fontclr 2","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":270,"wires":[["ccb64e30a758c6d0"]]},{"id":"75984bf53702c1ac","type":"change","z":"5b2f1c1e34d60f19","name":"3","rules":[{"t":"set","p":"text","pt":"msg","to":"Message 3","tot":"env"},{"t":"set","p":"bgc","pt":"msg","to":"colour 3","tot":"env"},{"t":"set","p":"fontclr","pt":"msg","to":"fontclr 3","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":310,"wires":[["ccb64e30a758c6d0"]]},{"id":"ec5080f153f43d22","type":"function","z":"5b2f1c1e34d60f19","name":"","func":"if (msg.payload == \"reset\")\n{\n    context.set(\"previous\",0);\n    return;\n}\n\nvar max = 4;\nvar previous = context.get(\"previous\") || 0;\nprevious = (previous + 1) % max;\ncontext.set(\"previous\",previous);\n\nif (previous == 0)\n{\n    previous = 1;\n    context.set(\"previous\",1);\n}\nmsg.payload = previous;\nmsg.topic = env.get(\"topic\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":190,"wires":[["9c628490f5a7ab36","ee1c20a8875e36cc"]]},{"id":"ccb64e30a758c6d0","type":"fan","z":"5b2f1c1e34d60f19","name":"","x":570,"y":270,"wires":[[]]},{"id":"ee1c20a8875e36cc","type":"trigger","z":"5b2f1c1e34d60f19","name":"Delay","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"350","extend":true,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":570,"y":190,"wires":[["20347974efa46acb"]]},{"id":"20347974efa46acb","type":"change","z":"5b2f1c1e34d60f19","name":"","rules":[{"t":"set","p":"hold","pt":"msg","to":"hold","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":535,"y":150,"wires":[["52f023f6a52afa5b"]],"l":false},{"id":"52f023f6a52afa5b","type":"switch","z":"5b2f1c1e34d60f19","name":"","property":"hold","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":585,"y":150,"wires":[["7d8c55ef2950c72a"]],"l":false},{"id":"7d8c55ef2950c72a","type":"change","z":"5b2f1c1e34d60f19","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":635,"y":150,"wires":[["ec5080f153f43d22"]],"l":false},{"id":"2b0c0efac574a5e0","type":"subflow:5b2f1c1e34d60f19","z":"1283f6a97005461c","name":"","env":[{"name":"topic","value":"control","type":"str"},{"name":"Message 1","value":"SOM & EOM","type":"str"},{"name":"Message 2","value":"SOM","type":"str"},{"name":"Message 3","value":"EOM","type":"str"},{"name":"colour 1","value":"limegreen","type":"str"},{"name":"colour 2","value":"yellow","type":"str"},{"name":"colour 3","value":"gold","type":"str"},{"name":"fontclr 1","value":"black","type":"str"},{"name":"fontclr 2","value":"black","type":"str"},{"name":"fontclr 3","value":"black","type":"str"}],"x":1900,"y":290,"wires":[["a7cb12089c39ae8a"],["d21f9af9e897b3e2"]]}]

It allows 1 button to select 3 options.
Each click cycles through the list.

The hold makes it continue from where it left off if set true.

[{"id":"5b2f1c1e34d60f19","type":"subflow","name":"3 Press button","info":"","category":"","in":[{"x":70,"y":190,"wires":[{"id":"ec5080f153f43d22"}]}],"out":[{"x":840,"y":190,"wires":[{"id":"ee1c20a8875e36cc","port":0}]},{"x":840,"y":270,"wires":[{"id":"ccb64e30a758c6d0","port":0}]}],"env":[{"name":"topic","type":"str","value":""},{"name":"Message 1","type":"str","value":""},{"name":"Message 2","type":"str","value":""},{"name":"Message 3","type":"str","value":""},{"name":"colour 1","type":"str","value":""},{"name":"colour 2","type":"str","value":""},{"name":"colour 3","type":"str","value":""},{"name":"fontclr 1","type":"str","value":""},{"name":"fontclr 2","type":"str","value":""},{"name":"fontclr 3","type":"str","value":""},{"name":"hold","type":"bool","value":"true","ui":{"type":"input","opts":{"types":["bool"]}}}],"meta":{},"color":"#DDAA99"},{"id":"9c628490f5a7ab36","type":"switch","z":"5b2f1c1e34d60f19","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":230,"y":270,"wires":[["625edd1859414ac8"],["2ed89392aefd3ac3"],["75984bf53702c1ac"]]},{"id":"625edd1859414ac8","type":"change","z":"5b2f1c1e34d60f19","name":"1","rules":[{"t":"set","p":"text","pt":"msg","to":"Message 1","tot":"env"},{"t":"set","p":"bgc","pt":"msg","to":"colour 1","tot":"env"},{"t":"set","p":"fontclr","pt":"msg","to":"fontclr 1","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":230,"wires":[["ccb64e30a758c6d0"]]},{"id":"2ed89392aefd3ac3","type":"change","z":"5b2f1c1e34d60f19","name":"2","rules":[{"t":"set","p":"text","pt":"msg","to":"Message 2","tot":"env"},{"t":"set","p":"bgc","pt":"msg","to":"colour 2","tot":"env"},{"t":"set","p":"fontclr","pt":"msg","to":"fontclr 2","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":270,"wires":[["ccb64e30a758c6d0"]]},{"id":"75984bf53702c1ac","type":"change","z":"5b2f1c1e34d60f19","name":"3","rules":[{"t":"set","p":"text","pt":"msg","to":"Message 3","tot":"env"},{"t":"set","p":"bgc","pt":"msg","to":"colour 3","tot":"env"},{"t":"set","p":"fontclr","pt":"msg","to":"fontclr 3","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":310,"wires":[["ccb64e30a758c6d0"]]},{"id":"ec5080f153f43d22","type":"function","z":"5b2f1c1e34d60f19","name":"","func":"if (msg.payload == \"reset\")\n{\n    context.set(\"previous\",0);\n    return;\n}\n\nvar max = 4;\nvar previous = context.get(\"previous\") || 0;\nprevious = (previous + 1) % max;\ncontext.set(\"previous\",previous);\n\nif (previous == 0)\n{\n    previous = 1;\n    context.set(\"previous\",1);\n}\nmsg.payload = previous;\nmsg.topic = env.get(\"topic\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":190,"wires":[["9c628490f5a7ab36","ee1c20a8875e36cc"]]},{"id":"ccb64e30a758c6d0","type":"fan","z":"5b2f1c1e34d60f19","name":"","x":570,"y":270,"wires":[[]]},{"id":"ee1c20a8875e36cc","type":"trigger","z":"5b2f1c1e34d60f19","name":"Delay","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"350","extend":true,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":570,"y":190,"wires":[["20347974efa46acb"]]},{"id":"20347974efa46acb","type":"change","z":"5b2f1c1e34d60f19","name":"","rules":[{"t":"set","p":"hold","pt":"msg","to":"hold","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":535,"y":150,"wires":[["52f023f6a52afa5b"]],"l":false},{"id":"52f023f6a52afa5b","type":"switch","z":"5b2f1c1e34d60f19","name":"","property":"hold","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":585,"y":150,"wires":[["7d8c55ef2950c72a"]],"l":false},{"id":"7d8c55ef2950c72a","type":"change","z":"5b2f1c1e34d60f19","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":635,"y":150,"wires":[["ec5080f153f43d22"]],"l":false},{"id":"2b0c0efac574a5e0","type":"subflow:5b2f1c1e34d60f19","z":"1283f6a97005461c","name":"","env":[{"name":"topic","value":"control","type":"str"},{"name":"Message 1","value":"SOM & EOM","type":"str"},{"name":"Message 2","value":"SOM","type":"str"},{"name":"Message 3","value":"EOM","type":"str"},{"name":"colour 1","value":"limegreen","type":"str"},{"name":"colour 2","value":"yellow","type":"str"},{"name":"colour 3","value":"gold","type":"str"},{"name":"fontclr 1","value":"black","type":"str"},{"name":"fontclr 2","value":"black","type":"str"},{"name":"fontclr 3","value":"black","type":"str"}],"x":1900,"y":290,"wires":[["a7cb12089c39ae8a"],["d21f9af9e897b3e2"]]},{"id":"aac062ca68a9ac0b","type":"inject","z":"1283f6a97005461c","name":"click","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":1720,"y":290,"wires":[["2b0c0efac574a5e0"]]},{"id":"a7cb12089c39ae8a","type":"debug","z":"1283f6a97005461c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2100,"y":260,"wires":[]},{"id":"d21f9af9e897b3e2","type":"debug","z":"1283f6a97005461c","name":"Back to button","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2110,"y":320,"wires":[]}]

And (sorry) I'm stuck on how to set the default condition/value.

(Subflow only)
I think this works.

[{"id":"5b2f1c1e34d60f19","type":"subflow","name":"3 Press button","info":"","category":"","in":[{"x":70,"y":190,"wires":[{"id":"ec5080f153f43d22"}]}],"out":[{"x":840,"y":190,"wires":[{"id":"ee1c20a8875e36cc","port":0}]},{"x":840,"y":270,"wires":[{"id":"ccb64e30a758c6d0","port":0}]}],"env":[{"name":"start at","type":"num","value":"","ui":{"type":"input","opts":{"types":["num"]}}},{"name":"hold","type":"bool","value":"true","ui":{"type":"input","opts":{"types":["bool"]}}},{"name":"topic","type":"str","value":""},{"name":"Message 1","type":"str","value":""},{"name":"Message 2","type":"str","value":""},{"name":"Message 3","type":"str","value":""},{"name":"colour 1","type":"str","value":""},{"name":"colour 2","type":"str","value":""},{"name":"colour 3","type":"str","value":""},{"name":"fontclr 1","type":"str","value":""},{"name":"fontclr 2","type":"str","value":""},{"name":"fontclr 3","type":"str","value":""}],"meta":{},"color":"#DDAA99","inputLabels":["Input"],"outputLabels":["Output","Loop back to button node"],"icon":"node-red-dashboard/ui_button.png"},{"id":"9c628490f5a7ab36","type":"switch","z":"5b2f1c1e34d60f19","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":230,"y":270,"wires":[["625edd1859414ac8"],["2ed89392aefd3ac3"],["75984bf53702c1ac"]]},{"id":"625edd1859414ac8","type":"change","z":"5b2f1c1e34d60f19","name":"1","rules":[{"t":"set","p":"text","pt":"msg","to":"Message 1","tot":"env"},{"t":"set","p":"bgc","pt":"msg","to":"colour 1","tot":"env"},{"t":"set","p":"fontclr","pt":"msg","to":"fontclr 1","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":230,"wires":[["ccb64e30a758c6d0"]]},{"id":"2ed89392aefd3ac3","type":"change","z":"5b2f1c1e34d60f19","name":"2","rules":[{"t":"set","p":"text","pt":"msg","to":"Message 2","tot":"env"},{"t":"set","p":"bgc","pt":"msg","to":"colour 2","tot":"env"},{"t":"set","p":"fontclr","pt":"msg","to":"fontclr 2","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":270,"wires":[["ccb64e30a758c6d0"]]},{"id":"75984bf53702c1ac","type":"change","z":"5b2f1c1e34d60f19","name":"3","rules":[{"t":"set","p":"text","pt":"msg","to":"Message 3","tot":"env"},{"t":"set","p":"bgc","pt":"msg","to":"colour 3","tot":"env"},{"t":"set","p":"fontclr","pt":"msg","to":"fontclr 3","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":310,"wires":[["ccb64e30a758c6d0"]]},{"id":"ec5080f153f43d22","type":"function","z":"5b2f1c1e34d60f19","name":"","func":"//  Get \"start value\"\nif (msg.topic == \"startup\")\n{\n    context.set(\"previous\",msg.payload-1);\n}\n\nif (msg.payload == \"reset\")\n{\n    context.set(\"previous\",0);\n    return;\n}\n\nvar max = 4;\nvar previous = context.get(\"previous\") || 0;\nprevious = (previous + 1) % max;\ncontext.set(\"previous\",previous);\n\nif (previous == 0)\n{\n    previous = 1;\n    context.set(\"previous\",1);\n}\nmsg.payload = previous;\nmsg.topic = env.get(\"topic\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":190,"wires":[["9c628490f5a7ab36","ee1c20a8875e36cc"]]},{"id":"ccb64e30a758c6d0","type":"fan","z":"5b2f1c1e34d60f19","name":"","x":570,"y":270,"wires":[[]]},{"id":"ee1c20a8875e36cc","type":"trigger","z":"5b2f1c1e34d60f19","name":"Delay","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"350","extend":true,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":570,"y":190,"wires":[["20347974efa46acb"]]},{"id":"20347974efa46acb","type":"change","z":"5b2f1c1e34d60f19","name":"","rules":[{"t":"set","p":"hold","pt":"msg","to":"hold","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":535,"y":150,"wires":[["52f023f6a52afa5b"]],"l":false},{"id":"52f023f6a52afa5b","type":"switch","z":"5b2f1c1e34d60f19","name":"","property":"hold","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":585,"y":150,"wires":[["7d8c55ef2950c72a"]],"l":false},{"id":"7d8c55ef2950c72a","type":"change","z":"5b2f1c1e34d60f19","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":635,"y":150,"wires":[["ec5080f153f43d22"]],"l":false},{"id":"942b4a9f6dc7bb9c","type":"inject","z":"5b2f1c1e34d60f19","name":"Start at","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"startup","payload":"start at","payloadType":"env","x":230,"y":160,"wires":[["ec5080f153f43d22"]]},{"id":"2b0c0efac574a5e0","type":"subflow:5b2f1c1e34d60f19","z":"1283f6a97005461c","name":"","env":[{"name":"topic","value":"control","type":"str"},{"name":"Message 1","value":"SOM & EOM","type":"str"},{"name":"Message 2","value":"SOM","type":"str"},{"name":"Message 3","value":"EOM","type":"str"},{"name":"colour 1","value":"limegreen","type":"str"},{"name":"colour 2","value":"yellow","type":"str"},{"name":"colour 3","value":"gold","type":"str"},{"name":"fontclr 1","value":"black","type":"str"},{"name":"fontclr 2","value":"black","type":"str"},{"name":"fontclr 3","value":"black","type":"str"},{"name":"start at","value":"1","type":"num"}],"x":1900,"y":290,"wires":[["a7cb12089c39ae8a"],["d21f9af9e897b3e2"]]}]

Well I had a quick look but I don't really understand what you are doing.

Completely personal preferences/prejudices, not any criticism of your flow and way of thinking:

I don't use subflows, I just don't like them and don't know what they add to NR.
When I have a flow that's too complex to fit on one tab I'll split it between two tabs using link in and link out nodes.
So far I've not needed a subflow to provide the equivalent of a subroutine.

I dislike the idea of a button with two or more functions.
I have one or two IOT buttons which have the possibility of short/long/double/triple press but it's just not my style.
In the absense of a satisfactory rotary selector switch widget I'd go for three or more small buttons to select the desired function for the big red "GO" button.

Sorry.... No problems.

I am just trying to rationalise my flows and it is painful.

I think I have satisfied my question anyway.

Thanks though for the effort/replies.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.