Re: Sioc Code Frustration
Les
Are you sure that section of conditional code is not being run. The reason I ask is that you appear to be using L0 in two variable sections of code. You cannot carry across a local variable value from one section to another - that is why they are local. This will give you strange results :-( Perhaps you could call the subroutine passing the L0 (not sure?). Simplest answer is to have a new variable defined to replace the instances where you have used L0
As always I stand to be corrected :)
Regards
David
Re: Sioc Code Frustration
Hi Les,
David is right.
This statement:
gives undefined results, while L0 has no defined value...
Nico
BTW: wrap CODE tags around your code, will make your posts a lot more readable (see the numbersign icon above in this editor)
Re: Sioc Code Frustration
Hello iwik
A small change and the code should logically work though not as you may expect.
Unsure what you try to achieve because it seems that the "servo" value will
have an overlapping region.
I would have split the gauge/meter in two sections - each with its own scaling factor
or maybe just lower the multiplier in the line:
L1 = L0 * 1023
Code:
Var 1002,name Fuel Link FSUIPC_IN,Offset $0b7c,Length 4
{
L0 = v1002 / 8388608
L2 = L0 * 100
IF L2 < 25
{
L1 = L0 * 1023
V1000 = L1 + 70
}
ELSE
{
V1000 = L0 * 1023
}
}
Var 1000,Link USB_SERVOS,Output 2,Posl 0,Posc 512,Posr 1023,Type 2
Happy coding ;-)
Re: Sioc Code Frustration
Hi and Thanks all.
David- Learnt something new, meaning of Local variables.
Kiek- Will do code with tags in future, always wondered how others were getting that format.
Per-Eirk- i think i lost my way big time. Your comments helped a lot, put me back on track and made my code simpler. Works well now.
Les
Re: Sioc Code Frustration
Hi,
Here some information about Local or Internal Variables in SIOC.
regards,
NMico
Re: Sioc Code Frustration
Thanks Nico,
I was aware of those varaibles but unsure of when and how they can be used. I find i have to trip myself up before it sinks in. I quite often visit your page
for clarification.
Regards
Les