Closed mchobby closed 8 years ago
Try to call charsTest() from main object without calling initCh(), it's working fine in my tests.
And printLn() works to.
I did downloaded the last driver (from today). Still nothing printing but I did made additional investigation. I did print() debug information on the console from printChar(), see here under.
def printChar(self, char, x, y, cont=False, scale=None):
if not scale:
scale = self._fontscale
font = self._font
scale = 3 if scale > 3 else scale
index = str(ord(char))
chrwidth = len(font[index])
height = font['height']
data = font[index]
X = self.TFTHEIGHT - y - (height*scale)+scale
Y = x
print( '--- %s ---' % char )
print( 'X,Y = %i, %i' % (X,Y) )
self._char_orientation()
print( 'chrwidth, height, scale = %i, %i, %i' % (chrwidth, height,scale) )
self._fill_bicolor(data, X, Y, chrwidth, height, scale=scale)
if not cont:
self._graph_orientation()
while running the 05b_charstest.py example, I do get the following information
--- ! ---
X,Y = 300, 7
chrwidth, height, scale = 1, 14, 1
--- " ---
X,Y = 300, 12
chrwidth, height, scale = 3, 14, 1
--- # ---
X,Y = 300, 19
chrwidth, height, scale = 8, 14, 1
--- $ ---
X,Y = 300, 31
chrwidth, height, scale = 7, 14, 1
--- % ---
X,Y = 300, 42
chrwidth, height, scale = 10, 14, 1
Apparently the X value is outside the screen resolution (240px in width).
X and Y calculation seems calculated for a 90° rotated screen... whereas mine is used with the default orientation (like all example's screenshot).
I have to chect it soon. It must to be fixed. Thanks.
I understand now what do you mean. This driver without screen rotation feature now. In perspective I have a plans to realize that, using PyBoard accelerometer, and at least with object definition. We must to think obout it, because there might be any troubles with memory. I see it so, that we must to save all widgets using LCD class properties, and recalculate them to every next orientation. Or simply, we may add argument in initialization as 'orientation'. May be it coming soon. If you have a reason right now to usage.
Just 2 things === default screen orientation === I'm using the driver "out-of-the-box" with my Adafruit TFT. I do not try to hack anything. With my screen, I do have the following configuration my default screen config show in this picture I'm not trying to rotate the screen display...
so the debug X,Y values seems abnormal (X=300 is over the 240px for screen width). So no text does print with println().
Is YOUR screen displaying in the same orientation for X and Y axis than mine?
=== Screen rotation feature === I think that the best would be to use a boolean parameter at initialisation time. So we are not depending for the accelerometer (some pyboard model doesn't have them). Changing orientation while running software may be an option... followed by a reset() + screen redrawing should be enough.
=== default screen orientation === Yes, axis X and Y are the same. === Screen rotation feature === Shore, may be it's a good enough, but rotation by accel we may set as a option.
Now it's added. Call it just as LCD( portrait=False ) and your x=300 must be in matrix. Than tft width changes from 240 to 320px. And 'y' axis higher point must be at 240px.
Remember, that bmp images are rotating to, they will be resized with new proportion.
I'm working on:
That rocks in portrait mode. Thanks for the fix. Great :-)
Could you check the test script 05a_println.py (about to be merged)? 05a_println.py tests the printLn().
Surprisingly it does not print anymore (on my setup). I do have included the charsTest() (line under comment) which does not product anything at the moment.
Sorry to trouble you with all those issues.