Shop OBEX P1 Docs P2 Docs Learn Events
Quick Media Player (new touchscreen for Quickstart!) - Page 4 — Parallax Forums

Quick Media Player (new touchscreen for Quickstart!)

124»

Comments

  • skylightskylight Posts: 1,915
    edited 2013-04-06 17:59
    Rayman wrote: »

    I have some ideas on how to do this a lot better, just not the time yet...
    No problem I'd try to help but the Pasm is a bit over my head at the moment and hard for me to follow what's going on with that bit of code, having tried already to gain control through changing the spin portions of code without success.Thanks for your help so far.
    I might have a look at jazzing up the slideshow in the meantime now I have the knowledge to utilise controls.
  • skylightskylight Posts: 1,915
    edited 2013-04-19 01:54
    @Rayman Looking at the schematics for the QMP I'm not absolutely sure what I/O are unused, I think P6 is but not sure what else is, also do any unused I/O's come out onto the QMP board for use? For a project in mind I need at least two spare I/O's.
    If not it's not a problem as the quickstart has the extra connections to the I/O's it's just knowing whats unused really.
  • RaymanRayman Posts: 14,665
    edited 2013-04-19 05:53
    P8 through P15 are completely free. You can also use the I2C bus on P28 and P29 for other things. Also, P30 and P31 could be used if need be although these are used for programming. If you don't need the uSD card, you could use it's pins too...
  • skylightskylight Posts: 1,915
    edited 2013-04-19 08:01
    Thanks Rayman, One more question, I thought I had worked out the coordinate thing by using the commented out line to map the buttons, I'm creating a new screen with buttons for another project but when I tried to draw a rectangle in the correct place I'm having all sorts of problems with size and position, must have been lucky when mapping out the buttons on the wav player project?

    I have sent the touchx and touchy coords to the PST and when holding the QMP in landscape with the home,email icons to the left then top left is 0,0 (x,y) and bottom right is 320,240 as expected what I am having trouble with is what is x1,x2,y1,y2 in relation to the screen as what I thought is not correct.

    If possible please could you show a diagram of those coords for the rectangle as I've tried all sorts of combinations but am getting no where, thanks for your help
  • RaymanRayman Posts: 14,665
    edited 2013-04-19 08:59
    This is with the landscape driver so top-left corner of visible screen is (x=0,y=0) and bottom-right corner is (319,239).
    If I remember right, (x1,y1) would be the top-left corner of the button you want to make and (x2,y2) would be the bottom-right corner of that button.
    So, it expects x2>x1 and y2>y1
  • skylightskylight Posts: 1,915
    edited 2013-04-19 10:30
    That's what I was thinking , I touched the screen at the top left of where I wanted the button got the coords and entered them accordingly for x1 and y1 in the Dat section
    I touched the bottom right of where I wanted the button and put those coords in x2 and y2
    X2>X1 and Y2>Y1 as you say,

    the rectangle drawn ends up long in width and drawn to the left of where I expected an approximate square given thickness and inexact positioning of the stylus used.
    could the x1 x2 y1 y2 positions in the DAT section be wrong?


    The code is identical to the wavplayer code regarding the DrawRectangle line and the define buttons DAT section (with new coords).

    When touching the top left and bottom right of the "Play" button square from the wav player code , I get almost the coords of the ones you placed in the DAT section bar stylus,position errors as above.

    The error comes when I touch to the right and above centre of the screen: touchx (241) touchy(48) Top left of where I want the square and touchx(287) touchy(82)bottom right of the square, this is an approx square but the drawn rectangle is long horizontally and to the left of where I want it.

    This suggests I may be putting the wrong values in place of the x1, y1,x2,y2 which were in the DAT line for the original play button , could the original rectangle have been rotated somewhat or other so the x1 y1 corner is not where expected and same with the x2,y2 corner?

    Or could it be the touchx and touchy coords are not corresponding to the expected inputs for the DAT line of code?



    I've attached the code as is, which is a stripped down version of the wavplayer code and the bitmap for the new screen, I'm basically trying to map the two red triangles (Up and Down), the code increments and decrements a byte value from 0 to 255 and works fine when I used the Wav Player controls (lower part of screen) Playbutton for UP and Stopbutton for Down, it's basically the mapping of the new area of the screen that's causing problems.
    As you will see the rectangle drawn is horizontally long, I just can't understand where i'm going wrong.

    Thanks as always for helping me with the problems.
  • RaymanRayman Posts: 14,665
    edited 2013-04-19 11:09
    Ooops... I think I see a flaw in my code there... We need to change that DAT section "byte" to "word"...
    Same thing for the "GetButton" routine...

    Problem is that with x coordinates >255 are bigger than can fit in a "byte"...
  • skylightskylight Posts: 1,915
    edited 2013-04-19 14:22
    of course! and i'm dealing with byte variables in the code i'm working on but didn't even think of that, well spotted and thanks!

    That explains why it worked for the original button but not the new place on the screen.
  • skylightskylight Posts: 1,915
    edited 2013-04-19 16:10
    Tried changing Byte to word in the define button DAT section and in GetButtons but then GetButtons doesn't return it's result

    Maybe the i2c driver needs it's byte references changed also?

    Not a problem meantime as I can keep all buttons coords beneath 255 on the screen, but it might get a bit condensed.
  • RaymanRayman Posts: 14,665
    edited 2013-04-19 16:33
    I'm pretty sure the I2C driver is good because I use the same thing for higher resolution displays...

    I'll try to look at this tomorrow and fix that bug...
  • skylightskylight Posts: 1,915
    edited 2013-04-21 08:28
    Thanks Rayman, I know you are busy in the Prop 2 and GCC forums so I appreciate your time used in helping me
  • skylightskylight Posts: 1,915
    edited 2013-04-21 13:39
    Thanks Rayman, I will try it out tomorrow as I have to redesign a button in the original area >255 because I had moved everything <255.

    As a matter of interest and information, did you change anything apart from the keypad program, I noticed you made the word changes there and I'm almost certain I did those same changes myself but it didn't work for me, I changed the byte references to word in the DAT define button section and also in GetButtons unless you changed something else elsewhere?
  • RaymanRayman Posts: 14,665
    edited 2013-04-21 15:50
    this was the tricky part here;
    repeat i from 0 to nButtons-1
        if touchx>word[p] and touchx<word[p+2]
          if touchy>word[p+4] and touchy<word[p+6]
            return word[p+8]
        p+=10
    
  • skylightskylight Posts: 1,915
    edited 2013-04-22 10:31
    Update: It works a treat!
  • skylightskylight Posts: 1,915
    edited 2013-05-03 06:11
    @Rayman

    I'm having problems with the lcd.DrawString command with my project, in the wavplayer program you use the command to print the filename that's playing to the screen using the variable j as in :
    lcd.DrawString(50,120,j)
    
    coordinates may be different just using for example, printing j is not a problem as it is a string

    the problem i'm having is I have a variable long storing a number which can be 1 or 100 or 1000 or any value between(using a long as i'm sharing the variable with other objects)

    When I use the LCD.Drawstring command I get spurious characters, so the question is how do I convert the number stored in the variable into a string that I can put in the LCD.Drawstring command?
  • kuronekokuroneko Posts: 3,623
    edited 2013-05-03 07:01
    skylight wrote: »
    When I use the LCD.Drawstring command I get spurious characters, so the question is how do I convert the number stored in the variable into a string that I can put in the LCD.Drawstring command?

    Short of writing your own conversion you could use the Simple_Numbers object (comes with the PropTool). Its dec method takes a long and returns the buffer/string address where the converted number is stored. This is then fed into any matching string print method.
    OBJ
      n: "Simple_Numbers"
      s: "FullDuplexSerial"
      
    PUB null
    
      ...
      s.str([COLOR="#FF8C00"]n.dec(42)[/COLOR])
    
  • william chanwilliam chan Posts: 1,326
    edited 2013-05-03 07:38
    Hi Rayman,

    Does the QMP come with the 2.4" touchscreen or do we have to purchase the touchscreen separately?
  • skylightskylight Posts: 1,915
    edited 2013-05-03 08:23
    @kuroneko thanks i'll give that a try.

    @
    william chan Yes it comes complete with touchscreen as in the photos in post #1 of this thread, it's a great compact screen, I love it!

    Rayman has many examples of code to use with it on the website shown in post #1

    I have tinkered a bit with Rayman's code objects to accomplish several things in a very short time, so I would say it's ideal for beginners using the propeller like myself.
  • skylightskylight Posts: 1,915
    edited 2013-05-03 08:53
    @kureneko That worked brilliantly! Thank you very much, The programming side of the project is almost complete just needs a bit of tweaking of the display and layout
    then just the interface hardware to sort out.
  • RaymanRayman Posts: 14,665
    edited 2013-05-03 17:17
    William, QMP comes with the display, it's actually directly soldered to the board. Maybe I should be more explicit about that in the description...

    I might mention one update though. I've run out of my original display supply and Newhaven stopped selling that version.
    But, (and this is what I love about Newhaven) the new version is pin compatible with the old version.
    So, it's not a big deal, but now there are two drivers, one for the original version and one for the new version.
    To the programmer, but drivers work exactly the same way.

    skylight, glad to hear everything is working out.

    I'm in the airport right now, on my way to the Expo...
  • RaymanRayman Posts: 14,665
    edited 2013-05-03 17:22
    skylight, there is a virtual text disply mode in the driver. You start it with the "StartText" function.
    Then, you can use the dec, bin, and hex functions to show numbers.
    But, I not 100% sure what happens if you try to do this and graphics at the same time. It may or may not do what you want...
    Glad kuroneko helped, I've been busy making parts to sell at the expo today...
  • william chanwilliam chan Posts: 1,326
    edited 2013-05-21 06:39
    Hi Rayman,

    What does it take to make the Paint program work with the new ili9340 lcd?
    The first demo does not show how to use the touch function.

    William
  • RaymanRayman Posts: 14,665
    edited 2013-05-21 09:16
    William, you've just reminded me that I have some work to do...
    I need to provide an updated version of QMP_TV that works with the new driver...

    For now, you might try skylight's keypad code in post #103 or the waveplayer with screen buttons posted earlier.
    This will demo how to use the touchscreen.



    Just replace the old driver with the new one to make it work...
  • william chanwilliam chan Posts: 1,326
    edited 2013-05-21 14:45
    Hi Rayman,

    I loaded the keypad program ( with the new 2d driver ) but all I got was a blank red screen.
    The QMP_GfxDemo program works well.
  • RaymanRayman Posts: 14,665
    edited 2013-05-21 15:13
    Ok, that's what I get too... I forgot you'd need to copy this bitmap file to uSD card for it to work...
    FrLitD.zip

    Just tested and with that bmp file on uSD, it sorta works.
    Not a terribly good demo though... Up button works, but down button is actually out it the middle of the screen somewhere...
  • william chanwilliam chan Posts: 1,326
    edited 2013-05-21 20:57
    Sorry, I am not sure what I did wrong.
    After placing the bmp file on the uSD card, that bitmap now appears on screen, but no numeric buttons appear. : (
    Touching the screen everywhere gave no visible responses.
  • RaymanRayman Posts: 14,665
    edited 2013-05-22 03:35
    Sorry, I should have told you... Skylight's code uses fullduplexserial to send out info to Propeller Serial Terminal...

    Here's a very basic paint demo for you:

    QMP_Paint2 - Archive [Date 2013.05.22 Time 06.37].zip

    Needs polish, but it works...
  • skylightskylight Posts: 1,915
    edited 2013-05-24 05:12
    Sorry missed this thread re-appearing,

    @William Chan the keypad version I posted some time back was a very early experiment , I was having trouble mapping the two arrow buttons but if you read on Rayman helped sort that out.
    Here is a bitmap of an earlier half sized keypad I produced:

    Example Keypad.bmp

    The mapping was not utilising the whole screen due to the limitations of using a byte variable instead of a word variable ie coordinates beyond 255 were not possible, as the display is 320x240 it needed a word variable to be able to map the whole screen and now works great. see post #103 (coordinates havn't been changed so as Rayman says the buttons need remapping).
    If you wish to create a keyboard then here are a good collection of buttons and icons that you can reduce in size to make a keyboard, then you just have to map out the keys in the define keys dat section of the keypad.spin program.

    http://icons.mysitemyway.com

    use zoner photo studio to resze the buttons, this program is excellent as it allows the user to easily manipulate the bitmaps and gives coordinates which makes it a doddle when mapping the buttons.

    http://download.cnet.com/Zoner-Photo-Studio/3000-2192_4-75186165.html
Sign In or Register to comment.