Skip to content

Commit

Permalink
V3.1 - support for Grbl 0.8c, switch to polling Grbl for position, no…
Browse files Browse the repository at this point in the history
… longer wipe Grbl positional data due to reset and many other changes
  • Loading branch information
zapmaker committed Jan 2, 2013
1 parent c4a967b commit 64c1575
Show file tree
Hide file tree
Showing 26 changed files with 1,675 additions and 501 deletions.
8 changes: 6 additions & 2 deletions GcodeSenderGUIthreads.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ SOURCES += main.cpp\
grbldialog.cpp \
about.cpp \
gcode.cpp \
timer.cpp
timer.cpp \
atomicintbool.cpp \
coord3d.cpp

HEADERS += mainwindow.h \
rs232.h \
Expand All @@ -28,7 +30,9 @@ HEADERS += mainwindow.h \
about.h \
images.rcc \
gcode.h \
timer.h
timer.h \
atomicintbool.h \
coord3d.h

FORMS += mainwindow.ui \
options.ui \
Expand Down
38 changes: 38 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,44 @@ build from source.
Details on how to do this can be found here:
http://zapmaker.org/

V3.1
Enhancements
- Supports Grbl 0.8c. Still supports 0.8a. 0.51 is supported but without LCDs.
- Grbl settings dialog is now a table of dynamic length depending on # of params.
- LCD position data is now obtained from Grbl and is *not* computed
- Added LCD displays for both machine and work coordinates
- Cycling of Grbl via COM port toggling has been completely removed, except
that Close button has now been renamed Close / Reset.
- Position data on Grbl is persisted as long as possible to allow for repositioning, etc.
- Zero work coordinates has been added (G92)
- Go-to-home feature added (lifts tool 5 mm and traverses to x=0, y=0)
- Option to put manual command (back) into absolute mode after jog button command
- Grbl Soft reset (Ctrl-X) button added
- Z-axis rate limiting capability added. Only affects file, not jog or manual commands.
- User is required to specify which measurement mode they are using, mm or inches:
* Default is millimeters
* Grbl is configured to operate in either mm or inches
* If a file is sent in inches and user is in mm, it will auto-restore to mm
after the file has been sent (and vice-versa, mm->inches)
- 0.8c enhancements:
* Displays current Grbl state (i.e. Run, Idle, etc.)
* LCDs display whether values are in inches or millimeters
* Unlock Grbl button added ($X)
* Determines and sets parser state for current mm/inch command mode ($G)
* Determines and sets coordinate units via $13
- Removed annoying "No movement expected for command" message
- Flags that cross threads have been changed to use QAtomicInt
- Version is now shown in title bar
- A basic log file feature has been added
- Runs on the Raspberry Pi!

Known Issues
- The registry key product name has been changed from GCodeSender to GrblController
*** WARNING: Old settings are not migrated ****
- Switching between millimeters and inches works, but has not been fully tested
- Go to home has not been fully tested with inches mode
- Manually issuing $13 or G20/G21 can confuse the program

V3.0
Enhancements
- Nearly a full code rewrite to ensure ease-of-use and robustness
Expand Down
20 changes: 12 additions & 8 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
This file contains enhancements the developer would like to implement:
This file contains enhancements the developer and user community would like to see:

- Restore "Go to home on completion" feature, right now that is commented out to prevent destroying work/bit
Primary:
- Add visualizer
- Restore "Tool change" feature, including popup dialog
- Implement support for Grbl 0.8c "homing" feature
- Improve logging to timestamp each line and add all diag output
- Save/Load current GRBL settings from disk
- Suppress some bookkeeping output from the status window

Secondary:
- Clear log button
- Restore "Favorites" feature
- Restore "Tool change" feature
- Handle 0.5 168 processor bug: binary response garbage causes failure (ignore and resend?)
- Print current GRBL settings
- Add option to auto connect to last port
- Provide diagnostic response view
- Provide counter showing time waiting for a response if time > 5s
- Popup dialog when successful send is complete
- Print current GRBL settings
- Save log button
- Clear log button
- Write user manual
2 changes: 2 additions & 0 deletions about.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ About::About(QWidget *parent) :
ui(new Ui::About)
{
ui->setupUi(this);

ui->labelProductAndVersion->setText(GRBL_CONTROLLER_NAME_AND_VERSION);
}

