grbl / grbl-sim

Compiles Grbl into an executable for your computer.
GNU General Public License v3.0
89 stars 76 forks source link

Windows version is not 'stdin' redirect friendly #11

Open alexian79 opened 9 years ago

alexian79 commented 9 years ago

Hi guys, with original code I was not able to use < input redirection on Windows, to read g-code from file. I think root cause is using _kbhit() and getch().

Did quick fix that works for me:

From 05fd7ab068552fc7955d9d50132efa727da3818f Mon Sep 17 00:00:00 2001 From: Oleksiy Bondarenko alexeibondarenko@cashcode.com Date: Mon, 2 Nov 2015 12:51:01 -0500 Subject: [PATCH] Made windows version stdin redirect friendly


Makefile | 4 ++-- platform_WINDOWS.c | 32 +++++++++++++++++++++++++++----- sim.bat | 4 +++- 3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile index a6945bd..298123f 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,9 @@

You should have received a copy of the GNU General Public License

along with Grbl. If not, see http://www.gnu.org/licenses/.

-# PLATFORM = WINDOWS +PLATFORM = WINDOWS

PLATFORM = OSX

-PLATFORM = LINUX +# PLATFORM = LINUX

The original grbl code, except those files overriden by sim

GRBL_BASE_OBJECTS = ../protocol.o ../planner.o ../settings.o ../print.o ../nuts_bolts.o ../stepper.o ../gcode.o ../spindle_control.o ../motion_control.o ../limits.o ../coolant_control.o ../probe.o ../system.o diff --git a/platform_WINDOWS.c b/platform_WINDOWS.c index 7c4a3c3..71b8224 100644 --- a/platform_WINDOWS.c +++ b/platform_WINDOWS.c @@ -31,12 +31,32 @@

double ns_per_perfcount;

+volatile struct {

13hakta commented 8 years ago

Please create a pull request to this repository. And if not, please share patch as non-formatted text.

alexian79 commented 8 years ago

Will look for this change this evening.

alexian79 commented 8 years ago

change extension to .patch

PS. There was another blocker issue for me that simulator deadlocks randomly during path simulation.

0001-Made-windows-version-stdin-redirect-friendly.patch.txt