Git Product home page Git Product logo

Comments (17)

arkypita avatar arkypita commented on May 27, 2024

I think you could have the same problem as #32

To help me solving this Issue you must provide me the exact grbl version, as reported with $I command and the value of $10 status report mask settings. Even better if you can tell me how is the string of realtime status that grbl returns on ? command

Could you also try without bluoetooth (so with direct USB cable) to see if there is any difference

from lasergrbl.

mkeyno avatar mkeyno commented on May 27, 2024

I tested both .9j and 1.1f , none of combination did not connect through bluetooth serial bridge while its work fine with usb serial (cable) connection , FYI , $10=0 (Status report options, mask)
As it stated before your software unlike the other gcode sender can't made wireless serial bridge

from lasergrbl.

arkypita avatar arkypita commented on May 27, 2024

Ok! So you're telling me that LaserGRBL works well if it is connected via cable but it does not work via bluetooth, while other software works properly both via cable and bluetooth. It's correct?

So the problem then resides in how .net (the system with which LaserGRBL is programmed) handles COM/Bluetooth ports.

Can you give me some additional information about this bluetooth connection? Which bluetooth module do you use on the arduino side? And on the PC side, do you use integrated bluetooth or do you have an external module? Do you use a specific driver/software to see bluetooth as a COM port or is it completely transparent/automatic in windows? LaserGRBL shows the right COM port in port list? What is the exact behaviour?

Since this is a problem I can hardly reproduce, because I do not have a bluetooth module to try, what I can do is write a simple diagnostic program and send it to you.

I am googling about issue with .net comport and bluetooth but without knowing the specific model of your bluetooth adapter the search can not be very effective.

www.google.it/search?client=opera&q=.net+comport+bluetooth
www.google.it/search?client=opera&q=.net+comport+bluetooth+issues
www.google.it/search?client=opera&q=.net+comport+bluetooth+bug

from lasergrbl.

mkeyno avatar mkeyno commented on May 27, 2024

I use HC-6 to control my Arduino modules, its paired to my laptop BT by Standard Serial over Bluetooth protocol and hence I could easily open it by program like Termite or realterm
it could be selected but it seems handshaking its not successful

http://2.bp.blogspot.com/-ANqBbReXkt4/T99Bw9aJWDI/AAAAAAAAAI0/eBYdC4Yr5Eo/s1600/HC-06.png

from lasergrbl.

arkypita avatar arkypita commented on May 27, 2024

I have published a new version of LaserGRBL that records any connection problem and internal program errors in a session log file.

https://github.com/arkypita/LaserGRBL/releases/tag/v2.6.0

Please update to the new version, try connect LaserGRBL (perform 2-3 attempts) and open session log file.

sessionlog

Then copy and paste your session log here.

from lasergrbl.

mkeyno avatar mkeyno commented on May 27, 2024

thanks @arkypita for your concern , I install new software , and here its feedback

5/2/2017 11:31:53 AM	SetStatus   	Machine status [Connecting]
5/2/2017 11:31:53 AM	OpenCom     	Open COM11ʕ @ 115200 baud
5/2/2017 11:31:53 AM	OpenCom     	System.IO.IOException: The port 'COM11ʕ' does not exist.
5/2/2017 11:31:53 AM	OpenCom     	   at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
5/2/2017 11:31:53 AM	OpenCom     	   at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
5/2/2017 11:31:53 AM	OpenCom     	   at System.IO.Ports.SerialPort.Open()
5/2/2017 11:31:53 AM	OpenCom     	   at LaserGRBL.GrblCore.OpenCom()
5/2/2017 11:32:09 AM	SetStatus   	Machine status [Disconnected]

as you see the Bluetooth COM number came with suffix letter 'ʕ' , I don't know why?
grbl

and here when it connected through usb serial , as you see the connected COM port came with no extra suffix char

5/2/2017 11:48:24 AM	SetStatus   	Machine status [Connecting]
5/2/2017 11:48:24 AM	OpenCom     	Open COM19 @ 115200 baud
5/2/2017 11:48:24 AM	SendImmediate	Send Immediate Command [24]
5/2/2017 11:48:25 AM	SetStatus   	Machine status [Alarm]

from lasergrbl.

arkypita avatar arkypita commented on May 27, 2024

Googling the name of the function I use to read available comport names (getportnames) show a lot of issue signaled by the community when used with bluetooth. It seems to be a bug of .NET framework under WindowsXP (but someone reports similar issues on Windows 7).

One of those result suggest some tricks to solve the problems. Some tricks is on program side (cleanup port names) some on user side (uninstall-reinstall bluetooth driver, a regedit trick, etc).

