-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
QR code generation #10
Comments
If you want it to also integrate with barcodes on a printer, it sounds like you want to add printers as a concept to Spoolman as well. Currently, Spoolman only cares about filaments and spools, not machines. But it's something I've had in mind. |
I see. So in theory, without printer integration. There would be no point
for qr codes? I'm trying to think of the logic and in order for spoolman to
scan a QR code to make active, it would need to make it active to a
particular printer and send that info to mainsail, similar to what the curl
command is doing now.
Seems like QR code integration would need to happen on mainsail's end
considering it is mainsail that is telling Spoolman what spool is active.
I honestly don't know enough of how this work but my vision would be to be
able to open Spoolman on my phone, scan a qr code, and select a destination
eg. Printer 1 (make active on that instants of mainsail), printer 2(make
active on that instants of mainsail), storage 1(deactivate if active),
storage 2(deactivate if active)
I'm not a developer but I do have a QR code scanner app that is in
development. If you're not interested in creating all of this, I could
incorporate that feature in my app. If this is something that would be
possible and you would be interested in doing so, let me know I will talk
to my developer.
Here is my app. It is q WIP.
https://play.google.com/store/apps/details?id=com.be.solo.qr.code.scanner
…On Mon, Jun 26, 2023, 1:57 PM Donkie ***@***.***> wrote:
If you want it to also integrate with barcodes on a printer, it sounds
like you want to add printers as a concept to Spoolman as well. Currently,
Spoolman only cares about filaments and spools, not machines. But it's
something I've had in mind.
—
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOQWWQXKF45B6RYCZMURGLXNHEPZANCNFSM6AAAAAAZTFOPKE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
It sounds like that is something that could be entirely done in a frontend like Mainsail, yes. I believe it's time to take this suggestion to them. They could likely integrate a QR code scanner directly in their frontend, since browsers nowadays support giving direct access to the camera. |
Okay, would it be best for you to create the QR code when the spool is
created? Once spoolman is added to the frontend, I will send a picture
request to mainsail. I'm not sure how receptive they are to these type of
requests or how long it takes to implement if they do decide it's worth
their time. I'm really shocking for people aren't clamoring for spool
management.
…On Mon, Jun 26, 2023, 3:27 PM Donkie ***@***.***> wrote:
It sounds like that is something that could be entirely done in a frontend
like Mainsail, yes.
I believe it's time to take this suggestion to them. They could likely
integrate a QR code scanner directly in their frontend, since browsers
nowadays support giving direct access to the camera.
—
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOQWWVKHDNFZOKQUMLYLSLXNHPDZANCNFSM6AAAAAAZTFOPKE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I think the QR code could be created in many different ways. It doesn't need any complicated setup, could just be a free-text encoding of like "spool:1" where 1 is the spool ID. Then you could generate and print the QR code in any way you like. The above idea then only works for a setup where you first open mainsail for the printer you want to assign the spool to, and then scan the spool. If you want a more fancy integration where you can first scan the QR code for a printer, and then the QR code for the spool you want to assign, it will be a bit more messy. Mainsail only operates with a single printer, so it wouldn't know what to do with you scanning a printer QR code inside mainsail. If this variant is desired, it would be something that needs to be more integrated with Spoolman itself. |
I understand, just thought it would be nice to have it stored with the
spool information but I see your point and it's not really necessary. I
just I am thinking of a complete spool inventory management, where you can
assign a spool to any location. Not just active and not active.
Side note... What is Lot Nr, in spool settings?
Looks like you have been approved. A couple questions, will the front end
feature automatically be there? If so, how do we access it?
Just looking for a little clarification on how it works in the front end.
Also, is there a time process for this to be added or is it added now and I
just have to switch back to the master branch?
Thanks for your help and this app I'm general.
…On Mon, Jun 26, 2023, 3:50 PM Donkie ***@***.***> wrote:
I think the QR code could be created in many different ways. It doesn't
need any complicated setup, could just be a free-text encoding of like
"spool:1" where 1 is the spool ID. Then you could generate and print the QR
code in any way you like.
The above idea then only works for a setup where you first open mainsail
for the printer you want to assign the spool to, and then scan the spool.
If you want a more fancy integration where you can first scan the QR code
for a printer, and then the QR code for the spool you want to assign, it
will be a bit more messy. Mainsail only operates with a single printer, so
it wouldn't know what to do with you scanning a printer QR code inside
mainsail. If this variant is desired, it would be something that needs to
be more integrated with Spoolman itself.
—
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOQWWQGIVIOVHKFF36VAELXNHRZBANCNFSM6AAAAAAZTFOPKE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I was able to get this working using the macros like Arksine explained in his last post on your thread. I have to say I am stoked that this happened so fast. I appreciate your efforts. More donation will be coming down the road. I remember going down this path about 6 months ago and being very frustrated that there were no solutions. I did not want to go back to Octoprint. Someone needed to take this project on, I am glad you decided to. And to get Arksine attention and have him make it work well with moonraker, That is just so awesome! Thanks! To piggy back on one of the other request, a notification if there isn't enough filament would be nice. And I still would like for a QR code to be automatically created when the spool is created. I am sure I will think of other cool things that could be added in the future. Let's make this the standard for Klipper Spool Management! |
For your full spool management ideas, I think we'd need a more fleshed out investigation on what exact usecases the majority of users want etc. This could be discussed in a new issue. I only have a single printer, with a single extruder, myself, so it's a bit harder for me to understand where the pain points are. Lot nr is a general term when dealing with manufactured materials. It is generally printed on the spool, could also be called batch nr. When making a big project that would require several spools of the same color, you'd want all spools to have the same lot nr, otherwise they could have variations in color. Front ends will have to be manually updated in their own rate. I have created a feature request in Mainsail for added support. Not yet notified the Fluidd community though. Notification if there isn't enough filament is something that would be done in the front ends I believe. I could add a feature to the built-in client to generate a QR code for a spool. But let's first try to get some basic functionality into the front ends before diving into qr code scanning! Glad you find my work useful! |
Please add some box with spool colour to list to easy find, maybe link to vendor page and other info? :) PA settings? |
@locki-cz please create new issues, one for each feature request |
I did a proof of concept using the chamber camera worked for QR codes just not barcodes. I tested this with
You could poke Spoolman's code somehow? sudo apt install zbar-tools
cd /home/pi/klipper/klippy/extras/
wget https://raw.githubusercontent.com/th33xitus/kiauh/master/resources/gcode_shell_command.py [gcode_shell_command qrcode_snapshot]
command: wget http://IP/webcam/?action=snapshot -O /home/pi/printer_data/gcodes/qrcode.jpg
verbose: True
timeout: 2.
[gcode_shell_command qrcode_scanner]
command: zbarimg /home/pi/printer_data/gcodes/qrcode.jpg
verbose: True
timeout: 2.
[gcode_macro QRCode_Scan]
gcode:
RUN_SHELL_COMMAND CMD=qrcode_snapshot
RUN_SHELL_COMMAND CMD=qrcode_scanner I tested regular barcodes on most spools with this code above and enabled all barcodes in the app's arguments but for whatever reason maybe my camera isn’t clear enough for the library. It just says it can’t detect any code. QR codes almost always work no matter the weirdness of what it’s having with what it sees. To generate QR codes on the printer just use
|
Integrating it with the existing printer webcam is a brilliant idea! How the frontends decide to scan and register the spool ID from the picture is up to them. But from my end in Spoolman I will still definitely add a way to create QR codes for the spools. And yes, QR codes have a lot better error correction than regular old barcodes. |
I fixed the PoC code above to set the spool_id with curl which works like this now Install ZBar
Install qrencode Generate a QRCode
On your 2D printer, print this on a sticker for your spool. CLI
Change mainsail.cfg
/home/pi/klipper_config/qrcodespoolman.sh #!/bin/sh
# NonaSuomy PoC scan QRCodes via 3D printer camera
wget http://<PrinterIP>/webcam/?action=snapshot -O /home/pi/printer_data/gcodes/qrcode.jpg
SPOOLID=$(zbarimg -S*.enable /home/pi/printer_data/gcodes/qrcode.png | sed 's/[^0-9]*\([0-9]\+\).*/\1/')
echo $SPOOLID
curl -X POST -H "Content-Type: application/json" -d "{\"spool_id\": \"$SPOOLID\"}" http://<PrinterIP>:7125/server/spoolman/spool_id Put your spool qrcode upto the chamber camera and hit "QRCode Scan" on the dashboard of MainsailOS. http://<PrinterIP:7125/server/spoolman/spool_id
Enjoy! |
Sorry to say but we will never add a macro to the mainsail.cfg that needs a not default Klipper module. wht you do at your own install is up to you but that method will never be part of the package we deliver with MainsailOS |
Hence the PoC! Most people have the CMD module made by Arksine the creator of Moonraker from the kiauh installer. Until that day though people can still have fun with something that works. Anyone besides me (Not a developer) could make a module without the CMD module and have something running just the same. Ideally, this could just as easily be added to the Spoolman docker. It would just have to have a setting to be pointed at the printer's webcam feed, decode, then post to moonrakers spool_id :D |
In my opinion moonraker would be the best fit for that. Then you could use the remote method to to the same as you do know with your gcode shell command. moonraker-timelapse is a good example for stuff like that. |
Not sure how that would work or how moonraker-timelapse is a comparison of how it would work. Maybe you could explain further. The nicest way would be to just toss the spool in the chamber for a second and have a scan button on KlipperScreen so you don't have to touch a computer to load the new spool. However it gets to that point and what works in the background is beyond my ability. |
Timelapse use a moonraker module that takes a picture in the background triggered by a Klipper macro. |
See here that is how we take the picture thru Klipper https://github.com/mainsail-crew/moonraker-timelapse/blob/main/klipper_macro/timelapse.cfg#L297 and that is called in moonraker < https://github.com/mainsail-crew/moonraker-timelapse/blob/main/component/timelapse.py#L378> when the gcode is executed Best would be to integrate that in the spoolman module that is already part of moonraker. The moonraker DB also contains the webcam setup so that it could use the cam specified in there. |
QR code may contain URL to spool info on spoolman web page ( https://my_domain/spool/show/555 ) |
to be reverted when QR scanning is available ref: Donkie/Spoolman#10 Signed-off-by: Mathis Mensing <github@matmen.dev>
This is now available in release 0.10.0. Please try it out! If you have any suggestions or find any bugs, please make new issues :) |
@Donkie I am sure I am missing it somehow but how would you go about generating and printing the QR code from the UI? |
Remember to do Ctrl+F5 after every update. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Looks like you don't even have the previous version. How are you updating Spoolman? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Tested and everything worked! |
Any chance someone can give instructions on how to set this up to work in
mainsail? I have been following this thread but kind of got lost.
…On Sat, Aug 12, 2023 at 8:32 PM NonaSuomy ***@***.***> wrote:
Tip if you can't get the cam scanner working because of https.
Make the browser device camera work with non https local sources.
chrome://flags/#unsafely-treat-insecure-origin-as-secure
Enable the Insecure origins treated as secure
Add the address for your Spoolman server IP:Port that you want to ignore
the secure origin policy for. Remember to include the port number too.
Ignore the port used in this image I made it for another docker with a
similar issue.
[image: image]
<https://user-images.githubusercontent.com/1906575/231532662-4dd5b4b3-ffef-43d5-a08e-25610f32c377.png>
Save and restart Chrome.
Click enable on camera request when pops up.
—
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOQWWUJMFPMM2OYYOAJIZ3XVAODLANCNFSM6AAAAAAZTFOPKE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
What do you want working and how do you want it to work? As mainsail really has no support for this unless you want to use my PoC above. You would have to use fluidd which seems to have knocked it out of the park with support for it with matmen's pr fluidd-core/fluidd#1119 |
I may have to switch to fluid. I have been meaning to test it out anyways.
But I like the idea of being able to use the WebCam to scan the spool and
automatically set it to active. But I would also like the same thing to
happen if I use my phones, camera.
Oh my set up it’s a little different when it comes to the Klipper
installation. I have two printers installed on the same machine, and their
contact files are separated. RedRover_data and WhiteLighting_data.
Looking at your code above, I try to manipulate using my settings as much
as possible, but I can’t find a klippy_config folder anywhere. Therefore, I
also do not have the qrcodespoolman.sh file.
I am decent at following directions, and I understand coding a little bit,
but definitely not enough to figure this out.
…On Sun, Aug 13, 2023 at 10:32 AM NonaSuomy ***@***.***> wrote:
What do you want working and how do you want it to work? As mainsail
really has no support for this unless you want to use my PoC above. You
would have to use fluidd which seems to have knocked it out of the park
with support for it with matmen's pr fluidd-core/fluidd#1119
<fluidd-core/fluidd#1119>
—
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOQWWQFKXTDUDNGIJECIGTXVDQQ3ANCNFSM6AAAAAAZTFOPKE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This comment was marked as off-topic.
This comment was marked as off-topic.
My PoC above does only this but I haven't tested it yet with the current release of QR codes.
This feature request would have enabled that ability #72 Maybe donkie will eventually add a plugin system for stuff they don't directly agree with but makes sense to others. Ideally, there is nothing stopping you from modifying donkeys spoolman code and adding an action button next to the spools or automatically post via the qr code scanning page as well. Then you can bring that webpage up on your phone then scan and set the spool maybe with a drop-down list of your printers. Basically set the spool id via a similar command to how I did above but use whatever web-related methods to I'm not sure if the phone has the same https limitation but probably does. So this may toss a wrench in the gears.
klippy_config is a standard folder in your home directory when you use the MainsailOS pi image. Maybe yours is called RedRover_config? Maybe search what files are stored in klippy_config and then find that same directory of files on your setup. It can probably be put in any place you want that the printer has access to. Then edit the scripts above to show those location changes you made. You have to make this file qrcodespoolman.sh and edit it as was said above. Let me know if you need more information. |
I think a Barcode/QRCode would be very useful.
Being able to easily scan a QR code and be able to have the printer select that spool would be nice. You would need a way to select the printer first, maybe add a qrcode to the printer as well so you could scan that one first, then scan the spool. But a dropdown of printers would be just as easy unless you are running a farm. This may involve more interaction with the printer software then what is possible.
I know this would be a strech and may not be worth the effort, but if you could scan UPC and have it populate all the info it could pull from it, that would be amazing. But I don't know enough on how UPC codes work to even know if that data could be pulled.
The text was updated successfully, but these errors were encountered: