Page 4 of 5

Re: Native Support for ON/OFF/ON Switches

Posted: Fri Apr 02, 2021 4:04 pm
by BradyBrother100
HI! I think Corjan's code would be a great implementation into Air Manager.

Re: Native Support for ON/OFF/ON Switches

Posted: Mon Apr 05, 2021 11:07 am
by jph
Hi Brady,
For some reason I can't seem to reply to your PM ????
Anyway, here is a link to, and a brief description of the 12 way rotary switches you asked for - the ones that can be set mechanically for any number of position from 1 to 12.

https://siminnovations.com/forums/viewt ... 929#p34929

Regards,
Joe

Re: Native Support for ON/OFF/ON Switches

Posted: Wed Apr 21, 2021 3:19 pm
by BradyBrother100
Hey! In Air Manager 4.X, will the ability to assign multiple pins to the hw_input_add be added?


Thanks!
Brady

Re: Native Support for ON/OFF/ON Switches

Posted: Wed Apr 21, 2021 3:25 pm
by Corjan
Hi,

Will be part of the next (free) upgrade, AM 4.1.

Corjan

Re: Native Support for ON/OFF/ON Switches

Posted: Mon Jun 21, 2021 6:33 pm
by alkargr
I had the same problem with those 3 pin switches so instead of using:

Code: Select all

function switch_callback(position)
  print("Switch pos " .. position)
end
hw_switch_add("ARDUINO_MEGA2560_D_D4", "ARDUINO_MEGA2560_D_D6", switch_callback) --ON/OFF/ON switch
I used:

Code: Select all

function dn_switch_callback(position)
    pos_down=position
    checkMidPosition()
  print("Down position " .. position)
end
hw_switch_add("ARDUINO_MEGA2560_D_D4",  dn_switch_callback)

function up_switch_callback(position)
    pos_up=position
    checkMidPosition()
  print("Up position " .. position)
end
hw_switch_add("ARDUINO_MEGA2560_D_D6",  up_switch_callback)

function checkMidPosition()
    if pos_up==0 and pos_down==0 then pos_mid=1 print("Mid position 1") else pos_mid=0 print("Mid position 0") end
end
It works well even for the initial state of the switch when the program begins.

Re: Native Support for ON/OFF/ON Switches

Posted: Sat Jan 29, 2022 3:51 am
by BradyBrother100
Corjan wrote: ↑Wed Apr 21, 2021 3:25 pm Hi,

Will be part of the next (free) upgrade, AM 4.1.

Corjan
👀👀

Re: Native Support for ON/OFF/ON Switches

Posted: Sat Jan 29, 2022 12:30 pm
by Corjan
Ah, looks like this didn’t make the cut after all :)

You could make this in pure lua,

Corjan

Re: Native Support for ON/OFF/ON Switches

Posted: Sat Jan 29, 2022 1:11 pm
by Ralph
It's indeed easy to make in Lua with two digital inputs. I think there's even a pre made hardware function available in Air Manager. You would only have to add your commands or events.

Re: Native Support for ON/OFF/ON Switches

Posted: Sat Jan 29, 2022 1:18 pm
by Keith Baxter
Hi,

So it will be in beta AM4.2 build(1) :lol: :lol:

If this is going to happen? Then add OFF ON ON as well please.

Keith

Re: Native Support for ON/OFF/ON Switches

Posted: Sat Jan 29, 2022 5:51 pm
by Ralph
I don't see any urgency, since it can easily be done in Lua.