Wednesday, November 25, 2020

Sound the Alarm!

 Well, wouldn't you know...  It's time for yet another holiday season to be "celebrated" under strict covid lockdown!  So I was gonna call this story "The Holiday Formerly Known as Thanksgiving", but I've already done that title, or at least something quite similar.  And I prefer to produce only the freshest nuggets of high quality content.  So instead of grumbling about the holiday that might've been, I'm gonna sound the alarm with this tiny tale of what can only be described as the most zipit alarm clock, ever.

This is the old clock, not the zipit clock

Now I realize I've dipped into this well before, but this time is truly special because I'm totally invested in the outcome.  You see my former alarm clock -- an all-in-one alarmClockRadioPhone purchased long ago when Radio Shack was a thing -- has finally passed on to another existence that clearly does not involve monitoring the passage of time.  It's dead, Jim.  And so it must be replaced ASAP lest I find myself late for some early morning Zoom meeting of ultra vital importance.  You all know how that is I'm sure.  Meanwhile, I'm an old crank so don't even bother to suggest how my smart phone can totally do all those things and so much more.  Yes, yes, I know!  But the darn thing has a touch screen interface, and that makes it simply unsuitable for covert operation in a darkened room.  Not to mention the screen blanker.  Great for battery life, but it renders impossible any sort of casual consultation upon return to bed from the usual 3 AM restroom visit.  And don't get me started on the bothersome late night texts, alerts, and spam calls.  That thing is banned from the bedroom.  So yes, I'm truly motivated to make the zipit clock right this time.

The zipit flipclock app of my former essays is pretty darn spiffy, but it's far too bright for nighttime use if you're actually planning to sleep.  And this can't be remedied without ruining the aesthetics.  So I reached a bit further back in the bag of tricks and took a second look at the ttyclock sources.  At first I simply tried it with red numbers and the largest font in my possession that could render it complete on the zipit screen.  The red numbers won't roast your eyeballs in the dark, but the digits are still sorta small for a quick glance from far away across the room.

You've probably seen this one before

Sadly, the largest font can only fit the hours, but the character height is close to ideal.

Not quite

Eventually it dawned on me that ttyclock emulates a BOLD font with double-wide digits.  So I whipped up a new build with a skinny digit option.  This version fills the tiny zipit screen with minimal waste when rendered with the 32 pixel tall character blocks of the large terminus console font.  As a bonus, that font is already used by my cheesy setclock app and the matching, if somewhat inadequate, alarm app.  At this point I felt I had an adequate replacement for the 7 segment LED display of the deceased all-in-one alarm clock.  

That's the stuff

But then I chanced upon the graceful lines of the gluqlo flipclock on github, and imagined how that might look in red.  The code makes use of sdl and a ttf font for the display, which makes it a really nice fit for the zipit.  So I hacked the code to add an option for red, and took it for a test drive.  It looks pretty darn sweet when viewed from a certain angle.  I also added an option to display an alarm time down below on the right in the margins.

I like it!

Even so the zipit is less than ideal for this purpose, with several considerable shortcomings, especially for nighttime operation.  The zipit's three status LEDs are simply blinding at night, and must be dealt with.  The adjustable screen and keyboard backlight gradients are far too granular.  Try it yourself.  Turn off the lights and press the ctrl-volume or shift-volume buttons to adjust the backlights.  There's simply too much light at the lowest setting above zero.  And the display backlight leaks out the side of the screen like nobody's business.  Meanwhile the optimal viewing angle on the zipit is quite narrow.  As you rotate outside the viewzone the digits disappear into the leaky backlight which washes over you with the cold white intensity of an auto headlight.  I swear you could read a book in that glare.  

I've addressed these issues as best I could, and have used the zipit this way for about two months now. So it's good enough, if only just barely.  My alarm and clock apps both use a wrapper script to temporarily disable the status LEDs.  It took a while to sort out the best method because we've got kernel notification events tangled up with the ebindkeys daemon.  The details for dealing with this are found in the small /etc/init.d/S11z2-leds script and the /etc/ebindkeysrc config file.  For temporary LED light relief it's better to set the triggers to "none" than set the brightness to 0.  And be aware that "S11z2-leds restart" does nothing.  You must use "start" to restart.  Also, ebindkeys does not restore the charging LED trigger properly after a notification.  For the backlights I decided I needed 3 levels of auto dimmer adjustments to tune it between daylight and sleep at certain hours, with a manual override via the spacebar.  To automate it I needed to put that fix in the gluqlo C code.  Meanwhile the alarm itself is still implemented in a wrapper script that runs in the background behind the gluqlo clock display.  

Nothing new here...

Perhaps someday I'll find the time to integrate the whole mess into the C code, and also incorporate a GUI for various music options.  In other news, while testing I grew tired of entering the time of day via the setclock app after every reboot.  The alt key for numbers gets wearysome.  So I added a webtime app to do it via the magic of the internet.  I also had to update the /etc/TZ file with explicit spring ahead and fall back settings.  eg.  EST5EDT,M3.2.0,M11.1.0

It looks right at home there

 The sources and bleeding edge openwrt zipit binaries are available on github.

gluqlo_wrt_be_1_1.tgz

ttyclock_wrt_be_2_0_1.tgz 



No comments:

Post a Comment