Looking to add physical buttons to select what the Knobster will control.

Support for the SimWareKits Knobster in combination with Air Manager and Air Player

Moderators: russ, Ralph

Message
Author
robertwaite
Posts: 9
Joined: Fri Sep 25, 2020 10:54 pm

Looking to add physical buttons to select what the Knobster will control.

#1 Post by robertwaite »

Hello,
I want to get the behavior depicted in the below screencast to use the knobster instead of a hard-wired dial knob encoder.
https://www.youtube.com/watch?v=mWfKkJd ... tion=share

As in the screencast, my intention is to use this for when MSFS2020 eventually gets VR support.

I assume at this point its not possible to wire in an Arduino button with a function to explicitly set a control as if we selected it with a touch screen.
I want to rule out that assumption before i start playing with an idea i have. Can anyone confirm that assumption?

Ive got some research to do to get up to speed on custom hardware controls before i can do this. My thought is to have a single dual dial control on the interface that is selectable via any normal Air Manager panel. this would be the only control selected while under VR and the Knobster would then always be manipulating that control. I should in theory I should be able to set Inter-instrument communication variables via the button presses on the Arduino to set what I want to control. The code on the primary dial dial control on the panel would send events based on what the active inter instrument variable are.

The only thing that is not clear to me yet is how to configure a dial control. the API documents and the online tutorial only shows a single dial. if you know of any reference that would point me in the right direction on how to set up dial with button control let me know. I only got my knobster yesterday and this will be my first air manager control i will be creating. So I understand i have a learning curve ahead of me.


Again the main thing I'm after is how to create a dial dial control that can be selected for control by a knobster in a conventional air manager panel. Once i figure that out everything else should fall into place. In the meantime ill be hitting the API documents and examples for clues.

thanks I'll be happy to share the end result here once i figure it out.
Robert

robertwaite
Posts: 9
Joined: Fri Sep 25, 2020 10:54 pm

Re: Looking to add physical buttons to select what the Knobster will control.

#2 Post by robertwaite »

I've found a Generic - Knobster avionics controller I think I'm going to be able to use as a starting template.
This should be a good start as opposed to starting with a scratch control. in theory, if i can set inter interment variables via other instraments i should be able to switch what i am controlling and use this as a single point to select in an Air Manager panel.

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Looking to add physical buttons to select what the Knobster will control.

#3 Post by Sling »

Hi robertwaite and welcome to the forum,
I assume at this point its not possible to wire in an Arduino button with a function to explicitly set a control as if we selected it with a touch screen.
Your assumption is correct.

Your idea is totally doable and if i'm not mistaken has been done before. To get a dual dial you simply co-locate 2 dials at the same location. You just need to make the outer one larger than the inner one. Check the GNS530/430 overlay code for an example.

Tony

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

Re: Looking to add physical buttons to select what the Knobster will control.

#4 Post by jph »

robertwaite wrote: Sat Sep 26, 2020 12:31 am I've found a Generic - Knobster avionics controller I think I'm going to be able to use as a starting template.
This should be a good start as opposed to starting with a scratch control. in theory, if i can set inter interment variables via other instraments i should be able to switch what i am controlling and use this as a single point to select in an Air Manager panel.
interesting ;)
It would be quite good fun to experiment - for vr - with either an air mouse or a normal mouse (you can of course use more than one mouse at the same with windoze.) - a sort of dedicated 'frankenmouse' where a knobster type arrangement is grafted on (or even a single small encoder with the push button selecting inner or outer) . then the mouse selects the control, and the grafted on encoder(s) do the adjusting - the whole unit moves as one. This may well be interesting with an air-mouse as well (with a suitable encoder arrangement grafted or clipped on) so you only have to move and select the control with the mouse and then use the encoder (knobster) as 'normal' - basically a mouse or pointer mouse with a control attached. - possibly even a track ball with built in /on knobster. It may be even more intuitive in VR ? ..
There are a few REALLY small dual concentric encoders from aliX at the moment... you would probably need 3d printed knobs... but the ability to have the mouse movement, button click select
and the encoders(s) all in one unit would be fun. These units are pretty tiny.
As said, using more than one mouse is no issue, so you could have a 'normal' mouse and a 'franken-mouse' ..... ;) would definitely be fun to experiment with.
Joe
Joe. CISSP, MSc.

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

Re: Looking to add physical buttons to select what the Knobster will control.

