fix bwr display

This commit is contained in:
Shuanglei Tao
2024-11-16 00:04:23 +08:00
parent 32eb020b62
commit 107f639b0b
4 changed files with 5 additions and 19 deletions

View File

@@ -478,11 +478,6 @@
<FileType>1</FileType>
<FilePath>..\components\drivers_nrf\spi_master\nrf_drv_spi.c</FilePath>
</File>
<File>
<FileName>nrf_drv_twi.c</FileName>
<FileType>1</FileType>
<FilePath>..\components\drivers_nrf\twi_master\nrf_drv_twi.c</FilePath>
</File>
<File>
<FileName>nrf_nvmc.c</FileName>
<FileType>1</FileType>
@@ -891,7 +886,7 @@
<MiscControls></MiscControls>
<Define>BLE_STACK_SUPPORT_REQD S110 SWI_DISABLE0 SOFTDEVICE_PRESENT NRF51 DEBUG NRF_LOG_USES_RTT=1</Define>
<Undefine></Undefine>
<IncludePath>..\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</IncludePath>
<IncludePath>..\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</IncludePath>
</VariousControls>
</Cads>
<Aads>
@@ -1030,11 +1025,6 @@
<FileType>1</FileType>
<FilePath>..\components\drivers_nrf\spi_master\nrf_drv_spi.c</FilePath>
</File>
<File>
<FileName>nrf_drv_twi.c</FileName>
<FileType>1</FileType>
<FilePath>..\components\drivers_nrf\twi_master\nrf_drv_twi.c</FilePath>
</File>
<File>
<FileName>nrf_nvmc.c</FileName>
<FileType>1</FileType>
@@ -1582,11 +1572,6 @@
<FileType>1</FileType>
<FilePath>..\components\drivers_nrf\spi_master\nrf_drv_spi.c</FilePath>
</File>
<File>
<FileName>nrf_drv_twi.c</FileName>
<FileType>1</FileType>
<FilePath>..\components\drivers_nrf\twi_master\nrf_drv_twi.c</FilePath>
</File>
<File>
<FileName>nrf_nvmc.c</FileName>
<FileType>1</FileType>

View File

@@ -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) {

View File

@@ -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");