Open alexian79 opened 9 years ago
Please create a pull request to this repository. And if not, please share patch as non-formatted text.
Will look for this change this evening.
change extension to .patch
PS. There was another blocker issue for me that simulator deadlocks randomly during path simulation.
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 {
platform_start_thread(stdin_poller); }
//cleanup int here; @@ -62,7 +82,6 @@ void platform_sleep(long microsec) { Sleep(microsec/MICRO_PER_MILLI);
}
//create a thread plat_thread_t* platform_start_thread(plat_threadfunc_t threadfunc) { @@ -89,8 +108,11 @@ void platform_kill_thread(plat_thread_t* th){
//return char if one available. uint8_t platform_poll_stdin() {