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

Proposals for technical extension of cnc.js #75

Closed
slimline33 opened this issue Sep 12, 2016 · 16 comments
Closed

Proposals for technical extension of cnc.js #75

slimline33 opened this issue Sep 12, 2016 · 16 comments

Comments

@slimline33
Copy link

Hi cheton,

I'm not using cnc.js V. 1.3 so long like mach3 because I have some suggestions for new versions of your cnc.js.

  • Live folder watch for uploading gcode
  • Macros which can start sample/safed gcode
  • Informing when a updated version is available and select update from the menu
  • button for reboot (sudo reboot)
  • shutdown (sudo halt)
  • a menu point link to a own bash scripts..

This is would I suggest and that would be really nice add ons or widgets.

Is there something similar integrated shame on my. I haven't found that allready :D

Christoph

@cheton
Copy link
Collaborator

cheton commented Sep 12, 2016

Live folder watch for uploading gcode

A watch directory will help you to import new files faster. I may add this feature in a future release.

Macros which can start sample/safed gcode

Macros are supported in v1.6.

Informing when a updated version is available and select update from the menu

Yes! I'm planning on adding update notifications to inform new updates.

button for reboot (sudo reboot)
shutdown (sudo halt)
a menu point link to a own bash scripts..

I think the above three can be combined into one by selecting custom menu items to trigger scripts from UI.

@slimline33
Copy link
Author

Yes that sounds really nice!

I use a precomposed raspberry image with installed cnc.js. I think i made a own image. Than it's easyer to update.

Custom menu is a good idea. I think much people using only cnc.js on the raspberry for the own cnc machine.

I think I add a kiosk mode which will only show a browser with cnc.js and that runs on the raspberry with a small touch lcd.

@AustinSaintAubin
Copy link
Contributor

Could really use the shutdown and reboot option for my raspberry pi though the GUI.

@cheton cheton added this to the 1.8 milestone Oct 26, 2016
@cheton
Copy link
Collaborator

cheton commented Nov 3, 2016

With the 1.7.0 release, it will start to notify users when a newer version (e.g. 1.7.x, 1.8.x) is available to download. For example, you will see the following screen when a new update is available:

image

@cheton cheton mentioned this issue Nov 6, 2016
@slimline33
Copy link
Author

Now there is a "update found" message. Whats about with an "update" button? Something like this:

img_27112016-164301 1

@cheton
Copy link
Collaborator

cheton commented Nov 27, 2016

By now the Electron app (i.e. executable installer .exe, .dmg) should be able to perform an update internally, but I have not yet implemented it to the app. It might be added in a future version.

For Node.js installation, I can try to force the update by running npm install -g cncjs@latest on the server side, but this may encounter failed update for certain reasons, maybe the software was installed using a different account, or a different installation path.

Do you have any recommendations for this? Trigger a custom script to update package might be a solution to it.

@slimline33
Copy link
Author

mhmm... sorry I have no solution for this. I understand the problems with the installation path because a update script could help I think.

This is the update-script from octoprint: https://github.com/foosel/OctoPrint/blob/master/src/octoprint/plugins/softwareupdate/scripts/update-octoprint.py but its python and no node. It can not help.

First of all the software have to check the path where it is installed. On a raspberry I got with npm install -g cncjs@latest always the error with the serialmodule... I have to perform a sudo npm install -g cncjs --unsafe-perm.

I hope anybody of other users have a solution? Should we open a new enhancement issue?

@cheton
Copy link
Collaborator

cheton commented Nov 28, 2016

OctoPrint's update script use git to update its source code, but that's not the case with the cnc software.

How about passing a command-line option to specify a path to the update script? For example:

$ cnc --update-script="/path/to/update-script.sh"

Then the web interface will be able to perform an update when the update script is available to use.

@slimline33
Copy link
Author

slimline33 commented Nov 28, 2016

After a fresh installation the path is "/usr/lib/node_modules/cncjs/bin" - the script can check the path for the executable and if not found the user can input the real path.

Or in the update page on the site the user can change the path in a form.

@cheton
Copy link
Collaborator

cheton commented Dec 2, 2016

The watch directory support is added in the 1.8.5 release. You can check out the usage below:

Usage

 $ cnc --watch-directory /home/pi/watch

Instead of passing command line options for --watch-directory and --allow-remote-access, you can create a ~/.cncrc file that contains the following configuration in JSON format:

{
  "watchDirectory": "/path/to/dir",
  "allowRemoteAccess": false
}

Then you can browse the watch directory to select a G-code file to load:

image

@cheton
Copy link
Collaborator

cheton commented Dec 29, 2016

The support for running shell commands was added in 95698eb, and later it will be published in 1.8.10 release. An example configuration (i.e. ~/.cncrc file) will look like below:

{
    "state": {
        "checkForUpdates": true
    },
    "commands": [
        {
            "text": "Reboot",
            "command": "/sbin/reboot"
        },
        {
            "text": "Shutdown",
            "command": "/sbin/shutdown"
        }
    ],
    "macros": [],
    "users": []
}

@cheton
Copy link
Collaborator

cheton commented Jan 12, 2017

@slimline33,

To perform an upgrade, you can run pm2 start cnc to monitor cnc process, and add "Update" command in ~/.cncrc to trigger an update from UI. Once an update has been completed, it will kill the cnc process, then pm2 will automatically start the process again:

{
  "commands": [
    {
      "text": "Update (root user)",
      "command": "sudo npm install -g cncjs@latest --unsafe-perm; pkill -a -f cnc"
    },
    {
      "text": "Update (non-root user)",
      "command": "npm install -g cncjs@latest; pkill -a -f cnc"
    }
  ]
}

@cheton cheton closed this as completed Jan 12, 2017
@Thrillz
Copy link

Thrillz commented May 20, 2018

@cheton hi, i have installed cncjs using npm and would like to add a custom widget to it. Going by the tutorial i have to create a directory under src/widgets but i can't find the "src" directory.

@Thrillz
Copy link

Thrillz commented May 20, 2018

Hi @cheton how do i add a custom widget to an npm installation of cncjs because i can't find the "src" directory even in node_modules

@cheton
Copy link
Collaborator

cheton commented May 22, 2018

The "src/widgets" folder you mentioned is located in cncjs-widget-boilerplate:
https://github.com/cncjs/cncjs-widget-boilerplate

You can follow the development guide to mount the default widget for testing


https://github.com/cncjs/cncjs-widget-boilerplate#development

Development

Run npm run dev to start a local development server for development, then connect to http://localhost:5000 and wait until bundle finished.

You can specify a mount path to test your widgets with CNCjs:

$ cncjs -vv --mount /widget:/path/to/cncjs-widget-boilerplate/dist

@cheton
Copy link
Collaborator

cheton commented May 22, 2018

Mounting from a remote server is also supported:

$ cncjs --mount /widget:https://cncjs.github.io/cncjs-widget-boilerplate/v1/

Just walk through the instructions to learn how to load a custom widget:
https://github.com/cncjs/cncjs-widget-boilerplate#configure-cncjs

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

No branches or pull requests

4 participants