Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Certainly something similar was already mentioned here in the forum- Is there a possibility that an axis can be assigned to a potentiometer in the cockpit? I've been trying to assign axes or buttons to the potentiometer for the cockpit lighting for a long time. I always use fsuipc for all controls and aircraft, of course profile-related. can you help ? Thanks, joeair

Posted
52 minutes ago, JoeAir said:

Is there a possibility that an axis can be assigned to a potentiometer in the cockpit?

How are you connecting your potentiometer to the computer? If you wired it through something like a Leo Bodnar BU0836 card then connect that to the PC via USB, it will be seen as an axis by both Windows and FSUIPC, and you can assign it as you like.

I don't know about cockpit lighting though. I don't know of a simulated aircraft which has adjustable cockpit lighting, so perhaps you are talking about controlling real lighting in your built cockpit using some control in FSUIPC, but in that case I can't see where a potentiometer comes into it. You need a DtoA (digital to analogue) ciruit instead?

Perhaps you could explain in a little more detail exactly what it is you are trying to achieve?

Pete

 

 

 

Posted

Thanks for answer, it's a lot easier. The 3 axes of the ch flightsim yoke are not used and I want to use them for the cockpit lighting. No self-made card. In the fsuipc log, I think I remember, that the variable lights_potentiometer_set appears when the poti is operated in the cockpit. I can say more precisely this evening if neede. There is apparently no direct axis assignment.  JoeAir

Cockpitlights.JPG

Posted
41 minutes ago, JoeAir said:

I think I remember, that the variable lights_potentiometer_set appears when the poti is operated in the cockpit.

Ah, so it is a facility in a simulated aircraft, not in your own cockpit, and a simulated potentiometer not a real one you are connecting!  Which aircraft is that?

Isn't this "lights_potentiometer_set" control listed for assignment in the drop down for axes? All controls ending in "_set" should be. Otherwise I'll have to ask John to look.

Pete

 

Posted
3 minutes ago, Pete Dowson said:

Isn't this "lights_potentiometer_set" control listed for assignment in the drop down for axes? All controls ending in "_set" should be. Otherwise I'll have to ask John to look.

The LIGHT_POTENTIOMETER_SET control/event are currently not flagged as axes controls. I can add/flag this as an axis control so that it is available in the axes assignments drop-down. Presumably this also applies to the LIGHT_POTENTIOMETER_*_SET (where * is 1,2,3..30), which I can also add.

I'll post a version for you to try with this added later today....

John

Posted
1 hour ago, John Dowson said:

The LIGHT_POTENTIOMETER_SET control/event are currently not flagged as axes controls.

yes, thats it- it isn't listed as axis. When you can add it, would be big step for me and what i heard, for others too.

1 hour ago, John Dowson said:

LIGHT_POTENTIOMETER_*_SET

i have never seen it before in any cockpit. If you want, i will go through all planes if any uses those "n_set"

To answer Pete's question, it is the Mooney M20R from Carenado.

Thank you, JoeAir

Posted
2 hours ago, John Dowson said:

I'll post a version for you to try with this added later today....

Please try the attached version, v7.2.0b: FSUIPC7.exe

I have only added the Light Potentiometer Set control. I will add the specific number ones (1-30) if/when requested.

John

Posted

Hi, a tried it out, but it doesn't adjust the panel light.
What i did:

Pic 01- you see, in FSUIPC I set the ch yoke axis to normal axis
Pic 02- what the log shows when moving the ch yoke axis
Pic 03- what the log shows when turning the potentiometer in the cockpit

Added 22 minutes later:

is the same at Carenado and MS Planes.

Axis Light_01.JPG

Axis Light 02.JPG

Axis Light 03.JPG

Posted

It is not possible to tell what is happening for screen shots. Please attach your FSUIPC7.log and FSUIPC7.init files. We ALWAYS need to see these to lookl at such issues, not screen shots - they nearly always turn out to be useless.

Posted

You logs show the control is being sent with the correct axis parameter, although the axis isn't moving that much:

Quote

 1796704 FS Control Sent: Ctrl=67227, Param=-15083 LIGHT_POTENTIOMETER_SET
  1796719 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -15083 (0xffffc515) LIGHT_POTENTIOMETER_SET
  1797407 FS Control Sent: Ctrl=67227, Param=-14433 LIGHT_POTENTIOMETER_SET
  1797422 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -14433 (0xffffc79f) LIGHT_POTENTIOMETER_SET
  1797422 FS Control Sent: Ctrl=67227, Param=-14173 LIGHT_POTENTIOMETER_SET
  1797438 FS Control Sent: Ctrl=67227, Param=-13783 LIGHT_POTENTIOMETER_SET
  1797438 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -14173 (0xffffc8a3) LIGHT_POTENTIOMETER_SET
  1797438 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -13783 (0xffffca29) LIGHT_POTENTIOMETER_SET
  1797469 FS Control Sent: Ctrl=67227, Param=-13523 LIGHT_POTENTIOMETER_SET
  1797485 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -13523 (0xffffcb2d) LIGHT_POTENTIOMETER_SET
  1797485 FS Control Sent: Ctrl=67227, Param=-13003 LIGHT_POTENTIOMETER_SET
  1797500 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -13003 (0xffffcd35) LIGHT_POTENTIOMETER_SET
  1797516 FS Control Sent: Ctrl=67227, Param=-12743 LIGHT_POTENTIOMETER_SET
  1797532 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -12743 (0xffffce39) LIGHT_POTENTIOMETER_SET
  1797547 FS Control Sent: Ctrl=67227, Param=-12483 LIGHT_POTENTIOMETER_SET
  1797563 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -12483 (0xffffcf3d) LIGHT_POTENTIOMETER_SET
  1797563 FS Control Sent: Ctrl=67227, Param=-12223 LIGHT_POTENTIOMETER_SET
  1797579 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -12223 (0xffffd041) LIGHT_POTENTIOMETER_SET
  1797625 FS Control Sent: Ctrl=67227, Param=-11963 LIGHT_POTENTIOMETER_SET
  1797641 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -11963 (0xffffd145) LIGHT_POTENTIOMETER_SET
  1797922 FS Control Sent: Ctrl=67227, Param=-12223 LIGHT_POTENTIOMETER_SET
  1797938 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -12223 (0xffffd041) LIGHT_POTENTIOMETER_SET
  1798047 FS Control Sent: Ctrl=67227, Param=-12483 LIGHT_POTENTIOMETER_SET
  1798047 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -12483 (0xffffcf3d) LIGHT_POTENTIOMETER_SET
  1798672 FS Control Sent: Ctrl=67227, Param=-12223 LIGHT_POTENTIOMETER_SET
  1798688 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -12223 (0xffffd041) LIGHT_POTENTIOMETER_SET
  1798766 FS Control Sent: Ctrl=67227, Param=-11963 LIGHT_POTENTIOMETER_SET
  1798766 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -11963 (0xffffd145) LIGHT_POTENTIOMETER_SET
  1799250 FS Control Sent: Ctrl=67227, Param=-12223 LIGHT_POTENTIOMETER_SET
  1799266 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -12223 (0xffffd041) LIGHT_POTENTIOMETER_SET
  1799407 FS Control Sent: Ctrl=67227, Param=-12483 LIGHT_POTENTIOMETER_SET
  1799407 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -12483 (0xffffcf3d) LIGHT_POTENTIOMETER_SET
  1802344 FS Control Sent: Ctrl=67227, Param=-12743 LIGHT_POTENTIOMETER_SET
  1802360 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -12743 (0xffffce39) LIGHT_POTENTIOMETER_SET
  1818204 FS Control Sent: Ctrl=67227, Param=-13003 LIGHT_POTENTIOMETER_SET
  1818219 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= -13003 (0xffffcd35) LIGHT_POTENTIOMETER_SET
 

And you also have the same control set to a button with a fixed parameter of 5 for some reason:

Quote

  2178454 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= 3 (0x00000003) LIGHT_POTENTIOMETER_SET
  2181219 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= 3 (0x00000003) LIGHT_POTENTIOMETER_SET
  2181875 ***  AXIS: Cntrl= 67227 (0x0001069b), Param= 3 (0x00000003) LIGHT_POTENTIOMETER_SET

On fact, you have multiple assignments to LIGHT_POTENTIOMETER_SET in the profile you use for the Carenado Mooney:

Quote

35=RB,0,C67227,5     -{LIGHT_POTENTIOMETER_SET}-
36=RB,1,C66894,0     -{LIGHT_POTENTIOMETER_INC}-
37=UB,0,C0,0     -{Custom control: <0>}-
38=UB,1,C66894,0     -{LIGHT_POTENTIOMETER_INC}-
...
 

1=BX,256,F,67227,0,0,0    -{ TO SIM: LIGHT_POTENTIOMETER_SET }-
2=BY,256,F,65765,0,0,0    -{ TO SIM: AXIS_THROTTLE_SET }-
3=BZ,256,F,67227,0,0,0    -{ TO SIM: LIGHT_POTENTIOMETER_SET }-
4=GX,256,F,65763,0,0,0    -{ TO SIM: AXIS_AILERONS_SET }-
5=GZ,256
6=GZ,B,0,0,67227,5    -{ Entering=LIGHT_POTENTIOMETER_SET }-

