Bitmap colours are not mapping corectly

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
unawoo
 
Posts: 114
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

Post by unawoo »

Okay
i had the original color_rect on the new clue so i compaired it to the real thing.
so i flashed the original clue with:
1. clue_color_rect.uf2 = large rectangles as before
2. clue_color_test_gc1.uf2 = no change
3. clue_color_test_gc2.uf2 = fixed, exactly same as good clue
4. clue_color_test_gc3.uf2 = fixed, exactly same as good clue
5. clue_color_test_gc4.uf2 = rectangles and small blocks

User avatar
unawoo
 
Posts: 114
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

Post by unawoo »

Hey Carter,
looked at the arduino links and it is too convoluted for me, it would take me a long time to figure out.
how about the gc.uf2's, were they create from an arduino file?

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: Bitmap colours are not mapping corectly

Post by adafruit_support_carter »

I hacked the ST7789 Arduino library directly to force sending that one init command. Basically just edited this init array:
https://github.com/adafruit/Adafruit-ST ... 89.cpp#L51
Did that for each option and recompiled each time.

[EDIT] Oh, and if you don't know the trick - once you've uploaded an Arduino sketch, if you want a UF2 copy of it, then put the board in bootloader mode and copy off the file CURRENT.UF2. You can rename it if you want. That's how I created those 4 UF2 files.

User avatar
unawoo
 
Posts: 114
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

Post by unawoo »

well i still can't figure it out. can you post the arduino code for the gc2.uf2 as an example?

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: Bitmap colours are not mapping corectly

Post by adafruit_support_carter »

Here's the code for the main color test sketch. This is the same for each version, since the changes are in the library code:

Code: Select all

#include "Adafruit_Arcada.h"
Adafruit_Arcada arcada;

#define NX 15
#define NY 15

void setup(void) {
  Serial.begin(9600);
  //while (!Serial);
  
  arcada.arcadaBegin();
  arcada.displayBegin();
  arcada.setBacklight(255);

  int width = arcada.display->width();
  int height = arcada.display->height();

  int DX = width / NX;
  int DY = height / NY;
  float DH = 360.0 / (NX*NY);
  float hue = 0;

  Serial.print("DX = "); Serial.println(DX);
  Serial.print("DY = "); Serial.println(DY);
  Serial.print("DH = "); Serial.println(DH);

  for (int y=0; y<height; y+=DY) {
    for (int x=0; x<width; x+=DX) {
      uint16_t rgb = arcada.ColorHSV565(int16_t(hue), 100, 100);
      Serial.print("("); Serial.print(x); Serial.print(","); Serial.print(y); Serial.print(") to ");
      Serial.print("("); Serial.print(x+DX); Serial.print(","); Serial.print(y+DY); Serial.print(") ");
      Serial.print("hue = "); Serial.print(hue); Serial.print(" rgb = "); Serial.println(rgb);
      arcada.display->fillRect(x, y, x+DX, y+DY, rgb);
      hue += DH;
    }
  }
}

void loop() {
}
Here's the edited section of code from the library file Adafruit_ST7789.cpp:

Code: Select all

static const uint8_t PROGMEM
  generic_st7789[] =  {                // Init commands for 7789 screens
    10,                              //  9 commands in list:
    ST77XX_SWRESET,   ST_CMD_DELAY, //  1: Software reset, no args, w/delay
      150,                          //     ~150 ms delay
    ST77XX_SLPOUT ,   ST_CMD_DELAY, //  2: Out of sleep mode, no args, w/delay
      10,                          //      10 ms delay
    ST77XX_COLMOD , 1+ST_CMD_DELAY, //  3: Set color mode, 1 arg + delay:
      0x55,                         //     16-bit color
      10,                           //     10 ms delay
    ST77XX_MADCTL , 1,              //  4: Mem access ctrl (directions), 1 arg:
      0x08,                         //     Row/col addr, bottom-top refresh
    ST77XX_CASET  , 4,              //  5: Column addr set, 4 args, no delay:
      0x00,
      0,        //     XSTART = 0
      0,
      240,  //     XEND = 240
    ST77XX_RASET  , 4,              //  6: Row addr set, 4 args, no delay:
      0x00,
      0,             //     YSTART = 0
      320>>8,
      320&0xFF,  //     YEND = 320
    ST77XX_INVON  ,   ST_CMD_DELAY,  //  7: hack
      10,
    ST77XX_NORON  ,   ST_CMD_DELAY, //  8: Normal display on, no args, w/delay
      10,                           //     10 ms delay
    ST77XX_DISPON ,   ST_CMD_DELAY, //  9: Main screen turn on, no args, delay
      10,                          //    10 ms delay
    0x26, 1, 0x02};
You can change the last value in the last line:

Code: Select all

    0x26, 1, 0x02};
to be 0x01, 0x02, 0x04, or 0x08.

0x26 is the gamma curve set command
0x01, 0x02, 0x04, and 0x08 are the actual setting

User avatar
margor
 
Posts: 5
Joined: Mon Mar 16, 2015 2:55 am

Re: Bitmap colours are not mapping corectly

Post by margor »

unawoo wrote:Okay
i had the original color_rect on the new clue so i compaired it to the real thing.
so i flashed the original clue with:
1. clue_color_rect.uf2 = large rectangles as before
2. clue_color_test_gc1.uf2 = no change
3. clue_color_test_gc2.uf2 = fixed, exactly same as good clue
4. clue_color_test_gc3.uf2 = fixed, exactly same as good clue
5. clue_color_test_gc4.uf2 = rectangles and small blocks
My Clue has the same behavior.
Attachments
GC4
GC4
Adafruit_Clue_ - 3.jpeg (87.23 KiB) Viewed 333 times
GC2 &amp; GC3
GC2 & GC3
Adafruit_Clue_ - 2.jpeg (88.03 KiB) Viewed 333 times
GC1
GC1
Adafruit_Clue_ - 1.jpeg (81.73 KiB) Viewed 333 times

User avatar
unawoo
 
Posts: 114
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

Post by unawoo »

@carter
the arduino mod to the ccp file gives me "arm-none-eabi-gcc" errors. tried running it from a separate folder on desktop with the code, ccp and h files in the same place.

@margor
a fix for when the clue is running a circuitpython program is to include these lines at the top:

import board
display = board.DISPLAY
display.bus.send(0x26, b"\x04")

your program may include the import board command, if so don't duplicate it.
now all the colors should be right.

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: Bitmap colours are not mapping corectly

Post by adafruit_support_carter »

@margor Looks like yours is definitely doing the same thing. Please start a new thread so we can use that to work on getting you a replacement CLUE.

User avatar
unawoo
 
Posts: 114
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

Post by unawoo »

hi carter,
needed to update a few libraries in arduino, now the code compiles, but to no effect.
i tried 01,02,04 and 08 none work.
thanks for trying.

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: Bitmap colours are not mapping corectly

Post by adafruit_support_carter »

@unawoo No worries. Just go ahead and use the replacement CLUE that seems to be working OK. Even though it seems like we can make the other CLUE behave better, we aren't currently considering that to be a fix. So for now, we aren't going to be updating the libraries to try and incorporate those changes. We are looking to get one of these mis-behaving CLUEs back for further testing, but I think we've bugged you enough at this point. So I'd say just forget about it for now and have fun with the replacement CLUE. That one is working OK per all the guides and stuff, right?

User avatar
unawoo
 
Posts: 114
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

Post by unawoo »

it's a great board, a tricorder is just a tough away.
and thanks to you and Kevin i can use my mis-behaving clue with circuitpython, hope you get your hands on one so you can experience it yourself. :)
oh and yes, all the examples work on the new one with circuitpython and arduino.

Locked
Please be positive and constructive with your questions and comments.

Return to “CLUE Board”