network_block_diagram

InfoNinja Software

Overview | Hardware/Firmware | Software

The InfoNinja soft­ware runs on a desk­top com­puter and com­mu­ni­cates to the InfoNinja via Ethernet.

(todo)

InfoNinja Command Reference

for firmware ver­sion 1.0

Display Text

URL

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

Parameters

  • n : the 0-based line num­ber to replace
  • my_text : the URL-encoded text to write

Description

This com­mand dis­plays 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 over­writ­ten, even if you’re writ­ing a shorter line.

The text is URL-encoded, so you will have to escape non-alphanumerics with percent-hex equiv­a­lents. For exam­ple, “hello world” would be escaped to “hello%20world”.

You have up to 20 char­ac­ters (after un-escaping) on each line, but remem­ber that the last 5 char­ac­ters of the first line (line 0) might be obscured by the tea timer count­down.

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 com­mand sets the LCD back­light color to any arbi­trary value. You should keep a few things in mind:

  • The user can dis­able the solid-color back­light with the back­light tog­gle but­ton.
  • If you spec­ify a back­light blink mode, that takes prece­dence over the solid color you define here.
  • If you want to do more com­plex ani­ma­tions (such as blink­ing or fad­ing), this is prob­a­bly not the com­mand to use. The vari­able net­work delay can be unpre­dictable. You likely want to use “Set Blink/Fade Mode” com­mand, pos­si­bly extend­ing that com­mand to do a cus­tom color pat­tern, if that is your desire.

Set Button Lights

URL

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

Parameters

  • n : light mode

Description

This com­mand enables, dis­ables, or blinks the but­ton LEDs. The pos­si­ble val­ues for light mode are:

  • 0 : dis­able but­ton lights
  • 1 : enable but­ton lights
  • 2 : blink but­ton lights (the light tog­gles every sec­ond)

Set Blink/Fade Mode

URL

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

Parameters

  • n : light mode

Description

This com­mand enables or dis­ables the LCD back­light blink/fade mode. The pos­si­ble val­ues for light mode are:

  • 0 : Disable blinking/fading
  • 1 : flash between bright yel­low and dim yel­low once a sec­ond
  • 2 : flash between bright red and dim red once a sec­ond
  • 3 : flash between bright blue and dim blue once a sec­ond
  • 4 : fade between bright yel­low and dim yel­low
  • 5 : fade between bright red and dim red
  • 6 : fade between bright blue and dim blue

Note that this set­ting over­rides any back­ground color you may have set via the background-color com­mand.

Also note that man­u­ally enabling the blue fade mode through soft­ware may be mis­lead­ing. This mode is auto­mat­i­cally enabled if InfoNinja has not been com­mu­ni­cated to in the last few min­utes. It is used to indi­cate that the dis­played data may be stale.

Button State

Retrieving the but­ton state from the desk­top soft­ware is specif­i­cally not sup­ported. Because the web server is single-threaded, it does not allow for cool Ajax-like block­ing web requests (where the incom­ing web request is accepted, but holds off writ­ing to it until the but­ton state changes, sim­u­lat­ing a syn­chro­nous action from an asyn­chro­nous query). The desk­top soft­ware would have to con­tin­u­ally poll InfoNinja for the but­ton state, then send updates to respond accord­ingly. This intro­duces enough latency as to pro­vide a rather poor user expe­ri­ence. For this rea­son, the abil­ity to query but­tons has been inten­tion­ally omit­ted.

Test Page

The GitHub Repository has a test page.  You can use this to sim­u­late client soft­ware com­mands before you even write any soft­ware.  This will allow you to see how par­tic­u­lar lay­outs may appear before com­mit­ting them to code.

Software

The soft­ware, as I wrote it, is a Ruby script.  There is a main thread respon­si­ble for send­ing updates to your InfoNinja.  This main thread owns a TextBuffer object, which rep­re­sents the LCD screen itself.  Each “ser­vice” you’d like to mon­i­tor is derived from a base ServiceThread object.  Each of these kicks off a thread that receives a han­dle to the same main TextBuffer so that they can inde­pen­dently write their updates into it.  This is fine for text, as long as your indi­vid­ual ser­vices con­fine them­selves to spe­cific areas of the screen.

Note that the last five char­ac­ters of the first line may be obscured by the tea timer func­tion.

When it comes to back­light color changes and but­ton blink­ing, the main thread polls each of the indi­vid­ual ServiceThread objects.  The value con­sid­ered “the most severe” wins.  For instance, if one wants to flash the back­ground yel­low and another wants to flash it red, then red wins.

The order of but­ton lights, from least severe to most sever is:

  • but­ton lights off
  • but­ton lights on
  • but­ton lights flash­ing

The order of LCD back­light alert modes, from least severe to most severe is:

  • no alert mode
  • flash yel­low
  • flash red
  • flash blue
  • fade yel­low
  • fade red
  • fade blue

Note that “fade blue” is not a good choice for your appli­ca­tion to use.  This is the mode InfoNinja kicks into if it has not received an update in over a minute.  It could be con­fus­ing to the user if it fades blue for some other rea­son.

At the time of writ­ing, the avail­able ser­vices are:

  • Time — dis­plays the time in the top-left cor­ner
  • Trimet bus arrivals — shows the next down­down arrival times of the #9 and #14 bus lines.  You will need a Trimet Developer ID to use this func­tion.

Creative Commons License InfoNinja hard­ware by Brian Enigma is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.  InfoNinja firmware and soft­ware is licensed as GPL v2.0 soft­ware.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>