-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ashelly
committed
May 21, 2015
1 parent
da651e3
commit 806e2b0
Showing
16 changed files
with
304 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,41 @@ | ||
GRBL SIM : by Jens Geisler | ||
# GRBL SIM | ||
|
||
: by Jens Geisler, Adam Shelly | ||
|
||
|
||
This repository contains an experimental Grbl simulator that compiles the main Grbl source code into a wrapped executable for use on a computer. No Arduino required. When the executable is run, the user should be able to interact with the Grbl simulator as if connected to an Arduino with Grbl. | ||
|
||
WARNING: Grbl Sim is under heavy development. So many things may not work, or respond in ways unexpected. At the moment, this code is a proof-of-concept. | ||
*WARNING: Grbl Sim is under heavy development.* So many things may not work, or respond in ways unexpected. At the moment, this code is a proof-of-concept. | ||
|
||
## What can you do with Grbl Sim? | ||
|
||
- Simply check out how Grbl works without needing an Arduino. | ||
- Visualize a g-code program by having the simulator parse and execute to a GUI. Fluctuations in feed rates by the acceleration planner can be viewed as well. | ||
- A powerful debugging tool for development. | ||
- Each of the AVR functions are replaced with dummy functions, like the stepper ISR. These could be written to do whatever you need. For example, output simulated step pulses over time and examine its performance. | ||
- On Linux, hook it to a fake serial port (/dev/ttyFAKE) and use it to test your Grbl interface software: | ||
|
||
- `> socat PTY,raw,link=/dev/ttyFAKE,echo=0 "EXEC:'./grbl_sim.exe -n -s step.out -b block.out',pty,raw,echo=0" ` | ||
|
||
|
||
### Realtime modifications: | ||
|
||
Now simulates Atmel hardware in separate thread. Runs in *aproximate* realtime. Emphasis on * **Approximate** *. Work is underway to speed it up. | ||
|
||
## How do you compile Grbl Sim? | ||
|
||
- Clone this repository into the directory containing the Grbl source code. (should be `<repo>/grbl`). | ||
|
||
- Edit the Grbl-Sim Makefile to select the correct `PLATFORM =` line. LINUX and WINDOWS are currently supported. | ||
|
||
- *(You may need to make other modifications to the Makefile and some environment variables for your particular machine. Please share any modifications you find)* | ||
|
||
- Run `> make new` to compile Grbl Sim! | ||
|
||
What can you do with Grbl Sim? | ||
- Simply checking out how Grbl works without needing an Arduino. | ||
- Visualize a g-code program by having the simulator parse and execute to a GUI. Fluctuations in feed rates by the acceleration planner can be viewed as well. | ||
- A powerful debugging tool for development. | ||
- Each of the AVR functions are replaced with dummy functions, like the stepper ISR. These could be written to whatever you need. For example, output simulated step pulses over time and examine its performance. | ||
|
||
Realtime modifications by Adam Shelly: | ||
|
||
Simulates Atmel hardware in separate thread. Runs in aproximate realtime. | ||
## Validator | ||
**NEW** | ||
|
||
How do you compile Grbl Sim? | ||
Run `gvalidate.exe GCODE_FILE` to validate that grbl will parse your GCODE with no errors. | ||
|
||
Simply place the sim folder into the directory containing the Grbl source code. Within the sim folder, use the Makefile there to compile Grbl Sim! Edit the `PLATFORM =` line in the Makefile to "LINUX" or "WINDOWS" as needed. (You may need to make other modifications to the Makefile and some environment variables for your particular machine.) | ||
|
||
On Linux, use `socat PTY,raw,link=/dev/ttyFAKE,echo=0 "EXEC:'./grbl_sim.exe -n -s step.out -b block.out',pty,raw,echo=0"` to create a fake serial port connected to the simulator. This is useful for testing grbl interface software. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* | ||
/* | ||
pgmspace.c - replacement for the avr library of the same name to provide | ||
dummy functions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
grbl_eeprom_extensions.c - | ||
Grbl adds 2 functions to the orignal avr eeprom library. | ||
They need to be reproduced here because we need to completely override the | ||
original eeprom interface for simulation | ||
Grbl is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Grbl is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Grbl. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
// Extensions added as part of Grbl | ||
// KEEP IN SYNC WITH ../eeprom.c | ||
|
||
void memcpy_to_eeprom_with_checksum(unsigned int destination, char *source, unsigned int size) { | ||
unsigned char checksum = 0; | ||
for(; size > 0; size--) { | ||
checksum = (checksum << 1) || (checksum >> 7); | ||
checksum += *source; | ||
eeprom_put_char(destination++, *(source++)); | ||
} | ||
eeprom_put_char(destination, checksum); | ||
} | ||
|
||
int memcpy_from_eeprom_with_checksum(char *destination, unsigned int source, unsigned int size) { | ||
unsigned char data, checksum = 0; | ||
for(; size > 0; size--) { | ||
data = eeprom_get_char(source++); | ||
checksum = (checksum << 1) || (checksum >> 7); | ||
checksum += data; | ||
*(destination++) = data; | ||
} | ||
return(checksum == eeprom_get_char(source)); | ||
} | ||
|
||
// end of file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define report_status_message orig_report_status_message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
./grbl_sim.exe -t 3 0.01 <HelloWorld.nc >HelloWorld.dat 2> HelloWorldSteps.dat | ||
./grbl_sim.exe -t 1 0.01 <HelloWorld.nc >HelloWorld.dat 2> HelloWorldSteps.dat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
socat -d-d PTY,raw,link=/tmp/ttyFAKE,echo=0 "EXEC:'./grbl_sim.exe 1 -n -s step.out -b block.out',pty,raw,echo=0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.