@ayke@hachyderm.io avatar

ayke

@ayke@hachyderm.io

Author and maintainer of https://mastodon.social/@TinyGo.

I like blinky lights and am dreaming of a solarpunk future.

Twitter: @aykevl
Old account: https://mastodon.social/@aykevl

This profile is from a federated server and may be incomplete. Browse more on the original instance.

ayke, to embedded
@ayke@hachyderm.io avatar

Added the Raspberry Pi Pico to https://play.tinygo.org/!
It's a simple board, but lots of people have it and it is very cheap. So it only makes sense to add it to the playground.

Thanks to @sago35 for the suggestion!

@Raspberry_Pi

robpike, to random
@robpike@hachyderm.io avatar

"Use 5.08cm of tape for 454g of weight." Seems oddly specific until we rewrite into imperial units: 2 inches of tape for 1 pound of weight.

Anyway.

Unkindly I am reminded of the Sun brochure advertising a keyboard or mouse or some such that, renormalizing for simplicity, weighed "1 pound or 2.2 kilograms".

ayke,
@ayke@hachyderm.io avatar

@robpike I live outside north America so I don't usually need to deal with this...

... except when doing electronics, and lots of things are a multiple of 2.54mm.

ayke, to random
@ayke@hachyderm.io avatar

Working on something ✨

It's essentially the same as https://play.tinygo.org, but showcased directly on the homepage of https://tinygo.org. This required a ton of refactoring to make the code modular and embeddable in a webpage.

robpike, to random
@robpike@hachyderm.io avatar

And there's more. I noticed this weird little line under the notch. (If you screen grab, the notch shows as white - another glitch.) Turns out they didn't pixel count correctly: the line is the top pixel row of my wallpaper.

A designer should verify every pixel, especially around the edges and where things overlap. I did in my day, anyway.

ayke,
@ayke@hachyderm.io avatar

@robpike I once looked it up, and apparently the menu bar is slightly bigger than the notch on purpose. I really don't see why.

robpike, to random
@robpike@hachyderm.io avatar

OK this is a surprise. I have a new Mac laptop with a notch and I CAN'T SEE ALL MY MENUBAR ITEMS I MEAN WHAT? WHAT????

How is this even an idea for a UI?

ayke,
@ayke@hachyderm.io avatar

@robpike am I weird for using the same layout on Asahi Linux? Left of the notch is KDE app drawer button, app list (icons only), and global menubar. Right is various taskbar icons, CPU/RAM usage applet, etc. The only thing missing is that Wayland programs often don't support the global menubar.

...yes I run into the same issue sometimes of things getting hidden under the notch, but I can typically fix it by rearranging/removing things on the right. KDE is very flexible.

ayke,
@ayke@hachyderm.io avatar

@robpike I use a dark wallpaper, a photo of the night sky. It's almost invisible that way.

ayke, to GraphicsProgramming
@ayke@hachyderm.io avatar

My talk has been released!
It's about the @TinyGo smartwatch that I've been working on, including how I made testing the firmware as simple as "go run" and how I've made the display as fast as I could.

https://fosdem.org/2024/schedule/event/fosdem-2024-2562-smartwatch-firmware-in-go-on-tinygo-small-displays-and-building-a-delightful-developer-experience/

I've posted my progress on Mastodon so if you're curious just take a look at my older posts.

ayke, to GraphicsProgramming
@ayke@hachyderm.io avatar

I wrote a blog post about how to efficiently render polygons on slow microcontrollers while still looking reasonably nice!

It contains an intuitive explanation (with lots of images!) how it works, and an explanation of the algorithm itself in pseudocode.

https://aykevl.nl/2024/02/tinygl-polygon/

You can see the result below, which is an analog clock that's part of my smartwatch project.

ayke, to random
@ayke@hachyderm.io avatar

They said the would last about a week??

I'm running custom firmware written using @TinyGo. Admittedly I haven't been using the watch a lot, but BLE, the touchscreen, and the step counter have all been enabled this time.

(It says InfiniTime only because that's what Gadgetbridge scans for, it's not actually running InfiniTime).

ayke,
@ayke@hachyderm.io avatar

My PineTime is still going strong after a month!

I'll be giving more details on how I wrote this firmware in my FOSDEM talk next Saturday:
https://fosdem.org/2024/schedule/event/fosdem-2024-2562-smartwatch-firmware-in-go-on-tinygo-small-displays-and-building-a-delightful-developer-experience/

ayke, to NixOS
@ayke@hachyderm.io avatar

@TinyGo now has a Nix flake in the dev branch!
Just run nix develop and you'll be dropped in a development shell with all necessary tools installed to flash most boards. And it works on both Linux and MacOS! See the comment at the top of flake.nix for details.

Hopefully this is also useful for non-Nix users that want to get a working dev environment to start hacking on TinyGo without figuring out all dependencies first.

ayke,
@ayke@hachyderm.io avatar

In other news: the NixOS TinyGo package has been updated to v0.30.0! It used to be a year out of date but it's now at the current stable version.

My work on the Nix flake should also make the NixOS tinygo package much simpler once v0.31.0 is released. Adding flake support meant fixing a bunch of Nix-specific issues so that a number of patches in nixpkgs can now be removed.

https://github.com/NixOS/nixpkgs/pull/251527

robpike, to random
@robpike@hachyderm.io avatar

Even on the phone's small screen, it's clearly much crappier, even in daylight, than the camera in my iPhone 11 Pro, which is already 4 years behind. Is this normal for Android? I mean, this isn't a low-end phone and I expected the camera to perform much better than this.

Anyone with more Android experience who can provide insight? What supply or technical reasons explain that huge gap in quality?

ayke, (edited )
@ayke@hachyderm.io avatar

@robpike it makes a huge difference which camera app I use. I have a Fairphone 3+, and the stock camera is... okay, but not great. There are (unofficial) ways to install Google Camera however, and the difference in quality is quite dramatic, especially with low light.

I believe there are two main differences here:

  1. Google Camera takes a bunch of under-exposed photos and essentially overlays them to reduce sensor nose.
  2. Lots of image post-processing for white balance and such.
robpike, to random
@robpike@hachyderm.io avatar

That feeling when your worlds intersect

https://twitter.com/search?q=%22%25!(EXTRA%20string%22

This link takes you to the shitter site, but at least for Go programmers it's worth it.

ayke,
@ayke@hachyderm.io avatar

@robpike looks like someone didn't write tests. Also, don't people check their tweets before they send them?

robpike, to random
@robpike@hachyderm.io avatar

To this day, I still don't understand what "a process is a locus of control" is supposed to mean, yet my career is arguably all about processes.

ayke,
@ayke@hachyderm.io avatar

@robpike "powerhouse of the cell"

b0rk, to random
@b0rk@jvns.ca avatar

I almost never request ideas for new zines but -- what topics are you having a hard time learning?

ayke,
@ayke@hachyderm.io avatar

@b0rk perhaps something about testing?

There is so much stuff that goes into that: table driven tests, property testing, fuzz testing, etc. And of course benchmarking which is also not at all easy: CPU frequency scaling, how to make sure the right thing is tested (I often see people make this mistake), how to deal with compiler optimizations in benchmarks, etc. Perhaps also methodologies like TDD and alternatives and basically just how to keep yourself motivated to write good tests.

b0rk, (edited ) to random
@b0rk@jvns.ca avatar

has anyone seen a really good analysis of the problems with git's command line UI? Would love to read it. for example:

  • git checkout is dangerous and has too many different jobs (though git switch is trying to fix that!)
  • for a tool that's supposed to make changes easy to undo, you actually need to learn a LOT of ways to undo

(not looking for git tutorials, explanations of git’s underlying model, or explanations of why you think git's UI is actually good, just an analysis of the problems)

ayke,
@ayke@hachyderm.io avatar

@b0rk not an analysis, but one very specific quirk that probably made sense at the time but really is unintuitive:

git push origin :branchname

This removes that particular branch on the remote. But if you didn't know that particular syntax, you'd never be able to guess from the command.

pamelafox, to random
@pamelafox@fosstodon.org avatar

Thanks to my colleague Jay for telling me about the exa tool for pretty tree directory outputs.

ayke,
@ayke@hachyderm.io avatar

@pamelafox oh wow thanks! Made a few new aliases today :)

Also useful:

  • tig as a more interactive "git log"
  • delta, a more powerful diff
  • the fish shell, with builtin syntax highlighting
  • neovim, a slightly improved vim
ayke, to random
@ayke@hachyderm.io avatar

Picked up the @PINE64 PineTime again, after a very long pause.
Programming it using @TinyGo. The UI needs some love, but it's quite fast already!

It should last a long time on the battery, probably more than a month.

https://github.com/aykevl/things/tree/master/watch

