nviennot / turbo-resin

Open-source firmware for resin printers
GNU General Public License v3.0
200 stars 21 forks source link

Support Photon Mono 2k #9

Open gudvinr opened 1 year ago

gudvinr commented 1 year ago

Since Photon Mono uses same board and chassis as PM4K and only difference is screen size I think supporting PM should be quite straightforward unless I am missing something.

Compared to PM4K it has 130×80mm² (LxW) screen with 2560×1620 resolution.

Photon Mono_V017.zip: 0.1.7 firmware TEST.pwmo: test print

nviennot commented 1 year ago

Yes, it should just work. Maybe changing a couple of constants here and there, but it should just work

gudvinr commented 1 year ago

I think there should be some hierarchy to make this support easier.
After looking through code I see a lot of conditional compilation based on feature=PRINTER so if you just add mono2k in addition to that it'll need quite a bit of duplication.

It'll become even more noticeable if you add support for mono x 4k, mono x 6k, saturn 2/s, etc where some features are the same but not all of them.

I understand that it is kinda a long shot because even mono4k version doesn't have all planned features and these chores aren't fun in general. But on the other hand, it might be even harder in the future to make this kind of work.

I think even single level of abstraction will make it easier to support different devices, e.g. since mono and mono 4k have basically same platform you can split those devices into phomo platform and 2 mono4k + mono2k devices. Then it'll be possible to use feature=phomo at almost all places where you use mono4k now.

Same thing with Mono X 4k/6k and probably all printers that use same chitu board can be defined through same chituxyz "platform".

nviennot commented 1 year ago

Absolutely agree with you. There's some hierarchy in the work:

For libraries selection, and other selective compilation knobs, we have the Cargo.toml features: https://github.com/nviennot/turbo-resin/blob/main/Cargo.toml#L38-L62

It's hierarchical. See how each printer picks their CPU, which then selects other features. This should also include the list of hardware peripheral like which stepper motor driver to use, which touchscreen driver to use, etc.

In addition, there are constants: https://github.com/nviennot/turbo-resin/tree/main/src/consts

These should be hierarchical, But are not at the moment. My plan is to use YAML files that can include each other to make it hierarchical, like ruby on rails config files. That's why The current config files for constants have no code whatsoever. It's to ease the transition to yaml.

Once we transition to YAML files, we could generate the cargo.toml features as well from the YAML files. That could be nice to have everything in one location.

agittins commented 1 year ago

I've just picked up a Photon Mono (my first resin printer) and I have been rather surprised at how closed the ecosystems are - very happy to have stumbled onto this project, and to see the amazing work already done on the 4k!

I have an stlink-v2 clone, decent camera and at least a few days before I get hold of any actual resin, so is there anything that would be helpful to have from this unit before I start making a sticky mess? My unit's already on the latest firmware, but I could probably take pull dumps from it if they'd be useful, or if there are unknown pinouts on this board I'll get some photos - or do you already have what you need from this board?

I think I'll at least bring out the SWD pins to the outside so I can play with firmware going forward, is there a solid process (normal caveats excluded!) for being able to write the factory firmware back after experimenting (via stlink2)?

EDIT: Gah, I see there's a makefile target for restoring the original firmware (providing a copy has been taken) - that's awesome!

nviennot commented 1 year ago

I'm glad this project is of interest!

I'm having a bit of a pause on the project as I have to push hard on something at work. So if you know how to code, go ahead, otherwise, stand by :)

stisa commented 1 year ago

@agittins I had a pass at this last year, mostly copy-pasting the mono4k implementation, but since i only have a motherboard for the mono 2k and I couldn't get serial to work, I am not sure how well it works. It flashed fine though.

PS: if you can get some kind of serial I'd be very thankful!