About Me
Michael Zucchi
B.E. (Comp. Sys. Eng.)
also known as Zed
to his mates & enemies!
< notzed at gmail >
< fosstodon.org/@notzed >
Electrified Kilt!
I caught up with some old mates recently and one of them gave me a
couple of ESP-01 board to play with. I wasn't really sure what I
was going to do with them, one plan was a wifi-connected irrigation
controller just for something to poke at and to learn about the
devices and the i/o. But this act of generosity cascaded into a bit
of a spending spree on aliexpress where i've added some esp32-c3's,
a bunch of sensors, relay boards, power modules, solderless
breadboards, LED strips ...
Once I got them working I wasn't really sure what to do with them, I
have some ideas for the light strips for xmas but since I had them
and winter solstice was coming up I decided to do something a bit
silly and see if I could successfully 'electrify' one of my kilts!
The pictures don't really do it justice - the leds are very bright
at night and very colourful and animate very smoothly. I'm using a
Makita battery which is a bit hefty to hang off my belt but it's
what I had available and has enough juice to run it for about 20
hours or something stupid.
We're having a mid-winter 'light show' thing at the moment and I
wore it out again last night (the opening night), I should've done
a mainy on foot but I didn't really have the gumption for it and
just stayed in the one pub all night. One does feel a bit self
concious wearing it although on the solstice I walked home lit up
like an xmas tree some time late at night (about an hour's walk).
Hacker Hacking
It turned out to be more work than I expected, from working out how
to lay out and attach the leds (sewing them on, so I need to unsew
to wash it), soldering up an adapter board, plus of course all the
coding.
I started with some of the code
in FastLED but all I really have
left is some of the colour palettes.
I used Arduino initally to get the devices 'live' but quickly moved
onto the FreeRTOS sdk - Arduino is interesting enough but its' a bit
clunky to work with compared to proper tools. And I gotta say some
of the quality of code is pretty low. I also started the LEDs
showing with an ESP-01 board (esp8266) but then moved to an ESP32-C3
which is a much more interesting board. It's the first time I've
played with a RiscV processor - TBH I find some of the ISA decisions
a bit weird but due to the simplicty of the instruction set and
enough registers the compiler mostly does a pretty good job of
compiling it. Mostly. It does some weird shit when you return a
structure in registers (a 2-vector) like move the stack pointer down
and up and doesn't store anythin gon the stack.
The first time I wore it for the solstice I noticed the colours were
a bit flat - the Perlin noise from FastLED wasn't being scaled qutie
correctly so it was missing a big part of the range. I experimented
a lot with it but ended up scapping it and converting the Java
implementation of Simplex Noise from Stefan Gustavson into C and
then into fixed-point. I also experimented with a lot with the
code, various micro-optimisations and using a hash function rather
than a permute table, gradients generated from bits or from lookup
tables, and so on.
I was going to write a text scroller and even found (and created)
some tiny fonts. But in the end I couldn't think of anything
worthwhile to write so I decided not to bother coding it up. I
created some tiny animations but they looked a bit shit with such
a small number of pixels to work with so decided to drop them as
well. Instead I render some simple geometric shapes on the fly
using signed
distance fields which also let more easily play with the
colours. This was another journey into writing some fixed-point
affine transforms, sincos functions and inverse square root which
the internet provided starting points for which I cleaned up or
simplified for better RISCV optimisation. And I implemented a
version of the R250 random number generator but with a smaller
number of coefficients and parameter choices which sped it up a
bit more and use that to drive everything. I even hooked up a web
server I wrote (not using the ESP SDK one) that you can connect to
via wifi but I couldn't really think of anything useful to do with
it.
I was worried about the cost of calculation and spent a good few
days trying various optimisations but the simplex algorithm was
already significantly faster than the noise routines from FastLED
and in the end it wasn't a problem. I think the fastest 3D
simplex calculation was about 280 cycles, the FastLED 3D noise was
about 520 iirc. There are only 50 leds and the colours are easily
updated 125 times/second - that's with up to two planes of 3D
Simplex Noise or a basic SDF graphic. One somewhat small but still
effective optimisation technique to remove the 8 and 16 bit
integral types used heavily in ARM or AVR code - these usually
require extra operations since the RISCV CPU has only 32 bit types.
The gamma curve of the leds I have is pretty rough - at the low
end the steps are very noticeable so I implemented 2 bits of
temporal dither (aka 'frame rate control') to try to help. So the
LEDS themselves are actually updated 500 times/second and every
fourth timeout I re-render the graphics. There is more that could
be done to adjust the colour curves and so on but really I
couldn't be bothered. I also didn't investigate the ESP32 timers
and interrupts and just run it off an RTOS timeout handler.
So anyway I came up with 2 different noise types - one a higher
contrast scaled simplex noise with mostly monochromatic palettes,
and a smoother one with more colourful palettes. Apart from the z
dimension the smoother one can also move up or down, left or right.
And 5 different SDF patterns - a line, a cross, a rectangle, half
plane, quarter plane and two quarter planes. These rotate or move
and the line/cross/rectangle are repeated on an 8x8 grid. There's
about a dozen different palettes plus 8 monochromatic ones created
on the fly which can also be complemented (i.e. purple+green or just
purple+black). These run for a randomised time and then slowly fade
into the next routine. One last thing I added was it flashes for 5
seconds every now and then (at different rates) and on a separate
cycle to everything else just to add a bit more bling.
I even wrote an Xlib 'kilt simulator' I could use to rapidly test the
routines!
Ahh well that kept me off the streets for a couple of weeks and
got a few laughs and a lot of weird looks. I'll (probably?)
eventually get around to uploading the code, I have to work out
where I got all the bits from first. I'm not involved with any
forums any more and mastadon isn't really my thing so nobody will
end up seeing it anyway. I filed a bug report with FastLED about
their 8 bit blend function which isn't quite correct.
It was also fun doing a bit of coding again - although CMake could
certainly fuck off. Shit like that puts me off wanting to code
again for a job, although maybe I should start thinking about it
again.
Summer
Well summer finally arrived — only about 2 months late. The
garden's been pretty confused this year but the growing season is
all but done now, but i'm hoping for a few more chillies yet.
My leg is slowly healing, unfortunately I developed bursits due to
dealing with the degrading joint and that has lingered beyond the
hip replacement. The implant is particularly perpendicular which
seems to be adding additional stress on the bursa but I was
probably too active pre and post-operation and aggravated it
further.
I've got some daily physio exercises to move through and that
seems to be helping but it's frustrating I can't ride as much as
I'd like to. Cycling seems to be the main aggravator for the
bursitis which is a bit of a problem when I don't drive. I can
get a cortisol injection if I want but I'm trying to avoid is as
frankly I'm sick of hanging around hospitals and doctor surgeries.
While it's mostly just annoying it can be quite painful and the
main problem is it interfering with sleep which I don't get enough
of anyway. Anyway it seems to be getting better, albeit very
slowly.
I've been spending way too much time and money at the pub drinking
way too much; at least it's mostly been for fun and my mood has
generally been a bit better this year. I've had a couple of low
episodes but I just push through it and try to get out of my head
and my house and they haven't persisted, very much not looking
forward to winter though, It's quite a bleak time even with the
relatively mild winters we experience.
Retirement?
I've just got so much spare time it's hard to fill so I've been
looking at things to do such as reading, cooking, exercising. My
key-lime tree has been shedding excessive fruit so I've had lots
of limes to use up — so I've been making pickles and
chutneys and marmalade's and cordial, and hot sauces. I fermented
1.5kg of chillies that I turned into tobasco-style sauces. I
found a local place to get sauce bottles and small jars although
it's not particularly cheap. I tend to give away a lot of what I
made and the jars and bottles rarely return.
In part due to the hip replacement and in part because I have the
time I've been keeping pretty fit and healthy, right bang on
'ideal weight' for my height. Apart from the obscenely excessive
beer and a bit of a gout flare-up I'm eating very well, it
basically turned into a Mediterranean Diet without intending to.
Greens from the garden, lots of citrus, chillies, nuts, legumes,
soups, a bit of liver once in a while. Not a whole lot of meat
— not because I don't like it I just can't be bothered
cooking it.
Yesterday I did a bit of a budget review and I'm going to have to
either cut back on spending quite a bit or consider working again
at some point. Still I'm going ok considering I haven't worked
for over 3 years and have zero income so there's still no real
rush. I'm getting a bit too comfortable with not having to deal
with all that bullshit and I simply blanch at the thought of
having to work again. Lucky me I guess.
Domain Changed!
I've changed the site domain to zedzone.au. I'm pretty sure I got
everything but if something breaks it breaks and I can fix it as
required. It was a pain in the arse to have to do it but it
didn't take much work.
Old Site | | New Site |
www.zedzone.space | → | www.zedzone.au |
code.zedzone.space | → | code.zedzone.au |
zedzone.space | → | zedzone.au |
I've added a permanent redirect from the old .space domain to the
.au domain — but this will only work as long as the domain is
active, and it expires in 7 days.
Domain Change
I got the .space domain because it was cheap but now it's jumped
significantly in price ... so i'm going to attempt to move to zedzone.au.
This might upset things for a little while but so be it, it's not
like this is a heavily trafficked site.
More Legs
Tomorrow will be 7 weeks since I had the hip operation. It's been
one of those "I can't believe it's been 7 weeks, but shit a lot has
happened" periods.
They told me not to put more than 10kg weight on the operated leg
for 6 weeks - but after 3 weeks of bloody crutches I gave that idea
the flick. A couple of days I walked all the way into/out of the
city - about 10km round trip - entirely on crutches but it just
seemed absurd. About a week using a walking stick but then my hand
started going numb so I mostly just hobbled around after that.
After 5 weeks I got on the bicycle. At the 6 week mark I had a
review and the surgeon was very pleased with my progress but I was
miserable with the ongoing pain and news of lifelong movement
restrictions. I'm seeing a physio on Monday so hopefully I can get
a better idea of what they are, plus maybe some exercises and
guidance on "overdoing it". So far the directions have been vague
and pretty useless although the surgeon did say I could get on the
bike again (which I had already obviously).
Mostly i'm just frustrated as fuck at this point. The pain is
taking a long time to recede, it hurts to sit, it hurts to lie on my
back or operated side - and well even the non-operated one. This is
intefering with my sleep which was already shithouse. It hurts to
sit playing playstation or drinking beer, it hurts afterwards if i
ride too much, walk too much, stand too much. It's difficult and
painful to tie my shoelaces or cut my nails. OTC painkillers don't
really do much - hell even when I was in the hospital it took 20mg
of oxycodone to do anything and they thought I was a junkie or
something. As far as I know i'll never be able to sit cross-legged
on the floor ever again - maybe that seems trivial but what am I
suppose to do, carry a fucking chair everywhere I go? How do I do
my go-to hamstring stretch when my back gets too stiff?
So i've been walking a lot anyway - it seems to help with the pain
to some extent. At the 6 week mark I started back on situps and
pushups - at least I can do those. Riding a bit when the weather is
good.
But mostly i'm drinking way too much and with the lack of sleep
being moody and sulky and feeling lonely and depressed - so pretty
much like every other spring.
One of my main haunts closed down - arsehole landlord in dispute
with his daughter even though the business was keeping things in the
black. With 4 weeks notice for everyone it was pretty shit. I
managed to make it to the closing even on crutches but it's left
quite a hole in the community and a hole in my heart every time I
walk past.
And one of my nephews was recently in an absolutely horrific car
accident - ute rolled end on end and he was thrown 15 metres from
the vehicle. By all measures he should be dead but somehow he's
still physically alive but his brain ... well things are bad. His
eyes open but nobody's home, he can't breathe or eat without tubes.
I just hope his needless suffering isn't extended by his idiot
father and stempother (they're "preppers") who think he needs to be
kept alive at all costs and it turns into another Terri Schiavo
indicdent. That's if the pneumonia doesn't do him in soon.
THR coming up
For various reasons it's been a fairly involved few months but now
life is back to anhedonia, insufficient sleep, and excess alcohol.
But in 5 days that all changes again as i'm finally going under
the knife for a total hip replacement on my left leg.
I'm resigned to it but still anxious as fuck and well just
super-pissed off that I need to have it done all from a nothing
accident 3.5 years ago. It'll be a couple of months before I
can even think of getting on a bicycle again which is somewhat
limiting as that is my main mode of transport apart from walking.
By pretty much pure chance a niece wants to move to Adelaide so is
coming to stay with me for a bit - she can help with the basic day
to day stuff that I might not be able to do for a few weeks.
There aren't any real insights on how long it might take to
recover enough to get around, cook, and clean so I will just have
to see how it pans out for me.
I didn't drink for July (moral support for a friend at the time)
and lost a bit of weight and spent a bit more effort on getting as
fit and strong as possible before the operation so physically i'm
about as prepared as i'm likely to be.
Mentally and emotionally i'm a bit of a wreck but oh well, one day
at a time.
Life and Legs ...
So life has been bumbling along. I spent too much of our
piss-weak summer blowing money on booze, had a few fun times I
guess but i'm getting pretty over it. Summer was too cold and
windy for the most part so I only went for a few longish rides,
and I think only went for a dip at the beach a couple of times.
Despite all the booze and lack of cycling I did a lot of walking
and got fairly fit and trim. But my broken hip is causing a lot
of pain now, the joint has gone necrotic and walking irritates it.
I just keep pushing through the pain as I'm trying to ensure it's
as strong as possible by the time I have a total hip replacement -
I don't have an exact time but it should be within a few months.
I had to get an infected tooth ripped out in preparation last week
and that's still bothering me but I suppose it should heal up
soon. One expensive hole in my mouth after a root canal cracked
plus I got it taken out under anaesthetic.
Turned 50.
YaY.
Still not working.
I feel pretty burnt-out even after 2.5 years of non-work. But it
is becoming pretty boring having a whole day to fill day after
day. I spent a lot of time in the garden this year but there's
only so much time that can sink.
I'm a bit sick of going to the pub. Plus I gotta cut down the
grog before my hip op.
But it's my only regular social contact, so it's either that or
nothing. Fuck. I have too much anxiety to interact in online
communities very much, hell sometimes I can't even read SMS's from
friends.
So I've been somewhat depressed lately. A lot of that is no doubt
the impending hip operation and dealing with the infected tooth,
but really i'm so fucking lonely and see no way out of it. I
find it incredibly difficult getting close to people although i
yearn for it deeply. I get hit on by women at the pub
occasionally and at best just feel puzzled (or annoyed) and at
worst panic and freeze up.
I'm forever sleeping miserably and usally wake up abougt 4 hours
after going to sleep and then stay awake many hours before perhaps
nodding off here and there. The pain from my hip (and now tooth)
is partly to blame now. Nothing interests me at the moment, I do
a bit of hacking or play some games or lurk on reddit but it just
feels like i'm going through the motions burning up time until I
can have another shitty sleep and repeat it all again. I have the
odd enjoyable get together with mates (typically at pub) but small
things can set me off and get me down for days particularly if I
over-do it on the booze. Finding it harder to get into
conversations and often feel I don't belong.
I've been reading a lot, mostly fantasy and some sci-fi. It's an
escape, although sometimes even that upsets me.
Compilering
So a few months ago Xyhpoid contacted me about the work I did on
Dusk some time ago to see if I still had the source. Indeed I
did, but I hadn't touched it for 10 years, left it in a half-arsed
state, and can't remember much of where it was at or what I wanted
to do with it.
Still, at the moment i've got a lot of time on my hands and not
much to do with it so I started poking around again. Amongst some
minor phaffing about I decided to look at writing a compiler for
the dusk script language that compiles directly to the JVM.
It's been a somewhat interesting exercise, from parser for a
custom language to generator for class files. A probably goal is
to create a new dusk script - it will be something like a relaxed
java but with more security by limiting access to classes and
functions via white-lists.
Apart from something interesting to play another motiviator is the
dropping of nashorn from the OpenJDK. I did a quick survey of
extant JVM languages looking for something sutiable but despite a
proliferation in the earlier days of Java most have been
abandonded, and even those that haven't haven't updated to handle
the java modules system or the deprecation for removal of
SecurityManager. Another problem is that most give unfettered
access to the whole JDK in one way or another which isn't
acceptable for my use case.
Anyway some of the exploratory work is going on in
the compilerz
project. There is also some work going on in duskz but i haven't pushed
it stream yet.
Copyright (C) 2019 Michael Zucchi, All Rights Reserved.
Powered by gcc & me!