Friday, May 22, 2009

TouchShield text() Emerges

In was an eternal battle of man versus github. Source code writer versus source code keeper. Fueled by coffee and determination, Man pulls out the all powerful
git reset --hard 
This is a bold move and swiftly defeats the evil repository, releasing a new function from it's clutches.

A new text() function emerges victorious on the TouchShield.



The text() function can be shown off provocatively on the TouchShield using the random(200) as the height parameter.

text("Hershey", random(320), random(240), random(200) );




This all wouldn't have happened without Mark's hard work on the Hershey font modules, thanks!

6 comments:

JustinN said...

I guess this sort of answers my question I posted to that other thread ("up and running...").

But did this functionality make it into the 0.8.8 release?

(BTW this is perfect timing. It's one of the major things on my checklist for the robotmeter)

Chris said...

@Justin,

Yep, it finally made it into the v0.8.8 release.

Mike just mentioned to me that the text() reference wiki updates went live too.

JustinN said...

Passing a float to be displayed doesn't seem to work. (I'm using v0.8.8 on OS X Leopard and a slide).

(oil_temp is a float)

text(oil_temp, 90, 115, 10); gives an error stating that there is no matching function and then gives me the text() prototype listing.

text(oil_temp, 90, 115); compiles just fine and runs

For now I'll be using a function to convert the float to a string.

JustinN said...

Also, noted that unlike the old text() the new text() doesn't do fills (doesn't do backgrounds).

So if you have a number you update again and again you have to clear it somehow first.

Chris said...

@Justin,

Great catch on your tests. The background fills aren't being handled down at the low level. With some hacks, it should make it down there in a next release, thanks!

At the moment, the variable height text() calls support only character arrays.

I usually use the dtostrf() function to format a float into a character array.

JustinN said...

I actually kind of like the text with no background. It looks really nice superimposed over a bar graph. (Maybe make that an option? Maybe not, to save space.)

As for the not working with floats I use the elegant solution found here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207226548/11#11

Hopefully I didn't sound critical in my posts. You guys are doing a great job and I'm very thankful that height adjustable text is now available. (Now if I could only figure out how to properly pass float values from the arduino to the stealth lol.)