8bit Value to CCT for Slider Labeling

Is there a way to make a label that can show a CCT instead of an 8bit value or a percentage in a slider?  For instance, I know in my fixtures that:

  • 0=~1750k
  • 46=~2700K
  • 80=~3500K
  • 190=~6000K

I would be okay with this being a separate label that displays a calculated value based on the 8bit value of a slider, and not attached to the slider itself. I don't even need to to be EXACT, as long as I'm within +/-50 °K that would work.

Parents
  • I don't have time to test this at the moment but this should be a decent start...

    If you add your fixture(s) to a group(my example uses the all fixtures group 0) and use a master intensity slider(making assumptions about the fixtures) this should work. In my example you will need to make something on your touch screen with key "intValue" for the caption to update.  Add an action to run a script after your intensity action. You will need to add as many steps as you require or figure out the math for the conversion.

    name = foo

    intLvl = 0

    grp = get_group(0)

    name = grp.name

    log("the intensity group name is "..name)

    intLvl = grp.master_intensity_level.integer

    log("the intensity of is "..intLvl)

    if intLvl <46 then

    set_control_caption("intValue", "1750k")

    log("the CCT = 1750k")

    elseif intLvl == 46 then

    set_control_caption("intValue", "2700k")

    log("the CCT = 2700k")

    elseif intLvl == 80 then

    set_control_caption("intValue", "3500k")

    log("the CCT = 3500k")

    elseif intLvl == 190 then

    set_control_caption("intValue", "6000k")

    log("the CCT = 6000k")

    else return false

    end

  • Thanks John, I'll dig into this when I'm at my desk.  I had a feeling the solution would be a script. 

    Assuming I have linear function Y=22.4X+1750 where X is the 8bit value and Y is the CCT, I'm guessing I can build a script to make that calculation instead of only changing at the 4 values above. 

    Well I guess it's time I learn some LUA...

Reply
  • Thanks John, I'll dig into this when I'm at my desk.  I had a feeling the solution would be a script. 

    Assuming I have linear function Y=22.4X+1750 where X is the 8bit value and Y is the CCT, I'm guessing I can build a script to make that calculation instead of only changing at the 4 values above. 

    Well I guess it's time I learn some LUA...

Children
  • Hi, Jonathan,

    Scripting is your friend here, and it can be quite simple.

    Lets say you have your slider, and a label 'label001'

    a) Make a trigger that reacts to your slider move
    b) In the Action, make a script with the following

    local v = get_trigger_variable(1).integer --this captures the 0-255 from the slider

    local k = v * 22.37 + 1750 --this sets the CCT value matching your wishes

    --k = math.floor(k/10)*10 --optional, remove the two "--" at the beginning to round your Kelvin value down to the nearest 10

    local s = string.format("%.0f",k).."K" --formats k without decimals, and adds the K from Kelvin at the end, to make this into a nice string.

    set_control_caption("label001", s) --sets label "label001" to the string defined in previous line

    where in the last line you need to be sure your "label001" matches your label name.
    That's it!

    In case you need to do this for many different sliders it might be cleaner to put the above in a function - but that's not required for a simple. Let me know if that is the case!

  • AMAZING.  Thank you  I'll be on site to test this tomorrow morning. But it looks pretty clean

  • Thank you so much. I tested this morning and it worked great!  

Related