nickp Posted November 21, 2016 Posted November 21, 2016 So, I'm trying to maximize the use of buttons on my KPL6. It would be really easy to assign one button to the KPL.ABCD and just have a scene that turns the fan controller onto off/low/med/high depending on which button is pressed. I tried a different approach. I created a State variable called PatioFanSpeed. Initial value is 1. 1=off, 2=low, 3=med, 4=high. I created a PatioFan1 program. This checks to see if KPL.A has been pressed, then sets the PatioFanSpeed=1, Turns off the Fan, and launches a scene to turn off KPL.AB LEDs. I created a PatioFan2 program. This checks if the PatioFanSpeed variable = 2, then sets the Fan speed to Low, and launches the scene to turn ON the KPL.AB LEDs. I created a PatioFan3 program. This checks if the PatioFanSpeed variable = 3, then sets the Fan speed to Med, and launches the scene to turn ON the KPL.AB LEDs. I created a PatioFan4 program. This checks if the PatioFanSpeed variable = 4, then sets the Fan speed to High, and launches the scene to turn ON the KPL.AB LEDs. I created a PatioFanFaster program. This checks to see if KPL.B has been pressed, and if so, it adds one to the PatioSpeedFan variable. I created a PatioFan_VariableRollover program. It checks to see if the PatioSpeedFan equals 5, and if so, it sets it to 2. So, if I press the KPL.A button the fan and A&B LED's turn off. If I press the KPL.B button, the fan starts and low, and then cycles through low-medium-high with each successive button press. It works. But two questions. 1. I don't always have the best user-interface ideas, but I tried to mimic the controls on the previous fan controller. 2. I ended up writing 6 programs for this. Not sure if this was the most efficient way to do this. What are your thoughts on the programming itself. I think I could do this in fewer programs, but only about 2 fewer. Check KPL.B AND (variable = 1 OR =4) , then set variable to 2, and set fanspeed to low. Check KPL.B AND variable = 2, then set variable to 3, and set fanspeed to med. Check KPL.B AND variable = 3, then set variable to 4, and set fanspeed to high. Check KPL.A, then set variable to 1, and set fanspeed to off. Any opinion on the best way to program this. The first method uses a state variable - not sure if this adds additional load on the system. Thoughts? Nick.
larryllix Posted November 21, 2016 Posted November 21, 2016 I use this same technique for light scenarios in my gathering room with many different tyeps of lights, Insteon, MiLight, Hue, LEDenet etc.. I always use 0 for Off as it seems logically more sensible to me, and if a power cycle reset it to 0 it would be off, One button value rotation program If ... KPL.button is switched On ... AND ... $sVariable < 4 Then ... $sVariable += 1 Else ... $sVariable = 0 Then you need four programs that run scenes detecting each value of the state variable. If ... $sVariable = 2 Then ... Set scene.medium On x 4 CPU based stuff will never load the ISY down! Think about massive systems running on 4Mhz systems in the old days without problems. (That's right MegaHertz!!) Insteon I/O will bog down as it is slow after all the echoes and repeats and handshaking.
stusviews Posted November 21, 2016 Posted November 21, 2016 One button KPL speed controller: CR Fan HighIf Control 'CR KPLH CR Fan' is switched On And Status 'CR FanLinc-Motor' is Off Then Set Scene 'CR Fan-High' On Else - No Actions - (To add one, press 'Action') CR Fan MediumIf Control 'CR KPLH CR Fan' is switched On And Status 'CR FanLinc-Motor' is High Then Set Scene 'CR Fan-Medium' On Else - No Actions - (To add one, press 'Action') CR Fan LowIf Control 'CR KPLH CR Fan' is switched On And Status 'CR FanLinc-Motor' is Med Then Set Scene 'CR / Scenes / CR Fan-Low' On Else - No Actions - (To add one, press 'Action') CR Fan OffIf Control 'CR KPLH CR Fan' is switched On And Status 'CR FanLinc-Motor' is Low Then Set Scene 'CR Fan-Off' Off Else - No Actions - (To add one, press 'Action') Each press of the button toggles through Off-High-Medium-Low-Off. The H button is set to non-toggle On. The Off scene turns the button LED off.
nickp Posted November 21, 2016 Author Posted November 21, 2016 Thanks Guys. Larry - I like your use of Else, totally forgot to implement that. I thought that I read somewhere that state variables put a higher load on the system, cant find that now. Makes sense that the CPU is really capable of anything... My first PC was a 80386SX at 16MHz with 1MB RAM. Yeah, megabytes. Those were the days. Stu - I like your implementation also. Using the status of the fan motor as the variable, and then cycling through. Although you go high/medium/low/off... Any comments on the "wife factor" with this cycling approach to fan speed? Thanks, Nick.
stusviews Posted November 21, 2016 Posted November 21, 2016 Both spouse and self have other methods of controlling fans. Before installing the FanLinc (on one particular fan) I used a Micro On/Off module and a single KPL button. I wrote the speed control programs using that one button just to see if I could do it. I emulated the standard fan pull chain direction from off to high to medium to low to off. I could have just as easily reversed that pattern. My first computer was an IBM with an 8086 (that I overclocked) running at 5Mhz (8Mhz after overclocking) plus an 8087 math co-processor and with 640KB RAM. Yeah, kilobytes. Now, those were the days (that are best left behind as memories only)
nickp Posted November 21, 2016 Author Posted November 21, 2016 I remember helping my father with his business. He would purchase "RAM Boards" for the IBM computers with 384KB of RAM, and we would manually add an additional 384 KB of RAM to 768KB - which was just above that magic 640KB number. The days of dual 5 1/4 floppy drives to boot the system, or (wait for it) when we finally got a 10MB hard drive. I remember FAT12 file system that could not handle a hard drive bigger than 32MB, and MSDOS 3.01 that allowed us to go beyond that. And nowadays we use equipment more powerful than that just to turn on the lights.
larryllix Posted November 21, 2016 Posted November 21, 2016 My first was expandable to 384 bytes of RAM and 1024 byte Eprom. For my first large system, I paid just under $1,000 for a 64K RAM board populated to 32K. Those days static ram (with 6 transistors each bit) was the only reliable memory. Dynamic ram lost memory bits occasionally, which was later discovered to be alpha particles penetrating the case of the memory chips. IBM attempted to make a work-around by using parity ad every byte contained an extra bit (9 bits) but they didn't know what to do, when it was wrong, so your system just hung. But then IBM didn't believe in interrupt processing then and PC motherboards didn't have the IRQ lines connected. Thank Gawd IBM got out of it, dragging the technology back into the previous decade, with every release.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.