Archive for category Software

MakerGear M2: Marlin 1.0.2 Firmware Tweaks

Given that I’m throwing all the balls in the air at once:

  • V4 hot end / filament drive
  • 24 VDC motor / logic power supply
  • PETG filament

It seemed reasonable to start with the current Marlin firmware, rather than the MakerGear version from long ago. After all, when you file a bug report, the first question is whether it happens with the Latest Version.

Marlin has undergone a Great Refactoring that moved many of the constants around. I suppose I should set up a whole new Github repository, but there aren’t that many changes and I’ve gotten over my enthusiasm for forking projects.

Anyhow, just clone the Marlin repo and dig in.

In Marlin_main.cpp, turn on the Fan 1 output on Arduino pin 6 that drives the fans on the extruder and electronics box:

pinMode(6,OUTPUT);	// kickstart Makergear M2 extruder fan
digitalWrite(6,HIGH);

You could use the built-in extruder fan feature that turns on when the extruder temperature exceeds a specific limit. I may try that after everything else works; as it stands, this shows when the firmware gets up & running after a reset.

In Configuration_adv.h, lengthen the motor-off time and set the motor currents:

#define DEFAULT_STEPPER_DEACTIVE_TIME 600
#define DIGIPOT_MOTOR_CURRENT {185,215,185,185,135}

The Configuration.h file still has most of the tweaks:

#define STRING_CONFIG_H_AUTHOR "(Ed Nisley - KE4ZNU - Hotrod M2)"
#define STRING_SPLASH_LINE2 STRING_VERSION_CONFIG_H

#define BAUDRATE 115200

#define MOTHERBOARD BOARD_RAMBO

#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_BED 1

#define HEATER_0_MAXTEMP 290
#define HEATER_1_MAXTEMP 290
#define HEATER_2_MAXTEMP 290
#define HEATER_3_MAXTEMP 290

#define X_MAX_POS 136
#define X_MIN_POS -100
#define Y_MAX_POS 125
#define Y_MIN_POS -127
#define Z_MAX_POS 175
#define Z_MIN_POS 0

#define HOMING_FEEDRATE {75*60, 75*60, 30*60, 0}

#define DEFAULT_AXIS_STEPS_PER_UNIT   {88.88,88.88,400,424.4}
#define DEFAULT_MAX_FEEDRATE          {450, 450, 100, 94}
#define DEFAULT_MAX_ACCELERATION      {5000,2500,2000,10000}

#define DEFAULT_ACCELERATION          10000
#define DEFAULT_RETRACT_ACCELERATION  10000
  

I missed the max & min position settings on the first pass (they’re new!), which matter because I put the origin in the middle of the platform, rather than the front-left corner. Marlin now clips coordinates outside that region, so the first thinwall calibration box only had lines in Quadrant 1…

, ,

2 Comments

Bookleting a PDF with Landscape Pages

For reasons not relevant here, we had to make a booklet out of a PDF file that contained several wide tables that should print in landscape mode, but were tagged as portrait pages. As a further complication, the pdftops utility I normally use complained vociferously about nearly every page:

Syntax Warning: FoFiType1::parse a line has more than 255 characters, we don't support this

A bit of fiddling produced this recipe, with pdf2ps in place of the usual pdftops:

pdfcrop --margins "36 0 10 0" FileName.pdf 
pdftk FileName-crop.pdf rotate 41-46east output FileName-crop-rotate.pdf
pdf2ps -dLanguageLevel=3 -sPAPERSIZE=letter -dFIXEDMEDIA FileName-crop-rotate.pdf FileName-crop-rotate.ps
ps2book.pl -f 1 FileName-crop-rotate.ps
ps2pdf FileName-crop-rotate_book.ps

The gymnastics in pdf2ps forces letter-size pages, no matter what the internal size specifies.

That was not particularly obvious, but hooray for pdftk…

Leave a comment

ID3 Tagging Audio Book Files

For whatever reason, the audio books we get at the library sale generally don’t have CDDB database entries, so I fill in the appropriate values by hand. Weirdly, some individual CDs within a single book do have entries, which confuses the process (well, me) no end unless I notice it first; I’ve turned off auto-lookup to make that problem Go Away. Perhaps a different database would help, but I don’t do this nearly often enough to care that much.

