0

Bitmap colours are not mapping corectly
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Bitmap colours are not mapping corectly

by unawoo on Wed Aug 19, 2020 7:01 pm

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

unawoo
 
Posts: 102
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

by unawoo on Wed Aug 19, 2020 8:47 pm

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?

unawoo
 
Posts: 102
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

by adafruit_support_carter on Wed Aug 19, 2020 9:34 pm

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.

adafruit_support_carter
 
Posts: 20281
Joined: Tue Nov 29, 2016 2:45 pm

Re: Bitmap colours are not mapping corectly

by unawoo on Wed Aug 19, 2020 10:17 pm

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

unawoo
 
Posts: 102
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

by adafruit_support_carter on Thu Aug 20, 2020 12:26 am

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 | TOGGLE FULL SIZE
#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 | TOGGLE FULL SIZE
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 | TOGGLE FULL SIZE
    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

adafruit_support_carter
 
Posts: 20281
Joined: Tue Nov 29, 2016 2:45 pm

Re: Bitmap colours are not mapping corectly

by margor on Sat Aug 22, 2020 8:55 am

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
Adafruit_Clue_ - 3.jpeg
GC4
Adafruit_Clue_ - 3.jpeg (87.23 KiB) Viewed 129 times
Adafruit_Clue_ - 2.jpeg
GC2 & GC3
Adafruit_Clue_ - 2.jpeg (88.03 KiB) Viewed 129 times
Adafruit_Clue_ - 1.jpeg
GC1
Adafruit_Clue_ - 1.jpeg (81.73 KiB) Viewed 129 times

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

Re: Bitmap colours are not mapping corectly

by unawoo on Sat Aug 22, 2020 1:20 pm

@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.

unawoo
 
Posts: 102
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

by adafruit_support_carter on Mon Aug 24, 2020 11:36 am

@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.

adafruit_support_carter
 
Posts: 20281
Joined: Tue Nov 29, 2016 2:45 pm

Re: Bitmap colours are not mapping corectly

by unawoo on Tue Aug 25, 2020 4:07 pm

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.

unawoo
 
Posts: 102
Joined: Thu Apr 14, 2016 9:39 pm

Re: Bitmap colours are not mapping corectly

by adafruit_support_carter on Tue Aug 25, 2020 4:15 pm

@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?

adafruit_support_carter
 
Posts: 20281
Joined: Tue Nov 29, 2016 2:45 pm

Re: Bitmap colours are not mapping corectly

by unawoo on Tue Aug 25, 2020 6:24 pm

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.

unawoo
 
Posts: 102
Joined: Thu Apr 14, 2016 9:39 pm

Please be positive and constructive with your questions and comments.