Display image based on multiple variables

Visualization and Recording of CAN Data
Post Reply
fjleish
Posts: 1
Joined: Tue 21. Mar 2023, 10:35

Display image based on multiple variables

Post by fjleish » Tue 21. Mar 2023, 18:15

Hello,

I am trying to create a scene where I have a lamp driven by several signals.

I have created my 6 variables and have created 6 different instruments, each displaying the same lamp image. The goal is that when ANY of the signals is set to a particular value (0 or 2) the lamp will show and when ALL of the signals are set to a different value (1 or 3) the lamp should not be shown.

Showing the lamp works okay as the 6 images seem to stack perfectly. However, I cannot seem to be able to find a way to extinguish a lamp for one signal without removing it for all. E.g. if 3 signals have the fault set to 0x2 and I change one of them to 0x1, then the lamp will turn off, despite 2 signals still having value 0x2.

I originally tried an instrument with just two pictures - hoping that when the values were not in the ranges specified then the images would not show. Unfortunately this was not the case and the images were not removed when the values were out of range.

[instrument1]
pictures=2
no_restore=0
transparency=0
name="S1"
offset=0,0
var_name="Status_1"
0="warn_lamp_on.bmp","",110,83,0,0
1="warn_lamp_on.bmp","",110,83,2,2

I have now tried to use an alpha channel but it seems the alpha channel is applied on top of the whole stack of all images and not just the one I am trying to hide - meaning if several fault signals are set then all lamps are removed.

[instrument1]
pictures=4
no_restore=0
transparency=1
name="S1"
offset=0,0
var_name="Status_1"
0="warn_lamp_on.bmp","",110,83,0,0
1="warn_lamp_on.bmp","alpha.bmp",110,83,1,1
2="warn_lamp_on.bmp","",110,83,2,2
3="warn_lamp_on.bmp","alpha.bmp",110,83,3,3

Is the issue due to using the same image name with the images? Is there a cleaner way of coding up a lamp that looks at multiple signal values?

Thanks

G.Bohlen
Hardware Development
Hardware Development
Posts: 57
Joined: Wed 22. Sep 2010, 21:38

Re: Display image based on multiple variables

Post by G.Bohlen » Wed 22. Mar 2023, 09:14

Hello,
the alpha image is used to calculate the combined picture and fixed background in advance, so it is not possible to have several pictures at the same position (per default no calculation at runtime)
It think it would be necessary to calculate to final lamp status first and then display the result. Doing this calculation is not supported by the device.

For a test you could try
transparency=2
for eacht instrument.
It is an undocumented function that should take the currently existing background instead of the precalculated picture, but this function is not really tested.
You would need an alpha-image, set to either 0 (use current background) or 255 (use picture) for each pixel.

Regards,
Gunnar Bohlen

Post Reply