Results 1 to 7 of 7
Thread: SIOC init switches
-
02-23-2015, 03:41 PM #1
- Join Date
- May 2014
- Location
- Germany
- Posts
- 7
SIOC init switches
Hi,
I'm just coding for my home-built OVH and came across some problems regarding the switch position after starting SIOC.
What I'm using:
- P3D 2.4
- iFly 737 CBE
- iFlyToFSUIPC
- SIOC (of course) + 3 Mastercards, etc...
After starting everything the switches are not in sync with the simulation (the LEDs are). I hoped that SIOC would read the switch-positions and then send it to the sim, but it does not Or it does it for some switches (read somewhere that this is a known problem).
I then tried to use "Var 0" and call some init subroutines in my different sections:
Code:Var 0 Value 0 { v1 = DELAY 1 100 //call init routines after 1s } Var 1 { CALL &InitBleed ... }
Code:Var 1 name InitBleed Link SUBRUTINE { CALL &TRIM_SWITCH CALL &L_REC_SW CALL &R_REC_SW ... }
Then I put some delay in between (which looks terrible in SIOC ):
Code:Var 1 name InitBleed Link SUBRUTINE { CALL &TRIM_SWITCH &InitBleed1 = DELAY 1 10 } Var 2 name InitBleed1 { CALL &L_REC_SW &InitBleed2 = DELAY 1 10 } Var 3 name InitBleed2 { CALL &R_REC_SW &InitBleed3 = DELAY 1 10 } ...
BUT: Is this really the way to do it?
It's not good looking code in my opinion.
Maybe anyone has a good idea how to do it?
Thanks for any hints...
Marc
-
Post Thanks / Like - 0 Thanks, 1 Likes, 0 DislikesShimokuta liked this post
-
02-24-2015, 11:57 AM #2
- Join Date
- May 2014
- Location
- Germany
- Posts
- 7
Re: SIOC init switches
Hm,
the more switches I add to this procedure the less stable it works.
Played around with delays and so on, but result is not very promising.
It seems SIOC does not recognize the correct state for some switches, but eratically...very disappointing
Maybe I should not put too much effort into that and sync my switches manually.
-
02-27-2015, 02:51 PM #3
- Join Date
- May 2014
- Location
- Germany
- Posts
- 7
Re: SIOC init switches
Sorry, this was a double post. My browser did not update the page correctly.
Last edited by Mischung; 02-28-2015 at 12:45 PM. Reason: Double post.
-
02-28-2015, 11:46 AM #4
- Join Date
- May 2014
- Location
- Germany
- Posts
- 7
Re: SIOC init switches
Sorry, this was a double post. My browser did not update the page correctly.
Last edited by Mischung; 02-28-2015 at 12:43 PM. Reason: Double post
-
02-28-2015, 11:52 AM #5
- Join Date
- May 2014
- Location
- Germany
- Posts
- 7
Re: SIOC init switches
So I had some time to dig a bit deeper and I'm pretty sure it does work now. At least my panel is doing a perfect sync of all the switch positions now.
My mistake was to think too procedural (which is pretty natural when you're programming C or C++ usually). So this event-based thing is not intuitive at first glance.
I found out that SIOC already does a perfect init at startup, but is sending out the commands way too fast. Bringing in delays will also not work, because at first startup all variables change at the same time, so all the delays would have to be different then (otherwise commands will be sent simultaneously again).
So I try to give you all an idea of what I did:
1) Using var 0 to start an init-phase
Code:Var 0 Value 0 { v1 = DELAY 1 100 // go to var 1 after 1 s (wait for stable conditions) } Var 1 { CALL &Init // call the init routine }
Code:Var 2000, name TRIMAIR, Link IOCARD_SW, Device 1, Input 31 // Trim Air { CALL &TRIM_SWITCH } Var 3000 name TRIM_SWITCH Link SUBRUTINE { IF &TRIMAIR = 1 { &cmd_Ifly = 118 } ELSE { &cmd_Ifly = 117 } }
3) init-routine (here we can call all the switches sub-routines)
Code:Var 1 name Init Link SUBRUTINE { CALL &TRIM_SWITCH // first call the trim switch routine &Init1 = DELAY 1 20 // after a delay of 200 ms call next init1 } Var 2 name Init1 { CALL &L_REC_SWITCH // call the next switches routine &Init2 = DELAY 1 20 // of course delay again } Var 3 name Init2 { CALL &R_REC_SWITCH // and so on &Init3 = DELAY 1 20 } ...
Hope everyone got the idea. Don't hesitate to ask if you have any questions.
Now I have to do the rest of the overhead program
Regards
Marc
-
Post Thanks / Like - 2 Thanks, 1 Likes, 0 Dislikes
-
03-14-2015, 12:43 PM #6
Re: SIOC init switches
Hello Marc,
Have you checked the microcontroller version of your USB expansion card?
With version 2, available since june 2013 the initial position of switches are always detected, so no need for all your initialisation code.
If you have an older USB expansion card you can easily upgrade it with a new microcontroller, see here.
Regards,
Nico Kaan
-
03-14-2015, 02:58 PM #7
- Join Date
- May 2014
- Location
- Germany
- Posts
- 7
Re: SIOC init switches
Hi Nico,
I have the latest version of the PIC-code. The cards and SIOC are working as expected, but the corresponding commands will be sent out way too fast during init-phase (at least iFlyToFSUIPC cannot handle that). That's where all these delays are helping out.
If SIOC or iFlyToFSUIPC would be able to have a kind of internal command queue with configurable min. delay between executions, everything would be fine I guess.
Regards
Marc
Quick Connections, Great Times in Your Town Find Sexy Womans from your town for night...
FMGS + PFD + ND + ECAM LOW & UP +...