Given that:

  • Mary plays the tracks sequentially from start to finish
  • The tracks don’t correspond to book divisions
  • She doesn’t care about the details

I concluded a simple track naming convention that sorts in ascending alphabetic order would suffice.

Asunder auto-fills the fields after the first CD. After a bit of manual wrestling to extract an error-filled track, I had a directory full of MP3 files with informative, albeit slightly redundant, names:

1901-01 - Track 01.mp3

Alas, the ID3 fields apply to a single music CD, with track numbers and names within a single album and no notion of a multi-CD set. I use the “year” field as a CD sequence number; it must be a four-digit year and, seeing as how Asunder defaults to 1900, the first CD becomes 1901.

So the following fields apply:

  • Genre: “Audio Book” (for v2 tags) or Speech (v1 tag = 101)
  • Artist: author
  • Album: book title
  • Year: 19 + CD number within set as 1901
  • Track Name = CD number + track number as “D:01 T:01″

But the real gotcha is that the Most Favorite MP3 Player (remember MP3 players?) recognizes only ID3 v1 tags and Asunder writes only ID3 v2 tags.

Fortunately, the id3v2 utility can do this thing. Rather than screw around selecting each file, extracting the v2 tags, doing something horrible involving bash or sed or awk or whatever, and ramming the results into v1 tags, I just fed in the appropriate number of CDs and more than enough tracks, then ignored any errors concerning missing files.

Firing a Bash cannon broadside:

for d in {01..15} ; do id3v2 -1 -a "Who Wrote It" -A "The Book Title" -y 19$d -g Speech 19${d}* ; done
for d in {01..15} ; do for t in {01..15} ; do id3v2 -1 -t "D:${d} T:$t" -T $t 19${d}-${t}* ; done ; done
for d in {01..15} ; do for t in {01..15} ; do id3v2 -2 -t "D:${d} T:$t" -T $t 19${d}-${t}* ; done ; done

The last line tightens up the title name tag in v2 format to fit the MP3 player’s teeny display. The next time around, I should remove the “Track” text from the file name for consistency.

And then it just worked…

2 Comments

CD Ripping: Fractional Tracks

Mary gets books-on-CD at the annual library book sale, but she’s found they’re easier to use in MP3 format. We regard format transformation for our own use as covered by the First Sale Doctrine and Fair Use, but, obviously, various legal opinions differ.

I use Asunder to rip audio CDs, although it doesn’t handle non-recoverable errors very well at all. Wiping the offending disc with nose oil or ripping from a different drive will resolve most of the issues, but a recent acquisition had a nasty circumferential scratch in the middle of Track 7 that just didn’t respond to Black Magic.

CDparanoia can rip portions of a track, so a little binary search action extracts the usable data from Track 7:

cdparanoia "7-7[4:35]" Track7a.wav
cdparanoia III release 10.2 (September 11, 2008)

Ripping from sector  177155 (track  7 [0:00.00])
	  to sector  197780 (track  7 [4:35.00])

outputting to Track7a.wav

 (== PROGRESS == [                              | 197780 00 ] == :^D * ==)   

Done.

cdparanoia "7[5:30]-7" Track7b.wav
cdparanoia III release 10.2 (September 11, 2008)

Ripping from sector  201905 (track  7 [5:30.00])
	  to sector  208894 (track  7 [7:03.14])

outputting to Track7b.wav

 (== PROGRESS == [                              | 208894 00 ] == :^D * ==)   

Done.

With that in hand, you import the two WAV files into Audacity with a five second gap between them, drop two seconds of A-440 sine wave in the gap, and export to MP3.

The M3U playlist entry has the track time in seconds, so I hand-carved that entry to match the abbreviated length:

#EXTINF:376,Disc 14 Track 7
14-07 - Track 7.mp3

Done!

7 Comments

Thunderbird: Disabling an ISP Email Account

For reasons that probably make sense to them, Optimum Online (the ISP part of Cablevision) uses totally insecure password-in-the-clear user authentication to the POP3 and SMTP servers. That’s marginally OK for access through their own cable network, but, should you access those servers through a different ISP, you’ve just exposed some sensitive bits to the Internet at large.

Disabling an account in Evolution requires removing one checkmark:

Edit → Preferences → Mail Accounts tab → uncheck the account → done!