#5 Post by jph »

general idea of size of the mini dual concentric encoders. REALLY neat units !. - also have push button as well. ;)
thumbnail (1).jpg
thumbnail.jpg
Joe
Joe. CISSP, MSc.

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

Re: Looking to add physical buttons to select what the Knobster will control.

#6 Post by jph »

You may also be able to use the original idea with a static button reference via sim message port (arduino custom interface) and do the main work on an arduino.. that would probably accomplish what you want,
Worth exploring ...
Joe. CISSP, MSc.

robertwaite
Posts: 9
Joined: Fri Sep 25, 2020 10:54 pm

Re: Looking to add physical buttons to select what the Knobster will control.

#7 Post by robertwaite »

Thanks for your responces,

If there are others that have done similar stuff i would like to see to so that i can glean some ideas.

Ive made a lot progreess and have come up with an even better strategy that uses the Knowbster itself to switch between modes instead of physical buttons.
Being that with the button press having a pressed and released state you can essentially get 4 additional events out a dual encoder being you can press turn then release.
So over been using that to switch between mode and then getting a sound event on the release to remind me what mode i am in.
within the structure of the modes you define the mode transition so that you have structured navigation while holding the button and turning the encoders.


I still got bugs to iron out but this is My code so far:

Code: Select all

msfsEventFlag = "MSFS_"
debugMode = true
emptyString = ""

--Debugging tip: set this to true and you can default in as pressed and test without a knobster
--local pressed = true --Debugging mode
pressed = false
local changedDirectionSincePressed = false 

local resetMode = "KnobsterMode_Heading1"
local knob_rot = 6
local ModeName                 = "Altitude_Mode"
local outter_knob_ccw_function = msfsEventFlag .. "GPS_PROCEDURE_BUTTON"
local outter_knob_cw_function  = msfsEventFlag .. "GPS_FLIGHTPLAN_BUTTON"
local inner_knob_ccw_function  = msfsEventFlag .. "GPS_ZOOMIN_BUTTON"
local inner_knob_cw_function   = msfsEventFlag .. "GPS_DIRECTTO_BUTTON" 
local pressed_outter_knob_ccw_function = resetMode
local pressed_outter_knob_cw_function  = "KnobsterMode_COM1"
local pressed_inner_knob_ccw_function  = resetMode
local pressed_inner_knob_cw_function   = "KnobsterMode_COM1"
local button_function          = msfsEventFlag .. "GPS_MENU_BUTTON"

soundAltitude_Mode         = sound_add("Altitude_Mode.wav")
soundCom1_Mode             = sound_add("Com1_Mode.wav")
soundCOM2_Mode             = sound_add("COM2_Mode.wav")
soundCourse_Selection_Mode = sound_add("VOR1_Mode.wav")
soundNav1_Mode             = sound_add("Nav1_Mode.wav")
soundNav2_Mode             = sound_add("Nav2_Mode.wav")
soundVS_FLC_Mode           = sound_add("VS_FLC_Mode.wav")
soundAutoPilot1            = sound_add("AutoPilot1.wav")
soundAutoPilot2            = sound_add("AutoPilot2.wav")
soundAutoPilot3            = sound_add("AutoPilot3.wav")
soundHeading1              = sound_add("Heading1.wav")
soundHeading2              = sound_add("Heading2.wav")
soundAltitude2             = sound_add("Altitude2.wav")

function PlayModeSound()
    
    --todo: look into a way to use a analog to reflection as to dynamically build these
    --todo: rename ModeNameTo SoundToPlayOnRelease
    if ModeName == "Altitude_Mode" then sound_play(soundAltitude_Mode) end
    if ModeName == "Com1_Mode" then sound_play(soundCom1_Mode) end
    if ModeName == "COM2_Mode" then sound_play(soundCOM2_Mode) end
    if ModeName == "Course_Selection_Mode" then sound_play(soundCourse_Selection_Mode) end
    if ModeName == "Nav1_Mode" then sound_play(soundNav1_Mode) end
    if ModeName == "Nav2_Mode" then sound_play(soundNav2_Mode) end
    if ModeName == "VS_FLC_Mode" then sound_play(soundVS_FLC_Mode) end    
    if ModeName == "AutoPilot1" then sound_play(soundAutoPilot1) end
    if ModeName == "AutoPilot2" then sound_play(soundAutoPilot2) end
    if ModeName == "AutoPilot3" then sound_play(soundAutoPilot3) end
    if ModeName == "Heading1" then sound_play(soundHeading1) end
    if ModeName == "Heading2" then sound_play(soundHeading2) end
    if ModeName == "Altitude2" then sound_play(soundAltitude2) end
