Native Support for ON/OFF/ON Switches

Let Sim Innovations know about your Air Manager experience and let us know about your dream feature addition

Moderators: russ, Ralph

Message
Author
User avatar
BradyBrother100
Posts: 54
Joined: Tue Oct 13, 2020 4:21 pm
Location: United States MDT

Re: Native Support for ON/OFF/ON Switches

#31 Post by BradyBrother100 »

HI! I think Corjan's code would be a great implementation into Air Manager.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Native Support for ON/OFF/ON Switches

#32 Post 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
Joe. CISSP, MSc.

User avatar
BradyBrother100
Posts: 54
Joined: Tue Oct 13, 2020 4:21 pm
Location: United States MDT

Re: Native Support for ON/OFF/ON Switches

#33 Post by BradyBrother100 »

Hey! In Air Manager 4.X, will the ability to assign multiple pins to the hw_input_add be added?


Thanks!
Brady

User avatar
Corjan
Posts: 2933
Joined: Thu Nov 19, 2015 9:04 am

Re: Native Support for ON/OFF/ON Switches

#34 Post by Corjan »

Hi,

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

Corjan

alkargr
Posts: 14
Joined: Tue Feb 25, 2020 6:34 pm

Re: Native Support for ON/OFF/ON Switches

#35 Post 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.

User avatar
BradyBrother100
Posts: 54
Joined: Tue Oct 13, 2020 4:21 pm
Location: United States MDT

Re: Native Support for ON/OFF/ON Switches

#36 Post by BradyBrother100 »

Corjan wrote: Wed Apr 21, 2021 3:25 pm Hi,

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

Corjan
👀👀

User avatar
Corjan
Posts: 2933
Joined: Thu Nov 19, 2015 9:04 am

Re: Native Support for ON/OFF/ON Switches

#37 Post by Corjan »

Ah, looks like this didn’t make the cut after all :)

You could make this in pure lua,

Corjan

User avatar
Ralph
Posts: 7867
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Native Support for ON/OFF/ON Switches

#38 Post 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.

User avatar
Keith Baxter
Posts: 4671
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Native Support for ON/OFF/ON Switches

#39 Post 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
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Ralph
Posts: 7867
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Native Support for ON/OFF/ON Switches

#40 Post by Ralph »

I don't see any urgency, since it can easily be done in Lua.

Post Reply