fix configuring 154B bugs

This commit is contained in:
fsender
2025-03-23 14:01:06 +08:00
parent 25b9e62f5f
commit b8b74b2b8d
3 changed files with 18 additions and 5 deletions

View File

@@ -96,12 +96,15 @@ const unsigned char drvSSD168x::WS_20_30[42] =
};
const unsigned char drvSSD168x::VSH_table[32]=
{/*0x00,0xbc,0xc1,0xc6,0xcb,0x23,0x26,0x28,0x2a,0x2c,0x2e,0x32,0x35,0x39,0x3d,0x41,*/
0x00,0x24,0x28,0x2c,0x30,0x33,0x36,0x38,0x3a,0x3c,0x3e,0x40,0x42,0x44,0x45,0x46,
0x00,0xac,0xb0,0xb6,0xbd,0xc5,0xce,0x26,0x2c,0x33,0x3a,0x42,0x4a,0x4a,0x4a,0x4a,
0x00,0x41,0x3c,0x37,0x32,0x2d,0x28,0x23,0xcb,0xc6,0xc1,0xbc,0xb7,0xb2,0xb0,0xae};
//以下代码均为我 FriendshipEnder 原创, 呵呵哒~~
void drvSSD168x::SetLut() {
static const unsigned char VSH_repeat[16]={
0,1,1,1,1,1,1,1,1,1,1,1,1,2,3,4
};
unsigned int i;
guy_epdCmd(0x3f);
guy_epdParam(greyScaling?0x07:0x02); //greyScaling?0x07:0x22
@@ -119,7 +122,8 @@ void drvSSD168x::SetLut() {
guy_epdParam(i==1?0x80:(i==(greyScaling?0:2)?0x40:0x00));
for(int j=0;j<11;j++) guy_epdParam(0);
}
guy_epdParam(greyScaling?1:iLut);
//guy_epdParam(greyScaling?1:iLut);
guy_epdParam(greyScaling ? 1 : pgm_read_byte(VSH_repeat + iLut));
for(i=0;i<83;i++) guy_epdParam(0);
guy_epdParam(0x22);
for(i=0;i<8;i++) guy_epdParam(0);

View File

@@ -432,7 +432,7 @@ void ReadguyDriver::handleInitPost(){
drawRect((guy_dev->drv_width()>>1)-46+48,(guy_dev->drv_height()>>1)-14,20,28,0);
drawRect((guy_dev->drv_width()>>1)-46+72,(guy_dev->drv_height()>>1)-14,20,28,0);
refresh_begin(0);
guy_dev->drv_fullpart(1);
guy_dev->drv_fullpart(0);
guy_dev->_display((const uint8_t*)getBuffer());
#if (defined(READGUY_ALLOW_DC_AS_BUTTON))
refresh_end();

View File

@@ -538,6 +538,7 @@ void ReadguyDriver::setButtonDriver(){
}
else {
currentBright=-1; //引脚不支持PWM,设置为亮起
pinMode(READGUY_bl_pin, OUTPUT);
digitalWrite(READGUY_bl_pin,HIGH);
}
} //关于按键策略, 我们在此使用多个Button2的类, 然后在一个task共享变量来确定上一个按键状态
@@ -574,13 +575,18 @@ void ReadguyDriver::setBright(int d){
#if ((defined (ESP8266)))
analogWrite(READGUY_bl_pin,d);
#else
#if (defined ( ESP_IDF_VERSION_VAL ) && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)))
#if (defined ( ESP_IDF_VERSION_VAL ) )
#if ( (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)))
analogWrite(READGUY_bl_pin,d);
#else
ledcWrite(0, d);
#endif
#endif
#endif
}
else if(currentBright>=-2 && currentBright<0){ //-1为不支持PWM的亮起,-2为不支持PWM的熄灭
currentBright=d?-1:-2;
pinMode(READGUY_bl_pin, OUTPUT);
digitalWrite(READGUY_bl_pin,d?HIGH:LOW);
}
}
@@ -699,7 +705,10 @@ void ReadguyDriver::invertDisplay(){
}
void ReadguyDriver::sleepEPD(){
if(READGUY_cali==127) {
if(READGUY_bl_pin>=0) digitalWrite(READGUY_bl_pin, LOW); //关闭背光灯, 节省电量
if(READGUY_bl_pin>=0) {
pinMode(READGUY_bl_pin, OUTPUT);
digitalWrite(READGUY_bl_pin, LOW); //关闭背光灯, 节省电量
}
guy_dev->drv_sleep();
}
}