LaserWeb/deprecated-LaserWeb1

CH340: Undefined error with Serialport / Chinese Fakes strikes again.

Closed this issue · 15 comments

delete this bug

The CH340 shouldn't be a problem (i actually started to like the ch340 the last few months and use them on my own PCBs quite a bit. That said, I actually havent used on against Laserweb (or more specifically node.js SerialPort) yet...

Line 748, deals wth logging info when you select a port in the UI:
Just tested now with a MJDuino clone I have lying around here, running Turnkey:
Here's what my start looks like:
ERROR: Error connecting to webcam: connect ECONNREFUSED - Disabling Webcam Widget
WARN: Ignored: Port /dev/ttyACM0 said: start
INFO: Found device: Arduino__www.arduino.cc_ /dev/ttyACM0 Firmware Detected: Marlin 1.0.0
WARN: Ignored: Port /dev/ttyACM0 said: echo:Marlin 1.0.0
WARN: Ignored: Port /dev/ttyACM0 said: echo: Last Updated: Nov 10 2015 10:51:58 | Author: (Peter vd Walt)
WARN: Ignored: Port /dev/ttyACM0 said: Compiled: Nov 10 2015
WARN: Ignored: Port /dev/ttyACM0 said: echo: Free Memory: 2540 PlannerBufferBytes: 2576
WARN: Ignored: Port /dev/ttyACM0 said: echo:Hardcoded Default Settings Loaded
WARN: Ignored: Port /dev/ttyACM0 said: echo:Steps per unit:
WARN: Ignored: Port /dev/ttyACM0 said: echo: M92 X53.50 Y53.50 Z3260.00 E5000.00
WARN: Ignored: Port /dev/ttyACM0 said: echo:Maximum feedrates (mm/s):
WARN: Ignored: Port /dev/ttyACM0 said: echo: M203 X5000.00 Y5000.00 Z5000.00 E5000.00
WARN: Ignored: Port /dev/ttyACM0 said: echo:Maximum Acceleration (mm/s2):
WARN: Ignored: Port /dev/ttyACM0 said: echo: M201 X9000 Y9000 Z9000 E9000
WARN: Ignored: Port /dev/ttyACM0 said: echo:Acceleration: S=acceleration, T=retract acceleration
WARN: Ignored: Port /dev/ttyACM0 said: echo: M204 S8000.00 T8000.00
WARN: Ignored: Port /dev/ttyACM0 said: echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s), Z=maximum Z jerk (mm/s), E=maximum E jerk (mm/s)
WARN: Ignored: Port /dev/ttyACM0 said: echo: M205 S0.00 T0.00 B1 X20.00 Z20.00 E5.00
WARN: Ignored: Port /dev/ttyACM0 said: echo:Home offset (mm):
WARN: Ignored: Port /dev/ttyACM0 said: echo: M206 X0.00 Y0.00 Z0.00
WARN: Ignored: Port /dev/ttyACM0 said: echo:Laser lifetime usage:
WARN: Ignored: Port /dev/ttyACM0 said: echo: Hours: 0
WARN: Ignored: Port /dev/ttyACM0 said: Minutes: 0
WARN: Ignored: Port /dev/ttyACM0 said: echo:PID settings:
WARN: Ignored: Port /dev/ttyACM0 said: echo: M301 P22.20 I1.08 D114.00
INFO: Machine Profiles read from file
INFO: Now interacting with /dev/ttyACM0 running Marlin 1.0.0
Checking for Updates
INFO: Git Refresh Fetching origin

So yours got to the machine profiles too. The next step is to hang tight till you select a dropdown in the UI
Once a port is selected, we log out to screen which port that was.

So, that said, it might be serial port related with the ch340...

Quick mental checks:

  1. You can access the port from say pronterface? (i.e your posix user account has the right tty//dialout groups?)
  2. Board was plugged in before you started Laserweb?
  3. a ctrl+c and start again tried?
  4. sudo dmesg -c before starting laserweb, replicate error, then 'dmesg'

If you can't make Marlin gcode either, there is a debug mode for when you run "node server.js" but I forget the details at this time. If other software can connect, you could then save the marlin gcode and load it into the other softward as a momentary work around.

@nathanielstenzel you advice is way off and just going to confuse the user...

@mrgastoso - i added a extra logging for us, to see whether the CH340 does something different in the array, please 'git pull' then test again, paste new log

Port ID32 is very high! I am used to devices 0,1,2 etc.

ls /dev/tty*
If yoi have a tonne of ttyS1-ttys3x devices, try a
sudo rm /dev/ttyS*

Then unplug, replug controller, and try starting server.js again.

It is something pc specific in your case.

Os? (ubuntu, pi, something else?)
Browser (Chrome?)
No firewalls that could be screwing with websockets (the undefined error is we arent getting the port id in the websocket response for usePort (sent from browser to server.js over websocket). We do get the useport message but not the id

It is something pc specific in your case.

Os? (ubuntu, pi, something else?)
Browser (Chrome?)
No firewalls that could be screwing with websockets (the undefined error is we arent getting the port id in the websocket response for usePort (sent from browser to server.js over websocket). We do get the useport message but not the id

Node5 doesnt work with node-serialport yet. I run Ubuntu 15.10. Do you have another machine at hand you can try?

In bed already, but in the usePort function in server.js, add a console.log('usePort data was ' +data); so we can see what the browser sends?

Look. At line 750. Add the console.log to line 751 for instance

yeah, see we are getting null in the data, which explains why we also get an undefined on the next line trying to use said 'data'

So, issue isnt in server.js - lets check the next level up:
Ctrl+shift+I in chrome, any errors?

We can add some debug to see what are sending:
In /i/main.js:

https://github.com/openhardwarecoza/LaserWeb/blob/master/i/main.js#L559

Add a
console.log('UsePort triggered - we selected: ' + $('#choosePort').val());

No other errors right after reload?

Calling it a night. Sorry, work in a few hours (:
Will check tomorrow, in mean time, try another machine. When that selected 32 was sent, did server.js
Log 32 too?

Excellent! So we can close this one? There is an open issue here to improve the serial bridge - when we get to it, i will make sure to test ch340

Works for me, so keeping it closed. Using chinese fakes is entirely your problem. Order genuine Arduino / Smoothieboard hardware and then we wont need to waste my, and your time, figuring out why the fakes dont work (: