Fixing KiCAD Custom Plugin Error


As of this writing, when one attempts to run a custom Python3 plugin script for KiCad (v6) where the script file is not located at /Applications/KiCad/ python complains that it cannot find the KiCad libraries.

Apple security boffins have made it all but impossible to set global env variables, so export PYTHONPATH="..." isn’t really an option, when running plugin scripts from within the KiCad GUI (Generate BOM for example.)

I did get that working by wrapping the text in Command line running the generator: with sh -c 'export PYTHONPATH="/Applications/KiCad/ && [original command here] ' … but then I realized …

Better Way (probably)

In your custom Python script, simply change this …

import kicad_netlist_reader
import kicad_utils
import csv
import sys

… to this …

import sys
import kicad_netlist_reader
import kicad_utils
import csv

I guess KiCad itself may be able to fix this quirk on macOS some day. For now, I’ll stick with what’s working.

Bypassing Low Voltage Warning in OctoPrint

Say what now?!

Octoprint has a built-in module “Pi Support” that gives warnings if something’s up with your ‘Pis power supply or if it’s been “throttled” any time since system boot-up.

Very clever … but what happens if your sweet old Raspberry Pi 3+ Model B has a faulty MxL7704 power management chip, say one that reports low 5V_SYS even though it’s fine? Let’s just imagine you’ve already hooked a laboratory voltmeter and scope up to your R’Pi to verify this sad state of affairs.

Here’s a script that will bypass the warning. It should go without saying that using this is NOT a good idea but who am I to judge?

ANYTHING_BUT_THROTTLED=`$VCGENCMD $* | sed 's/\(throttled=\).*/\10x0/'`
exit $?

Use your favorite editor to create the script somewhere tidy like ~/scripts/vcgencmd-bypass and make it executable using chmod a+x vcgencmd-bypass.

Now all you have to do is point Settings => Pi Support => Advanced options to this script rather than the default /usr/bin/vcgencmd executable; Like so …

Why you naughty hacker you!

The script allows all vcgencmd commands through, changing only the likes of any throttled=0x50000 output to throttled=0x0.

Now of course, that same faulty chip is going to tell Raspbian to throttle even when it shouldn’t … or is it? Turns out that in my case, the glitch only seems to occur once during boot-up. I am guessing around the time the first I2C initialization event occurs. I have benchmarked the Pi to death trying to get it to produce throttled=0x4 (Currently throttled) with no or should I say only joy.

In case you’re wondering what made me suspect a faulty chip … well that would be connecting a 4 Amp power supply the wrong way around, directly to the PCB, bypassing the fuse etc. That seemed to outright kill the Pi but a few hours later when I plugged it in one last time before trashing it … YIPPEE! It worked again. I guess the cip cooled down? 😛

… or I’ve fallen down some garden path in a comedy of life’s wonderful little errors. shrug. Either way, you’re welcome!

Have fun!

Intel Quartus 16.1: Fix for, “Inconsistency detected by dl-close.c”

If you stumbled on this via Google, I hope you found it useful in your specific use case.

While using intelFPGA (Quartus) Lite v16.1 on my Ubuntu Linux 16.x system, I was seeing this shared library-related error …

