-
Notifications
You must be signed in to change notification settings - Fork 56
ClockApplet
The Clock applet is the core application of the watch. It runs for the vast majority of the watch's battery life, so it must be as efficient as possible while still presenting a number of useful functions to the wearer.
Unlike all other applets, the Clock face is drawn only once each
second, rather than every 250ms. clock_draw()
calls draw_time()
for this, which then draws as few digits of the clock are might be
reasonable. For example, the ten-seconds digit is only drawn if the
ones-seconds digit is a zero, so that on most clock ticks only a
single digit needs to be drawn.
On a keypress, the applet will run a special function, such as showing the day of the week when the 9 key is pressed. This is done only on the down event, while the applet halts drawing the time until the key-up event, at which case it redraws all digits of the time.
It cannot be overstates how much the efficiency of this one module
matters for the battery life of the device. Any weird hack that makes
draw_time()
more efficient might well be worth it.
Hold 7
to run the POST test, 8
to display the callsign, 9
for
the day of the week, and /
for the date. 4
shows the GITHASH
of
the firmware, 5
the date on which the firmware was compiled, 6
toggles the CPU load indicator, and *
displays the part number of
the CPU. =
shows the battery voltage. 0
shows the name of the
working channel, and .
shows the frequency.
The 1
, 2
, 3
, -
row is optionally passed to the .fallthrough
handler
of the applet. The Hebrew applet uses this to show the current Hebrew calendar
date and day of week from the home screen.
All unused buttons will simply blank the screen.
Holding the SET
button will switch to the SetTime applet, which
allows the date and time to be set. This is implemented as a separate
C module to keep the code readable.
While setting the time, seconds are forced to zero and held there. In watchmaker's slang, this is called "hacking."