http://stackoverflow.com/questions/32040209/serialport-getportnames-returns-incorrect-port-names

If you want to test the regedit way follow this guide:

Go in to the Registry with regedit.exe.

  1. Navigate to "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM"
  2. Make note of the comm port name.
  3. Append a "0" or any character to the comm port name.
  4. Change the comm port name back to what it was in step 3.

from lasergrbl.

mkeyno avatar mkeyno commented on May 27, 2024

@arkypita I have last publish of windows 7 64bit, its nothing related to windows xp ,following is simple USB communication which is work for both local USB serial and Bluetooth serial , as it mentioned COM port name appeared with extra character which is let to unknown for systems.IO. routine handler, may I suggest to made adhoc solution to remove the last char before open the port and test it again

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.IO.Ports;

namespace Usb_Reader
{
    public partial class Form1 : Form
    {
        char oldString = '\0';
        
        StreamReader sr;
        public Form1()
        {
            InitializeComponent();
            comboBox1.Items.AddRange(SerialPort.GetPortNames());
        }

        private void btnconnect_Click(object sender, EventArgs e)
        {
            if (btnconnect.Text == "Connect")
            {
                if (comboBox1.SelectedIndex != -1)
                {
                    serialPort1.PortName = comboBox1.SelectedItem.ToString();
                    try
                    {
                        serialPort1.Open();
                        btnconnect.Text = "DisConnect";
                        panel1.Enabled = true;
                        timer1.Enabled = true;
                        try
                        {
                            timer1.Interval = int.Parse(interval.Text);
                        }
                        catch(Exception)
                        {
                            timer1.Interval = 100;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }

                }
            }
            else
            {
                btnconnect.Text = "Connect";
                serialPort1.Close();
                panel1.Enabled = false;
                timer1.Enabled = false;
            }
        }

        private void txtwrite_KeyPress(object sender, KeyPressEventArgs e)
        {

            if (e.KeyChar.ToString() == "\r")
            {
                serialPort1.WriteLine(txtwrite.Text);
            }
        }

        private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            string data = serialPort1.ReadLine();
            if (data == "\r")
            {
                return;
            }
            StreamWriter sw = new StreamWriter("usb_in.txt");
            
            sw.Write(data);
            if (txtread.InvokeRequired)
            {
                txtread.Invoke(new MethodInvoker(delegate { txtread.Text = data; }));
            }
            sw.Close();
            
        }
        
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                timer1.Interval = int.Parse(interval.Text);
            }
            catch (Exception)
            {
                timer1.Interval = 100;
            }
            File.Copy("php_in.txt", "php_in_Copy.txt",true);
            sr= new StreamReader("php_in_Copy.txt");
            string line = sr.ReadLine();
            if (line[0] != oldString)
            {
                txtwrite.Text = line;
                //if (txtwrite.InvokeRequired)
                //{
                //    txtwrite.Invoke(new MethodInvoker(delegate { txtwrite.Text = line; }));
                //}
                serialPort1.WriteLine(line);
                oldString = line[0];
            }
            sr.Close();
        }

        private void interval_KeyPress(object sender, KeyPressEventArgs e)
        {
            //int result = 0;
            //e.Handled = int.TryParse(interval.Text, out result);
        }
    }
}

from lasergrbl.

arkypita avatar arkypita commented on May 27, 2024

GetPortNames() read port names from registry keys located in HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM

Sometimes Windows has wrong names in this list. If the names in this list are wrong GetPortNames returns them obviously wrong.

The best solution is to clean up the names within the program, as the ability to edit and fix registry requires advanced skills, and it is not definitive.

Wrong names has a single random final character in excess of the due. Since random character means that it could also be a numerical char, the simple solution of removing all non-numeric final characters can not cover all the cases.

Remove non numerical should be a first pass.
The second pass is to use a fallback procedure that intercept System.IO.IOException: The port 'COM11ʕ' does not exist. and try again removing one char, as you suggest.

I will publish a fix for you as soon as possible
Thanks for your feedback 👍

from lasergrbl.

mkeyno avatar mkeyno commented on May 27, 2024

thanks for your concern, but as you can see the port name is correct (as it expected) so it must another reason which is made GetPortNames returns wrong list
grb l

from lasergrbl.

arkypita avatar arkypita commented on May 27, 2024

You see it as correct, but maybe it is not.
I think that the binary data behind the string it is not well null terminated, so when copied between registry and GetPortNames() the function does not know the string lenght.

Just try to edit the string "COM11" in something like "FOO" and save, then edit back "FOO" to "COM11" and save it again. Now the string should be ok.

