CNCTERM - Text interface to LinuxCNC

Latest version, 2023-09-20, gzip'd tarball

Browse the code

Screenshots

Introduction

Cncterm is a curses-based interface to linuxcnc. It is designed to be the user interface for machines with less-capable processors or no direct video output, such as running on a BeagleBone Green which does not have an HDMI or VGA interface.

As a curses program, the interface can run happily over a serial line, which could also be useful for remote control of a machine tool.

Current testing shows that running g-code on a BeagleBone Green with cncterm takes less than 30% of the CPU for everything, including loading code off a networked server.

The code should work with up to 5 motion axes, spindle control, and flood and mist coolant options. The code has provision for a MPG wheel, and hardware cycle start and feed hold buttons. While not tested with a tool changer, the code should work with manual and automatic tool changers correctly configured in the HAL layer.

Cncterm has been developed on a machinekit installation on a BeagleBone Green, but should work on any linuxcnc installation.

Keyboard Interface

Cncterm uses a standard alphanumeric keyboard for most interface tasks. In addition to the alphanumeric keys, the interface needs the escape, backspace, and F1 keys. This limited set of required keys allows the use of serial terminals, including such ancient options as a VT52, for the full interface. No mouse or touch screen is supported. The interface uses the Python curses libraries, so any terminal supported by curses should work without code change. Testing has been done with xterm and vt220 terminals.

KeyFunctionKeyFunction
ESC, BackspaceAbort; stop immediately like E-StopTABNext display tab to right; wraps at end
CR or LFClear messages, redrawUp ArrowJog Y+
HomeHome current axisDown ArrowJog Y-
EndHome all axes, in order from INI fileLeft ArrowJog X-
F1Override limit switches; toggleRight ArrowJog X+
ASelect A (4th) axisPg UpJog Z+ or previous page
BSelect B (5th) axisPg DnJog Z- or next page
CAutomatic mode\Toggle Block Delete
DMDI mode/ or ?Spindle stop
EToggle E-Stop, or <Spindle reverse
FToggle Flood Coolant. or >Spindle forward
GRedraw screen, without clearing messages[ or {Jog -
HToggle Optional Stop] or }Jog +
IToggle Mist Coolant= or +Spindle rpm +
JMove 1 screen left, wraps at start-Spindle rpm -
KMove 1 screen right, wraps at end$Toggle diameter, radius mode for lathe
LReload tool table from disk110% feed
MManual mode220% feed
NSet coordinate offset of current work system330% feed
OOpen program file from disk440% feed
PPause executing program550% feed
QQuit - NO CONFIRMATION!660% feed
RRun currently loaded program if in Auto mode770% feed
SReset interpreter880% feed
TToggle machine ready state; E-Stop must be off!990% feed
UCycle through jog step options, wraps at end0100% feed
VPage down on tool ,program listings |Redraw screen, without clearing messages
WPage up on tool, program listings' or "Enter MDI line, execute immediately
XSelect X (1st) axis;Home current axis
YSelect Y (2nd) axis:Home all axes, in order from INI file
ZSelect Z (3rd) axisCTRL-OOverride limit switches, toggle
%Spindle RPM 50%!Spindle RPM 110%
^Spindle RPM 60%@Spindle RPM 120%
&Spindle RPM 70%#Spindle RPM 130%
*Spindle RPM 80%
(Spindle RPM 90%
)Spindle RPM 100%

INI File Entries

HAL Pins

These pins setup after starting the cncterm interface:

#### Start of HAL file
  # connect various pins for cncterm interface
  net cncterm-wheel cncterm.jog.wheel.increment => joint.0.jog-scale joint.1.jog-scale joint.2.jog-scale joint.3.jog-scale
  net cncterm-wheel-x cncterm.jog.wheel.x joint.0.jog-enable
  net cncterm-wheel-y cncterm.jog.wheel.y joint.1.jog-enable
  net cncterm-wheel-z cncterm.jog.wheel.z joint.2.jog-enable
  net cncterm-wheel-a cncterm.jog.wheel.a joint.3.jog-enable

  net cncterm-wheel cncterm.jog.wheel.increment => axis.x.jog-scale axis.y.jog-scale axis.z.jog-scale axis.a.jog-scale
  net cncterm-wheel-x cncterm.jog.wheel.x axis.x.jog-enable
  net cncterm-wheel-y cncterm.jog.wheel.y axis.y.jog-enable
  net cncterm-wheel-z cncterm.jog.wheel.z axis.z.jog-enable
  net cncterm-wheel-a cncterm.jog.wheel.a axis.a.jog-enable

  net encoder-counts cncterm.wheel-counts

  # these pins inverted in kneemill.hal
  net abort-raw debounce.0.5.in <= bb_gpio.p8.in-28
  net cncterm-abort cncterm.abort <= debounce.0.5.out
  net start-raw debounce.0.6.in <= bb_gpio.p8.in-30
  net cncterm-start cncterm.cycle-start <= debounce.0.6.out
  net block-raw debounce.0.7.in <= bb_gpio.p8.in-31
  net cncterm-block cncterm.single-block <= debounce.0.7.out

  net cncterm-active cncterm.jog.active => bb_gpio.p8.out-32
  net cncterm-status cncterm.status-light => bb_gpio.p8.out-33
#### EOF

Other Notes

In lathe mode, the display of the X (1st) axis can be switched from "radius" to "diameter", where the x coordinate is doubled; this tells the operator the diameter being cut, rather than the radius. Lathe mode is noted on startup, and the "*" in the Enabled column for the X axis is replaced with "D" for diameter mode, or "r" for radius mode. Switch between the two modes with "$". The display starts in diameter mode.

The screen layout should be self-explanatory, but perhaps not. Feedback welcome.

TODO


(C) 2023 Paul Gettings first initial dot last name at the goolge mail location