About::~About()
Expand Down
1 change: 1 addition & 0 deletions about.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define ABOUT_H

#include <QDialog>
#include "definitions.h"

namespace Ui {
class About;
Expand Down
4 changes: 2 additions & 2 deletions about.ui
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelProductAndVersion">
<property name="geometry">
<rect>
<x>180</x>
Expand All @@ -81,7 +81,7 @@
</font>
</property>
<property name="text">
<string>Grbl Controller 3.0</string>
<string>Grbl Controller</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
Expand Down
22 changes: 22 additions & 0 deletions atomicintbool.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "atomicintbool.h"

AtomicIntBool::AtomicIntBool(int newValue /* = 0 */)
: value(newValue)
{
}

void AtomicIntBool::set(int newValue)
{
value.fetchAndStoreRelaxed(newValue);
}

int AtomicIntBool::get()
{
return value.fetchAndAddRelaxed(0);
}
/*
int AtomicIntBool::getAndClear()
{
return value.fetchAndStoreRelease(0);
}
*/
22 changes: 22 additions & 0 deletions atomicintbool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef ATOMICINTBOOL_H
#define ATOMICINTBOOL_H

#include <QAtomicInt>

// we wrap QAtomicInt because it is possible to accidentally
// access the non-atomic operations of the class (look at the
// header for QAtomicInt to see what I mean, and thus setting
// a value directly against one of these variables will access
// the non-atomic method)
class AtomicIntBool
{
public:
AtomicIntBool(int newValue = 0);
void set(int newValue);
int get();

private:
QAtomicInt value;
};

#endif // ATOMICINTBOOL_H
11 changes: 11 additions & 0 deletions coord3d.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "coord3d.h"

Coord3D::Coord3D()
: x(0.0), y(0.0), z(0.0)
{
}

bool Coord3D::operator==(const Coord3D& rhs)
{
return (x == rhs.x && y == rhs.y && z == rhs.z);
}
20 changes: 20 additions & 0 deletions coord3d.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef COORD3D_H
#define COORD3D_H

#include <QMetaType>

class Coord3D
{
public:
Coord3D();
bool operator==(const Coord3D& rhs);

public:
float x;
float y;
float z;
};

Q_DECLARE_METATYPE ( Coord3D )

#endif // COORD3D_H
27 changes: 25 additions & 2 deletions definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,32 @@

#include <QtGlobal>
#include <QString>
#include <QDateTime>
#include "atomicintbool.h"

//#define DEBUG
#define DEBUG

#define DEFAULT_Z_JOG_RATE 260
#define DEFAULT_WAIT_TIME_SEC 100

#define DEFAULT_Z_JOG_RATE 260.0
#define DEFAULT_Z_LIMT_RATE 100.0

#define MM_IN_AN_INCH 25.4
#define PRE_HOME_Z_ADJ_MM 5.0

#define REQUEST_CURRENT_POS "?"
#define SETTINGS_COMMAND_V08a "$"
#define SETTINGS_COMMAND_V08c "$$"
#define REQUEST_PARSER_STATE_V08c "$G"
#define SET_UNLOCK_STATE_V08c "$X"

#define REGEXP_SETTINGS_LINE "(\\d+)\\s*=\\s*([\\w\\.]+)\\s*\\(([^\\)]*)\\)"

#define CLOSE_BUTTON_TEXT "Close / Reset"

#define GRBL_CONTROLLER_NAME_AND_VERSION "Grbl Controller 3.1"


extern AtomicIntBool g_enableDebugLog;

#endif // DEFINITIONS_H
Loading

1 comment on commit 64c1575

@maher2018
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

Please sign in to comment.