sqfmi / Watchy

Watchy - An Open Source E-Ink Smartwatch
http://www.sqfmi.com
MIT License
2.06k stars 335 forks source link

MicroPython on Watchy #183

Open vgiralt opened 2 years ago

vgiralt commented 2 years ago

Hi, I'm much more comfortable using Python for my developments, it has a faster programming cycle (and it's been ages since I last used C -or variants- :-)). Where can I find instructions on using MicroPython for displaying information on the Watchy screen? Thanks!

Professor-Woody commented 2 years ago

I was going to take a swing at writing a few apps for the watchy myself using micropython. But before I take the jump I want to know what eink screen it is so I can look for some existing drivers (or write my own).

Any information would be appreciated. Edit Don't know why it didn't occur to me to just look at the arduino code. NM.

But it's there any word on other micropython support while we're asking?

Is this project still running even?

rogueeve575 commented 2 years ago

I haven't gotten my firmware to the point where I can test this for sure yet as my plan for it is pretty optimistic, but I am reasonably confident that it's this screen:

https://www.waveshare.com/1.54inch-e-paper-module.htm https://www.waveshare.com/wiki/1.54inch_e-Paper_Module_Manual#Introduction https://github.com/waveshare/e-Paper

The documentation is not awesome and bits are in Chinese, but it's good enough I think to come up with a platform driver for your firmware. I found it was easiest to look at their code for the Raspberry Pi/Jetson Nano, as they don't have a bespoke example for ESP32 and the Raspberry Pi code doesn't have as much platform-setup boilerplate in it that we don't care about, just the screen-specific code mostly--raise this GPIO pin, send this over SPI. And it's certainly less code to wade through than the GxEPD2 source.

They have the RasPi examples in both C and Python if that's your thing and the core driver code is surprisingly actually not all that long nor terribly complicated; don't be dissuaded by the scary-looking wavetable array at the top. I plan to base the driver for my firmware off of this file: https://github.com/waveshare/e-Paper/blob/master/RaspberryPi_JetsonNano/c/lib/e-Paper/EPD_1in54_V2.c

I'm not certain if the Watchy uses the V2 version or the original version of the screen so I'll just have to experiment by compiling and running both examples somehow, maybe taking the screen out and hooking it up to my Pi temporarily using the e-paper hat they have in their store. If you find out anything I'd be interested to hear it and save me some time.

Also intriguing is that Waveshare also makes nearly identical tri-color modules (black/white/red or black/white/yellow) in the same size which look like the pinouts and cable MAY be close enough to just swap them in and change the software to get an upgraded Watchy with color! I never glued down my screen so I ordered one of the red ones and will look into this possibility more when it eventually gets here from China.

edit: looks like someone reported that that screen may not be 100% compatible, although they said it did work partially so I still have plenty of hope; possibly this is because the Watchy has v1 and they ordered a v2 or vice versa? But this'll have to be looked into: https://github.com/sqfmi/Watchy/issues/182

Professor-Woody commented 2 years ago

Much appreciated for the info! I ordered my watchy last night and looking forward to having a play as well.

And I saw the tricolour screens as well! I've looked into them previously and if I remember they have a worse refresh rate. Possibly no partial refreshing either. That's not a deal breaker and It's been a year or two though since I read up on them, but something to watch out for

ITCactus commented 2 years ago

I haven't gotten my firmware to the point where I can test this for sure yet as my plan for it is pretty optimistic, but I am reasonably confident that it's this screen:

https://www.waveshare.com/1.54inch-e-paper-module.htm https://www.waveshare.com/wiki/1.54inch_e-Paper_Module_Manual#Introduction https://github.com/waveshare/e-Paper

it is not. at sqfmi shop you can find the link to the proper module. i also pointed to that in #175

rogueeve575 commented 2 years ago

Oh cool, thanks I must have missed that that page has a datasheet link. So it's from Dalian Good Display then not Waveshare.

Since I already ordered some screens from Waveshare, anyone have any idea if the pinouts are close enough that they could be made to work with software modifications? From #182 it's implied that apparently the cable does connect to the mainboard at least and the display even "kind of" worked...since I'm rewriting a whole new OS from scratch it doesn't bother me to add multiple screen drivers so I can support Waveshare displays as well as the stock screen, especially if the hardware design turns out to be flexible enough that the right software could get the Waveshare 3-color screens working.

saraceni-andrea commented 2 years ago

Hi, I'd like to contribute porting to MicroPython, is there an initial repository? THANK YOU!

hueyy commented 2 years ago

I've been working on porting to MicroPython bit by bit: https://github.com/hueyy/watchy_py

Thus far I've got the eink screen and vibration working on a barebones level. Still working on the rest.

hueyy commented 1 year ago

Hmm I've run into a bit of a snag trying to port Watchy to MicroPython. In short, MicroPython doesn't expose the esp_sleep_get_ext1_wakeup_status API so it's not possible to identify what pin woke the device up (see https://github.com/micropython/micropython/issues/6981). This makes it rather challenging to identify what button was pressed on the Watchy.

theSuda commented 1 year ago

Did this go any further? Is micropython going to be available on Watchy or has the development stopped?

saraceni-andrea commented 1 year ago

Did this go any further? Is micropython going to be available on Watchy or has the development stopped?

Hello @theSuda, I hope there is the intention of a stable MicroPython porting ...

Meanwhile, I'll link you some references and a CircuitPython porting of @joshua-beck-0908

joshua-beck-0908 commented 1 year ago

Ah, I haven't work on the CircuitPython library for a little while, it's not really finished, but I'll try to release what I have this weekend. 😅