Why assigned in so many places?

Anyway, can you generate one more log. This time, please don't start a new log file - its far easier for me if you give me one full log file, not continuation log files (I think I'm going to remove this facility). For this log, just load your aircraft, and move a single axis to, which you have assigned LIGHT_POTENTIOMETER_SET , through its full range forwards then backwards. We can then see the parameters being sent with that control when you operate it through its full range. 

Posted

Thank you for patience,

Sorry, I had a mess with 8 log files. First I tried axes, then switches and others.
Today I deleted all logs and assigned only the ch yoke axis with a fresh ini and one log.
Once the poti in the cockpit had moved briefly, but only in one direction of rotation.
I notice that the type param = with the yoke axis is 5 digits, when I turn it in the cocpit it is 1 digit param = 5.

FSUIPC7.logFSUIPC7.ini

Posted
2 minutes ago, JoeAir said:

Sorry, I had a mess with 8 log files. First I tried axes, then switches and others.
Today I deleted all logs and assigned only the ch yoke axis with a fresh ini and one log.
Once the poti in the cockpit had moved briefly, but only in one direction of rotation.

Ok. The log shows that the axis is assigned and sending the correct axis value.

3 minutes ago, JoeAir said:

I notice that the type param = with the yoke axis is 5 digits, when I turn it in the cocpit it is 1 digit param = 5.

If thats the case, then it doesn't look like this us a real axis control. What happens if you assign to a button with parameter 5 - does that work at all?

You could try to see if there are any available lvars that you could use - try listing them using the Add-ons->WASM->List Lvars menu entry, and see if any look applicable, Then change in the UI, and list again to see the new values. If you find something that looks like it controls the lighting. Then, you can test this by changing the value of the lvar using the WASM0>Set Lvar... menu option. if you find an lvar that works, I can then show you how to use this.

Otherwise, you may want to ask how this works and how to control on the Carenado forums. I dont have this add-on so its difficult to advise.

 

  • 7 months later...
Posted

John / Pete,

There are a couple of opportunities to submit via execute calculator code a value for those dimmers.

See documentation for the glareshield dimmers: https://docs.flybywiresim.com/pilots-corner/a32nx-briefing/a32nx_api/#glareshield

So for instance for the FlyByWire A32nx there are plenty of indexed light potentiometers out of the range 1-30.
They are addressed via Calculator Code

@ 10.23 / 50 max 100 min 85 (>K:2:LIGHT_POTENTIOMETER_SET)

for instance means "Set the 'Integrated main Panel and Pedestal Lights' (Index 85) to 50% of its maximum brightness".

image.png.6c86c8923dd05a0e88ab015f1b449153.png
 

I think what would help a lot of the cockpit builders is to have a function available in FSUIPC to send a value to a executeCalculatorCode function from an analogue input.

So something like 

@ 10.23 / %val% max 100 min 85 (>K:2:LIGHT_POTENTIOMETER_SET)

where %val% would just insert what FSUIPC reads from the analogue input.

