The simFlight Network Forums

Setting Spoilers/Speedbrakes via Offset 0BD0

Recommended Posts

Hi all,

I'm working with Jason Fayre on the Talking Flight Monitor project, the accessibility add-on for FSX and Prepar3d. One of our users asked for the ability to set spoilers/speedbrakes to an arbitrary percentage; in the sim, the keyboard command (slash key by default) either sets them to full or off, with no way to fine-tune their extension. The notes for the offset (0BD0) say that a value of 4800 is armed, but that 5620 is the minimum you can set that actually causes extension. 5620 is 7% extended, and 16383 is 100%. I'm fairly good at math, but I'm confused by the snippet that says: "The percentage extension is the proportion of the distance in the range 4800 to 16383..." I can't figure out, for the life of me, a good formula that can be used to convert an arbitrary percentage value into the value to write to the offset. I consider myself a decent coder, but the way FSUIPC and SimConnect represent things can sure make for some difficult calculations. :) Any help would be greatly appreciated.

Thanks,

Tyler

Share on other sites

3 hours ago, TRodick said:

I can't figure out, for the life of me, a good formula that can be used to convert an arbitrary percentage value into the value to write to the offset.

As it says, 5620 is 7% and 16383 is 100% (well, on the ground -- bear in mind that in flight the maximum the spoiler really goes to is about 70 or 80% (don't remember which). In the latter case it is known as "speedbrake" rather than "spoiler").

So, if you want x% then if x < 7, don't bother.

Otherwise, consider 93% is spread over (16383 - 5620) points in this scale.  So 1% = 10763 / 93 = 115.73, near enough.

So for x% where x >7, you'd use 5620 + ((x - 7) * 115.73), rounded down to an integer.

3 hours ago, TRodick said:

I consider myself a decent coder, but the way FSUIPC and SimConnect represent things can sure make for some difficult calculations. 🙂

It's really neither FSUIPC nor SimConnect, just the way that axis works internally.

Note that this is not the same in MSFS.

Pete

Share on other sites

You said round down to an integer. Are you saying follow the standard math rounding rules, or a simple truncation?

Share on other sites

9 hours ago, TRodick said:

You said round down to an integer. Are you saying follow the standard math rounding rules, or a simple truncation?

Sorry it wasn't clear. "Rounding down" is the same as truncation if you mean just discarding the fractional part.

Pete

Share on other sites

• 8 months later...

Hi, I'm trying to use a potentiometer to set spolier and flap values on the A320 Aerosoft n FSX. First I tried to SPOILER using the formula "Max(0, Min(16383, (@ - 16) * 16383 / (1023 - 16)))" In Mobiflight OFFSET. Used with offset "0BD0" for Spolier. Testing with Aerosoft A320 didn't work, but when switching aircraft like FSX's standard Boeing or Airbus it worked perfectly. Now this same formula used to actuate the FLAP in Airbus A320 Aerosoft changing only the OFFSET "0BDC" worked perfectly to actuate the flaps. Checking the documentation I see there is an instruction to use OFFSET "OBDO" "Spoilers control, 0 off, 4800 arm, then 5620 (7%) to 16383 (100% fully deployed)...". I don't know how to implement this code. I would be grateful if someone can help me.

Share on other sites

On 8/20/2021 at 3:06 PM, Thiago Duarte said:

Checking the documentation I see there is an instruction to use OFFSET "OBDO" "Spoilers control, 0 off, 4800 arm, then 5620 (7%) to 16383 (100% fully deployed)...". I don't know how to implement this code. I would be grateful if someone can help me.

That's normally done by calibrating the spoiler axis. Isn't your potentiometer seen as a joystick axis? If not, how are you reading it?

The 4800 value for "arm" is a built-in FS/P3D value. You'd normally calibrate a region of the axis movement so that you can guarantee to set ARM when the lever is in the ARM detente.

I don't understand how your formula relates to the potentiometer input. What values do you get from that?

If you are writing to 0BDC for flaps then one would expect Aerosoft to respect 0BD0 for the spoilers. If not, what are you supposed to use?

Pete

Share on other sites

15 hours ago, Pete Dowson said:

That's normally done by calibrating the spoiler axis. Isn't your potentiometer seen as a joystick axis? If not, how are you reading it?

The 4800 value for "arm" is a built-in FS/P3D value. You'd normally calibrate a region of the axis movement so that you can guarantee to set ARM when the lever is in the ARM detente.

I don't understand how your formula relates to the potentiometer input. What values do you get from that?

If you are writing to 0BDC for flaps then one would expect Aerosoft to respect 0BD0 for the spoilers. If not, what are you supposed to use?

Pete

First, I appreciate the answer to my question, and I apologize for not asking a complete question. Let's do it now.
Simulator: FSX
Aircraft: Airbus Aerosoft A320
Hardware Used for Integration: Arduino Mega 2560 + Potentiometer 10k
Communication Software: Mobiflight

In this configuration, I have no way to calibrate the spoiler directly in FSUIPC, because the Arduino is not recognized as a USB JOYSTICK. That's why I need to use MOBIFLIGHT.

My potentiometer returns the value 13 - 1023 which using @ it returns the value 0 - 16383 which is used in OFFSET to interact with FSX.
I have just sited an example that this same code works in another option, to reinforce that the Arduino + Potentiometer + Mobiflight + FSUIPC + FSX interaction are going well. In this case, the aforementioned formula took the value of the potentiometer and converted it to the range used in FSX, changing only the OFFSET to test with FLAP and everything went perfectly. Now when I return the offset to 0BD0 (SPOILER) I have no success. It appears that something is preventing it from extending and moving the spoiler lever. As I also said, this same code for the spoiler works on STANDARD FSX aircraft like Airbus and Boeing.

I believe it has something to do with this range from 4800 to 5619, and when the potentiometer value goes through it, it must be going into the range of spoiler armed function and thus blocks the operation of the spoiler lever.

Grateful for the attention.

Thiago Duarte

Share on other sites

5 hours ago, Thiago Duarte said:

In this configuration, I have no way to calibrate the spoiler directly in FSUIPC, because the Arduino is not recognized as a USB JOYSTICK. That's why I need to use MOBIFLIGHT.

I'm afraid I know nothing at all about MOBIFLIGHT.

5 hours ago, Thiago Duarte said:

Now when I return the offset to 0BD0 (SPOILER) I have no success. It appears that something is preventing it from extending and moving the spoiler lever. As I also said, this same code for the spoiler works on STANDARD FSX aircraft like Airbus and Boeing.

That sounds like that particular aircraft does its own thing, ignoring the built-in FS spoiler logic.

5 hours ago, Thiago Duarte said:

I believe it has something to do with this range from 4800 to 5619, and when the potentiometer value goes through it, it must be going into the range of spoiler armed function and thus blocks the operation of the spoiler lever.

No.  That cannot be if the FS spoiler logic is used. To start with, if you try to test on the ground then as soon as the value 4800 is passed the spoiler will fully deploy, just as they would when you land with armed spoilers. All that is different for spoilers compared to other flight controls is that the range 0 to 4799 does nothing.

Note that even with your raw axis values you can calibrate spoilers in FSUIPC by writing the value to 3BB2 (or in fact any of the offsets 3BA8 to 3BC4).  Then FSUIPC will detect is as if it was a USB joystick interface, allowing you to calibrate it properly. Then you wouldn't need your formula.

However, it sounds like that aircraft takes no notice of the FS spoiler. You need to find out (from documentation of the author) what you can use. Maybe you need to assign it directly to Axis_Spoiler_Set and not calibrate. That would deal with it assuming the aircraft logic traps the control directly, but then you'll need your formula applied.

Pete

Share on other sites

17 hours ago, Pete Dowson said:

I'm afraid I know nothing at all about MOBIFLIGHT.

That sounds like that particular aircraft does its own thing, ignoring the built-in FS spoiler logic.

No.  That cannot be if the FS spoiler logic is used. To start with, if you try to test on the ground then as soon as the value 4800 is passed the spoiler will fully deploy, just as they would when you land with armed spoilers. All that is different for spoilers compared to other flight controls is that the range 0 to 4799 does nothing.

Note that even with your raw axis values you can calibrate spoilers in FSUIPC by writing the value to 3BB2 (or in fact any of the offsets 3BA8 to 3BC4).  Then FSUIPC will detect is as if it was a USB joystick interface, allowing you to calibrate it properly. Then you wouldn't need your formula.

However, it sounds like that aircraft takes no notice of the FS spoiler. You need to find out (from documentation of the author) what you can use. Maybe you need to assign it directly to Axis_Spoiler_Set and not calibrate. That would deal with it assuming the aircraft logic traps the control directly, but then you'll need your formula applied.

Pete

Hello Pete, I come here to say that after days of research and effort to make the spoiler work with the Pontenciometro in the informed configuration, after your help I managed to solve my problem. I'm learning a lot with this challenge that is being the Aerosoft Airbus, every part I try to develop it preaches a joke to me, lol. I confess that until then I was unaware of the use of offset with fsuipc, and with this function as you showed me I had never used it. So after reading your help I started doing some tests and after many tries everything is perfect. Thank you very much.

Thiago Duarte

Share on other sites

• 7 months later...
On 8/25/2021 at 4:02 AM, Thiago Duarte said:

So after reading your help I started doing some tests and after many tries everything is perfect. Thank you very much.

Thiago Duarte

HI,

yes but you didn't write the solution, also i'm struggling with the spoiler, with arduino, mobiflight, prosim and p3d.... with the offsets 0BCC and 0BD0. they don't work even if i set 4800 or 5620... nothing to do, while it moves with 0366 only ch the servomotor remains in tension and so i can't close it by hand to free it i have to take the wheels off the ground again. . those of prosim do not answer or do not know anything.... those of mobiflight worse ... but if you have succeeded please show me how you have set mobiflight.... I took 3 weeks to set the 2 throttle.... but the spoiler still no ...

regards

max

Share on other sites

3 minutes ago, masmaz said:

i'm struggling with the spoiler, with arduino, mobiflight, prosim and p3d.... with the offsets 0BCC and 0BD0. they don't work even if i set 4800 or 5620.

I tested this today with ProsimB737, version 3.16B24 (almost the latest).

My spoiler is assigned as an axis in ProSim, with the calibration, including the ARM position, done in ProSim. I logged the offsets 0BCC and 0BD0 and they were being updated correctly whilst I manipulated the spoiler lever.

So, you certainly should be able to use those offsets to drive your spoiler motor.

Pete

Share on other sites

43 minutes ago, Pete Dowson said:

Pete

Hi, Pete, thanks for your reply, but i can assure you that there is no way to move this damned lever with those offsets 0BCC and 0BD0

in prosim configured with FSUIPC U32 and 4 Byte on mobiflight... on the plane they rise but the lever does not move...

the rest of the setting is 0/16383. or 4800/16383.... nothing to do....

the throttle works perfectly with the addition of 2 relays to free the servomotors and move them in manual... but the lever nothing to do...

to mobiflight

Share on other sites

19 hours ago, masmaz said:

in prosim configured with FSUIPC U32 and 4 Byte on mobiflight

Sorry, I don't understand this part. Isn't your spoiler lever a normal joystick axis which you can assign directly, and calibrate, in ProSim?

19 hours ago, masmaz said:

I use my hand. It isn't motorized.

I don't know MobiFlight. But why are you not assigning in ProSim? Version 3 or ProSim really does need all control axes assigned and calibrated directly in its config.

Pete

Share on other sites

1 hour ago, Pete Dowson said:

Sorry, I don't understand this part. Isn't your spoiler lever a normal joystick axis which you can assign directly, and calibrate, in ProSim?

yes sure, if you see the image I attached there is the part of the joystick axis and under the FSUIPC configuration

Quote

I don't know MobiFlight. But why don't you check ProSim? Version 3 or ProSim really needs all control axes assigned and calibrated directly in its configuration.
Peter

but all the axes of the TQ are configured in prosim, but put the motors, you manage it either with SIOC or with Mobiflight + Arduino that manages the mechanical part and the movement together with prosim, I have attached the images of how it is configured .. for more last night I think I found the solution ...

max

Share on other sites

2 hours ago, Pete Dowson said:

Pete

ok the solution is to use 2 offsets on mobiflight:

on Mobiflight: Arm 0BCC Byte 4, 4800/16383
on Prosim: FSUIPC 32 bit U 0x0BCC

on Mobiflight: Ground 0366 Byte 2, 0/16383

this way, when the wheels touch, the spoilers rise and the lever moves, the servo remains free to be moved by hand...

to be more precise

0BCC in arm sets to 1
0366 in arm stays at 0

when touching the ground. 0BCC goes to 0 0366 goes to 1

max

Share on other sites

22 hours ago, masmaz said:

if you see the image I attached there is the part of the joystick axis and under the FSUIPC configuration

One of the images you attached showed that you assigned the ProSim servo control to offset 0BCC. But 0BCC is just a boolean flag, values 0 or 1, indicating whether the speedbrake is armed or not. How do you expect your servo to move to positions 0 and 1? Even if it did move you would hardly see it.

0BCC and 0BD0 are set by the sim according to the axis position. I don't know anything about ProSim's assignable servo output, but surely it should go to a separate user offset, like those in the 66C0 range.  Maybe offset 0BCC will work, if ProSim drives the default speedbake. Certainly 0BCC is being set correctly here -- I don't have anything assigned to it in ProSim. I suspect assigning the Server output to 0BCC as well may cause conflicts with the Sim also setting it.

You said:

20 hours ago, masmaz said:

ok the solution is to use 2 offsets on mobiflight:

on Mobiflight: Arm 0BCC Byte 4, 4800/16383
on Prosim: FSUIPC 32 bit U 0x0BCC

But you are using 0BCC, which is 0 for not-armed, 1 for armed. Surely you need the lever position, which is in 0BD0, or, better, a user offset, as I said.

I don't understand why Mobiflight needs the 'on ground' offset.  When the speedbrake is armed the detection of ground is automatic in the speedbrake operation. That's the whole point or arming it.

Pete

Share on other sites

Pete I don't know how, let alone why, but if you want I'll show you a video that with this configuration when the wheels touch the ground it moves and the spoiler lifts...

max

Share on other sites

1 hour ago, masmaz said:

I'll show you a video that with this configuration when the wheels touch the ground it moves and the spoiler lifts...

Yes, I saw the video you posted in User Contributions. The lever is only moving a little. Surely you need the actual position of the lever -- offset 0BD0?

If not, then, sorry,  I don't know what ProSim and Mobiflight are doing. Surely for the throttles you use the throttle position, bot just a flag saying whether there's some thrust?

Pete

Create an account

Register a new account