How To write a plugin for DWC
-
Is there any guide, documentation how to write a plugin for DWC? Example Project?
or could have somebody answers to this questions:
Which envirement is used to do that ?
where can I find the plugin system API?
which dependecies are neccearry? -
@jrentschler01 DWC uses vuetify (https://vuetifyjs.com/en/). You need to get a dev environment setup and working for vuetify first, then get hold of the DWC source and get that setup, and then look at the built in plugins source code, and you can go from there.
How to package a plugin for release is already written up in this forum section, in another post.
This (https://github.com/Duet3D/DSF-Plugins/tree/master/EndstopsMonitor) is a good plugin sample to reference.
-
Here is my plugin for a filament weight load cell: https://github.com/Kriechi/duet-plugin-filament-load-cell
It has a DWC plugin as well as a small Python plugin for DSF running on the SBC. -
Thank you guys, I already got the envirement setup and it looks doable.
-
I'm able to build and run the DWC but I'm not able to connect to the Board I always get:
Failed to connect to 192.168.1.2:8080
Network errorIs there a password needed? Is the port 8080 correct?
The onboard DWC with 192.168.1.2 works normal.
I added also the M586 C"*" to my config. -
@jrentschler01 I don't think you need to specify the port. Just the IP. Its always worked for me that way.
-
@mintytrebor Omg so simple sure it works. I don't know why I didn't try this. Thank you
-
@MintyTrebor I looked also in your plugin and I see you use some dependencies they are not installed in DWC but where did you tell webpack to pack them into your plugin?
I see you have plugin.json in your /dist folder with a webpack config but I'm not sure where to put this in the DWC that it will be used for the build process?
and did you install your libraries that you use normally with npm into DWC to deveolpe and build it?
-
@jrentschler01 install plugins using the cmd line :
npm install <package name>
in the main folder you unpacked the dwc source.zip.
Include the package name in the plugin.json like mine.
The packages will auto include in the build/serve process, you can then just reference them in your plugin code as normal - eg
import <function> from '<packagename>';
The package.json tells dwc to install the additional libraries from internet when the plugin is installed by a normal user. (This is why I tell users to ensure they have an internet connection when installing the plugin in my wiki)
-
@mintytrebor said in How To write a plugin for DWC:
(This is why I tell users to ensure they have an internet connection when installing the plugin in my wiki)
Ahh okay, that is what I missed! Now I got it how it works. But do you see a way that we can tell webpack to bundle this packages into the plugin files? So that it works without an internet connetion?
But this is not critical now for me just would be a nice to have
And Thanks for your fast response!
-
@jrentschler01 said in How To write a plugin for DWC:
But do you see a way that we can tell webpack to bundle this packages into the plugin files? So that it works without an internet connetion?
Don't know. I just know that this is the way it works for me .
It is possible it may already include the library in the build, and just uses the package.json for tracking. Easiest way is to try installing the plugin when you have disabled the internet.
There may be an alternative, but I doubt it, as you would effectively be distributing someone else's code/library which probably breaks all sorts of licenses, plus it would be difficult for the author of the library to track downloads etc.
Update : Also worth remembering that the libraries you include may themselves use other libraries, so you could be dealing with nested dependencies - it's probably best just sticking to the normal processes.
-
@mintytrebor yes you right, lts just stick with the normal way. And nowdays everthing is connected to the internet even my refrigerator (which a sbit concerning by the way) so it should be fine for the duet, too