m5stack / m5-docs

The URL of M5Stack Official Documents:
http://docs.m5stack.com
MIT License
214 stars 79 forks source link

M5 Core2 Cannot control LCD brightness #180

Open teastainGit opened 3 years ago

teastainGit commented 3 years ago

M5 Core2 Cannot control LCD brightness with APX192.cpp or in sketch set up. Tried editing APX192.cpp with SetLcdVoltage(2900); to get 2.9 volts and tried these ideas that work on StickC and core basic: M5.Axp.SetLcdVoltage(3000); M5.Lcd.setBrightness(255); M5.Axp.ScreenBreath(15); The serial monitor boot up display always says "axp: lcd backlight voltage was set to 2.80v" regardless! Any Ideas? Terry from Canada

Minxster commented 3 years ago

I'm really new to programming, so I might not be too helpful at all. This is function I wrote to try and get around the issues I faced with changing the brightness. Hopefully it can help you :-)

`//Core2 doesn't seem to use the exsint M5.Lcd.SetBrightness!? void SetLCDBrightness (unsigned int BrightVal) { //Why is this not working, is there are reset of some sort after this!? //M5.Lcd.setBrightness(25);

// https://community.m5stack.com/topic/2676/m5-lcd-setbrightness-not-working/2

//Check value is 0>100 if (BrightVal>100) {BrightVal=100;} if (BrightVal<0) {BrightVal=0;}

// vPerc=100; //50% -> need to calc this though BrightVal=(BrightVal*8)+2500; //calc the value M5.Axp.SetLcdVoltage(BrightVal); // v from 2500 to 3300 }`