Menu

ili9341 filled box

2019-10-11
2019-10-11
  • stan cartwright

    stan cartwright - 2019-10-11

    using ili9341 glcd which is 320x240 I can use line 0,0,319,239,1 to draw a line from top left to right bottom corners.
    I tried filledbox 8,8,312,232,1 but got a line at the top of screen.
    It works 8,8,312,221,1 but anything bigger than 221 doesn't. ideas?

     
  • Anobium

    Anobium - 2019-10-11

    Post the minimal code to show the issue, also attached the ASM. This will tell me the config etc.

     
  • stan cartwright

    stan cartwright - 2019-10-11

    box 8,8,312,232,1 works.
    filledbox 8,8,312,232,1 doesn't.
    I'm using arduino nano.

    #chip mega328p,16
    #include <glcd.h>
    #option explicit
    #define GLCD_TYPE GLCD_TYPE_ILI9341
    
        #define GLCD_DC      portb.0 ;   DIGITAL_8           ' Data command line
        #define GLCD_CS      portb.2 ;   DIGITAL_10          ' Chip select line
        #define GLCD_RESET   portb.1 ;   DIGITAL_9           ' Reset line
        #define GLCD_DI      portb.4 ;   DIGITAL_12          ' Data in | MISO    - Not used therefore not really required
        #define GLCD_DO      portb.3 ;   DIGITAL_11          ' Data out | MOSI
        #define GLCD_SCK     portb.5 ;   DIGITAL_13          ' Clock Line
    
    #define ILI9341_HardwareSPI    ' remove/comment out if you want to use software SPI.
    #define GLCD_EXTENDEDFONTSET1
    ;
    ;now rename colours to make it easier to set up sprite data
    #define bk ILI9341_BLACK
    #define re ILI9341_RED
    #define gr ILI9341_GREEN
    #define bl ILI9341_BLUE
    #define wh ILI9341_WHITE
    #define pu ILI9341_PURPLE
    #define ye ILI9341_YELLOW
    #define cy ILI9341_CYAN
    #define dg ILI9341_D_GRAY
    #define lg ILI9341_L_GRAY
    #define si ILI9341_SILVER
    #define ma ILI9341_MAROON
    #define ol ILI9341_OLIVE
    #define li ILI9341_LIME
    #define aq ILI9341_AQUA
    #define te ILI9341_TEAL
    #define na ILI9341_NAVY
    #define fu ILI9341_FUCHSIA
    ;
    GLCDBackground = ILI9341_BLACK
    GLCDRotate (landscape)
    GLCDCLS wh
    
    filledbox 8,8,312,232,1
    do
    loop
    
     
  • Anobium

    Anobium - 2019-10-11

    Update to latest build first. Then, retry.

     
  • Anobium

    Anobium - 2019-10-11

    I see the error in the library. I think we have an overflow.

    Find the following in the FilledBox method in the glcd_ili9341.h library.

    Dim GLCDPixelCount As Word
    

    change to

    Dim GLCDPixelCount As Long
    

    You may need the following adapation also.

    GLCDPixelCount = [long](LineX2 - LineX1 + 1) * [long](LineY2 - LineY1 + 1)
    
     
  • stan cartwright

    stan cartwright - 2019-10-11

    downloaded from https://sourceforge.net/projects/gcbasic/
    Result is the same. I thought I was using latest version anyway.
    box 8,8,312,232,1 works ok.
    filledbox 8,8,312,232,1 and I get image.
    I tried 3 glcds. Should I try a uno or pic to test instead of nano?

     
  • stan cartwright

    stan cartwright - 2019-10-11

    downloaded from https://sourceforge.net/projects/gcbasic/
    Result is the same. I thought I was using latest version anyway.
    box 8,8,312,232,1 works ok.
    filledbox 8,8,312,232,1 and I get image.
    I tried 3 glcds. Should I try a uno or pic to test instead of nano?

     
  • stan cartwright

    stan cartwright - 2019-10-11

    downloaded from https://sourceforge.net/projects/gcbasic/
    Result is the same. I thought I was using latest version anyway.
    box 8,8,312,232,1 works ok.
    filledbox 8,8,312,232,1 and I get image.
    I tried 3 glcds. Should I try a uno or pic to test instead of nano?

     
  • stan cartwright

    stan cartwright - 2019-10-11

    sorry for multiple posts :)
    I changed the lines in ili9341 include as suggested and it works ok now.
    Why was this error not detected earlier?
    edit -thanks evan for making ili9341 useable with gcb.

     

    Last edit: stan cartwright 2019-10-11
    • Anobium

      Anobium - 2019-10-11

      Not sure how this was missed. But, the standard tests do not test that this method is capable of handling a filledbox with a result larger than 65, 535.

      I will update the master libraries. Must be few instances of this error across the ILI libraries.

       
  • stan cartwright

    stan cartwright - 2019-10-11

    I only discovered it when designing your project and wanted low code border. goals will be filled background boxes.
    credit for sorting problem so quick.

     

Log in to post a comment.