Results 11 to 20 of 23
Thread: Big SIOC Task
-
07-21-2010, 08:34 AM #11
- Join Date
- Jul 2013
- Posts
- 917
Re: Big SIOC Task
Jack
"Is this just here so we can associate which bracket goes with which" The indentation of brackets is to easily show what code is attached to the IF function.
Re the IF logic, reference to Nico`s site will show you that if the IF statement is met then all the code within the associated brackets will be executed. Also, you can nest IF statemnts for example
IF x <100
{
do this code
IF > 50
{
only do this code ie only when x > 50 but < 100
}
}
-
07-21-2010, 09:53 AM #12
Re: Big SIOC Task
Okay how's this:
Code:Var 8666, Link FSUIPC_IN, Offset $126C, Length 4 // Fuel Weight { L0 = V8666 // FSUIPC Offset Variable = L0 L0 = ABS L0 // L0 not signed L2 = L0 IF L0 <= 400 // First sector { L1 = L2 * 0.91 // (364 steps/400 values) = 0.91 } ELSE // Is a greater value { L2 = L0 - 400 // L2 only have values for next sector IF L0 <= 1200 // Second sector { L1 = L2 * 0.052 // (478 steps / 800 values) = 0.5975 L1 = L1 + 364 // Add steps of others sectors } ELSE { L2 = L0 - 1200 // L2 only have values for next sector IF L0 <= 1500 // 3. Sector { L1 = L2 * 0.028 // ( 141 / 300) = 0.47 L1 = L1 + 842 // Add steps of others sectors 364 + 478 } ELSE // Out of range { L1 = 983 // Max. position } } &FuelGauge = 0 + L1 // Add to minimum (0) } } Var 0650, name FuelGauge, Link USB_SERVOS, Output 2, PosL 0, PosC 492, PosR 983, Type 2 // FuelGauge Servo
-
07-21-2010, 10:26 AM #13
Re: Big SIOC Task
You are now referring to the subject of 'syntaxis'.
Every programming language has production rules for producing correct sentences in that language. These rules define what a correct sentence (statement) is and what not. (The meaning of a correct statement is what is called 'semantics')
Code:IF L0 > 0 { L1 = L0 }
Code:IF L0 > 0 {L1 = L0}
SIOC has strict rules for where you can put for instance an opening bracket (always at a new line, and only that bracket at that line). It does not matter how many spaces or tabs there are in front of it, or after it at the same line. So
Code:IF L0 > 0 { L1 = L0 }
NicoLast edited by kiek; 07-21-2010 at 10:52 AM.
-
07-21-2010, 10:34 AM #14
- Join Date
- Jul 2013
- Posts
- 917
Re: Big SIOC Task
Jack
Good progress. Offhand, I see only one issue - your line "&FuelGauge = 0 + L1" needs to be run every time that the fuel weight changes. Currently, you have it too high, I think that it should be just above the last bracket. I have not checked all the nested logic, however, there is a simple way for you to troubleshoot the code, as explained in an earlier thread.
Change your variables to lower numbers ie 10 and 11
Run SIOC using this code - assuming that there are no syntax errors
Open the IOCPConsole (it is within the SIOC runtime window)
You can then see your variable values on the left of the screen, also you can change their values within that screen
Also, by using the Log function when there is a change in value of the FSUIPC variable, then you can see all the code that is actioned. This is great for testing the logic flow
Good luck
-
07-21-2010, 11:07 AM #15
Re: Big SIOC Task
Thanks very much Nico for clarifying that. I had a feeling that the brackets were spcaed out like that for easier reading.
Also, thanks David for your advice. When you say that it is a problem, do you mean it won't work or is it just "better" to write it another way (like you said it is "too high").
Another thing... Do any of you guys have information on Offset $126C? I have seen it referenced a few times, but it doesn't seem to be in the FSUIPC SDK Manual, or the table listed on PM's website! Any clues? I need to know incase I've got the length wrong or it needs dividing/multiplying.
-
07-21-2010, 11:26 AM #16
- Join Date
- Jul 2013
- Posts
- 917
Re: Big SIOC Task
Jack
I am not bothered about "pretty code"! You check the logic flow, but I think that the line "&FuelGauge = 0 + L1" should be last. Try it within the IOCPConsole and see
I got the FSUIPC list from either the official site or within the fsuipc software package - I assume you have a registered copy. The info on fuel weight is in lbs and the offset has a length of 4 bytes.
EDIT: Not certain what you are reading, but I can assure you that the offset list is within the FSUIPC SDK manual zip file available from the official site. Suggest you check again - hint try the offset status file
David
-
07-21-2010, 12:08 PM #17
Re: Big SIOC Task
Okay, I have changed it so that FuelGauge = L1 is on the last line, only thing below it is the final closing bracket.
I will now test with SIOC and FSX!
-
07-21-2010, 01:20 PM #18
Re: Big SIOC Task
The offset list is in the "FSUIPC for Programmers.pdf". This file is part of the "FSUIPC SDK 29th Release" available at the official Peter Dowson page.
By the way, Offset $126C is not in that list, so it s not a published offset by Pete Dowson. Maybe it is an extra offset by Project Magenta (PM)? If so it will only work if you are using PM.
Nico
-
07-21-2010, 01:38 PM #19
- Join Date
- Jul 2013
- Posts
- 917
Re: Big SIOC Task
Nico
As advised earlier in the thread this offset is referenced in the FSUIPC Offsets Status file within the FSUIPC SDK 29th Release on the Official Peter Dowson Site. It is new to FSX.
David
-
07-21-2010, 01:42 PM #20
Re: Big SIOC Task
Hi David,
I see, thank you for the heads up. Was not aware of that file introducing new offsets (compared to the FSUIPC for Programmers.pdf).
Nico
Similar Threads
-
Sioc / PM
By mpl330 in forum OpenCockpits General DiscussionReplies: 6Last Post: 02-07-2010, 01:26 PM -
Where can I get SIOC, please?
By Jake 747 400 in forum General Builder Questions All Aircraft TypesReplies: 1Last Post: 11-18-2009, 06:10 PM -
SIOC Help
By CessnaGuy in forum I/O Interfacing and HardwareReplies: 5Last Post: 10-25-2009, 10:00 AM -
SIOC for MIP?
By HondaCop in forum I/O Interfacing Hardware and SoftwareReplies: 17Last Post: 07-21-2009, 07:48 AM -
N1 SET and SPD REF - SIOC
By paoloj in forum OpenCockpits General DiscussionReplies: 0Last Post: 10-28-2008, 04:23 AM