end

-- BACKGROUND
img_add_fullscreen("background.png")

-- OUTTER KNOB
function dial_outter(direction)
    changedDirectionSincePressed = true
    if direction == 1 then
        if pressed then
            --print("Finished seeting KnobsterMode_Heading: " .. hold_outter_knob_cw_function)
            processEvent(pressed_outter_knob_cw_function)
        else
            processEvent(outter_knob_cw_function)
        end
        --fs2020_event(outter_knob_cw_function)
    elseif direction== -1 then
        if pressed then
            processEvent(pressed_outter_knob_ccw_function)
        else
            processEvent(outter_knob_ccw_function)
        end
        --fs2020_event(outter_knob_ccw_function)
    end
end
outter_knob = dial_add("outter_knob.png", 5, 43, 91, 91, dial_outter)
dial_click_rotate(outter_knob, knob_rot)
touch_setting(outter_knob , "ROTATE_TICK", 30)


local function starts_with(str, start)
   --print("str:"   .. str)
   --print("start:" .. start)
   --print("str:sub(1, #start) == start:" .. tostring(str:sub(1, #start) == start))
   return str:sub(1, #start) == start
end


function processEvent(eventString)
    --print("eventString:"   .. eventString)
    --print("msfsEventFlag:" .. msfsEventFlag)
    
    if starts_with(eventString, msfsEventFlag) then
        --if debugMode then print("Microsoft Event:" .. eventString) end
        eventSring = string.gsub(eventString, msfsEventFlag, "")
        if debugMode then print("Parsed Microsoft Event: " .. eventSring) end
        fs2020_event(eventSring)     
    else
        if debugMode then print("Air Manager Event: "  .. eventString) end
        if eventString ~= "Null" 
            --print("Sending Air Manager Event: " .. eventString)
            then si_command(eventString) 
        else
            if debugMode then print("Null Event") end
        end
    end
end

-- INNER KNOB
function dial_inner(direction)
    changedDirectionSincePressed = true
    if direction == 1 then
        --fs2020_event(inner_knob_cw_function)
        if pressed then
            processEvent(pressed_inner_knob_cw_function)
        else
            processEvent(inner_knob_cw_function)
        end
    elseif direction== -1 then
        --fs2020_event(inner_knob_ccw_function)
        if pressed then
            processEvent(pressed_inner_knob_ccw_function)
        else
            processEvent(inner_knob_ccw_function)
        end
    end
end

inner_knob = dial_add("inner_knob.png", 19, 57, 64, 64, dial_inner)
dial_click_rotate(inner_knob, knob_rot)
touch_setting(inner_knob , "ROTATE_TICK", 30)

-- BUTTON
--function button_click()
--    
    --fs2020_event(button_function)
--    processEvent(button_function)
--end
function press_callback()
        
    pressed = true
    changedDirectionSincePressed = false
    print("press_callback" .. tostring(pressed))

end

function release_callback()

    pressed = false
    if changedDirectionSincePressed == false then 
        processEvent(button_function)
    end
    
    print("release_callback"  .. tostring(pressed))
    PlayModeSound()   
end
button_add("button.png", "button_in.png", 28, 65, 48, 47, press_callback, release_callback)


function KnobsterMode_Heading1(typecmd)
    ModeName                         = "Heading1"
    outter_knob_ccw_function         = "HEADING_BUG_DEC_10"
    outter_knob_cw_function          = "HEADING_BUG_INC_10"
    inner_knob_ccw_function          = msfsEventFlag .. "HEADING_BUG_DEC"
    inner_knob_cw_function           = msfsEventFlag .. "HEADING_BUG_INC"
    pressed_outter_knob_ccw_function = resetMode
    pressed_outter_knob_cw_function  = "KnobsterMode_Heading2"
    pressed_inner_knob_ccw_function  = resetMode
    pressed_inner_knob_cw_function   = "KnobsterMode_Altitude1"
    button_function                  = msfsEventFlag .. "HEADING_BUG_SET 300" --this does not seem to work follow up and find out how to use this. Intention is to everride the MSFS bug that reset the heading when using auto pilot.
    
    --print("Finished seeting KnobsterMode_Heading: " .. hold_outter_knob_cw_function)
end
si_command_subscribe("KnobsterMode_Heading1", KnobsterMode_Heading1)

function KnobsterMode_Heading2(typecmd)
    ModeName                      = "Heading2"
    outter_knob_ccw_function      = msfsEventFlag .. "AP_NAV1_HOLD"
    outter_knob_cw_function       = msfsEventFlag .. "AP_HDG_HOLD"
    inner_knob_ccw_function       = msfsEventFlag .. "AP_NAV1_HOLD"
    inner_knob_cw_function        = msfsEventFlag .. "AP_HDG_HOLD"
    pressed_outter_knob_ccw_function = resetMode
    pressed_outter_knob_cw_function  = "KnobsterMode_AutoPilot1"
    pressed_inner_knob_ccw_function  = resetMode
    pressed_inner_knob_cw_function   = "KnobsterMode_Altitude1"
    button_function               = msfsEventFlag .. "HEADING_BUG_SET 300" --this does not seem to work follow up and find out how to use this. Intention is to everride the MSFS bug that reset the heading when using auto pilot.
    
    --print("Finished seeting KnobsterMode_Heading: " .. hold_outter_knob_cw_function)
end
si_command_subscribe("KnobsterMode_Heading2", KnobsterMode_Heading2)
   
 
function KnobsterMode_Altitude1(typecmd)
    ModeName                      = "Altitude_Mode"
    outter_knob_ccw_function      = "AP_ALT_VAR_DEC_1000"
    outter_knob_cw_function       = "AP_ALT_VAR_INC_1000"
    inner_knob_ccw_function       = msfsEventFlag .. "AP_ALT_VAR_DEC"
    inner_knob_cw_function        = msfsEventFlag .. "AP_ALT_VAR_INC"
    pressed_outter_knob_ccw_function = resetMode
    pressed_outter_knob_cw_function  = "KnobsterMode_AutoPilot1"
    pressed_inner_knob_ccw_function  = resetMode
    pressed_inner_knob_cw_function   = "KnobsterMode_COM1"
    button_function               = msfsEventFlag .. "HEADING_BUG_SET 300" --this does not seem to work follow up and find out how to use this. Intention is to everride the MSFS bug that reset the heading when using auto pilot.
    --print("Finished seeting KnobsterMode_Heading: " .. hold_outter_knob_cw_function)
end
si_command_subscribe("KnobsterMode_Altitude1", KnobsterMode_Altitude1)
 
 
function KnobsterMode_COM1(typecmd)
    --print("Setting COM1 Mode")
    ModeName = "Com1_Mode"
    outter_knob_ccw_function = msfsEventFlag .. "COM_RADIO_WHOLE_DEC"
    outter_knob_cw_function  = msfsEventFlag .. "COM_RADIO_WHOLE_INC"
    inner_knob_ccw_function  = msfsEventFlag .. "COM_RADIO_FRACT_DEC"
    inner_knob_cw_function   = msfsEventFlag .. "COM_RADIO_FRACT_INC"
    button_function          = msfsEventFlag .. "COM_STBY_RADIO_SWAP"
    pressed_outter_knob_ccw_function = resetMode
    pressed_outter_knob_cw_function  = "KnobsterMode_NAV1"
    pressed_inner_knob_ccw_function  = resetMode
    pressed_inner_knob_cw_function   = "KnobsterMode_NAV1"
end
si_command_subscribe("KnobsterMode_COM1", KnobsterMode_COM1)
 
function KnobsterMode_NAV1(typecmd)
    
    ModeName = "Nav1_Mode"
    outter_knob_ccw_function = msfsEventFlag .. "NAV1_RADIO_WHOLE_DEC"
    outter_knob_cw_function  = msfsEventFlag .. "NAV1_RADIO_WHOLE_INC"
    inner_knob_ccw_function  = msfsEventFlag .. "NAV1_RADIO_FRACT_DEC"
    inner_knob_cw_function   = msfsEventFlag .. "NAV1_RADIO_FRACT_INC"
    button_function          = msfsEventFlag .. "NAV1_RADIO_SWAP"
    pressed_outter_knob_ccw_function = "KnobsterMode_COM1"
    pressed_outter_knob_cw_function  = "KnobsterMode_VS_FLC"
    pressed_inner_knob_ccw_function  = "KnobsterMode_COM1"
    pressed_inner_knob_cw_function   = "KnobsterMode_VS_FLC"
end
si_command_subscribe("KnobsterMode_NAV1", KnobsterMode_NAV1)
 
function KnobsterMode_VS_FLC(typecmd)   
    ModeName = "VS_FLC_Mode"
    outter_knob_ccw_function = msfsEventFlag .. "AP_VS_VAR_DEC"
    outter_knob_cw_function  = msfsEventFlag .. "AP_VS_VAR_INC"
    inner_knob_ccw_function  = msfsEventFlag .. "AP_SPD_VAR_DEC"
    inner_knob_cw_function   = msfsEventFlag .. "AP_SPD_VAR_INC"
    button_function          = msfsEventFlag .. "AP_NAV1_HOLD"
    pressed_outter_knob_ccw_function = "KnobsterMode_NAV1"
    pressed_outter_knob_cw_function  = "KnobsterMode_VOR1"
    pressed_inner_knob_ccw_function  = "KnobsterMode_NAV1"
    pressed_inner_knob_cw_function   = "KnobsterMode_VOR1"
end
si_command_subscribe("KnobsterMode_VS_FLC", KnobsterMode_VS_FLC) 

function KnobsterMode_VOR1(typecmd)  
     ModeName = "Course_Selection_Mode"
    
    outter_knob_ccw_function = msfsEventFlag .. "VOR1_OBI_DEC"
    outter_knob_cw_function  = msfsEventFlag .. "VOR1_OBI_INC"
    inner_knob_ccw_function  = msfsEventFlag .. "VOR2_OBI_DEC"
    inner_knob_cw_function   = msfsEventFlag .. "VOR2_OBI_INC"
    button_function          = msfsEventFlag .. "AP_NAV1_HOLD_ON"
    pressed_outter_knob_ccw_function = "KnobsterMode_VS_FLC"
    pressed_outter_knob_cw_function  = "KnobsterMode_COM2"
    pressed_inner_knob_ccw_function  = "KnobsterMode_VS_FLC"
    pressed_inner_knob_cw_function   = "KnobsterMode_COM2"
end
si_command_subscribe("KnobsterMode_VOR1", KnobsterMode_VOR1)    
         
function KnobsterMode_COM2(typecmd)
    
      ModeName = "COM2_Mode" 
    outter_knob_ccw_function = msfsEventFlag .. "COM2_RADIO_WHOLE_DEC"
    outter_knob_cw_function  = msfsEventFlag .. "COM2_RADIO_WHOLE_INC"
    inner_knob_ccw_function  = msfsEventFlag .. "COM2_RADIO_FRACT_DEC"
    inner_knob_cw_function   = msfsEventFlag .. "COM2_RADIO_FRACT_INC"
    button_function          = msfsEventFlag .. "COM2_RADIO_SWAP"
    pressed_outter_knob_ccw_function = "KnobsterMode_VOR1"
    pressed_outter_knob_cw_function  = "KnobsterMode_NAV2"
    pressed_inner_knob_ccw_function  = "KnobsterMode_VOR1"
    pressed_inner_knob_cw_function   = "KnobsterMode_NAV2"
end
si_command_subscribe("KnobsterMode_COM2", KnobsterMode_COM2)



function KnobsterMode_NAV2(typecmd)
    
    ModeName = "Nav2_Mode" 
    
    outter_knob_ccw_function = msfsEventFlag .. "NAV2_RADIO_WHOLE_DEC"
    outter_knob_cw_function  = msfsEventFlag .. "NAV2_RADIO_WHOLE_INC"
    inner_knob_ccw_function  = msfsEventFlag .. "NAV2_RADIO_FRACT_DEC"
    inner_knob_cw_function   = msfsEventFlag .. "NAV2_RADIO_FRACT_INC"
    button_function          = msfsEventFlag .. "NAV2_RADIO_SWAP"
    pressed_outter_knob_ccw_function = "KnobsterMode_COM2"
    pressed_outter_knob_cw_function  = resetMode
    pressed_inner_knob_ccw_function  = "KnobsterMode_COM2"
    pressed_inner_knob_cw_function   = resetMode
end
si_command_subscribe("KnobsterMode_NAV2", KnobsterMode_NAV2)
 
 

function KnobsterMode_G1000(typecmd)  
    
    ModeName = "G1000_Mode"
    
    outter_knob_ccw_function = msfsEventFlag .. "G1000_PFD_GROUP_KNOB_DEC"
    outter_knob_cw_function  = msfsEventFlag .. "G1000_PFD_GROUP_KNOB_INC"
    inner_knob_ccw_function  = msfsEventFlag .. "G1000_PFD_PAGE_KNOB_INC"
    inner_knob_cw_function   = msfsEventFlag .. "G1000_PFD_PAGE_KNOB_DEC"
    button_function          = msfsEventFlag .. "G1000_PFD_ENTER_BUTTON"
end
si_command_subscribe("KnobsterMode_G1000", KnobsterMode_G1000) 
 
function KnobsterMode_AutoPilot1(typecmd)
    ModeName                      = "AutoPilot1"
    outter_knob_ccw_function      = msfsEventFlag .. "AP_NAV1_HOLD" -- , AP_BC_HOLD
    outter_knob_cw_function       = msfsEventFlag .. "AP_HDG_HOLD" --AP_WING_LEVELER , AP_BC_HOLD
    inner_knob_ccw_function       = msfsEventFlag .. "TOGGLE_FLIGHT_DIRECTOR" --SYNC_FLIGHT_DIRECTOR_PITCH
    inner_knob_cw_function        = msfsEventFlag .. "AP_MASTER" -- AUTOPILOT_OFF, AUTOPILOT_ON
    pressed_outter_knob_ccw_function = resetMode
    pressed_outter_knob_cw_function  = "KnobsterMode_AutoPilot2"
    pressed_inner_knob_ccw_function  = resetMode
    pressed_inner_knob_cw_function   = resetMode
    button_function               = msfsEventFlag .. "HEADING_BUG_SET"
    
end
si_command_subscribe("KnobsterMode_AutoPilot1", KnobsterMode_AutoPilot1)

function KnobsterMode_AutoPilot2(typecmd)
    ModeName                      = "AutoPilot2"
    outter_knob_ccw_function      = msfsEventFlag .. "AP_WING_LEVELER" --seems to do nothing --
    outter_knob_cw_function       = msfsEventFlag .. "AP_ALT_HOLD"
    inner_knob_ccw_function       = msfsEventFlag .. "AP_AIRSPEED_HOLD"
    inner_knob_cw_function        = msfsEventFlag .. "YAW_DAMPER_TOGGLE" 
    pressed_outter_knob_ccw_function = resetMode
    pressed_outter_knob_cw_function  = "KnobsterMode_AutoPilot3"
    pressed_inner_knob_ccw_function  = resetMode
    pressed_inner_knob_cw_function   = resetMode
    button_function               = msfsEventFlag .. "HEADING_BUG_SET"
   
end
si_command_subscribe("KnobsterMode_AutoPilot2", KnobsterMode_AutoPilot2)

function KnobsterMode_AutoPilot3(typecmd)
    ModeName                      = "AutoPilot3"
    outter_knob_ccw_function      = msfsEventFlag .. "AP_ATT_HOLD"
    outter_knob_cw_function       = msfsEventFlag .. "AP_LOC_HOLD"
    inner_knob_ccw_function       = msfsEventFlag .. "AP_APR_HOLD"
    inner_knob_cw_function        = msfsEventFlag .. "AP_BC_HOLD"
    pressed_outter_knob_ccw_function = resetMode
    pressed_outter_knob_cw_function  = "KnobsterMode_VOR1"
    pressed_inner_knob_ccw_function  = resetMode
    pressed_inner_knob_cw_function   = resetMode
    button_function               = msfsEventFlag .. "HEADING_BUG_SET"
    
end
si_command_subscribe("KnobsterMode_AutoPilot3", KnobsterMode_AutoPilot3)


function HEADING_BUG_DEC_10(typecmd)
    for i = 10,1,-1 
    do 
       fs2020_event("HEADING_BUG_DEC")
    end
end
si_command_subscribe("HEADING_BUG_DEC_10", HEADING_BUG_DEC_10)

function HEADING_BUG_INC_10(typecmd)
    for i = 10,1,-1 
    do 
       fs2020_event("HEADING_BUG_INC")
    end
end
si_command_subscribe("HEADING_BUG_INC_10", HEADING_BUG_INC_10)

function AP_ALT_VAR_DEC_1000(typecmd)
    for i = 10,1,-1 
    do 
       fs2020_event("AP_ALT_VAR_DEC")
    end
end
si_command_subscribe("AP_ALT_VAR_DEC_1000", AP_ALT_VAR_DEC_1000)

function AP_ALT_VAR_INC_1000(typecmd)
    for i = 10,1,-1 
    do 
       fs2020_event("AP_ALT_VAR_INC")
    end
end
si_command_subscribe("AP_ALT_VAR_INC_1000", AP_ALT_VAR_INC_1000)

--AP_HDG_HOLD
function AP_HDG_HOLD(typecmd)
    --headingBeforeHdgHold = 
    --fs2020_event("AP_HDG_HOLD")
   
    --GPS WP NEXT ID	ID of next GPS waypoint	String	N	-
    --GPS WP NEXT ID	ID of previous GPS waypoint	String	N
    --GPS TARGET DISTANCE	Distance to target	Meters	N	-
    --GPS TARGET ALTITUDE	Altitude of GPS target	Meters	N	-	
    --GPS WP TRUE REQ HDG	Required true heading to waypoint	Radians	N
    --PLANE HEADING DEGREES TRUE	Heading relative to true north, although the name mentions degrees the units used are radians	Radians	Y	-
    --PLANE HEADING DEGREES MAGNETIC	Heading relative to magnetic north, although the name mentions degrees the units used are radians	Radians	Y
    --AIRSPEED TRUE	True airspeed	Knots	Y	-
    --VERTICAL SPEED	Vertical speed indication	Feet per second	Y
    --COM ACTIVE FREQUENCY:index	Com frequency. Index is 1 or 2.	Frequency BCD16	N	All aircraft
    --COM STANDBY FREQUENCY:index	Com standby frequency. Index is 1 or 2.	Frequency BCD16	N	All aircraft
    --GPS ETE	Estimated time enroute to destination	Seconds	N	-
    --GPS ETA	Estimated time of arrival at destination	Seconds	N	-
    --GPS FLIGHT PLAN WP COUNT	Number of waypoints	Number	N	-	
end
si_command_subscribe("AP_HDG_HOLD", AP_HDG_HOLD)

--function test(altitude)
   -- Prints the altitude in the debug window
--   print("test: " .. altitude)
-- end

 -- subscribe to FS2020 variable
 --fs2020_variable_subscribe("GPS WP NEXT ID", "String", test)
 --fs2020_variable_subscribe("GPS TARGET DISTANCE", "Meters", test)
 --fs2020_variable_subscribe("PLANE HEADING DEGREES TRUE", "Radians", test)
 --fs2020_variable_subscribe("GPS FLIGHT PLAN WP COUNT", "Number", test)
Last edited by robertwaite on Mon Sep 28, 2020 2:36 pm, edited 3 times in total.

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

Re: Looking to add physical buttons to select what the Knobster will control.

#8 Post by jph »

Hi Robert, I have never had need for, or used the knobster, but it seems you are making great inroads to a super solution for a long standing issue with VR.
I also have tried VR, but never wanted it or preferred it over my main physical / multi monitor cockpit project. But of course, things are moving on rapidly.
What headset are you using ? and also - what are your ideas for operating switches etc ? I can see how a simple approach to stepping through rotary solutions is excellent (and of course you can have a simple readout as to which function is selected in your approach to the problem (excellent :) !) .. but again, what about plain old switches ? what ideas do you have ?
Great work, keep it up. :D

Also, it is great to use the </> solution (check the icons above the post window) to embed your code in your post - it makes it much easier to read. If any issues with that, search the forums. Even 'seasoned' users have proven to have issues with that. ;)
Nice work.
Joe
Joe. CISSP, MSc.

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

Re: Looking to add physical buttons to select what the Knobster will control.

#9 Post by Keith Baxter »

Hi @robertwaite

Please edit your post and place the code within the code box. Click on the </> icon. It will make your post so much cleaner and easier to read and comment on.

Thank you

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
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Looking to add physical buttons to select what the Knobster will control.

#10 Post by Keith Baxter »

Awesome @robertwaite

Thank you, The main reason is so that we can select all and past into a test instrument. That way we can test and see exactly what you are doing.
I have not had the time to go through what you are doing. But your concept looks interesting.

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 

Post Reply