Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anet n4 fixes #633

Merged
merged 7 commits into from
Jan 1, 2023
Merged

Anet n4 fixes #633

merged 7 commits into from
Jan 1, 2023

Conversation

aspadm
Copy link
Contributor

@aspadm aspadm commented Jan 1, 2023

What does the pull request do?

Fixes for bugs founded after testing full pipeline Prusa -> UVtools -> real printer.

What is the current behavior?

  1. Printer crashes at files with non-empty description.
  2. UVtools can't open files with empty description (length == -1) from original slicer.
  3. Preview from Prusa looks stretched.
  4. Bounding region for layers differs from original slicer.

What is the updated/expected behavior with this PR?

Everything works as expected :)
Tested on real printer, looks like there are no visible errors now. Will investigate further.

aspadm and others added 4 commits January 1, 2023 04:55
In original format both name and description could be an empty string
with length -1.
Bounding rectangle should be an index of first/last white pixels.
Machine with FW v1.65 crashes and reboots for files with non-empty
description. Same for official slicer, so it looks like a FW bug.
@sn4k3
Copy link
Owner

sn4k3 commented Jan 1, 2023

Sorry for the introduced bug...
In which situations you see -1 in length? Using AiPrint without a description I get a 0 on length.
Also Serializer will set length to 0 when string is empty on encode, could we get rid of -1 and leave the int as 0?

@aspadm
Copy link
Contributor Author

aspadm commented Jan 1, 2023

Okay, -1 and 0 both works. It is from Qt string serialization (if I remember correctly).

@sn4k3
Copy link
Owner

sn4k3 commented Jan 1, 2023

https://docs.huihoo.com/qt/5.x/datastreamformat.html

const char *	
The string length (quint32)
The string bytes, excluding the terminating 0

The const char* uses a quint32 as length field, have you observed a -1 at anytime on the file?

@aspadm
Copy link
Contributor Author

aspadm commented Jan 1, 2023

Checked right now: AIPrint inserts -1 as description length.
example

@aspadm
Copy link
Contributor Author

aspadm commented Jan 1, 2023

From docs:

    If the string is null: 0xFFFFFFFF (quint32)
    Otherwise: The string length in bytes (quint32) followed by the data in UTF-16

@sn4k3
Copy link
Owner

sn4k3 commented Jan 1, 2023

Strange, I can't get that behaviour, I'm with AiPrint but I get this:

image

If the string is null: 0xFFFFFFFF (quint32)
Otherwise: The string length in bytes (quint32) followed by the data in UTF-16

Ok they are using QString but still's an quint32 which will turn into uint.MaxValue if null, QT may turn that "special" number/flag into a null, while C# serializer will trip, so we must keep the int.

Still if's ok to you, I would prefer to not init that int's and leave them as 0 as they will be into serialization time?

@aspadm
Copy link
Contributor Author

aspadm commented Jan 1, 2023

I tested both variants on printer and it works. So I see no difference then.

@sn4k3
Copy link
Owner

sn4k3 commented Jan 1, 2023

Also to be sure where bug is, can you try to start print this two files and report back the result?

@aspadm
Copy link
Contributor Author

aspadm commented Jan 1, 2023

Sonic Mini 8K_Ring_NameTest.n4 works, Sonic Mini 8K_Ring_DescriptionTest.n4 resets the machine.

@sn4k3
Copy link
Owner

sn4k3 commented Jan 1, 2023

Ok, what a ugly bug on firmware... Thanks again for your PR, great work 👍
How hard and fun was the UVtools format scheme to implement?

Btw I will open a new PR to implement the N7 into format, they are the same scheme but will need you to test the n4 again after finish

@aspadm
Copy link
Contributor Author

aspadm commented Jan 1, 2023

Anet N4 firmware is a little hell. All you need to know is that LCD works sometimes (looks like LCD driver problem). Hardware is similar to first revision of Anycubic Photon (stm32f407zgt6 + spartan-6), maybe I can port FW from it.
UVtools is pretty easy to expand. It took more time to remember C# (I mostly programming using Python and plain C). Unclear moment was with units convertation (mm/s <-> mm/min), all others moments can be seen from existing printers.

@sn4k3 sn4k3 merged commit ee1f48c into sn4k3:master Jan 1, 2023
@sn4k3
Copy link
Owner

sn4k3 commented Jan 1, 2023

mSLA firmwares are very bad, at this stage is an unthinkable thing. We have tons of trash in the market more because of broken firmwares. Stupid thing that it can be fixed with virtual no cost with an update. They never care about that, instead a new printer is released and then forgoten. We live with very bad economical and environment pratices...

Please check new PR, it should now support N4 and N7.

@aspadm
Copy link
Contributor Author

aspadm commented Jan 1, 2023

Stupid thing that it can be fixed with virtual no cost with an update.

Compared to FDM, it's worse, yes. Most of FDM's are started with Marlin and only after that splitted to many closed firmwares.
And looks like Anet N4 also uses Marlin, at least there are string FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:http://www.mendel-parts.com PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1 in FW binary. It is default responce to the M115. Maybe I need to raise an GPL violation issue...

@sn4k3
Copy link
Owner

sn4k3 commented Jan 1, 2023

The fact is that most printers are using a fork of marlin and most of them are in violation of the license. Chitu based printers for example response to G commands and gcode files, chances are that they use a marlin fork or at least portion of the code which violate the license anyway. As they have thier own fdm boards, all of them are based on marlin. Would they rewrite everything when a base exists?

sn4k3 added a commit that referenced this pull request Jan 2, 2023
- (Add) File format: Anet N7 (#635)
- (Add) PrusaSlicer Printer: Anet N7 (#635)
- (Improvement) Each layer can now be aware of it own resolution
- (Improvement) Better set of file resolution from layers when using a compression codec other than png
- (Fix) Anet N4 printer reset on latest firmware (#633)
- (Fix) PrusaSlicer printers: Change thumbnails resolution to match file preview resolution (Fix stretch images)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants