1
0
Fork 0
Commit graph

368 commits

Author SHA1 Message Date
Daniel Thompson
0831f79a10 draw565: Improve line wrapping
Currently the final word of wrapped text will always appear as a single
word on its own line. Fix this by rearranging the break cases to avoid
searching for the most recent space when we get to the end of the text.

Fixes: #230
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-07-22 20:04:50 +01:00
Daniel Thompson
586507753b wasp: Manager: Fix the capture of the post-init free RAM
Fixes: b59a5b1d37 ("wasp: Manager: Rewrite the startup logic")
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-21 21:41:51 +01:00
Daniel Thompson
b59a5b1d37 wasp: Manager: Rewrite the startup logic
Reduce the number of applications imported by the manager and alter
the way applications are initially registered to allow main.py
complete control over the initial applications (but only if it wants
it).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 19:25:31 +01:00
Daniel Thompson
e169dbf61a drivers: cst816s: Add a version() method
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 17:26:32 +01:00
Daniel Thompson
b0bab534ff apps: SportsApp: Initial sports app implementation
This app is functional... although it lacking in almost every
costmetic way, from the icon to the main screen.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 17:24:10 +01:00
Daniel Thompson
ae0d59dbe3 widgets: Further compact some of the internal representations
Many widgets adopted the _im(mutable) idiom to allow us to reduce the
RAM overhead of each widget. Where the immutable data considers entirely
of integers smaller than 256 then we can push this just a little further
by switching from a tuple to a bytes.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 17:08:39 +01:00
Daniel Thompson
9099c2398e widgets: Refactor the stopwatch as a widget
This is purely a refactoring for the purposes of code reuse. No change
of behaviour is expected.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 17:03:05 +01:00
Daniel Thompson
2d77ebc130 boards: simulator: main: Update the ChronoApp example
Currently the ChronoApp example code is both broken (missing apps. prefix)
and doesn't use the latest API for registering watch faces. Fix this.

Whilst here let's also provide an example for the DemoApp since that
is not included in the Software chooser.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 10:47:32 +01:00
Daniel Thompson
b6709997cc apps: DemoApp: Fully document the demo app
The demo app is of somewhat niche interest and is disabled by default
but arguable that makes it more important to document it fully since
this app is harder to find the many others.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 10:43:25 +01:00
Daniel Thompson
1a4b678b2b apps: FacesApp: Add a watch face chooser
This app is enabled by default and allows users to select a watch face
based on a fullscreen preview of how the app will draw the screen.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 10:28:27 +01:00
Daniel Thompson
2a1ac32279 all clocks: Add a preview() method ready for a watch face chooser
One benefit from wasp-os' dirt simple drawing model is that it is very
easy for apps to provide full screen previews of themselves. Add this
for all clocks ready for us to add a watch face chooser application.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 10:21:25 +01:00
Daniel Thompson
3ea061508f icons: Introduce new clock icon
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 10:18:58 +01:00
Daniel Thompson
f221e2f8a4 rtc: Undo the once-per-second wake up
So... waking up once per second turns out to be a dumb idea because it
regresses the stop watch and HRS tools (which now also only wake up once
per second).

Undo this change but sprinkle a few more micropython.native decorations
on methods used on the wakeup path to minimise power.

Fixes: fb18705b9b ("manager/rtc: Experimental power saving technique")
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-19 08:22:20 +01:00
Daniel Thompson
33ff7dc91e drivers: nrf_rtc: Fix sphinx build
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-18 21:43:47 +01:00
Daniel Thompson
fb18705b9b manager/rtc: Experimental power saving technique
Currently the time is calculated 8 times per second from (relatively) slow
python code. Optimize the power consumed by reducing the number of times
we check for wall time updates to only once-per-second and use native
code generation to reduce VM overhead when executing this critical code.

At the time of writing the difference is battery life has not yet been
measured (but we know the current master branch is worse than v0.4 and,
in theory at least, this should close the gap).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-04 10:49:33 +01:00
Daniel Thompson
4ad8273902 draw565: Fix bounding box calculations
wasp-os uses an drawing optimization technique to automatically place
a single pixel line on the right of glyphs when rendering them. This
results in a change to the bounding box for a rendered string (by adding
a single pixel on the right of the final character). Fix the bounding box
calculations accordingly. Among other things this eliminates graphical
artifacts when rendering labels in 2048.

Fixes: #203
Fixes: 58b5c0378e ("draw565: Optimize the string drawing")
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-04 10:46:25 +01:00
Tait Berlette
1115ac2fff MemoryError exception now shows custom message instead of CrashApp.
Signed-off-by: Tait Berlette <54515877+taitberlette@users.noreply.github.com>
2021-06-03 21:45:24 +01:00
Tait Berlette
9ded8e28a6 Added weather application.
Signed-off-by: Tait Berlette <54515877+taitberlette@users.noreply.github.com>
2021-06-03 21:43:38 +01:00
Daniel Thompson
e76a4afd85 manager: Improve application registration
When an application is registered using a string that gives the class
name (e.g.  "apps.chrono.ChronoApp") when we automatically delete
the module from a couple of namespaces. This ensures the garbage
collector can do a deeper clean when the application is unregistered.

We also provide a means to directly register watch faces (e.g. to
replace the default clock).

Fixes: #214
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-03 19:57:09 +01:00
Daniel Thompson
92812e5ad2 apps: heart: Implement a debug mode to copy out raw data
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-05-05 21:06:39 +01:00
Daniel Thompson
69a989b97e apps: testapp: Force characters to render with a not-black background
This helps pick up any problems with the glpyh rendering.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-03-29 22:17:27 +01:00
Daniel Thompson
58b5c0378e draw565: Optimize the string drawing
Currently there is a redundant fill operation issued for every character
drawn. This was added to draw the background colours correctly but the
change did not account for the optimized character rendering in
_draw_glyph().

This results in ~15% performance improvement for character rendering

Fixes: cc34c5d46d ("draw565: Fix wrong background color of strings")
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-03-29 22:16:43 +01:00
thefenriswolf
ed3f1c1e71 fonts: add 18pt font
Signed-off-by: thefenriswolf <stefan.rohrbacher97@gmail.com>
[daniel@redfelineninja.org.uk: fixed up the manifest]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-03-28 08:59:25 +01:00
Benoît HERVIER
7aa2ceb05b apps: Add DualClock app.
Signed-off-by: Benoît HERVIER <b@rvier.fr>
[daniel@redfelineninja.org.uk: Removed unused dual clock fonts from
clock_dual.py, fixed up the manifest]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-03-27 09:41:54 +00:00
Tait Berlette
79744770b0 apps: music: Change SWIPE_LEFTRIGHT to SWIPE_UPDOWN.
The music player volume control uses up and down events, but in the
foreground function the app requests left and right events.

Signed-off-by: Tait Berlette <54515877+taitberlette@users.noreply.github.com>
2021-03-27 09:08:36 +00:00
Daniel Thompson
402801c538 draw565: Avoid over-long lines when handling space
Currently, if the line wrapper attempts to break a line on a space and
that space character is outside the bounding box, then we generate an
over-long line.

Fix this by handling line break generation *after* we have checked the
length of the current line.

