Archive for category Software
Someone who found my original post about the Freestyle2’s dysfunctional media keys came up with a fix: https://github.com/whereswaldon/kfreestyle2d.
Some notes for the next time this comes up:
sudo modprobe uinput,
lsmod | grep uinp returns nothing at all (Xubuntu 16.04), but
evtest seems perfectly happy:
sudo evtest /dev/input/event17 Input driver version is 1.0.1 Input device ID: bus 0x3 vendor 0x58f product 0x9410 version 0x0 Input device name: "KB800 Kinesis Freestyle" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 113 (KEY_MUTE) Event code 114 (KEY_VOLUMEDOWN) Event code 115 (KEY_VOLUMEUP) Event code 140 (KEY_CALC) Properties: Testing ... (interrupt to exit) Event: time 1518199358.454619, type 1 (EV_KEY), code 113 (KEY_MUTE), value 1 Event: time 1518199358.454619, -------------- SYN_REPORT ------------ Event: time 1518199358.454638, type 1 (EV_KEY), code 113 (KEY_MUTE), value 0 Event: time 1518199358.454638, -------------- SYN_REPORT ------------ Event: time 1518199361.014681, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 1 Event: time 1518199361.014681, -------------- SYN_REPORT ------------ Event: time 1518199361.014699, type 1 (EV_KEY), code 114 (KEY_VOLUMEDOWN), value 0 Event: time 1518199361.014699, -------------- SYN_REPORT ------------ Event: time 1518199361.654701, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1 Event: time 1518199361.654701, -------------- SYN_REPORT ------------ Event: time 1518199361.654721, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0 Event: time 1518199361.654721, -------------- SYN_REPORT ------------ Event: time 1518199362.294715, type 1 (EV_KEY), code 140 (KEY_CALC), value 1 Event: time 1518199362.294715, -------------- SYN_REPORT ------------ Event: time 1518199362.294733, type 1 (EV_KEY), code 140 (KEY_CALC), value 0 Event: time 1518199362.294733, -------------- SYN_REPORT ------------
And the keys work without any special configuration on my part. Apparently they’re already built into XFCE, despite the sound keys not showing up in the Keyboard Shortcuts control panel where you assign programs to keys.
This is wonderful work!
I’ve never seen so many calculators before! Oops.
There should be some udev-rule-ish way to automagically figure out which
/dev/hidraw? device to use and symlink to a suitable alias, so the program could use it without knowing the actual device. A casual search turns up:
With which I’d produce
kinesis1, then use:
If only the Kinesis
Fn key was momentary, rather than a push-on / push-off toggle. Le sigh. I can cope.
A set of five calibration boxes will check both platform alignment and extruder settings:
Those boxes have three threads in their walls and stand 3.0 mm tall:
The first pass measurements:
The skirt is scant at 0.20 mm, the boxes are 0.15 mm short at 2.85 mm, and the walls are 0.03 mm too thin. Some Z offset adjustment seems in order, as the first few layers (on the left) came out grossly squished:
However, the box heights came out sufficiently uniform to show the platform alignment remains just fine.
Long ago, I moved the Z endstop switch to the X axis gantry, where it can directly sense the platform position:
Putting it there replaces all the mechanical putzing and adjusting cute little screws / bolts / nuts / spacers / suchlike with a simple offset in the startup G-Code:
G28 Z-2.15 ; home Z to platform switch, with measured offset
So I changed the startup G-Code in Slic3r to use
G28 Z-2.30, sliced a single box in the middle of the platform, printed it, and … it came out exactly the same height: 2.85 mm.
To make a very long story short, it turns out Marlin 1.1 ignores the numeric parameter in
G28. When I updated the firmware to that version, I had changed the Configuration.h file to include the homing offsets:
#define MANUAL_X_HOME_POS -100 #define MANUAL_Y_HOME_POS -127 #define MANUAL_Z_HOME_POS -2.15
So, with the same offset burned into the firmware, it looked like the startup G-Code was Doing The Right Thing. I never deleted the offset from the startup G-Code and, at some point, Marlin stopped supporting the numeric parameter.
However, the X and Y homing offsets must be hardcoded, because I want the XY origin in the middle of the platform to match my original OpenSCAD part designs. Everybody else prefers the XY origin in the front-left corner. FWIW, in Marlin 1.1-RC5 (two years old by now), the
#define BED_CENTER_AT_0_0 constant appears only in that line and nowhere else in the source code. Maybe it was a change in progress back then?
Anyhow, rather than hardcode the Z offset again, I set it to 0.00:
#define MANUAL_X_HOME_POS -100 #define MANUAL_Y_HOME_POS -127 #define MANUAL_Z_HOME_POS 0.0
Recompile and reload the firmware, then change the startup G-Code to use
G28 Z without the offset.
Doing so means I can measure and adjust the actual Z offset with
M206, then store the value in EEPROM with
M206 Z-2.25 M500
I went a little short at -2.25, for reasons I cannot explain now.
Measuring the offset goes like this:
- Zero the offset:
- Move the extruder off to the right:
- Home Z:
- Get some air under the nozzle:
- Measure the actual clearance, perhaps using your taper gauge, at (let’s say) 1.7 mm
- Set (1.7 – 4.0) as the offset:
- Print a box and adjust the offset accordingly
Using my actual measurement, not the for-instance example, I resliced the box, printed it, and it came out at 2.94 mm, just slightly short, so I re-tweaked the offset to
Z-3.28 and re-stored it.
Embiggening the wall thickness turned out to be a matter of updating the filament diameter. I measured the start of the current spool of orange PETG at 1.75 mm, the same as the previous natural PETG spool, but the current section is 1.70 mm. Plugging that into Slic3r, reslicing, and reprinting produced a dead-on square: 3.00 mm tall with 1.20 mm walls:
The skirt now comes out at 0.25 mm, the way it should, too. The difference between the original 0.20 mm skirt and 0.25 mm suggests the squashed center thread (of the three in the skirt around the first set of five boxes) forced the two adjacent threads to become a bit taller, for lack of somewhere for the excess plastic to go on one side of each thread, and the nozzle rode higher than you’d (well, I’d) expect from the bare numbers.
The picture is missing a few squares in the middle, because I couldn’t believe changing the
G28 Z-2.15 offset had no effect. It was easier to believe I’d inadvertently loaded the wrong file than the software / firmware was doing something wrong.
However, during the course of the adventure, I established
M851 does exactly nothing in this context, perhaps because it applies to some different type of homing / probing / mesh leveling / whatever. You can set the Z offset with several other G-Code and M-Code commands, but the documentation isn’t always forthcoming about how the various methods interact and different firmware uses identical codes for completely different functions, so proceed with Exceedingly Great Caution.
In any event, it’s much easier and faster to adjust the printer & slicing parameters by measuring test boxes than by puzzling over actual prints, so …
The OpenSCAD source code as a GitHub Gist:
We just scrapped out the old dish drainer, only to find the gadget bin on the new drainer let the measuring spoons fall over and lie along its bottom. After a week of fishing them out from under paring knives, cheese slicers, and suchlike, I gimmicked up a holder:
One might suggest natural PETG, rather than orange, thereby displaying a shocking ignorance of the MVP concept. We’ll run with orange for the shakedown trials, then build-measure-learn, iterate, and, for all I know, we may even pivot.
A bottom-up view of the solid model shows the trench accommodating the bin lip:
The OpenSCAD source code as a GitHub Gist:
The original doodle has useful dimensions, along with the usual over-elaborate features sacrificed in order to get it made:
A little support pillar makes a printable holder for a small tactile pushbutton:
A(n) 0-80 brass washer epoxied atop the butt end of a P100-B1 pogo pin keeps the pin from falling out and provides a flat button pusher:
With the epoxy mostly cured, ease the pin off the tape, flip the whole affair over, shove the switch into position, realign vertically with point down, then let the epoxy finish curing with the washer held in place against the switch to ensure good alignment:
The brass tube ID is a sloppy fit around the pogo pin, but it’s also many pin diameters long and the position error isn’t worth worrying about.
Solder a cable, clamp it in the pen holder, attach to tool holder:
The pogo pin provides half a dozen millimeters of compliance, letting the initial probe speed be much higher than the tactile pushbutton’s overshoot could survive, after which a low-speed probe produces a consistent result.
Unleashing bCNC’s Autolevel probe cycle:
Although the picture shows the MPCNC probing a glass plate, here’s the first height map taken from the bare workbench top with 100 mm grid spacing:
The ridge along the right side comes from a visible irregularity in the wood grain, so the numbers actually represent a physical reality.
Doing it with a 50 mm grid after re-probing the Z=0 level:
Eyeballometrically, the second plot is 0.2 mm higher than the first, but this requires a bit more study.
All in all, not bad for a first pass.
The pen body seats atop the holder, with its narrower snout inside the clamp, giving positive control of the point position:
Unfortunately, should one forget to zero the pen tip to the paper surface before starting a plot, Bad Things happen to good tips:
The holder really needs at least a few millimeters of compliance, as a fiber-tip pen makes a fairly delicate tool not intended for applying much force at all to anything.
But the holder might make a Z axis probe …
After once again figuring out how to read a vernier height gage, I measured the height of each end of the MPCNC rails:
- Position the gage near the end of the gantry’s travel
- Twiddle the knurled ring to lower the probe (a.k.a. lathe bit) until …
- It firmly captures the paper slip, then …
- Twiddle the ring the other way until …
- The paper barely moves
- Read the vernier and take a picture
So the numbers come out one paper thickness higher than the actual rail height; subtract 0.1 mm = 4 mil to get the true height:
In round numbers, the difference is under 0.3 mm along each rail.
The outer numbers on the lower sketch show the difference between each reading and the lowest value along that axis: the left rear corner is (roughly) 0.5 mm higher than the right front. The numbers inside the square give the additional height, rounded to sensible values, required to raise the low corners.
Which means you can’t plot at, say, Z=-0.2 mm to reduce the pen loading, because the pen doesn’t uniformly touch the paper across the entire plot:
These images have been perspective & aspect ratio corrected, then ruthlessly contrast-stretched to make the traces visible; the lighting isn’t that awful in person!
With the plot at Z=-0.2, the legends toward the front came out OK, but they’re missing along the far edge. The Spirograph traces go completely missing toward the left rear as the pen rises away from the paper, although I think we’re also seeing some ripples in the paper sheet.
Although such a small error probably makes no difference to a wood router, let’s see what we can do.
Manually editing the G-Code to put successive traces at 0.1 mm increments from Z=-0.3 to Z=-0.6 mm, then replotting on the same piece of paper, shows the problem a bit better:
All of the legends remain at Z=-0.2, because I wasn’t up for editing every pen-down command.
Even at Z=-0.6 mm, the pen doesn’t quite touch in the left rear corner. Previously, I’d been plotting at a nice, round Z=-1.0 mm, which worked fine. I didn’t run any tests below Z=-0.6, but I think Z=-0.8 would draw a complete plot.
That agrees reasonably well with the height gage measurements.
It’s obviously impossible to re-level the rails by dinking around with the corner post lengths, because I can’t move the EMT in precise increments and it’d never stay in that position anyway. Instead, I should slide shims under the three lowest corner feet to raise them enough to match the left rear corner.
The HP 7475A plotter spec calls for 19 g = 0.67 oz of downward force on the pen, so, in an ideal world, one might want to use one’s collection of aging plotter pens in a similar manner.
Plotter pen, meet digital scale:
Stepping the pen downward in 0.1 mm increments produced a set of numbers and a tidy linear fit graph:
I hereby swear I’m not making things up: the spring constant really is a nice, round 100 g/mm!
plot_z = -1.0 in the GCMC program, with Z=0.5 touched off atop a defunct ID card on the paper surface to compensate for any tabletop warp / bow / misalignment, plus any errors from the tool length probe. An eyeballometric scan against a straightedge shows pretty nearly no misalignment, which means the holder mashes the pen against the paper with about 100 g of force, five times the HP spec.
A distinct case of pen abuse rears its ugly head.
It’s time to conjure a height probe for the tool holder.