Going through the menu items on the PineTime.

ayke,
@ayke@hachyderm.io avatar

Got the step counter to work! Went for a short walk and compared it to my Mi Band 3. There was a difference of 2.4% (70 steps), which is honestly not that bad and it could be either one of them (or both!) that's off. For 14uA of current consumption that's quite impressive.

PR is up at the @TinyGo drivers repo.

ayke,
@ayke@hachyderm.io avatar

Wrote an algorithm for drawing circles, to be used for an analog clock.

I looked a bit into circle drawing algorithms but in the end I came up with something unique that I haven't seen before - including a unique way of doing anti-aliasing. I'm not exactly sure how it works to be honest or whether it's exactly correct but it works, is reasonably fast and it looks nice.

Code:
https://github.com/aykevl/tinygl/commit/40877786a2390b1013e626496aa7d2c02bba539a

Next up: straight lines to draw the handles.

ayke,
@ayke@hachyderm.io avatar

Lines are way, way more difficult than I expected! And it's because lines (with thickness) are essentially rectangles that can be rotated, and it's easiest to draw them as a polygon.

The code is still rather buggy but I have a somewhat working analog clock. Even here you can see that anti-aliasing is broken in some cases - I suspect I wasn't careful and I have integer overflows on 32-bit systems.

...I should probably take a break now as I've been far too obsessed with this.

ayke,
@ayke@hachyderm.io avatar

Apparently many papers have been written about how to do anti-aliased filling of a polygon. Perhaps I shouldn't be trying to come up with my own algorithm and just use one of the existing algorithms.

This problem really is much more complicated than it appears on the surface.

ayke,
@ayke@hachyderm.io avatar

I've figured it out! The new algorithm I wrote is partially based on the classic A-buffer algorithm from 1984 and partly on the "Scanline Edge-flag Algorithm for Antialiasing" paper from 2007. It looks pretty nice, even though it's not perfect (and slower than my previous attempt). Now I just need to clean up the code, write tests, and optimize the code some more.

I plan on writing a blog post describing the algorithm in more detail.

ayke,
@ayke@hachyderm.io avatar

Finally cleaned up and pushed the code! I'm still working on a blog post, it's almost finished it just needs a last pass over it to improve some remaining details.

Line drawing code: https://github.com/aykevl/tinygl/commit/fcc6944f703811d50904b7802e3bf713cb7dd34b
Watch code: https://github.com/aykevl/things/commit/02c90df003ae216303c34280751ec83c43a617e4

I've also updated the analog watch face to look a bit more modern.

...seriously, once this is done I won't touch polygon code for a while. I need some time off from polygons.

Screenshot of the simulator (a small window on my laptop), running the same code. Again you can see the antialiasing in action if you zoom in on the picture. It's not as good as some other antialiasing out there, but it's relatively fast and way better than no antialiasing.

ayke, to random
@ayke@hachyderm.io avatar

Working on some new LED earrings! This time with a much more powerful chip (attiny1616) that is only slightly larger than the attiny10. It does have much more I/O than the attiny10, which means I was able to put 18 individually controllable RGB LEDs on it.
I've sent the design to the factory, now I'm hoping I didn't make a mistake - I never actually worked with this particular chip before.

Big source for inspiration: https://www.tindie.com/products/californiasteam/tree-of-life-rgb-light-up-earrings/ (who sadly don't ship to the EU).

Backside of the earring PCB, showing the CR1225 battery holder, a button, some programming pads, and my domain name. The battery holder is pretty ugly, that's the part I designed myself as I couldn't find an existing 3D model and I really needed to see what it looks like.

ayke,
@ayke@hachyderm.io avatar

Now with a few new animations! I optimized the simplex noise algorithm (1D) for AVR. It's still not particularly fast but at least it's usable now.

On the left there are rainbow colors going down along the side of the ring, on the right I have an approximation for fire (in 3 different colors!)

Two LED earrings in the dark, playing their configured animation.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • kavyap
  • DreamBathrooms
  • GTA5RPClips
  • magazineikmin
  • InstantRegret
  • cubers
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • osvaldo12
  • ngwrru68w68
  • ethstaker
  • JUstTest
  • everett
  • Durango
  • normalnudes
  • Leos
  • mdbf
  • khanakhh
  • tester
  • modclub
  • cisconetworking
  • anitta
  • tacticalgear
  • provamag3
  • lostlight
  • All magazines