Skip to content

Conversation

@MisterTeknis
Copy link
Contributor

@MisterTeknis MisterTeknis commented Jan 4, 2026

New to GIT so hope this is right.

I was having issues where the print history or filament tracking was not working on my P2S in LAN Only mode, Read through the logs and stepped through the code to find issues with the model download was trying to grab paths it didn't have access to from the printers internal storage.

Changes:
Corrected LAN Only gcode file download to fix filament tracking.
Added path filtering to filename only to fix cases where there are unexpected paths.
Added retry attempts to prevent race condition where files were not fully saved on the printer before trying to grab them.
If a file still can't be downloaded, list out the files it could find in the cache directory for debugging.

Required printer option: Store sent files on external storage

Tested on P2S with AMS 2 Pro

Maybe related to issues:
#41
#78

Corrected LAN Only gcode file download to fix filament tracking. Added path filtering to filename only. Added retry attempts to prevent race condition where files were not fully saved on the printer before trying to grab them.

Required printer option: Store sent files on external storage

Tested on P2S with AMS 2 Pro
Fix the pycurl connection not being reset properly between retries / directory listings causing dropped connection errors.
@Xento
Copy link
Collaborator

Xento commented Jan 4, 2026

Thanks for your fix.
I implemented something similar yesterday: Xento@4fa75df
In #78 the url is this: file:///sdcard/Design Clip Single Color 100mm_Clip Single Color.gcode.3mf

Would this file be placed under /cache/Design Clip Single Color 100mm_Clip Single Color.gcode.3mf ?

In my implementation it should be downloaded from /sdcard/Design Clip Single Color 100mm_Clip Single Color.3mf

@MisterTeknis
Copy link
Contributor Author

I can only go off what I have observed with my P2s, so might be some differences there. I am using lan only mode.

Not at the computer to do more testing sorry. Further tests tomorrow. From memory.

There isn't a file path /sdcard to grab files from. At least not one that have permissions to see. Not even visible in FileZilla.
When having a USB installed and set printer options of storing sent files on external storage, all sent files are stored under the /cache/ directory. So in your example I could access the file /cache/Design Clip Single Color 100mm_Clip Single Color.gcode.3mf
Before I changed the passed url to truncate to only the file name it was trying to access "emmc" storage, it didn't have permissions. I think that's the internal printer memory.

I suspect with the different printers they are likely to store files differently, which is going to make this harder to test thoroughly.

@Xento
Copy link
Collaborator

Xento commented Jan 4, 2026

Ok, I think that all files are in the cache directory is correct.
The replacement of ".gcode" is there from the beginning of this project.
So can you check if the files contain .gcode at the end?
On my A1 I only have 3mf files without .gcode before the 3mf ending.

@MisterTeknis
Copy link
Contributor Author

Mine all still had gcode in the file names. So all ending in .gcode.3mf

@Xento Xento merged commit 173a4a3 into drndos:main Jan 4, 2026
4 checks passed
@MisterTeknis MisterTeknis deleted the LAN-Printer-Tracking-Fixes branch January 4, 2026 19:23
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.

2 participants