From 107f639b0b4019d32195bd351063bdeccdf188f4 Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Sat, 16 Nov 2024 00:04:23 +0800 Subject: [PATCH] fix bwr display --- Keil/EPD.uvprojx | 17 +---------------- config/bsp.h | 2 +- html/js/dithering.js | 2 +- html/js/main.js | 3 ++- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/Keil/EPD.uvprojx b/Keil/EPD.uvprojx index fe334a4..4b3b62f 100644 --- a/Keil/EPD.uvprojx +++ b/Keil/EPD.uvprojx @@ -478,11 +478,6 @@ 1 ..\components\drivers_nrf\spi_master\nrf_drv_spi.c - - nrf_drv_twi.c - 1 - ..\components\drivers_nrf\twi_master\nrf_drv_twi.c - nrf_nvmc.c 1 @@ -891,7 +886,7 @@ BLE_STACK_SUPPORT_REQD S110 SWI_DISABLE0 SOFTDEVICE_PRESENT NRF51 DEBUG NRF_LOG_USES_RTT=1 - ..\config;..\EPD;..\components\toolchain;..\components\drivers_nrf\config;..\components\drivers_nrf\common;..\components\drivers_nrf\delay;..\components\drivers_nrf\gpiote;..\components\drivers_nrf\hal;..\components\drivers_nrf\spi_master;..\components\drivers_nrf\pstorage;..\components\drivers_nrf\pstorage\config;..\components\drivers_nrf\twi_master;..\components\drivers_ext\segger_rtt;..\components\libraries\trace;..\components\libraries\timer;..\components\libraries\util;..\components\ble\common;..\components\ble\ble_advertising;..\components\softdevice\common\softdevice_handler;..\components\softdevice\s110\headers + ..\config;..\EPD;..\components\toolchain;..\components\drivers_nrf\config;..\components\drivers_nrf\common;..\components\drivers_nrf\delay;..\components\drivers_nrf\gpiote;..\components\drivers_nrf\hal;..\components\drivers_nrf\spi_master;..\components\drivers_nrf\pstorage;..\components\drivers_nrf\pstorage\config;..\components\drivers_ext\segger_rtt;..\components\libraries\trace;..\components\libraries\timer;..\components\libraries\util;..\components\ble\common;..\components\ble\ble_advertising;..\components\softdevice\common\softdevice_handler;..\components\softdevice\s110\headers @@ -1030,11 +1025,6 @@ 1 ..\components\drivers_nrf\spi_master\nrf_drv_spi.c - - nrf_drv_twi.c - 1 - ..\components\drivers_nrf\twi_master\nrf_drv_twi.c - nrf_nvmc.c 1 @@ -1582,11 +1572,6 @@ 1 ..\components\drivers_nrf\spi_master\nrf_drv_spi.c - - nrf_drv_twi.c - 1 - ..\components\drivers_nrf\twi_master\nrf_drv_twi.c - nrf_nvmc.c 1 diff --git a/config/bsp.h b/config/bsp.h index 4e75f46..49eb0c5 100644 --- a/config/bsp.h +++ b/config/bsp.h @@ -6,4 +6,4 @@ #define RTS_PIN_NUMBER 0 #define CTS_PIN_NUMBER 0 -#endif \ No newline at end of file +#endif diff --git a/html/js/dithering.js b/html/js/dithering.js index 42f12aa..5c9525f 100644 --- a/html/js/dithering.js +++ b/html/js/dithering.js @@ -92,7 +92,7 @@ function canvas2bytes(canvas, type='bw') { if (type !== 'bwr') { buffer.push(imageData.data[index] > 0 && imageData.data[index+1] > 0 && imageData.data[index+2] > 0 ? 1 : 0); } else { - buffer.push(imageData.data[index] > 0 && imageData.data[index+1] === 0 && imageData.data[index+2] === 0 ? 1 : 0); + buffer.push(imageData.data[index] > 0 && imageData.data[index+1] === 0 && imageData.data[index+2] === 0 ? 0 : 1); } if (buffer.length === 8) { diff --git a/html/js/main.js b/html/js/main.js index 282b496..2f396ef 100644 --- a/html/js/main.js +++ b/html/js/main.js @@ -76,6 +76,7 @@ async function sendIMGArray(imgArray, type = 'bw'){ async function sendimg(cmdIMG) { startTime = new Date().getTime(); + let epdDriver = document.getElementById("epddriver").value; let imgArray = cmdIMG.replace(/(?:\r\n|\r|\n|,|0x| )/g, ''); const bwArrLen = (canvas.width/8) * canvas.height * 2; @@ -86,7 +87,7 @@ async function sendimg(cmdIMG) { await sendcmd("0313"); await sendIMGArray(imgArray.slice(bwArrLen), 'bwr'); } else { - await sendcmd("0313"); + await sendcmd(epdDriver === "03" ? "0310" : "0313"); await sendIMGArray(imgArray); } await sendcmd("05");