#Placeholders for arguments

1 messages · Page 1 of 1 (latest)

prisma stag
#

Hi, I have a variable that I have set to the number of a COM channel (1 or 2)

I am trying to set a 7-segment display to show the radio frequency. If I hard code the channel:

(A:COM ACTIVE FREQUENCY:1, Khz)

it works fine, but if I try an pass through the COM channel (via the reference tab) with

(A:COM ACTIVE FREQUENCY:#, Khz)

It just gives an output value of 0. I have tried making the COM channel variable both a number and a string.

Should I be able to do this? Thanks for all your help!

ocean socket
#

I have never tried to do this in this way. What value is #? Show screenshot of the input config for this.

#

The value needs to be the number alone for this to work. No spaces before or after.

#

This is normally done with preconditions and creating outputs for both frequencies.

prisma stag
#

I can do it the preconditions way, I just thought it might be possivle with less entries.

ocean socket
#

You did not show how # gets its value

prisma stag
#

Radio Choice Variable is a number between 0 and 3 that I have set up to increment when I press a button

ocean socket
#

I think you are getting tripped up on the syntax of the command sent to the sim. It just doesn't accept any spaces before or after the index, which is what you are trying to insert with #.

#

I am not sure that the naked 1 or 2 that you are setting gets translated to a single character.

#

in other words,
(A:COM ACTIVE FREQUENCY: 1, Khz) doesnt work in the sim

#

(A:COM ACTIVE FREQUENCY:1 , Khz) will not work either

#

your idea of trying to insert the index is not bad, but it requires that Mobiflight insert exactly one character after the colon
(A:COM ACTIVE FREQUENCY:#, Khz)

#

hmmm

#

I think this method does not work with outputs

#

because it would require Mobiflight to dynamically change the code that was already sent to the sim.

#

I think I will need to confirm with Sebastian whether this has any chance of working

#

I tested in my Mobiflight and it just doesn't work.

#

I think the legend on the code box is wrong

#

support for placeholders doesn't work on output code.... but I need to confirm this

prisma stag
#

Ahhh that might make sense

ocean socket
#

ok, I think you can still avoid preconditions by defining one output as com1 and another output as com2.

#

Then bring com2 and the selector output as config references.

#

you can change the frequency value with a Transform like
if(#=1, %, $)

#

in words, if the selector value is 1, set the output to com2, else set it to com1

#

$= com1

#

%= com2

#

'#' is selector value

#

yeah, I just tested this and it works.... COM1 is converted into COM2 by the selector value

prisma stag
#

Are you saying that by having com1 or com2 where I was trying to insert 1 or 2, it would work?

#

Oh wait I see what you mean - grab the frequencies in to their own variables, and then switch between them at the display

#

It wouldn't reduce the number of lines in my config, but it would split the reading of the values from their display.

#

Thanks for all your help, @ocean socket

#

I guess this can be marked as solved - for future readers of this, the resolution appears to be that you can't put referenced variables in to indices.