Fixes: #193
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-03-22 08:29:06 +00:00
Daniel Thompson
86cc4844b6 apps: software: Include word clock in the available applications
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-03-10 21:50:01 +00:00
Daniel Thompson
df5aa24d2d apps: software: Automatically track y position for checkboxes
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-03-10 21:33:22 +00:00
Brendan M. Sleight
cec8d97aeb apps: WordClock: Add a new word-based clock app
Signed-off-by: Brendan M. Sleight <bms.git@barwap.com>
[daniel@redfelineninja.org.uk: Squashed down into a single commit and
updated subject]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk
2021-03-10 20:55:18 +00:00
Brendan M. Sleight
867ed324b5 Update requirements.txt
Signed-off-by: Brendan M. Sleight <bms.git@barwap.com>
2021-03-09 21:15:02 +00:00
Daniel Thompson
4879b7198e apps: steps: Reduce the graphing scale
Currently then even fast walking will run off the top of the graph. Change
the scale to that fast walking shows in full. I think at this level fast
running will probably run off the top but I need to gather a few more
details before settling on the final scale.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-03-01 20:03:07 +00:00
Daniel Thompson
7a5990072c apps: steps: Add a history graph
The steplogger records steps but currently there is no way to see the data
recorded on the device itself. Make a first attempt at graphing the
step data.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-25 08:00:03 +00:00
Daniel Thompson
72f5322cc3 steplogger: Write less frequently
Currently we dump the step data every 30 minutes. This was a good
interval for testing but we can extend it a little without any
problems.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-25 07:49:23 +00:00
Daniel Thompson
affa101169 steplogger: Ensure today's data is updated when we provide it
Currently steps from the last six minutes do not appear in the data. We
can fix this by updating the data before creating the iterator.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-25 07:45:53 +00:00
Daniel Thompson
474851219a boards: simulator: Increase the display blanking time
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-25 07:37:10 +00:00
Daniel Thompson
1cb1d96ef4 boards: simulator: Pick up out-of-bounds drawing
Currently, if we ask the simulator to draw out-of-bounds then it will
do exactly that, it will draw outside of the "screen" and corrupt the
pixels of the watch frame that surrounds it. This is an obviously poor
simulation of the real watch and when the out-of-bounds error is only
an out-by-one error can be easily overlooked until we load the code on
the device.

Let's just throw an exception if we draw out-of-bounds. That can easily
be picked up during testing.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-25 07:36:15 +00:00
Daniel Thompson
181aad6666 steplogger: Add iterator to allow UI to read the data
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-21 21:24:24 +00:00
Daniel Thompson
8940b7c3ab steplogger: Introduce code to perform data logging
The code is not yet enabled by default but it can be tested by adding
custom code to an interested user's main.py .

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-21 20:27:48 +00:00
Piotr Tworek
0d76b1b186 st7789: Fix incorrect variable name in ST7789_SPIs. __init__ docstring.
The data signal pin name is dc, not cs.

Signed-off-by: Piotr Tworek <tworaz@tworaz.net>
2021-02-20 08:46:59 +00:00
Daniel Thompson
090ed8489b apps: settings: Clamp the dates a little more tightly
Currently a couple of down presses on the year results in the time being
set to some time in 2099. The micropython date logic does not support
dates this far in the future and throws an exception. Adopt a simple
fix that should be OK for the next 39 years ;-) .

Reported-by: Christopher Peters <me@christopherp.de>
Fixes: #167
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-20 08:42:16 +00:00
Daniel Thompson
f2ad6a7d3f simulator: test: Add Draw565.bounding_box unit tests
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-06 13:30:30 +00:00
kozova1
28dbc66376
drivers: draw565: Added bounding_box() function that returns the size of a string.
This function returns a tuple of (width, height) of the string,
as it would appear if used in draw.string()

Signed-off-by: kozova1 <mug66kk@gmail.com>
2021-02-05 16:42:01 +02:00
Daniel Thompson
a124734ff2 draw565: Fix an out-by-one error in _bounding_box
Currently we add an extra blank pixel to the end of the string but this
is not required.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-04 22:15:59 +00:00
Daniel Thompson
463ba50d2b apps: testapp: Ensure we test centred strings
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-04 22:15:45 +00:00
Isaiah Grace
c686e2cae0 apps: settings: Added labels to the dates
Signed-off-by: Isaiah Grace <isaiah@graces.com>
2021-02-03 20:20:21 +00:00
Daniel Thompson
a1b1502d92 install: Include the wasptool dependencies in the install guide
Fixes: #159
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-30 12:55:28 +00:00
Daniel Thompson
40be05d261 apps: musicplayer: Adopt GfxButton and use it for trace fwd/back
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-18 21:55:02 +00:00
Daniel Thompson
6e269d5cd7 widgets: Add a button with a graphical icon
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-18 21:52:55 +00:00
Daniel Thompson
fbc806721e drivers: st7789: Further reduce allocations during set_window()
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-17 17:44:50 +00:00
Daniel Thompson
6b41c8f3db drivers: st7789: Pre-allocate a memoryview
Reduce the cost of slicing the linebuffer by pre-allocating a memoryview.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-17 17:44:21 +00:00