network_block_diagram

InfoNinja Software

Overview | Hardware/Firmware | Software

The InfoNinja software runs on a desktop computer and communicates to the InfoNinja via Ethernet.

(todo)

InfoNinja Command Reference

for firmware version 1.0

Display Text

URL

http://x.x.x.x/print?n:my_text

Parameters

  • n : the 0-based line number to replace
  • my_text : the URL-encoded text to write

Description

This command displays text on the given line (from 0 to 3). The entire line will be replaced with the text you give it, so any previously-displayed text will get overwritten, even if you’re writing a shorter line.

The text is URL-encoded, so you will have to escape non-alphanumerics with percent-hex equivalents. For example, “hello world” would be escaped to “hello%20world”.

You have up to 20 characters (after un-escaping) on each line, but remember that the last 5 characters of the first line (line 0) might be obscured by the tea timer countdown.

Set BacklightColor

URL

http://x.x.x.x/lcdcolor?rrrgggbbb

Parameters

  • rrr : The 3-digit red value, from 000 to 255
  • ggg : The 3-digit green value, from 000 to 255
  • bbb : The 3-digit blue value, from 000 to 255

Description

This command sets the LCD backlight color to any arbitrary value. You should keep a few things in mind:

  • The user can disable the solid-color backlight with the backlight toggle button.
  • If you specify a backlight blink mode, that takes precedence over the solid color you define here.
  • If you want to do more complex animations (such as blinking or fading), this is probably not the command to use. The variable network delay can be unpredictable. You likely want to use “Set Blink/Fade Mode” command, possibly extending that command to do a custom color pattern, if that is your desire.

Set Button Lights

URL

http://x.x.x.x/buttonled?n

Parameters

  • n : light mode

Description

This command enables, disables, or blinks the button LEDs. The possible values for light mode are:

  • 0 : disable button lights
  • 1 : enable button lights
  • 2 : blink button lights (the light toggles every second)

Set Blink/Fade Mode

URL

http://x.x.x.x/blinkmode?n

Parameters

  • n : light mode

Description

This command enables or disables the LCD backlight blink/fade mode. The possible values for light mode are:

  • 0 : Disable blinking/fading
  • 1 : flash between bright yellow and dim yellow once a second
  • 2 : flash between bright red and dim red once a second
  • 3 : flash between bright blue and dim blue once a second
  • 4 : fade between bright yellow and dim yellow
  • 5 : fade between bright red and dim red
  • 6 : fade between bright blue and dim blue

Note that this setting overrides any background color you may have set via the background-color command.

Also note that manually enabling the blue fade mode through software may be misleading. This mode is automatically enabled if InfoNinja has not been communicated to in the last few minutes. It is used to indicate that the displayed data may be stale.

Button State

Retrieving the button state from the desktop software is specifically not supported. Because the web server is single-threaded, it does not allow for cool Ajax-like blocking web requests (where the incoming web request is accepted, but holds off writing to it until the button state changes, simulating a synchronous action from an asynchronous query). The desktop software would have to continually poll InfoNinja for the button state, then send updates to respond accordingly. This introduces enough latency as to provide a rather poor user experience. For this reason, the ability to query buttons has been intentionally omitted.

Test Page

The GitHub Repository has a test page.  You can use this to simulate client software commands before you even write any software.  This will allow you to see how particular layouts may appear before committing them to code.

Software

The software, as I wrote it, is a Ruby script.  There is a main thread responsible for sending updates to your InfoNinja.  This main thread owns a TextBuffer object, which represents the LCD screen itself.  Each “service” you’d like to monitor is derived from a base ServiceThread object.  Each of these kicks off a thread that receives a handle to the same main TextBuffer so that they can independently write their updates into it.  This is fine for text, as long as your individual services confine themselves to specific areas of the screen.

Note that the last five characters of the first line may be obscured by the tea timer function.

When it comes to backlight color changes and button blinking, the main thread polls each of the individual ServiceThread objects.  The value considered “the most severe” wins.  For instance, if one wants to flash the background yellow and another wants to flash it red, then red wins.

The order of button lights, from least severe to most sever is:

  • button lights off
  • button lights on
  • button lights flashing

The order of LCD backlight alert modes, from least severe to most severe is:

  • no alert mode
  • flash yellow
  • flash red
  • flash blue
  • fade yellow
  • fade red
  • fade blue

Note that “fade blue” is not a good choice for your application to use.  This is the mode InfoNinja kicks into if it has not received an update in over a minute.  It could be confusing to the user if it fades blue for some other reason.

At the time of writing, the available services are:

  • Time — displays the time in the top-left corner
  • Trimet bus arrivals — shows the next downdown arrival times of the #9 and #14 bus lines.  You will need a Trimet Developer ID to use this function.

Creative Commons License InfoNinja hardware by Brian Enigma is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.  InfoNinja firmware and software is licensed as GPL v2.0 software.

Leave a Reply

Your email address will not be published. Required fields are marked *