Showing posts from February, 2009

Moving code from ESP8266 to ESP32

A while ago I made a mashup of Dan Royer's code CNC 2 Axis Demo with my own code for trapezoidal motion stepper and servo control for ESP8266.

I assumed porting the code to the ESP32 would be trivial, and that was true for the most part: changes like library name being Wifi.h instead of Wifi8266.h were not a problem. UDP now does not like multicharacter writes but you can use print instead. So far so good.

However, when it came to the interrupt code I was stuck with the stepper interrupt causing an exception sometimes. And to make things weirder, the servo interrupt worked flawlessly (both of them had the IRAM_ATTR directive if you ask me).

Going little by little, I could narrow down the culprit to a floating point operation during the interrupt, that would cause problems sometimes but not always. Browsing around I found this post. Where the solution was simple: do not use floats within the interrupt routines but doubles. The reason was the float calculation would be performed by…

Spiro curves

I've never been a fan of Bézier curves, but sometimes they are useful. Maybe my main complaint is acknowledging the fact that I've been incapable of getting a curve just right on the first attempt in any vector editing software. Maybe it is just me. So when I saw that Inkscape was adding support for a new type of curve I have never heard of before I started to pay attention. Of course this is old news for some of you, but I've been busy with other things and I have not checked the development version of Inkscape for quite a while (maybe a sign that I'm quite happy with 0.46 version).

The thing is that Mr. Levien was smart enough to develop an alternative to Bezier curves and kind enough to grant a free license of his patented technology to GPL software. Thanks to this Inkscape can brag of supporting a new type of curve not available on commercial software like Illustrator. A library is available on Sourceforge too.

But it won't be fair to the effort of Inkscape devel…

2D barcode decoding

Barcodes have been growing to pack higher data density. 2D barcodes can pack more data than older 1D codes. Many cellphones can decode barcodes as the are equipped with a camera good enough for the task.

There is a cool project that offers code for doing that with a variety of phones, including iPhone and Android.

Unfortunately it does not seem to work with my Nokia E71 phone (it has to be some kind of curse, as the built-in barcode software that came with the phone does not work either).

However I still can use the phone to take a picture of the codes I'm interested on to have them decoded on-line. You can try this form to decode a file with a picture of a barcode.

An alternative to using the cellphone for decoding the barcodes on-line (that can be expensive depending on your data plan) is to download those images to your PC and to use a simple script to get them decoded. I used curl tool for doing that as it has HTTP POST capabilities. It worked great.

ICH9 sound problem on resume

Last summer I renewed my two main desktop computers. I was looking for something compact but easily upgradeable. Not very expensive and reliable. I've got good experiences in the past with ASUS barebones, so I went for this one. All but a small detail have worked like a charm since day one.

I was amazed to see see that even suspend worked nicely with Ubuntu 8.04. But then I realized the system sound was gone when waking up from suspend. And it seemed the only way to get it back was to reboot the system.

Several forums reported the possibility of adding some parameters to the sound driver module so it will reload appropriately when resuming. Unfortunately the two first hours of attempts were unsuccessful and I decided I could live without it. However, days later I've found another post where what it is suggested worked for me too:

add these lines to /etc/modprobe.d/alsa-base

options snd-hda-intel model=3stack-dig
options snd-hda-intel enable_msi=1
options snd-hda-intel single_cmd=1