Mini Soft Keys Display

Open Source software contributions and discussions that supplement or extend the Palette / Light Palette software
Post Reply
User avatar
JohnGrimshaw
Posts: 1233
Joined: Tue Oct 16, 2007 12:51 pm
Primary Venue / Use: Other
Where I Am: International Man of Mystery
Location: Sydney, Australia
Contact:

Mini Soft Keys Display

Post by JohnGrimshaw » Sat Jun 21, 2008 7:11 pm

I am (now finally coming back to) working on a method for a small external display of the soft keys text, but I want a little advice...

1) can you give me some advice about the Lua Code to call the soft key values. I would prefer to not write code that was continually polling the console (I would prefer the ability to trigger code if the soft keys are changed), but at the moment, polling it is. Is there likely to be adverse effects if I do this? Can you advise me a preferred code method to achieve this?

The code to get the display to function (hopefully will be) nice and tight. S and M Key values are dumped to a table, and then spat out the RS232 port in a slightly modified form - not much to it.

2) Assuming I get the display sorted, I would like to get new Lua code I could use to actually activate the soft keys.

3) Rob mentioned elsewhere about the possibility of "HC.GetCommandLineText()".
- will that just show EXACTLY what is on the display, even if you are in the midst of typing something?
Could be useful for this application as well.
...and for more entertainment industry trivia and useless facts, just ask:
John Grimshaw
Managing Director
Stage Fast Pty Ltd

GaryDouglas
Posts: 689
Joined: Thu Oct 11, 2007 9:33 pm
Location: Calgary, Canada

Re: Mini Soft Keys Display

Post by GaryDouglas » Mon Jun 23, 2008 6:48 pm

There's code in the posted Century Array software that does just that in VB. The century app has a softkey bar that can be enabled by un-commenting some code.

It needs a little cleanup -- because the text from the Lua softkey functions' return values contain a bunch of control characters to denote color, up/down state and such. I commented the bar out because I didn't have the time to clean it all up! Please feel free to do so!

I can post a version in source form that has the bar re-enabled if you want it to get started.

It's pretty simple, and uses HC.GetSoftkeyText('S') and HC.GetSoftkeyText('M') to get the data.

I also just added HC.GetCommandLineText() so you can use it in the same fashion.

If you poll the console 5 times a second there are no adverse effects at all -- and 5 Hz is more than adequate.
Gary Douglas - Lead Software Developer - Pathway Connectivity - A Division of Acuity Brands Lighting Canada.

User avatar
JohnGrimshaw
Posts: 1233
Joined: Tue Oct 16, 2007 12:51 pm
Primary Venue / Use: Other
Where I Am: International Man of Mystery
Location: Sydney, Australia
Contact:

Re: Mini Soft Keys Display

Post by JohnGrimshaw » Sun Jul 06, 2008 7:46 am

OK - a couple of issues I need to sort out...
GaryDouglas wrote:If you poll the console 5 times a second there are no adverse effects at all -- and 5 Hz is more than adequate.
Try as I might, I cannot find Lua code that allows me to specify a "wait" period. My code has an "If ... then ... end" statement to compare the softkeys from the current state to the last state, and if they change, other code is run.

So, I could put an "else" statement in there that waits 0.2 sec, and put the whole thing inside "while true do ... end".
Last edited by JohnGrimshaw on Mon Jul 07, 2008 10:11 am, edited 1 time in total.
...and for more entertainment industry trivia and useless facts, just ask:
John Grimshaw
Managing Director
Stage Fast Pty Ltd

GaryDouglas
Posts: 689
Joined: Thu Oct 11, 2007 9:33 pm
Location: Calgary, Canada

Re: Mini Soft Keys Display

Post by GaryDouglas » Sun Jul 06, 2008 6:07 pm

You can try something like this (sorry not perfect LUA syntax):

time_at_top = os.clock()
while os.clock() - time_at_top < 0.200
Gary Douglas - Lead Software Developer - Pathway Connectivity - A Division of Acuity Brands Lighting Canada.

User avatar
JohnGrimshaw
Posts: 1233
Joined: Tue Oct 16, 2007 12:51 pm
Primary Venue / Use: Other
Where I Am: International Man of Mystery
Location: Sydney, Australia
Contact:

