26

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

mjf55 wrote:
rhys wrote:
mjf55 wrote:

Dumb of me.  I understand the page now.  Time to restart and see if my command is there.

EDIT:  Looks like i need a little work on the json file.  Not exactly what I want.  Its not exactly obvious, but not too bad. 

Now, all the commands run on the local system, in my case my laptop.  However, all my set up items are on the RPi controlling the printer.  Can you make these json command work on the RPi?

Sorry I'm not sure what you mean. The commands are executed server side i.e on the system serving the web page. In your case the rpi

For me, when I go to the Command page and select the grepExample - choose file button, the window that pops up is a Windows ( client ) file dialogue box, not an RPi one.  See picture here

I see whats causing confusion. It uploads the file before. Executing the command

27 (edited by mjf55 2017-09-05 13:16:22)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

rhys wrote:

I see whats causing confusion. It uploads the file before. Executing the command

Rhys, I must be missing something. 
I go to the command page, and using the grep example you have, I select a file to grep.  when I enter the search string, (Which I know is in there ), the result shows error fork/exec bash: no such file or directory
The issue appears that the file is uploaded into the GoPrintRelay directory ( thats there your code is ), but it uploads with the filename of tmp-toolArg0upload.  So when grep is executed on the original filename ( in my case CRex4.gcode ) it cannot file the file.

EDIT:  Looking at your code ( toolsApi.go ) it looks like you have this as a todo on line 75: //todo use temp directory and generated name

Post's attachments

Capture.JPG
Capture.JPG 38.03 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

28 (edited by rhys 2017-09-05 14:57:57)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

mjf55 wrote:
rhys wrote:

I see whats causing confusion. It uploads the file before. Executing the command

Rhys, I must be missing something. 
I go to the command page, and using the grep example you have, I select a file to grep.  when I enter the search string, (Which I know is in there ), the result shows error fork/exec bash: no such file or directory
The issue appears that the file is uploaded into the GoPrintRelay directory ( thats there your code is ), but it uploads with the filename of tmp-toolArg0upload.  So when grep is executed on the original filename ( in my case CRex4.gcode ) it cannot file the file.

EDIT:  Looking at your code ( toolsApi.go ) it looks like you have this as a todo on line 75: //todo use temp directory and generated name

Sorry I just noticed the Example is broken on Linux because it appears the $PATH is not searched. it will work if the absolute path is passed i.e /bin/bash. Oops, I had only tested that on windows (I have a Linux subsystem installed).

I'll look to fix this in the next release.
I haven't used threedub but the following example tool json may work

{
    "name":"send file to printer",
    "cmd":"/bin/bash -c 'mv $1 $1.gcode -f; threedub $1.gcode --print'",
    "usesPrinterConnection":true,
    "formfields":[
        {
            "type":"file",
            "name":"Select the gcode file to upload and print",
            "discription":"select file"
        }
    ]
}

the move is required because the temp file name will not have the correct extension and looking at  threedub's code it uses that to detect the type.

29

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

Excellent.  I also like you can string commands.  Very nice.

30

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

I plan on releasing a new version in coming days that has support for streaming still images from a camera. I'm using ffmpeg for this in my setup but the software can be configured to use any program that can write jpegs out to stdout. at a fixed interval

31

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

Excellent.  ffmpeg is a great program.  Looking forward to it.

32 (edited by rhys 2017-09-17 04:20:04)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

new release now available
in this release i've added support for camera still image streaming

https://github.com/rhysbryant/goprinter … ses/latest

33 (edited by mjf55 2017-09-18 04:50:53)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

I have been working on this a bit, and I cannot get any of the command.json files (in the tools folder)  to work.  First, I am running a Raspberry Pi attached to the printer (JR 1.0) via usb
this is the json file
{
    "name":"send file to printer",
    "cmd":"/bin/bash -c 'mv tmp-toolArg0upload "$0".gcode;threedub -p "$0".gcode' $1",
    "usesPrinterConnection":true,
    "formfields":[
        {
            "type":"file",
            "name":"Select the gcode file to upload and print",
            "discription":"select file"
        }
    ]
}

error:
tmp-toolArg0upload': -c: line 0: unexpected EOF while looking for matching `''
tmp-toolArg0upload': -c: line 1: syntax error: unexpected end of file
error exit status 1

let me explain the command portion of the cmd line
/bin/bash -c 'mv tmp-toolArg0upload "$0".gcode;threedub -p "$0".gcode' $1

