Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bangle.js: New devices have wrong LCD gamma #1758

Open
gfwilliams opened this issue Feb 14, 2020 · 3 comments
Open

Bangle.js: New devices have wrong LCD gamma #1758

gfwilliams opened this issue Feb 14, 2020 · 3 comments

Comments

@gfwilliams
Copy link
Member

@gfwilliams gfwilliams commented Feb 14, 2020

I'm pretty sure the Node.js/Bangle Beta devices have a slightly different LCD to the one I use for testing - the contrast is way off, and we need new gamma curves.

Here's my testing:

for (var i=0;i<240;i+=2) {
  var c = i/240;
  g.setColor(c,c,c);
  g.fillRect(i,0,i+1,239);
}
var y;
// random dots to give some idea of what gamma SHOULD be
for (var i=0;i<240;i++) {
  var c = i/240;
  for (y=100;y<140;y++) {
    g.setPixel(i,y,(c<Math.random())?0:-1);
  }
}

function setGamma(gamma) {
  Bangle.lcdWr(0xe0,gamma); // PVGAMCTRL
  Bangle.lcdWr(0xe1,gamma); // NVGAMCTRL
}

Bangle.setLCDPower(1);
Bangle.setLCDTimeout(0);
//BETTER setGamma([0xf0,0x09,0x13,0x0A,0x0b,0x06,0x38,0x33,0x4f,0x04,0xd,0x19,0x2e,0x2f]);
//BAD - setGamma([0xd0,0x06,0x0c,0x09,0x09,0x25,0x2e,0x33,0x45,0x36,0x12,0x12,0x2e,0x34]); // what we use now
//BETTER setGamma([0x70,0x2C,0x2E,0x15,0x10,0x09,0x48,0x33,0x53,0x0B,0x19,0x18,0x20,0x25]); // https://github.com/Xilinx/linux-xlnx/blob/master/drivers/staging/fbtft/fb_st7789v.c

// BAD - https://forum.arduino.cc/index.php?topic=546228.0
//Bangle.lcdWr(0xe0,[0xD0, 0x00, 0x05, 0x0E, 0x15, 0x0D, 0x37, 0x43, 0x47, 0x09, 0x15, 0x12, 0x16, 0x19]);
//Bangle.lcdWr(0xe1,[0xD0, 0x00, 0x05, 0x0D, 0x0C, 0x06, 0x2D, 0x44, 0x40, 0x0E, 0x1C, 0x18, 0x16, 0x19]);

// best so far - altered curve
// index 1 onwards changes the lighter end of gamma
// last array elements change the darker end of gamma
setGamma([0x70,0x1f,0x20,0x15,0x10,0x09,0x48,0x33,0x53,0x0B,0x19,0x15,0x2a,0x2f]);

So the last command should really improve contrast

@gfwilliams

This comment has been minimized.

Copy link
Member Author

@gfwilliams gfwilliams commented Feb 14, 2020

Actually the data is described in 8.19 Gamma Correction and PVGAMCTRL in https://www.newhavendisplay.com/appnotes/datasheets/LCDs/ST7789V.pdf

But randomly tweaking numbers may be easier!

@MaBecker

This comment has been minimized.

Copy link
Contributor

@MaBecker MaBecker commented Feb 14, 2020

I can confirm this, the first watch is much darker than the two I got via Kickstarter.

@MaBecker

This comment has been minimized.

Copy link
Contributor

@MaBecker MaBecker commented Feb 14, 2020

No sure, does this difference has to do with gamma, I would say no ...

The left one is from kickstarter , it is much brigther, both have set Bangle.setLCDBrightness(1)

IMG_9818

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.