Re: Mini Soft Keys Display

Post by JohnGrimshaw » Mon Jul 07, 2008 7:38 am

...and that is why you make the big bucks as a programmer, and I am a theatrical lighting tech, pretending to be a sales person that can program Lua ;)

Anyway - rejigged the code, used the time loop you suggested (yes a working version), and managed to get it to run well as a single loop. but when I added this...
time_at_top = os.clock()
while os.clock() - time_at_top < 1 do
-- nothing
end
HC.Status('Waiting...')
...this code locks up the Palette for the duration of the wait time.

Other then that, it is ready to go! Well, once the trigger is sorted it is.
Display.jpg
Pictured here is the display configured to sit over the M keys on a Palette. The line of space at the bottom is planned to have the command line.
Display.jpg (61.75 KiB) Viewed 1299 times
...and for more entertainment industry trivia and useless facts, just ask:
John Grimshaw
Managing Director
Stage Fast Pty Ltd

User avatar
gooze
Posts: 1760
Joined: Tue Dec 18, 2007 12:42 pm
Location: Amsterdam, The Netherlands
Contact:

Re: Mini Soft Keys Display

Post by gooze » Mon Jul 07, 2008 1:04 pm

That looks really great! I suppose (as you are a sales guy, not a programmer) that we here from you very soon were we can buy the gadget!?

How do you switch between S-keys and M-key display?
Floriaan Ganzevoort - Lighting designer
THEATERMACHINE design. production. operations.

User avatar
BrianEvans
Posts: 700
Joined: Fri Oct 12, 2007 1:11 pm
Location: Orlando, Florida

Re: Mini Soft Keys Display

Post by BrianEvans » Mon Jul 07, 2008 2:09 pm

Just for kicks I moved an old touchscreen interface "application" I'd written for houselight controls in a few theaters,
from Horizon to Marquee / Palette.

I have never had any uck using any kind of timing in LUA.
(GetTickCount in Visual Basic 6 is useless as well, pauses the whole application).

The code that builds the data for my touchscreens simply runs on the Down, and Up action of a variable,
and the last line of code in each action is HC.VariableSetDelayed.

This automates the button and it continuosly updates the string.
The default of the variable is set to 1, so as soon as the show file opens, it takes off.
The refresh rate is 5Hz as well (0.2 seconds).

I am actually impressed with how efficient the Lua code runs under Marquee / Palette.
I built a visualizer for an architectural job I programmed in Puerto Rico, and that message is about 800bytes,
and the refresh rate on it is 20Hz. (4 attributes for 200 LED fixtures. Long ago I learned to take an 8-bit value and turn it into a single ASCII character code on the way out the door,
you have to code around 0 because of the null character obviously).

Not sure if that helps you.
Is your LUA code embedded in the show file, or does it run independently?
Brian Evans - System Specialist - Horizon Control Inc.

User avatar
JohnGrimshaw
Posts: 1233
Joined: Tue Oct 16, 2007 12:51 pm
Primary Venue / Use: Other
Where I Am: International Man of Mystery
Location: Sydney, Australia
Contact:

Re: Mini Soft Keys Display

Post by JohnGrimshaw » Mon Jul 07, 2008 5:31 pm

gooze wrote:That looks really great! I suppose (as you are a sales guy, not a programmer) that we here from you very soon were we can buy the gadget!?

How do you switch between S-keys and M-key display?
What I will probably do next is hand the whole thing over to my brother, who is a programmer. He can port the whole thing to VB, and package it nicely so that you can have a couple of display configurations. I will concentrate on sorting out the hardware. Might take a couple of weeks to make it "market ready".

There MIGHT be two options:
- short display (about the length of the M keys on a palette - room to display M or S)
- long display (about the length of the soft keys on the LP - room to display M and S)
BrianEvans wrote:HC.VariableSetDelayed.
Helps for my testing! Not so much for an external script.
...and for more entertainment industry trivia and useless facts, just ask:
John Grimshaw
Managing Director
Stage Fast Pty Ltd

Post Reply