自动识别FLASH中保存的分辨率等信息

This commit is contained in:
tpu
2025-07-20 22:36:29 +08:00
parent e461c0dca0
commit d7c96e9411
6 changed files with 50 additions and 6 deletions

View File

@@ -70,10 +70,12 @@ Flash的0x39000处存放有墨水屏所使用的IO的信息:
Flash的0x3a000处存放有墨水屏的分辨率等信息: Flash的0x3a000处存放有墨水屏的分辨率等信息:
00 25 00 00 92 fa a8 fe 00 01 80 00 28 01 04 00
0080 0128 128x296 BWR
40 1f 00 00 f0 70 18 01 00 01 7a 00 fa 00 fc 07 40 1f 00 00 f0 70 18 01 00 01 7a 00 fa 00 fc 07
007a 00fa 122x250 007a 00fa 122x250 BWR
c4 0a 00 00 1a 4f ae 5a 00 00 68 00 d4 00 04 00 c4 0a 00 00 1a 4f ae 5a 00 00 68 00 d4 00 04 00
0068 00d4 104x212 0068 00d4 104x212 BW
原版的固件,不知道什么原因,无法用蓝牙搜索到。否则可以无损更新固件了(但大多数价签的电池都是没电的,还是得拆开)。 原版的固件,不知道什么原因,无法用蓝牙搜索到。否则可以无损更新固件了(但大多数价签的电池都是没电的,还是得拆开)。

View File

@@ -14,6 +14,10 @@ int scr_padding;
int update_mode; int update_mode;
int lut_size; int lut_size;
int detect_w = 104;
int detect_h = 212;
int detect_mode = EPD_BW;
// 窗口参数 // 窗口参数
int win_w; int win_w;
@@ -356,6 +360,7 @@ void epd_screen_update(void)
for(i=0; i<win_h*line_bytes; i++){ for(i=0; i<win_h*line_bytes; i++){
epd_data(fb_bw[i]); epd_data(fb_bw[i]);
} }
if(scr_mode&EPD_BWR){ if(scr_mode&EPD_BWR){
epd_cmd(0x26); epd_cmd(0x26);
for(i=0; i<win_h*line_bytes; i++){ for(i=0; i<win_h*line_bytes; i++){

View File

@@ -73,7 +73,9 @@ int select_font(int id);
void fb_test(void); void fb_test(void);
#define EPD_BW 0x00
#define EPD_BWR 0x20 #define EPD_BWR 0x20
#define MIRROR_H 0x40 #define MIRROR_H 0x40
#define MIRROR_V 0x80 #define MIRROR_V 0x80
#define ROTATE_0 0x00 // 0 #define ROTATE_0 0x00 // 0
@@ -99,6 +101,12 @@ extern int line_bytes;
extern int scr_padding; extern int scr_padding;
extern int update_mode; extern int update_mode;
extern int detect_w;
extern int detect_h;
extern int detect_mode;
extern int win_w; extern int win_w;
extern int win_h; extern int win_h;

View File

@@ -10,7 +10,7 @@
int fb_w; int fb_w;
int fb_h; int fb_h;
#define FB_SIZE 4096 #define FB_SIZE 4736
u8 fb_bw[FB_SIZE]; u8 fb_bw[FB_SIZE];
u8 fb_rr[FB_SIZE]; u8 fb_rr[FB_SIZE];

View File

@@ -346,6 +346,34 @@ int selflash(int otp_boot)
int id = sf_readid(); int id = sf_readid();
printk("Flash ID: %08x\n", id); printk("Flash ID: %08x\n", id);
sf_read(0x39000, 16, pbuf);
printk("39000: ");
for(int i=0; i<16; i++){
printk(" %02x", pbuf[i]);
}
printk("\n");
printk("EPD Type: %02x\n", pbuf[0]);
if(pbuf[1]==0x01){
printk("EPD Gpio: %02x %02x %02x %02x %02x %02x %02x %02x\n",
pbuf[8], pbuf[9], pbuf[10], pbuf[11], pbuf[12], pbuf[13], pbuf[14], pbuf[15]);
}
sf_read(0x3a000, 16, pbuf);
printk("3a000: ");
for(int i=0; i<16; i++){
printk(" %02x", pbuf[i]);
}
printk("\n");
int xres = *(u16*)(pbuf+10);
int yres = *(u16*)(pbuf+12);
if(xres<512 && yres<512){
detect_w = xres;
detect_h = yres;
detect_mode = pbuf[9]? EPD_BWR : EPD_BW;
printk("EPD Res: %dx%d %d\n", xres, yres, pbuf[9]);
}
int region_table = (int)&Region$$Table$$Base; int region_table = (int)&Region$$Table$$Base;
int firm_size = *(u32*)(region_table+0x10) - 0x07fc0000; int firm_size = *(u32*)(region_table+0x10) - 0x07fc0000;
printk("Firm size: %08x\n", firm_size); printk("Firm size: %08x\n", firm_size);

View File

@@ -183,13 +183,14 @@ void user_app_init(void)
adv_state = 0; adv_state = 0;
fspi_config(0x00030605); fspi_config(0x00030605);
epd_hw_init(0x23200700, 0x05210006, 104, 212, ROTATE_3); // 2.13黑白屏6个测试点 selflash(otp_boot);
epd_hw_init(0x23200700, 0x05210006, detect_w, detect_h, detect_mode | ROTATE_3); // 2.13黑白屏6个测试点
if(epd_detect()==0){ if(epd_detect()==0){
epd_hw_init(0x23111000, 0x07210120, 104, 212, ROTATE_3); // 2.13黑白屏5个测试点 epd_hw_init(0x23111000, 0x07210120, detect_w, detect_h, detect_mode | ROTATE_3); // 2.13黑白屏5个测试点
epd_detect(); epd_detect();
} }
selflash(otp_boot);
default_app_on_init(); default_app_on_init();
} }