as you know, the bash commands (bash -c executes the commands from a string; ie. everything inside the quote) need to be quoted.  In order to pass commands to this, the arguments ($0) need to be double quoted or else they are not expanded.  $0 is the first argument when passed this way
Also, when passing commands to a bash script, the first argument is $1 ( $0 is the bash command when executing.
Very confusing with these different first argument position ( 0 or 1) and the quoting ( single, double)

Now, if I execute this script ( after having the tmp-toolArg0upload file available ) it works, i.e. renames the file to the correct gcode and then passes it to threedub for conversion and printing.

bash script:
#/bin/bash
/bin/bash -c 'mv tmp-toolArg0upload "$0".gcode; threedub -p "$0".gcode' $1

This also will work
#/bin/bash
/bin/bash -c "mv tmp-toolArg0upload "$1".gcode; threedub -p "$1".gcode"

So, why the error above.  I think that your requirement of having the complete command in double quotes, bash's requirement to have single quotes for the string of bash commands ( when using bash -c ) and bash's requirement to have the double quotes to have the arguments expanded causes the error.

I do not know how to proceed.  This happens on any command.json that is passing arguments

34 (edited by rhys 2017-09-18 09:15:16)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

mjf55 wrote:

I have been working on this a bit, and I cannot get any of the command.json files (in the tools folder)  to work.  First, I am running a Raspberry Pi attached to the printer (JR 1.0) via usb
this is the json file
{
    "name":"send file to printer",
    "cmd":"/bin/bash -c 'mv tmp-toolArg0upload "$0".gcode;threedub -p "$0".gcode' $1",
    "usesPrinterConnection":true,
    "formfields":[
        {
            "type":"file",
            "name":"Select the gcode file to upload and print",
            "discription":"select file"
        }
    ]
}

error:
tmp-toolArg0upload': -c: line 0: unexpected EOF while looking for matching `''
tmp-toolArg0upload': -c: line 1: syntax error: unexpected end of file
error exit status 1

let me explain the command portion of the cmd line
/bin/bash -c 'mv tmp-toolArg0upload "$0".gcode;threedub -p "$0".gcode' $1

as you know, the bash commands (bash -c executes the commands from a string; ie. everything inside the quote) need to be quoted.  In order to pass commands to this, the arguments ($0) need to be double quoted or else they are not expanded.  $0 is the first argument when passed this way
Also, when passing commands to a bash script, the first argument is $1 ( $0 is the bash command when executing.
Very confusing with these different first argument position ( 0 or 1) and the quoting ( single, double)

Now, if I execute this script ( after having the tmp-toolArg0upload file available ) it works, i.e. renames the file to the correct gcode and then passes it to threedub for conversion and printing.

bash script:
#/bin/bash
/bin/bash -c 'mv tmp-toolArg0upload "$0".gcode; threedub -p "$0".gcode' $1

This also will work
#/bin/bash
/bin/bash -c "mv tmp-toolArg0upload "$1".gcode; threedub -p "$1".gcode"

So, why the error above.  I think that your requirement of having the complete command in double quotes, bash's requirement to have single quotes for the string of bash commands ( when using bash -c ) and bash's requirement to have the double quotes to have the arguments expanded causes the error.

I do not know how to proceed.  This happens on any command.json that is passing arguments


there was a bug in the way arguments are where parsed I've released a new version to fix this.
https://github.com/rhysbryant/goprinter … ses/latest

$1 is the first form field
in the case of field type file it's the file upload path
in the  case of field type text it's literal string

the numbering starts from 1 this is constant with shell and others $0 is currently reserved for the name of the process it's self.

if you need to use inner quotes escape with \"

/bin/bash -c 'mv $1 $1.gcode -f; threedub $1.gcode --print' should work with the latest release. let me know if it does not

35

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

With the latest 1.01 release it still fails.
Result
tmp-toolArg0upload: -c: line 0: unexpected EOF while looking for matching `''
tmp-toolArg0upload: -c: line 1: syntax error: unexpected end of file
error exit status 1

here is the json file
pi@octopi:~/GoPrinterRelay $ cat tools/printGcode.json
{
    "name":"send file to printer",
    "cmd":"/bin/bash -c 'mv $1 $1.gcode -f;threedub $1.gcode'",
    "usesPrinterConnection":true,
    "formfields":[
        {
            "type":"file",
            "name":"Select the gcode file to upload and print",
            "discription":"select file"
        }
    ]
}

36

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

hmm,

the build service I'm using, circleci is publishing the release using the previously built binary i.e 1.0
I'll have to fix the build config

37

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

rhys wrote:

hmm,

the build service I'm using, circleci is publishing the release using the previously built binary i.e 1.0
I'll have to fix the build config

Whats circleci?

38

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

mjf55 wrote:

With the latest 1.01 release it still fails.
Result
tmp-toolArg0upload: -c: line 0: unexpected EOF while looking for matching `''
tmp-toolArg0upload: -c: line 1: syntax error: unexpected end of file
error exit status 1

here is the json file
pi@octopi:~/GoPrinterRelay $ cat tools/printGcode.json
{
    "name":"send file to printer",
    "cmd":"/bin/bash -c 'mv $1 $1.gcode -f;threedub $1.gcode'",
    "usesPrinterConnection":true,
    "formfields":[
        {
            "type":"file",
            "name":"Select the gcode file to upload and print",
            "discription":"select file"
        }
    ]
}

I've now fixed the release build process. can you please download the latest release and retry. Sorry on the delay

39 (edited by mjf55 2017-09-23 21:30:34)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

No problem on the delay.  Your doing great work.
Good news.  The grep tool worked right away, but the printGcode.json file needs a change in the cmd line.  the threedub command is never told to print.  Need to add the -p like this
"cmd":"/bin/bash -c 'mv $1 $1.gcode -f;threedub -p $1.gcode'",

After that it ran.  Now that was a small file.  I'll try a larger on later.  the reason for that is that large file ~3mb seem to fail when sending to the printer using threedub.  just need to resend it a couple of time.
So, I want to see how the failure is reported back, i.e. is it a silent fail.  will test this afternoon.

EDIT, had one of my normal communications failures.  I am happy to say that the error message is passed right back to the web page under Result.  Works great.

Keep up the great work.

40 (edited by charlesmillhollin 2017-09-26 18:45:40)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

I got it installed on my raspberry pi and went to the website. It loaded up but it doesn't show any information. What am I doing wrong? Do I have to configure the printer in any way? Right now I just have it plugged into the pi using the usb cable. Sorry if this sounds stupid. Thanks!

Ok I have read the readme and it says to add the printer in xyzware. The printer doesn't show up after multiple attempts

41 (edited by mjf55 2017-09-27 02:03:54)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

charlesmillhollin wrote:

I got it installed on my raspberry pi and went to the website. It loaded up but it doesn't show any information. What am I doing wrong? Do I have to configure the printer in any way? Right now I just have it plugged into the pi using the usb cable. Sorry if this sounds stupid. Thanks!

Ok I have read the readme and it says to add the printer in xyzware. The printer doesn't show up after multiple attempts

Did you edit the config.json file and change the line that points to your printer?
       "printer":{
                "devicePath":"/dev/serial/by-id/usb-11f1_2510-if00"
                ,"relayTcpListener":":9100"
                ,"queryOverrides":
                        {
                         "n":"Go Printer Relay"
                        }

        },
Change that to point to your printer

You will need to restart goprinter if you edit it

42

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

Ok. Is it possible to edit the file through the raspberry pi (ssh)? I am new to linux and am not totally aware how to edit files through the command line. Thank you for your help

43 (edited by mjf55 2017-09-28 01:11:18)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

charlesmillhollin wrote:

Ok. Is it possible to edit the file through the raspberry pi (ssh)? I am new to linux and am not totally aware how to edit files through the command line. Thank you for your help

Yes, log into your pi.  Change directory to where you have it.  Then use nano to edit it.
nano config.json.  Change the line to what you need it to be.  Then press control o to write out the file.  Press control x to exit nano.  Restart goprint

44

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

Ok. I noticed other text in front of the current serial number. Should I replace that with something or just the serial number?

45 (edited by mjf55 2017-09-28 01:43:25)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

Change only what I highlighted in red.  The rest of the path is the same.

In pi do a ' ls -l /dev/serial/by-id/'  ( don't put in the quotes) and post the results here
  I can help more after that

46

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

I got this

lrwxrwxrwx 1 root root 13 Sep 28 01:38 usb-11f1_2510_3F1J0PGBXTH54Q0243-if00 -> ../../ttyACM0

47 (edited by charlesmillhollin 2017-09-28 02:33:11)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

Ok I got it changed and rebooted. I went to the website and got some boggled information. The printer isn't showing up in xyzware either. What is the next step? I have 300m of filament and it only shows odd information Thankshttp://soliforum.com/i/?KkrKCoP.jpg

48 (edited by mjf55 2017-09-28 02:53:04)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

Everything looks ok except the total filament.  The remaining filament should be correct.  Start a job, watch it work.

I don't know what you mean about xyzware.

EDIT: I think I know.  When goprint is running and is connected, it does not let other programs use the serial device.  It locks them it until you stop goprint.

49

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

Ok. When I click on any of the tabs, nothing loads. The website doesn't seem to be working properly

50 (edited by charlesmillhollin 2017-09-28 03:09:19)

Re: Web UI and relay for Davinci printers using a Raspberry pi or windows

I have another issue. I am now getting this when I start it.

pi@raspberrypi:~ $ sudo nohup ./goprinter_linux_arm
nohup: ignoring input and appending output to 'nohup.out'
nohup: failed to run command './goprinter_linux_arm': No such file or directory

Oh by the way. I have been reading the old readme and installed an older version. I installed the newest version and I still get the same errors and issues