TinyScreen.cpp

mrchad · 7 · 6681

mrchad

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
Is TinyScreen.cpp/h that is part of the TinyScreen_Demo project being maintained as a library somewhere?  I noticed that drawLine doesn't calculate r,g,b correctly like drawRect does.  I wanted to see if the latest version fixed that.  Also, did anyone else notice you have to call setBrightness before any of the draw commands works correctly?

Thanks, Chad


mike_ekim1024

  • Full Member
  • ***
    • Posts: 17
    • View Profile
You should be able to create a TinyScreen folder in Documents/Arduino/libraries and put TinyScreen.h and .cpp in in it.  Sure, it would be nice if it came that way, and with lots of other demos.  I assume some day they'll do that.

I haven't played with lines much yet, just a bunch of squares :)  Can you give a snippet of code and I can try it also.  It looks like it uses the same conversion from single byte to r:b:b as drawRect - is the color wrong even in the r g b version of the function?

So far I find the API is simple.. but could use some drawing circles and polygons.  Antialiased lines would be super cool, too.  I've implemented them before, but they're very slow if done in the client drawing each pixel (SPI byte per byte).


mrchad

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
drawRect has this:
  if(r&0x10)r|=0x0F;//carry lsb
  if(g&0x08)g|=0x07;//carry lsb
  if(b&0x08)b|=0x07;//carry lsb

drawLine in the version of TinyScreen_Demo I downloaded did not. A call to drawLine passing in RED would draw a light blue line.  I see now that it's updated on codebender.  My real reason for posting was that I was just wondering if there was an official place to always get the latest version of TineScreen.cpp and h as a library.  Maybe just as a file in TinyScreen_Demo is it for now.  There are 16 projects on codebender named TinyScreen_Demo, so personally I would like to see it published as a library, not embedded in a project.  Plus there are a number of projects published by TinyCircuits that have those files.  Anyway, I was hoping there was a defined source location.

Also, both drawLine and drawBox will cause strange stuff to show on my screen if you don't call setBrigtness.  the print method doesn't seem to have the same issue.  The demo doesn't have this problem because it happens to call setBrightness before any of the draw commands.  I should say, for me I am passing in 15, then the strange stuff doesn't show up.  I see that the begin method in TinyScreen.cpp calls setBrightness(5);  If no one else is seeing this problem, I'll post an example project that causes the issue for me.



mike_ekim1024

  • Full Member
  • ***
    • Posts: 17
    • View Profile
My real reason for posting was that I was just wondering if there was an official place to always get the latest version of TineScreen.cpp and h as a library.

Ahh, I got mine by clicking "Download" from the embedded TinyScreen_Demo app.  It seems to be the official one, which is listed on the second page on codebender.  It's unfortunate there isn't a better naming system - it can get confusing if all the projects have the same name!

I've been playing around with it a bit more.. created a custom mono-spaced 3x5 font (uppercase-only).. not sure what I want to do yet :)  What about you?

Mike


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
Hi Chad and Mike, we now have the library maintained at https://github.com/TinyCircuits/TinyCircuits-TinyScreen_Lib

It is also currently being integrated into codebender's supported libraries, so the included library files in codebender examples will go away and the maintained codebender library will be referenced instead.

There have been a few bug fixes done, but I'd like to figure out that setBrightness() issue. I haven't been able to reproduce the issue, so please post your example project.

Thanks,
Ben


mrchad

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
I'm working on an analog clock, just because...

Ben, thanks for creating the library!  It will make my life a lot better anyway.

I looked at the new basic example project and I see a comment about a delay not being in the draw commands because it's not always needed.  I realize now, what I really needed was a delay after the clearWindow command, setBrighness must have added enough delay.

Replace loop in TinyScreen_Demo with this to see what I was talking about, assuming it happens for you.  I guess now, you just need to follow clearWindow with a draw command to repro what I was seeing.

void loop() {
  display.setCursor(15,20);
  display.fontColor(BLACK,WHITE);
  display.clearWindow(0,0,96,64);
//  display.setBrightness(15);
  display.drawRect(20,20,25,30,1,WHITE);
  display.print("BRIGHT!");
  delay(5000);
}



 

SMF spam blocked by CleanTalk