Closed brainlessboy closed 8 months ago
I've added a UC8159 driver (used by the Impression 4 and 5.7) to the repository and built it as a package:
https://github.com/aeroniemi/inky-ts/pkgs/npm/inky
It hasn't been tested as I don't have any of those devices to try it out on, so if you find any issues let me know.
many many thanks!, i am trying to get this running (on a raspi zero 2w, i tested the hardware setup with python) ... the javascript code looks like this (altered your example code as i would expect it to work):
// index.js
const epaper = require('@aeroniemi/inky');
async function main() {
let screen = new epaper.Impression57();
screen.display_png("./bubblerobot.png");
await screen.show();
}
main();
(installing it from npm does not work, i had to manually install the dist into node.modules
then i execute
sudo node index.js
and i get the following error
/home/bubble/Documents/screentest/node_modules/rpio/lib/rpio.js:1158
throw new Error('Clock divider must be an even number between 0 and 65536');
^
Error: Clock divider must be an even number between 0 and 65536
at rpio.spiSetClockDivider (/home/bubble/Documents/screentest/node_modules/rpio/lib/rpio.js:1158:9)
at InkyImpression57.<anonymous> (/home/bubble/Documents/screentest/node_modules/@aeroniemi/inky/dist/inky_uc8159.js:80:32)
at Generator.next (<anonymous>)
at /home/bubble/Documents/screentest/node_modules/@aeroniemi/inky/dist/inky_uc8159.js:8:71
at new Promise (<anonymous>)
at __awaiter (/home/bubble/Documents/screentest/node_modules/@aeroniemi/inky/dist/inky_uc8159.js:4:12)
at InkyImpression57.setup (/home/bubble/Documents/screentest/node_modules/@aeroniemi/inky/dist/inky_uc8159.js:71:16)
at InkyImpression57.<anonymous> (/home/bubble/Documents/screentest/node_modules/@aeroniemi/inky/dist/inky_uc8159.js:192:24)
at Generator.next (<anonymous>)
at /home/bubble/Documents/screentest/node_modules/@aeroniemi/inky/dist/inky_uc8159.js:8:71
i changed the divider from 2500000/300000
to simply 25000
directly the javascript file within the node.modules dist folder ...
and the screen reacts! (it takes very long until it updates but then something happens), unfortunately it outputs a scrambled image ...
i played with these configurations
// Panel Setting
// 0b11000000 = Resolution select, 0b00 = 640x480, our panel is 0b11 = 600x448
// 0b00100000 = LUT selection, 0 = ext flash, 1 = registers, we use ext flash
// 0b00010000 = Ignore
// 0b00001000 = Gate scan direction, 0 = down, 1 = up(default )
// 0b00000100 = Source shift direction, 0 = left, 1 = right(default )
// 0b00000010 = DC - DC converter, 0 = off, 1 = on
// 0b00000001 = Soft reset, 0 = Reset, 1 = Normal(Default)
// 0b11 = 600x448
// 0b10 = 640x400
this.send_command(UC8159_PSR, [
(this.resolution_setting << 6) | 0b11101111,
0x08 // display_colours == UC8159_7C
]);
specially this line: i altered the configuration to be another resolution and played around with the other switches without actually knowing what i am doing :0]
(this.resolution_setting << 6) | 0b11101111,
i works! i get the image as expected :-)
BUT
this part, takes more then 3 minutes ...
this.send_command(UC8159_DTM1, buf);
the library you probably used to implement is from here https://github.com/pimoroni/inky/blob/master/library/inky/inky_uc8159.py and that is exactly the library i used to test the hardware ... how ever the PY version is much much faster ...
this line, the division results in 83.333333, and throws an error saying it needs an even number, i just replaced the division with the number 84 and now its as fast as the PY version ...
rpio.spiSetClockDivider(250000000 / 3000000); // 25MHz
to
rpio.spiSetClockDivider(84); // 25MHz
should i fork and do a pull request? or will you just update these details? again, many thanks for updating :-)
That's great to hear - I'll merge the relevant PR and close the duplicate alongside the changes to the readme!
I now remember that I didn't actually write the code related to defining this.resolution_setting
, so that's probably the cause of the issue related to that (it thinking that you're on a 4" display)
many thanks will close this then :-)
Hi :-) will you provide support for other Inky sizes? e.g. 4" and 5.7" ?