Les Newell wrote:
Another option is to regularly poll the serial buffer using
Serial.available() while you are initializing. If you don't spend too much
time in each loop() cycle, serialEvent() does most of the work for you.

Polling with Serial.available is my current approach for normal processing
-- moving steppers, actuating pneumatics, controlling pump, etc -- and I'll
probably extend it to handling initialization.

-----Original Message-----
From: Les Newell <les.new...@fastmail.co.uk> 
Sent: December 3, 2020 7:28 AM
To: emc-users@lists.sourceforge.net
Subject: Re: [Emc-users] USB - Serial question

I'm a software guy so here are some possible software solutions.
Why not wait for PathPilot to send it's setup query then do your
initialization? You still have plenty of time to do your initialization
while the machine is being homed etc.
Another option is to regularly poll the serial buffer using
Serial.available() while you are initializing. If you don't spend too much
time in each loop() cycle, serialEvent() does most of the work for you.
The hardest option would be to write your own serial interrupt routine and
do all of your serial in the ISR. You need to be comfortable with talking
directly to the ATMega hardware registers to do this.

Les



On 03/12/2020 00:53, ken.stra...@gmail.com wrote:
> Chris wrote:  I think USB takes care of this for you.  "set up" 
> packets are sent by the host (the PC) and never by the device (mouse, 
> disk, or whatever) The device never starts doing anything until after it
hears from the host.
>
> You've precisely described my problem!  I need to do somewhat time 
> consuming initialization -- home some steppers, actuate a pneumatic 
> cylinder, prime a pump, verify coolant pressure, etc. Soon after 
> PathPilot starts it scans for my USB device and, if found, sends a 
> query to ensure that I'm actually alive. If I ignore or reject the 
> alive query then PathPilot ignores me until my USB disconnects and then
reconnects.
>
> My problem is that I may not yet know if I will ever be alive and 
> ready when I'm first asked. I have a plan to queue any host requests 
> received while I'm still initializing.
>
> Probably more explanation than you wanted!



_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users



_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to