myCNC control software has API to record Height Map log file for further height adjustment.
There is a Height Map settings widget.
The following parameters can be set up in the widget
There are 2 Global variable registers mapped to the Log API
|Register Name||Register Address||Description|
|GVAR_POSITION_LOG_DATA||5730|| If Logging is stopped, writing to this register does not have an effect.
If the Logging is started, writing any value to this register
will add current position
to the Log data array.
Beside of storing into the Log Array,
The Log position is stored into Global Variables 5731-5736 as well
#5731 - X, #5732 - Y, #5733 - Z
#5734 - A, #5735 - B, #5736 - C
|GVAR_POSITION_LOG_CMD||5740|| Begin/Eng Height Map Log
Writing “1” to this register will start logging
Writing “0” to this register will stop logging
All the collected data will be stored in a log file
with given filename and time stamp
As an example add M80 procedure to start-stop Height Map Log file
The procedure will send to Register #5740 variable value “eparam” which is initialized as P-parameter from g-code line.
Another example - code to add the current position to the log file - code M85
This is just an example of storing position to the log.
To get a real example of Height sensing and Logging we have to
Macro example to probe surface (double touch with fast and slow speed) and store a result in log array is shown below
#10=3 (Sensor Nr) #11=1 (Sensor Normally opened) M88 P#10 L#11 (Smooth stop if sensor activated) G91 G0 Z-30 F500 (Fast probe screen surface) G04 P0.1 G91 G0 Z2 F500(Rebound 2mm) M89 P#10 L#11 (Stop if sensor activated) G91 G0 Z-30 F50 (Slow probe screen surface) G04 P0.1 (Pause) M85 (Save the coordinates in the log) G90
G-code program example for getting height map log is below
A time stamp will be added to the log filename. For example, if a file name is given as “/home/sk/height.map”, then actual height map files will be stored under names
height-map-2018-09-09-17-14-36 height-map-2018-09-09-19-29-43 heights.map-2019-02-18-16-10-19 heights.map-2019-02-18-16-48-16
; height-map.nc G90 G17 G21 G0X0Y0 M80P1 (Logging ON) G1 X50 Y50 Z20 (Position 1) M180 (Probe and add the result to the log) G0 Z20 (Lift up) G1 X60 Y50 Z20 (Position 2) M180 (Probe and add the result to the log) G0 Z20 (Lift up) G1 X70 Y50 Z20 (Position 3) M180 (Probe and add the result to the log) G0 Z20 (Lift up) G1 X80 Y50 Z20 (Position 4) M180 (Probe and add the result to the log) G0 Z20 (Lift up) G1 X80 Y60 Z20 (Position 5) M180 (Probe and add the result to the log) G0 Z20 (Lift up) G1 X70 Y60 Z20 (Position 6) M180 (Probe and add the result to the log) G0 Z20 (Lift up) G0 X60 Y60 Z20 (Position 7) M180 (Probe and add the result to the log) G0 Z20 (Lift up) G1 X50 Y60 Z20 (Position 8) M180 (Probe and add the result to the log) G0 Z20 (Lift up) M80 P0 (Save the Log and turn logging Off) M2
A log file example is below
G90 G1 X 50.00 Y 50.00 Z -9.634 G90 G1 X 60.00 Y 50.00 Z -8.125 G90 G1 X 70.00 Y 50.00 Z -8.270 G90 G1 X 80.00 Y 50.00 Z -9.156 G90 G1 X 80.00 Y 60.00 Z -9.706 G90 G1 X 70.00 Y 60.00 Z -9.741 G90 G1 X 60.00 Y 60.00 Z -9.360 G90 G1 X 50.00 Y 60.00 Z -9.066