Help Scripts SIOC
Posted: Fri Feb 10, 2023 7:08 pm
Hi from Madrid (Spain).
Let's see if someone who knows more than me can open my eyes. Programming sioc I know the basics switches and leds. I have copied two old codes that I found on the forums. With one I burned a servo because I don't understand the operations very well. I would like to understand the steps to follow. The code that works for me and not very well since the servos are jumping is this: (Thanks to Brian W. )
// ************************************************ ****************************
// * Config_SIOC ver 4.5 - By Manuel Velez - www.opencockpits.com
// ************************************************ ****************************
// * FileName : BRAKES_BRIANW.txt
// * Date : 7/24/2018
Var 0801, name SERVO_AcuPre, Link USB_SERVOS, Device 3, Output 1, PosL 200, PosC 478, PosR 804, Type 1 // ACCU PRESSURE
Var 0802, name TXRX_ACC, Link FSUIPC_INOUT, Offset $73A7, Length 1
{
L0 = &TXRX_ACC
L0 = L0 * 1
L0 = L0 * 1.8
L0 = L0 + 200
&SERVO_AcuPre = L0
}
According to the Opencockpits USB Servos card the range goes from 0 to 1023. According to Jean Luc's Offset (Triple Brake Indicator ACCU Pressure (0-255))
Could someone who knows how to program explain to me the reason for these calculations and where does multiply by 1 come from, then multiply by 1.8, then add 200, etc?
I have seen all the opencockpits videos, tutorials, forums, but I have not found anything on how and why to structure the code. Or if you know something where it is explained with examples to see what kind of information is needed to get to program something other than switches and leds.
Immensely grateful, regards, Rafa.
With a lot of effort, design, machining and time, this has been my job
Let's see if someone who knows more than me can open my eyes. Programming sioc I know the basics switches and leds. I have copied two old codes that I found on the forums. With one I burned a servo because I don't understand the operations very well. I would like to understand the steps to follow. The code that works for me and not very well since the servos are jumping is this: (Thanks to Brian W. )
// ************************************************ ****************************
// * Config_SIOC ver 4.5 - By Manuel Velez - www.opencockpits.com
// ************************************************ ****************************
// * FileName : BRAKES_BRIANW.txt
// * Date : 7/24/2018
Var 0801, name SERVO_AcuPre, Link USB_SERVOS, Device 3, Output 1, PosL 200, PosC 478, PosR 804, Type 1 // ACCU PRESSURE
Var 0802, name TXRX_ACC, Link FSUIPC_INOUT, Offset $73A7, Length 1
{
L0 = &TXRX_ACC
L0 = L0 * 1
L0 = L0 * 1.8
L0 = L0 + 200
&SERVO_AcuPre = L0
}
According to the Opencockpits USB Servos card the range goes from 0 to 1023. According to Jean Luc's Offset (Triple Brake Indicator ACCU Pressure (0-255))
Could someone who knows how to program explain to me the reason for these calculations and where does multiply by 1 come from, then multiply by 1.8, then add 200, etc?
I have seen all the opencockpits videos, tutorials, forums, but I have not found anything on how and why to structure the code. Or if you know something where it is explained with examples to see what kind of information is needed to get to program something other than switches and leds.
Immensely grateful, regards, Rafa.
With a lot of effort, design, machining and time, this has been my job