so something like:
image.png.0c4ec725f3b8fefe564ce14caa570bf2.png
Would avoid that you need to add each and everything into your code and offer the ability to access even more stuff from FSUIPC (licensed of course 🙂

Could that be an option? I'm sure I'd not be the only one really looking forward for something like that.

Posted
14 hours ago, joeherwig said:

Could that be an option? I'm sure I'd not be the only one really looking forward for something like that.

I have other ideas planned to allow parameterized calculator code to be used. Unfortunately, at the moment all my time is being taken by support (and keeping up with MSFS and P3D releases) and I have very little, if any, spare time at the moment to look into this. Hopefully I will get a chance to investigate this later this year.

For the time being, you can achieve what you propose relatively easily using lua. If you write the axis value to an FSUIPC offset ('Send to FSUIPC Offset' checkbox), you can have a lua script that monitors that offset (using the event.offset function) and then in the handling function construct the calculator code string and use ipc.execCalcCode function to execute.

John

Posted

Great to hear that you had such an flexible addition already in mind.

It's so valuable to have so engaged people in the community! 

Kudos! 

I'll check your proposal. It sounds promising. 

Posted

So...
Tried to get it running with

-- Dimmer values
function setDimmer(offset, value)
    -- inverted connected potentiometer so -16384 is max while 16384 is provided as min. 🤦
    percentValue = tostring(100 - round((value + 16384) / 327.68))
    _log(".---. ".. tostring(offset) .. " in %: " .. " " .. percentValue .. " %" )
    if (offset == 26304) then
        _log(".-.-.-.- Cpt. PFD brt " .. percentValue .. " %" )
        ipc.execCalcCode("@ 10.23 / " .. percentValue .. " max 100 min 88 (>K:2:LIGHT_POTENTIOMETER_SET)")
    elseif (offset == 26305) then
        _log(".-.-.-.- Cpt. MFD brt " .. percentValue .. " %" )
        ipc.execCalcCode("@ 10.23 / " .. percentValue .. " max 100 min 89 (>K:2:LIGHT_POTENTIOMETER_SET)")
    end
end

-- registering Dimmer value changed events for offsets
event.offset(x66C0, "SD", "setDimmer") -- Cpt. PFD brt on x66C0
event.offset(x66C1, "SD", "setDimmer") -- Cpt. MFD brt on x66C1

And it fires correctly the events. and regarding the documentation i wanted to run it for multiple events

Quote

"The function is called with the offset, so that the same
function can, if desired, be used for more than one such event,
and also the current (new) value in that offset."


No matter which potentiometer i turn, i get always both events fired.
And if i log from within the called function, the offset is always converted to decimal (which would not be a problem if afterwards the lua would fetch it right.)

If i run it (slightly converted from _log to print) it seems to be fine...
see: jdoodle.com/ia/m6y or https://www.jdoodle.com/iembed/v0/m6y

Probably one of you has an hint, what's wrong with my code...

 

Posted
17 hours ago, joeherwig said:
-- registering Dimmer value changed events for offsets
event.offset(x66C0, "SD", "setDimmer") -- Cpt. PFD brt on x66C0
event.offset(x66C1, "SD", "setDimmer") -- Cpt. MFD brt on x66C1

You are reading the values as a signed double, which us 4 bytes, but your offsets are only spaced by 1 byte, so they are overwriting each other.
How are you writing them? If writing them as Dwords (32-bit, 4 bytes) then if the first is at offset 0x66C0, the next should go at 0x66C4 and not 0x66C1.

John

  • 3 weeks later...
Posted

Hi John,

Got it well running for all light potentiometers with at least acceptable code style. Before we map that into our A32nx LINDA module and add the documentation i have one question. 

When i was trying to concat the calculator codes to use one potentiometer axis for multiple dimmers, it was working fine until i reached the 255 character limits.
Is that something limited by MS/Asobo within the SDK or is that a limit in FSUIPC?

Any chances to open up that limit?

Thanks a lot and all the best,

            Joe

Posted
12 hours ago, joeherwig said:

Is that something limited by MS/Asobo within the SDK or is that a limit in FSUIPC?

It is a limit imposed by the WASM / WAPI modules, which are part of FSUIPC.

12 hours ago, joeherwig said:

Any chances to open up that limit?

Sure - would 512 bytes enough? I could increase to anything up to 8k, which is the limit on Client Data Area sizes in the MSFS SDK.

John

Posted

Hi John,

If we could have the option of up to 8k without causing any further issues (like FPS drops) it would be better then 512 chars of course to be future proof. 🙂
Whether it is FPS relevant i cannot judge of course.

Thanks for you fast reply and best regards,

        Joe

Posted
4 minutes ago, joeherwig said:

If we could have the option of up to 8k without causing any further issues (like FPS drops) it would be better then 512 chars of course to be future proof. 🙂
Whether it is FPS relevant i cannot judge of course.

It would just use more memory. 8k isn't much these days, but I would be reluctant to use such a high value when this would just be unused for 99% of people.

For the next release, it will be 512bytes. After that, when I have time, I will look into allowing this to be controlled via a user (i.e. ini) parameter.

John

Posted

OK. So for the potentiometers we need ~ 64 chars per dimmer.
Distinguishing for instance between displays (12x 65 = 780 chars) and integrated / flood lights (7x remaining lights potentiometers)

1k should be fully enough imho and also only require two or three analog axes. And for those building more elaborate homecockpits, you can be sure, they're going to assign everything direcly and won't join.

So imho 1k should be enough for the moment.

Posted
1 hour ago, joeherwig said:

So imho 1k should be enough for the moment.

Ok, but I don't understand why you would need to send so much in one calculator code statement...

I will set the limit to 1k in the next release. That should be sufficient for most use - for example, the longest calculator code statement in the MF events.txt file is just short of 800 characters.

John

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.