AlMassimo Posted Sunday at 07:27 PM Report Posted Sunday at 07:27 PM Hello, I am trying to use the calculator code in myevents.txt in order to write the controls for pmdg 737. I created a simple myevents.txt under the FSUIPC directory. This is the content of the file : B737SPDDEC#38408 (>K:ROTOR_BRAKE) B737SPDINC#38407 (>K:ROTOR_BRAKE) B737HDGDEC#39008 (>K:ROTOR_BRAKE) B737HDGINC#39007 (>K:ROTOR_BRAKE) I have an (old!) opencockpits MCP V3, so I must use SIOC to control its functions. This is the part of the code that should activate the first 2 events // AP ENCODERS -------------------------------------------------------- var 0171, name E_SPD, Link IOCARD_ENCODER, Input 0, Aceleration 2, Type 2 { IF &E_SPD = 1 { &FS_PAR = 1 &FS_CONTROL = 4194304 &FS_CONTROL = DELAY 0 10 } ELSE { IF &E_SPD = -1 { &FS_PAR = 1 &FS_CONTROL = 4194305 &FS_CONTROL = DELAY 0 10 } } } But when I move the SPD encoder nothing happens. The same for the HDG encoder. I opened the .log file and I can find nothing about myevents.txt, and also the console doesn't show any activity when rotating the encoders (I activate logging of the events and I can see all other events). What am I doing wrong ? Did I miss something ? I hope that someone can help me. (BTW I solved the problem using LUA, but it seem to have a great lag so it's a pain to set the values rotating the encoders, maybe this also can be improved setting some params but I have no clue) Thanks for helping me Massimo
ark1320 Posted Sunday at 10:27 PM Report Posted Sunday at 10:27 PM 4 hours ago, AlMassimo said: Hello, I am trying to use the calculator code in myevents.txt in order to write the controls for pmdg 737. I don't understand the above because I think the rotor K-event refers to a helicopter rotor, not some aspect of a B737. But I am not familiar with Open Cockpits equipment and maybe they have "repurposed" that K event somehow. Regardless, the FS2020 SDK says the below (and the FS2024 SDK says something similar). So maybe try (K:ROTOR_BRAKE_ON) in place of (K:ROTOR_BRAKE) if some type of rotor brake event is really what you need to use.
AlMassimo Posted yesterday at 09:38 AM Author Report Posted yesterday at 09:38 AM All controls for PMDG 737 are sent by a parameter associated to the K:ROTOR_BRAKE command, that was "free" since the 737 doesn't have a rotor. The problem is that I can't see any effect by adding the file myevents.txt, I suppose I should see something in fsuicp.log file, or in the console, but nothing happens. Probably I did something wrong. I'll try with other events, like parking brake or other common commands...
John Dowson Posted yesterday at 10:07 AM Report Posted yesterday at 10:07 AM 14 hours ago, AlMassimo said: I created a simple myevents.txt under the FSUIPC directory. This is the content of the file : B737SPDDEC#38408 (>K:ROTOR_BRAKE) B737SPDINC#38407 (>K:ROTOR_BRAKE) B737HDGDEC#39008 (>K:ROTOR_BRAKE) B737HDGINC#39007 (>K:ROTOR_BRAKE) Why are you creating your own presets rather than using the one provided (by MobiFlight), e.g.: PMDG_B737_MCP_HDG_DEC#39008 (>K:ROTOR_BRAKE) PMDG_B737_MCP_HDG_INC#39007 (>K:ROTOR_BRAKE) PMDG_B737_MCP_IAS_MACH_DEC#38408 (>K:ROTOR_BRAKE) PMDG_B737_MCP_IAS_MACH_INC#38407 (>K:ROTOR_BRAKE) 14 hours ago, AlMassimo said: This is the part of the code that should activate the first 2 events // AP ENCODERS -------------------------------------------------------- var 0171, name E_SPD, Link IOCARD_ENCODER, Input 0, Aceleration 2, Type 2 { IF &E_SPD = 1 { &FS_PAR = 1 &FS_CONTROL = 4194304 &FS_CONTROL = DELAY 0 10 } ELSE { IF &E_SPD = -1 { &FS_PAR = 1 &FS_CONTROL = 4194305 &FS_CONTROL = DELAY 0 10 } } } I am not sure what that code is (is it from SIOB?), but it looks like that will be (eventually) using offset 0x3110 to send the preset control using a control number. Control numbers for presets are difficult to calculate and you shouldn't use them really. To send a preset via an offset, use the preset name and offset 0x7C50. Otherwise, check that you are using the correct control number. You can use FSUIPC's logging facilities to see what is being sent. Do you have the events.txt file installed? If so, control numbers 4194304 and 4194305 will trigger the 1st and 2nd preset in the events.txt file (not in the myevents.txt file). You should use the preset name via offset 0x7C50, not the control numbers which can change, 11 hours ago, ark1320 said: I don't understand the above because I think the rotor K-event refers to a helicopter rotor, not some aspect of a B737. But I am not familiar with Open Cockpits equipment and maybe they have "repurposed" that K event somehow. It is the aircraft developers (PMDG in this case) that have re-purposed the Rotor Brake event to implement custom controls. This is done by several aircraft developers that re-use the Rotor Brake control. 11 hours ago, ark1320 said: Regardless, the FS2020 SDK says the below (and the FS2024 SDK says something similar). So maybe try (K:ROTOR_BRAKE_ON) in place of (K:ROTOR_BRAKE) if some type of rotor brake event is really what you need to use. It is deprecated but can still be used - and must be used for the custom controls to work, not K:ROTOR_BRAKE_ON . This FAQ entry shows how to to use the PMDG custom controls via the Rotor Brake control: 21 minutes ago, AlMassimo said: The problem is that I can't see any effect by adding the file myevents.txt, I suppose I should see something in fsuicp.log file, or in the console, but nothing happens. Probably I did something wrong. I'll try with other events, like parking brake or other common commands... Yes - use logging to see what is being sent. If using presets, set Debug level logging in the WAPI to see the calculator code/preset being used. John
John Dowson Posted yesterday at 12:47 PM Report Posted yesterday at 12:47 PM Rather than using presets, you can just use the Rotor Brake control directly, e.g. var 0171, name E_SPD, Link IOCARD_ENCODER, Input 0, Aceleration 2, Type 2 { IF &E_SPD = 1 { &FS_PAR = 38407 &FS_CONTROL = 66587 &FS_CONTROL = DELAY 0 10 } ELSE { IF &E_SPD = -1 { &FS_PAR = 38408 &FS_CONTROL = 66587 &FS_CONTROL = DELAY 0 10 } } } i.e. use control number 66587, for the Rotor Brake control, with the parameter (38407, 38408, etc) indicating the actual custom control to be used. John
AlMassimo Posted 17 hours ago Author Report Posted 17 hours ago 6 hours ago, John Dowson said: Rather than using presets, you can just use the Rotor Brake control directly, e.g. var 0171, name E_SPD, Link IOCARD_ENCODER, Input 0, Aceleration 2, Type 2 { IF &E_SPD = 1 { &FS_PAR = 38407 &FS_CONTROL = 66587 &FS_CONTROL = DELAY 0 10 } ELSE { IF &E_SPD = -1 { &FS_PAR = 38408 &FS_CONTROL = 66587 &FS_CONTROL = DELAY 0 10 } } } i.e. use control number 66587, for the Rotor Brake control, with the parameter (38407, 38408, etc) indicating the actual custom control to be used. John Thanks John, I started using the code you suggested, but for some reason every time I act on a different encoder, the last command is sent, and only after that the new encoder sends the new command. So eg. if I have set the altitude to 10000 ft and then try to set the speed from 190 to 200, when I rotate the speed the first impulse still changes the altitude (eg to 10100), and only after I can modify the speed, as if the old par was still in memory and not substituted by the new parameter. The same happens when I change dir of rotation, after some increases the first counterclockwise tick still increases the value, and only the second starts decreasing. This is pretty annoying. With lua this doesn't happen, but as I said it has a lag much too big for an encoder (it's Ok for switches and buttons) so I tried other ways. What I cannot understand is why fsuipc is ignoring the content of myevents.txt (is it Ok to place it under the same directory of fsuipc?) apparently it could solve the issues since probably the replicated old command is a bug of SIOC as far as I can say.
John Dowson Posted 16 hours ago Report Posted 16 hours ago 53 minutes ago, AlMassimo said: I started using the code you suggested, but for some reason every time I act on a different encoder, the last command is sent, and only after that the new encoder sends the new command. So eg. if I have set the altitude to 10000 ft and then try to set the speed from 190 to 200, when I rotate the speed the first impulse still changes the altitude (eg to 10100), and only after I can modify the speed, as if the old par was still in memory and not substituted by the new parameter. The same happens when I change dir of rotation, after some increases the first counterclockwise tick still increases the value, and only the second starts decreasing. This is pretty annoying. Sorry, but I can't help if assigning in SIOC - I have never used and know very little about this. But you should be able to use FSUIPC's logging facilities to work out what is happening. 53 minutes ago, AlMassimo said: What I cannot understand is why fsuipc is ignoring the content of myevents.txt Why do you think it is doing this? What does your log file show? You should see a line indicating the number of presets loaded, e.g. Quote 2859 19048 Calculator Code presets have been loaded and are available for use Can you show me / attach your FSUI{C7.log file. There can be many reasons why a preset is not working, you need to narrow it down why (is the preset actually being sent on the button press/release? Is it being received in the WASM? Is the WASM even installed? etc). 57 minutes ago, AlMassimo said: is it Ok to place it under the same directory of fsuipc? Yes - that is the only location where this file is read from. 59 minutes ago, AlMassimo said: it could solve the issues since probably the replicated old command is a bug of SIOC as far as I can say. Not sure what this means, but using the presets/calculator code is exactly the same as using the Rotor Brake control directly, and if you are having issues with those then you will have the same issues when using the presets.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now