Doing the same in Thunderbird, however, requires arcane knowledge and deft surgery, documented in the usual obscure forum post containing most of the information required to pull it off:

Edit → Preferences → Advanced tab → Config Editor button

Search for server.server and find the .name entry corresponding to the ISP account. Note the digit identifying the server, which in my case was 1: server1.

Search for server1 and find the number of the mail.account.* entry with that string in the value field. In my case, that was account1.

Search for accountmanager to find the mail.accountmanager.accounts entry and remove the account you found from the Value string.

Done!

Make a note of all that information, because you must un-futz the accountmanager string to re-enable the account. Of course, if you add or remove any accounts before that, all bets are off.

There, now, wasn’t that fun?

Leave a comment

Samba Setup Woes

As with all Windows boxes, the old Lenovo Q150 (dual booted with Win 7 Home Premium) became slow and cranky, despite not being used for anything other than monthly science and annual taxes. Various fixes and tweaks being unavailing, I swapped in an Optiplex 780 (dual booted with Win 7 Pro), replaced the IBM L191p monitor with the recapped Dell 2005FPW, reinstalled all the programs, and discovered that Samba was intermittent.

For future reference…

Win 7 Pro includes the Remote Desktop Protocol server that’s missing from Win 7 Home Premium. Oddly, RDP works better than UltraVNC, using Remmina as a client.

The file server in the basement runs Xubuntu 14.04 with Samba 4.1.6 and works perfectly with smbclient, showing no glitches at all. Even when the Win 7 box doesn’t show the server shares at all, it’s rock solid to my desktop Xubuntu box.

The familiar sudo service samba restart doesn’t actually do that any more, so get used to the two-step dance:

sudo service nmbd restart
sudo service smbd restart

However, that sometimes seems to start a spurious third copy of smbd (there should be two, for unknown reasons), so it’s better to use a four-step dance:

sudo service nmbd stop
sudo service nmbd start
sudo service smbd stop
sudo service smbd start

The old SysV init system wasn’t good enough, so they invented the run-all-the-things upstart, then systemd Borged upstart, all while Samba, one of the most critical Windows interfaces, still hasn’t emerged from the original init scripts. They call this progress, but I’m not sure.

Telling the Samba server to not be the domain controller, which should resolve intermittent pissing matches over who’s on first, had no effect.

When the Win 7 box does show the shared files, everything works fine: files read & write with the proper permissions, the owners & groups are fine, all is right with the world. In between those moments, however, nothing works, because the share simply doesn’t appear.

Then, seconds or minutes or tens of minutes later, it’s back!

Setting map to guest = bad password, as found in the usual random blog comment, had no effect.

The most recent Samba update replaced the /etc/samba/smb.conf file, so we’ll restart from scratch and see what happens next.

My general approach to Samba has been to futz around until it mysteriously starts working. That seems not to be of any avail this time around; we may put the tax data on a USB stick and move on.

7 Comments

Dell Inspiron E1405 vs. Ubuntu 14.04LTS vs. Broadcom Drivers

So the ancient Dell E1405 laptop on the Electronics Bench, connected to this-and-that, woke up without network connections. As in, right after booting, the link and activity lights jammed on solid, the usual eth0 device wasn’t there, WiFi was defunct, and nothing made any difference.

After a bit of searching, the best summary of what to do appears on the Ubuntu forums. The gist of the story, so I need not search quite so much the next time, goes like this:

The laptop uses the Broadcom BCM4401 Ethernet and BCM4311 WiFi chips, which require the non-free Broadcom firmware found in the linux-nonfree-firmware package. There’s a proprietary alternative in bcmwl-kernel-source that apparently works well for most Broadcom chips, but not this particular set.

Guess which driver installed itself as part of the previous update?

The key steps:

sudo apt-get purge bcmwl-kernel-source
egrep 'blacklist (b43|ssb)' /etc/modprobe.d/*
... then manually kill any files that appear ...

Apparently that problem has been tripping people for at least the last four years. That this is the 14.04 Long Term Support version evidently has little to do with anything at all.

While I was at it, I deleted all the nVidia packages that somehow installed themselves without my noticing; the laptop has Intel 945 integrated graphics hardware.

I vaguely recall what I intended to do before this happened…

,

Leave a comment