LCDControl (software for Linux)

starlon

New member
Here's an introduction to LCDControl. It's about as finished as pyLCDControl was in regards to Crystalfontz LCDs. (Supports 533[tested], 626, 631, 632, 633, 634[tested], 635[tested], and 636.) No fans or DOW devices are supported at the moment of this posting.

Note that like pyLCDControl, this requires an X11 environment, because it's based on Qt. So unless your server keeps a GUI up 24/7, this program's not for servers.

The configuration file (config.json) should be enough to get a person started. This is loosely based on lcd4linux in that it uses the same "plugin" and "widget" system, and configuration structure (layouts and layers).

Plugins available as of today:
Cpuinfo, LCD, Netinfo, Diskstats, Loadavg, ProcStat, Fifo, Meminfo, Statfs, File, NetDev, Uname, Uptime

Widgets available as of today:
Text, Bar, Histogram, Icon, Bignums, Gif, Timer, Key, Visualization

Other features include: layout transitions (left, right, both, up, down, and tentacle), and multiple device per instance support.

LCDControl uses Javascript (QtScript) for value evaluation. Each plugin provides an object inside the Javascript environment, and each object has 1 or more methods. For example, here's a line from config.json:
Code:
"expression": "procStat.Cpu('system', 500)",
ProcStat also provides a ProcStat and Disk method along with Cpu. Being based on lcd4linux, you can refer to that documentation for more information on this plugin and others.

Dependencies are:
Qt (I'm using 4.5, not sure what's required)
Jsoncpp
Boost
ImageMagick and Magick++
Scons
xmms2
libvisual-0.4

Type 'scons' to build. And ./LCDControl to run. Currently it must be run inside the same directory as the configuration file, and it also expects a gif/ directory at that level if you're using GIF widgets. All GIF images from CrystalControl2 should work with this; in fact some of them are required by the configuration file if you don't alter it.

Here's the project's home on the internet: http://code.google.com/p/lcdcontrol/

You'll need SVN to download source.

You can see it in action with some actual hardware on my My Youtube
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
Last edited:

starlon

New member
Basic script support is in. The idea is that you create a blank layout and interface the LCD from javascript on top of that layout. This provides the building blocks to write custom menu systems.

Here's a very basic menu. PluginNetStat reads from /proc/net/tcp and provides information on TCP connections. The menu allows you to scroll up and down to view all TCP entries with an established connection.

Code:
var offset = 0;
var lock = 0;

function fooball() {
    if(lcd.GetCurrentLayout() != "layout_blank")
        return;
    if(lock)
        return;
    lock = 1;
    var i = 0
    var line = offset;
    while(line++ < netstat.LineCount() && i < 4) {
        lcd.SendData(i, 0, 0, '                    '); // Clear line
        var rem_address = netstat.Netstat(line + i, "rem_address"); // Get remote IP address
        var rem_port = netstat.Netstat(line + i, "rem_port"); // Get remote port
        var st = netstat.Netstat(line + i, "st"); // Get connection status
        if(st == "") {
            continue;
        }
        st = parseInt(st, 16)
        if(st != 1) { // Empty line; incremented past available lines
            continue;
        }
        lcd.SendData(i, 0, 0, rem_address + ":" + rem_port); // Write to LCD
        i++;
    }
    lock = 0;
}

function keyEvent(key) {
    if(lcd.GetCurrentLayout() != "layout_blank")
        return;
    if(lock)
        return;
    print("Key event: " + key);

    if(key == 1) { // Decrement netstat line
        offset--;
        if(offset < 0)
            offset = 0;
    }
    if(key == 2) { // Increment netstat line
        offset++;
        if(offset >= netstat.LineCount()) offset--;
    }
    if(key == 6)
        lcd.Transition(1); // Exit menu
}

lcd["_TickUpdate()"].connect(fooball); // LCDControl provides a tick timer that we connect to function 'fooball'
lcd["_KeypadEvent(const int)"].connect(keyEvent); // Connect keypad events to 'keyEvent'
 

Attachments

Last edited:

starlon

New member
Much appreciated, and huge thanks for the sticky. :)

Edit: Here's some eye candy. The image window may hang while the gif loads. It's about 1mb.

You can see it in action with some actual hardware on my My Youtube
 

Attachments

Last edited:
Top