Inconsistency detected by dl-close.c: 811: _dl_close: Assertion `map->l_init_called' failed!

The problem turned out to be some kind of incompatibility with Quartus supplies and indeed requires v1.59.0, while my system has v1.58.0 installed, being the latest pkg manager version at the time.

It turns out that the Quartus commandline tools refer to plain file, which is in fact a sym-link to Meanwhile, the GUI tools explicitly require the latter. Hmmm.

Damn the torpedos! FULL STEAM AHEAD!

The easiest fix I could see in my busy litle day was to simply remove the symlink, such that the Quartus command-line tools would use the system lib (found by, in the normal fashion) …

~$ cd ~/intelFPGA_lite/16.1/quartus/linux64/
~/intelFPGA_lite/16.1/quartus/linux64/$ rm -f

… and that actually did the trick, for once! Astonishing! 🙂



The Mandella Effect

I’ve known about these Mandella Effect people (online) for a few months now. Yet another fucking religion is born! *sigh*
NLP folks will all be nodding their heads in amusement, as will magicians the world over. David Copperfield will be turning in his grave. Wait. Copperfield is alive? I could swear the Chinese Wall swallowed him up in the ’80s! Damn. I must have taken a bend in the space-time curvature too fast or something. :-/
Isn’t it interesting how the Internet gives us so much freedom and opportunity to grow as an intelligent species … yet at the same time, the ever misguided masses use it to to dumb themselves down, faster than ever.
Large numbers of people believing in something, despite facts or good reason, are perhaps the most dangerous threats to not only civilisation but to our very species. Surely no one could disagree with that.
Belief systems. Hell, we should remove the word, “belief” from the @#$! dictionary, as far as I’m concerned. The word, “hallucination” covers it better. Perhaps belief in the present is a requirement for sanity and a good thing, in the grand scheme of things. What is not good, is believing in our beliefs, despite all evidence — regardless of the dimension we got kicked into last night.
Logik for da wise!
P.S: Spread the word! Everyone needs to STOP USING AUTOMATIC WASHING MACHINES IMMEDIATELY! Every time one of those things hits a spin cycle, it creates another dimension-changing time vortex! If it weren’t for clothes dryers doing likewise at a tangent, we’d all be truly screwed. (I was the first one ever to figure this out, by the way. Just saying.)

Apple OS X Prevent or Stop Three Dots (…) Being Converted to a Single Unicharacter

By default, in Apple OS X, when you type “…” (dot, dot , dot) and press [space], the three dots get converted to a single unicode character, ‘…’, which can cause problems in some scenarios.

There are several mechanisms involved for this feature, making it difficult to disable in some versions of OS X or in certain applications, if you don’t know where to look.

Since OS X Mavericks (10.9) most Apple apps have the menu option, Edit -> Substitutions, wherein Text Replacement and other auto-type features can be turned on or off, though oddly not just for the app in question, but system wide …


But what about all those non-Apple apps or earlier versions of OS X, that don’t have an Edit -> Substitutions menu item?

As of OS X Mavericks, the ‘dot,dot,dot’ feature specifically, is an auto-replace item, found in System Preferences -> Keyboard -> Text. You can delete the ‘…’ item entirely.

In earlier versions, there is  System Preferences -> Language and Text ->Text. Then un-check the ‘…’ item.

Note that since Mavericks, these auto-replace items are synced across all your devices, via iCloud. So removing the ‘…’ auto-replace item on your Mac will also remove it on your iPhone, iPad, etc.


USB Traffic Meter Thingy (gMeter) Update

First working gMeter-MLF build

I’ve now completed two versions of the envisaged USB visual meter and alarm sounder device, both based on the ATmega88P MCU and as envisaged in my previous post. A photo of the smaller version is shown, right.

I have published the design files and firmware as free open source (GLP v3) at Google Code.

Below is an image of the same board, with the first 5 of 8 LEDs lit up.

gMeter-MLF lit
Showing the first 5 green and yellow LEDs lit up. The next three are orange (x2) and red.

The original version of the gMeter board is larger (at about 150% the size of the MLF version) and uses an easier-to-hand-solder (bigger) ATmega88P microcontroller chip. It also includes a 4-pin header to connect a commonly available Bluetooth module (currently not supported in any way by the published firmware) as well as four spare I/O pads for expanded use, should the user wish to wrangle with the firmware source code, to that end.

Original gMeter
The original, larger gMeter board, with Bluetooth header and four spare I/O pads.

Curing Multiple Drive Map Weirdness in Windows

To help Google help you find this article, I should mention a few names I’ve come up for this scenario, search query names like, “multiple unwanted drive mappings”, and “windows multiple duplicate drive mappings” or even, “windows many cloned drive maps fault”.


None of the stuff in this article actually worked out in the end. Seems that underneath all the eye candy, Windows is still uselessly poor where it counts. Save yourself a lifetime of hassle and switch to Mac. You’ll never look back. That said …

The Story

A long, long time ago, I remember having a strange problem under Windows XP with Office 97. Machines around the office would have a single drive mapping to a samba network share — say, something like …

\\server\homedir (H:)

After booting, if I opened Windows Explorer soon enough, I’d see just that one mapping, as expected. Then, if I just sat there, doing nothing but staring at ‘Explorer, after a minute or so, that same mapping would start duplicating itself under every avaialble drive letter. Something like …

\\server\homedir (E:)
\\server\homedir (F:)
\\server\homedir (G:)
\\server\homedir (H:)
\\server\homedir (I:)
\\server\homedir (J:)
... all the way down to ...
\\server\homedir (Z:)

Back then, it took ages to find the cause, which turned out to be some kind of bug in the Office 97 ‘parasite’ program, FindFast — a file indexer meant to make finding stuff quicker, which it actually did do, reasonably well, I guess. (Who on Earth forgets where they saved things though? :p) Completely removing FindFast made the problem go away back then and I hadn’t paid it the slightest thought over the ten plus years hence. (Never came across it again either, oddly enough!)

Fast-forward several major service packs of Windows XP, through Windows Vista (yikes!) and all the way up to Windows 7 (with the latest service packs as at 2011-01-01) and we find that, in true-to-themselves Microsoft form, the SAME fault still exists in the Windows7 buil-it Indexer service today. AMAZING, yet somehow not surprising. (I converted to Apple Mac as soon as they went Intel under BSD Unix — after some 20 years of Windows’ psych0-trauma’ing. To think — I used to actually believe that bugs like this were just an unavoidable part of owning a computer. I’m much wiser now though! :p)

Granted, this is one of those faults that seems to hardly ever show up anywhere on the planet — unless M$ have a secret pact with Google to remove all mention of it, somehow. But it’s not completely unheard of. I did manage to find ONE solitary post on the topic, from back in 2004 I think. Heck — it might even have be from me. (Don’t think so.)

So the fix under Windows7?

Go to the Control Panel, change the view to anything but ‘by Category’ and locate Indexing Options icon. Activate that and click the Modify button, lower left of the resulting window. Remove the tick from checkbox alongside Offline Files. (Searching for files you can’t even access? What’s with that anyway?) Problem solved.

I have to admit that I was quite astonished when this stab in the dark actually did cure the fault. Since I’ve been living with it for months (in a virtual machine I use for PCB design under Windows) and only just finally came up with this brain-storm-fluke of an idea, I thought I’d better blog about it somewhere, in hopes others with the problem can learn the answer too. Hope it helped … and that my sarcastic, cynical banter wasn’t too bad a thing to endure.

Oh no!

The problem came back. It no longer happened “just on its own”, as mentioned above. But some programs seemed to trigger it to happen again after opening the Choose File dialog box.

Suspecting the possibility of residual index data from before I disabled ‘Offline Files’ indexing, I click the Advanced button in the Index Options window and then the button to delete and rebuild the index. So far, the problem has not come back again. Yay \o/

I suppose that disabling the indexing service altogether (don’t know how in Win7 yet) might be the ultimate fix. But it seems a little ‘sledge hammer’ to me.

I Give Up

OK. I give up. It came back again the next morning. If you stumbled upon this post and did eventually find a permanent cure for this ancient incurable Windows BS bug … please do let me know by way of a comment. Thanks.

ER9X-ala-gruvin has its Own Project Home

Wow. Looking back on those earlier posts about my ER9X hacks is kind of embarrassing now. But hey … that’s life. Always moving on, until it doesn’t!

My TH/ER9X hacking adventures have now launched off in whole new directions — including an open design project for a complete replacement main logic board for ‘9X radios. As of this writing, the first prototype PCB and components have been ordered, due to arrive for assembly very soon.

The gruvin9x project is currently focussing on Fr-Sky telemetry support and the afore mentioned prototype logic board. The latter is all about expanding the program capacity of the ATmega controller (upgrade to ATmega2561) and adding a fully functional MMC/SDCARD interface, with FAT32 file system support. This will be used to store model data and other stuff — like telemetry logs or even autopilot flight plans (much later). The fun has only just begun!

The whole project is now hosted at Google Code, under the vanity name gruvin9x — including the KiCAD open-source circuit diagrams and PCB design. Enjoy!

Once again, a BIG thanks to Thomas of TH9X, who got us started — and Erazz of ER9X, with all the followers and contributors there, who have added so much already. I haven’t had so much fun in years!