Florian Wesch

info-beamer pi 0.8.2 released

Posted Feb 05 2015 by Florian Wesch

The first info-beamer pi release that is ready for the Raspberry PI 2. Learn what has changed.

Compatibility with the RPi2

This is the first release of info-beamer pi since the RPi2 was released. It fixes a resource contention problem that sometimes occured when running on the new RPi2.

It also changes a problem that related to info-beamer trying to fetch the serial number of your device. See the blog post about the Raspberry PI 2 to learn how this affect older versions and how to fix it.

New garbage collection

Previously a full garbage collection cycle was initiated each frame to prevent exhausting all available GPU memory by accident. This has now been improved so the garbage collection faster and info-beamer hopefully does the right thing™.

Learn more about garbage collection and the changes in info-beamer 0.8.2 in a separate blog post.

Image loading is now async by default

Previously calling resource.load_image blocked while loading an image. This meant that rendering stopped for a moment when loading a big image. Normally this is not acceptable: You don't want your visualization to jitter. So now resource.load_image loads images in the background. So your code can immediately continue.

This might require updates in your code depending on how you handle loading images. This code will no longer work:

local image = resource.load_image "background.jpg"
local w, h = image:size()

w and h will most likely be zero, since the image is not yet loaded when querying for its size. Instead now you have to use the :state() call to find out if your image is already loaded:

function node.render()
    print(image:state())
end

The :state() call returns various values depending on the current state of the image:

"loading" 0 0 While the image is loading
"loaded" width height Once the image is fully loaded
"error" "error message" If image loading failed

The same call is available when loading videos. The information provided is basically the same. The the documentation for more information.

When you just use :draw() on your images everything will work as before except the image won't be drawn until is is fully loaded.

Error behaviour

Previously some functions could fail silently when the GPU ran out of memory. Now all functions return proper errors. So running out of memory while loading JPEG or PNG can now be detected. Use the :state() call on images and videos to find out if loading failed.

External error query

Sometimes your node fails and you fail to notice it unless you keep an eye on your console output. Since this isn't practical in a real setup there is now a way to query if a node created an error that wasn't caught.

Imagine this code:

gl.setup(100, 100)

function node.render()
    error "oh snap"
end

This will generate an error during runtime. Console output will look like this:

[error-example] runtime error: error-example/node.lua:4: oh snap
stack traceback:
        [C]: in function 'error'
        error-example/node.lua:4: in function <error-example/node.lua:3>
        kernel.lua:348: in function <kernel.lua:345>

In the console status info you'll see this:

    uptime 10s, cpu 0s+0s, rss 13708kb, temp=42.8'C
   mem   fps   rps allocs width height update  event flag  name (alias)
-----------------------------------------------------------------------
 172kb  60.1   0.1    0.0   100    100   0.1%   0.0%  REs  '- error-example (-)
-----------------------------------------------------------------------

Notice the flag column. The capital E shows that the node had a global error that wasn't handled. This status can also be queries using TCP:

pi@raspberrypi:~/error-example# netcat localhost 4444
Info Beamer PI 0.8.2-beta-pre1.a2f0b5 (https://info-beamer.com) [pid 14331/uptime 76]. *help to get help.
*query/*error/error-example
error-example/node.lua:4: oh snap
stack traceback:
        [C]: in function 'error'
        error-example/node.lua:4: in function <error-example/node.lua:3>
        kernel.lua:348: in function <kernel.lua:345>

^C
pi@raspberrypi:~/error-example# 

Basically you connect to info-beamer using TCP and then send *query/*error/<node-path>. Then just read lines till you read an empty line to get the error message. The revamped ibquery code for Python is an example on how to query info-beamer.

If you want to reset the error status from within your node, you can call node.reset_error().

Misc

The functions sys.set_flag and sys.client_write were moved to node.set_flag and node.client_write. Having them in the node namespace makes more sense since the only affect the current node. The old way of calling those functions (in the sys namespace) will still work for now. But using node is required in info-beamer 0.9 or later.

This version of info-beamer was compiled using a different cross compiler setup. Previously it was build in a qemu environment running a raspbian userland. This release was build using the cross compiler provided by the Raspberry Pi Foundation. There might be special builds for the Raspberry PI 2 in the future. For now there's still only a single binary that works on both the old PI and the new Raspberry PI 2. Please let me know if you have problems.

Enjoy!


Read more...


info-beamer.com offers the most advanced digital signage platform for the Raspberry Pi. Fully hosted, programmable and easy to use. Learn more...


Get started for free!

Trying out the best digital signage solution for the Raspberry Pi is totally free: Use one device and 1GB of storage completely free of charge. No credit card required.


Follow @infobeamer on twitter to get notified of new blog posts and other related info-beamer news. It's very low traffic so just give it a try.

You can also subscribe to the RSS Feed RSS feed.


Share this post:

Share using Twitter


Questions or comments?
Get in contact!