LEDsim - Simulator for SmartLED (WS281x) based matrix displays
Only from firmware version 2.7.0/2.7.0.32
The LED simulator described here is only included from firmware 2.7.0/2.7.0.32 (or 1.7.0/1.7.0.32 for P44-LC) and newer.
Overview
The LED simulator makes it easier to work with the p44lrgraphics subsystem, as it enables the entire view hierarchy of an LED setup to be checked, even when no LEDs are yet connected or they are not in the developer's field of vision (e.g. during remote maintenance). The simulator can be called up via the corresponding "LED Sim..." button on the "System" tab or via the coloured button at the bottom right of the IDE. When called up, the simulator shows the same image as the connected/configured LEDs, but the area and view to be shown can be set manually.
View hierarchy
The "view hierarchy" is visible in the pop-up menu at the top left, i.e. the structure of the image that is visible on the LEDs. The topmost entry, the "rootview", corresponds to what is displayed on the LEDs. This displayed image is made up of "sub-views" placed on top of or next to each other, which can be partially transparent so that the colours from several layers are superimposed. There are different view types, the respective type is shown in brackets.
The pop-up menu can be used to select which "view" (with its subviews) is to be displayed.
When a new view is selected, its properties will be output in the inspector as a JSON object and the pixels of the view will be displayed in the pixel display.
Pixel display
The pixel display can show the entire LED arrangement (the entire area fitted with LEDs = the rootview) or only parts of it.
-
When the LED simulator is started, the parameters (size x,y and position x,y) are set so that the rootview is fully visible.
-
When switching to subviews with the popup, the parameters do not change automatically. To adjust them to the size of the currently displayed (sub)view, the 'Auto' button at the top can be pressed.
-
The parameters can be adjusted manually at any time.
-
The maximum pixel size determines the maximum size of the pixels when they have enough space horizontally in the browser window. The size can be reduced manually to make the display smaller, even if it would have enough space horizontally - e.g. to see more of more vertical views (such as the torch animation) without scrolling.
-
The refresh rate specifies how often the pixel display is refreshed. The default setting is 100mS, which is slower than the real LEDs are usually refreshed (every 15mS by default), which is why the simulation is jerky. Although it is possible to set a shorter interval, this quickly reaches the limits of the network connection and device computing power and therefore rarely makes sense.
-
If the network connection is slow and does not deliver the current pixels with a short response time, the pixel display goes into pause mode (i.e. must be restarted with the start button). If the network connection is poor, only singlestep may be possible.
Pixel refresh requires computing power
The pixel display requires additional computing power, especially if a large area is displayed and/or a short refresh interval is set. If an animation is already at the performance limit of the device, the LED simulator can cause a jerky display. To judge an animation, the LED simulator should therefore be set to pause mode so that it does not consume any additional computing time.
View inspector
In the view inspector, after each switch in the view hierarchy popup and when the refresh button (or F5) is pressed, the current view is output as a JSON object in which the properties of the view are listed as fields. For views that in turn have subviews (types stack
, scroller
and sequencer
), these are visible as nested objects.
This JSON representation corresponds to the format in which views/view hierarchies are saved as .json files and read in as templates with the configure()
function or can be read in when creating an LED chain luminaire in the "Feature Config" field.
Change view properties
View properties (coordinates, colours, etc.) can be changed directly in the view inspector
-
under the line highlighted in green, changes can be made in the same format as with the
configure()
function i.e. as a JSON object:{ "bgcolor": "#332200"}
To simplify the input, the outer brackets and the quotes around the field name can be omitted:
bgcolor: "#332200"
Several properties can also be set at once:
x: 2, y:5
-
If one or more properties are selected in the inspector text and then Enter is pressed, they are copied to the end (i.e. below the line highlighted in green) and then set immediately. This is useful for reusing something that has already been typed.
-
If Enter/Return is pressed on a property line above the line highlighted in green without text being selected, the property is copied to the end and the value is set. If the value is adjusted beforehand, this is an easy way to change properties without a lot of typing.
-
The inspector content can be cleared with the corresponding button or with Cmd/Ctrl-K. The input area (below the context line highlighted in green) or the currently selected text is preserved. It is of course also possible to select a part of the text and delete it using the delete key.
-
After each change, the view configuration is displayed again.
-
Note: In the console of the p44script IDE view properties can also be changed, as the views can be found there as objects (
findview()
), variables can be assigned and the fields are available viaview.property
notation. In addition, animations can be tested withanimator()
and much more. When developing more complex effects with p44script, the console is therefore the more powerful and possibly more suitable tool than the inspector.