Then run or restart LaserGRBL, and see if you have some difference... I am just curious to see if it fix!

from lasergrbl.

mkeyno avatar mkeyno commented on May 27, 2024

your first solution its not work but when I edit back to original name , it went ok as following log , I suggest change property of list box to editable so I could edit the port name in such incident

5/2/2017 6:54:32 PM	SetStatus   	Machine status [Disconnected]
5/2/2017 6:54:34 PM	SetStatus   	Machine status [Connecting]
5/2/2017 6:54:34 PM	OpenCom     	Open FOO @ 115200 baud
5/2/2017 6:54:34 PM	OpenCom     	System.ArgumentException: The given port name does not start with COM/com or does not resolve to a valid serial port.
5/2/2017 6:54:34 PM	OpenCom     	Parameter name: portName
5/2/2017 6:54:34 PM	OpenCom     	   at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
5/2/2017 6:54:34 PM	OpenCom     	   at System.IO.Ports.SerialPort.Open()
5/2/2017 6:54:34 PM	OpenCom     	   at LaserGRBL.GrblCore.OpenCom()
5/2/2017 6:55:22 PM	SetStatus   	Machine status [Disconnected]
5/2/2017 6:55:26 PM	Program     	------------ PROGRAM STOP ------------

5/2/2017 6:55:33 PM	Program     	------------ PROGRAM START ------------
5/2/2017 6:55:35 PM	SetStatus   	Machine status [Disconnected]
5/2/2017 6:55:39 PM	SetStatus   	Machine status [Connecting]
5/2/2017 6:55:39 PM	OpenCom     	Open COM11 @ 115200 baud
5/2/2017 6:55:41 PM	SendImmediate	Send Immediate Command [24]
5/2/2017 6:55:41 PM	SetStatus   	Machine status [Idle]

from lasergrbl.

arkypita avatar arkypita commented on May 27, 2024

Your original COM11 was stored in registry in a wrong format, also if you saw COM11.

Of course "FOO" must not work! "FOO" it is a string like any other (FOO, PIPPO, YOURNAME. John, 1234) and it is used only to change COM11 in something else and save... not to test/use it :-)

The sequence edit as "foo" -> save -> edit as "COM11" -> save it again, is to be sure to save COM11 as new string and overwrite the old dummy value.

from lasergrbl.

arkypita avatar arkypita commented on May 27, 2024

Version v2.6.2 fix this bug/issue

https://github.com/arkypita/LaserGRBL/releases/tag/v2.6.2

from lasergrbl.

arkypita avatar arkypita commented on May 27, 2024

I have a question for you @mkeyno

If I want to add a bluetooth module in my engraver, i could simple buy a arduino module like this one (see link) and connect power, tx and rx and that's all, or I must write some code inside arduino grbl sketch to initialize the bluetooth board?

http://www.ebay.it/itm/Modulo-HC-06-scheda-bluetooth-4-pin-wireless-RF-transceiver-module-arduino-/222008015892?hash=item33b0b57c14:g:VK8AAOSwpzdWqTMZ

from lasergrbl.

mkeyno avatar mkeyno commented on May 27, 2024

@arkypita just connect the pins , no extra programing needed , that's why it called bridge , however I intend to use ESP8266 instead of BT , because its has more feature than simple serial transparent , the same in laseweb4 , it used websocket server on ESP side to create serial bridge , I was wondering if you have any future plan for this , I think its need websocket client on your software such as following lib

https://websocket4net.codeplex.com/
https://github.com/sta/websocket-sharp
https://msdn.microsoft.com/en-us/library/system.net.websockets.clientwebsocket(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
http://stackoverflow.com/questions/30523478/connecting-to-websocket-using-c-sharp-i-can-connect-using-javascript-but-c-sha
https://codereview.stackexchange.com/questions/41591/websockets-client-code-and-making-it-production-ready

BTW, of the topic , there is little exception when internet connection is not available
grbl exception

debug

System.Net.WebException was unhandled
  Message=The remote name could not be resolved: 'lasergrbl.com'
  Source=System
  StackTrace:
       at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
       at System.Net.WebClient.DownloadString(Uri address)
       at System.Net.WebClient.DownloadString(String address)
       at LaserGRBL.GitHub.CheckSite(String site)
       at LaserGRBL.GitHub.AsyncCheckVersion(Object foo)
       at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
       at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
  InnerException: 

from lasergrbl.

arkypita avatar arkypita commented on May 27, 2024

thanks for infos and hint
i have just ordered my bluetooth HC6 module :-)

also bug fixed in latest version

from lasergrbl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.