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>
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>
Enabling software by default allows us disable several other applications
by default because there is now a GUI based route to enable them.
This does require a few tweaks to the test suite and allows allows us to
remove a lot of boilerplate text from the application library document
since it is no longer relavent.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
By default bright and mid are white/grey tones, the ui widgets are
blue and the spot colours are different variants of orange.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Currently the theme is explicitly little endian. This does match the
underlying hardware but makes it needlessly difficult to hand edit
themes. Switch the default theme and theming tools over to big endian
form and add comments to the default theme to support hand editing.
We also expand the ASCII characters in the default them with hex codes.
This is the final step needed to make hand edited themes trivial to work
with.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Add the battery frame to the theme so it matches the frame used for
charging and rename accordingly.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This theming engine uses a bytestring (but supports anything indexable,
as long as the index results are a byte long),
stored as `wasp.system._theme`.
It has a default value, which should not change anything about the way this looks currently.
The theme can be set via `wasp.system.set_theme`,
but this should *ONLY* be used in `main.py`.
`wasp.system.set_theme` will return True if it was successful,
or False if the theme is of an old format.
Using an old format theme will *not* crash the watch,
but will use the default theme instead.
To theme this, one has to use tools/themer.py (use flag -h for complete explanation)
to generate a bytestring that's added in main.py (see diff).
The bytestring is then loaded into 'wasp.system._theme'.
Theme values can be looked up by apps by using `wasp.system.theme("theme-key")`.
Theme keys appear in the function body of `wasp.system.theme()`.
I've took the liberty of converting existing apps to use this method,
and it seems to work well.
A test theme is provided in `tools/test_theme.py`
Signed-off-by: kozova1 <mug66kk@gmail.com>
Signed-off-by: Carlos Gil Gonzalez <carlosgilglez@gmail.com>
[daniel@redfelineninja.org.uk: Fixed board support for simulator and
sphinx (a.k.a. doc builder)]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Create a simple time queue where actions (functions or bound methods) can
be queued against the real time clock.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
[daniel@redfelineninja.org.uk: fix regressions on simulator, disable by
default (for now) on real hardware and remove a couple of whitespace
changes to existing files]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Providing a status bar for all apps to use allows us to reduce allocations
within the applications.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Currently the simulator cannot run correctly because the indentation
in Manager.__init__ mixes tab and spaces. This is something CPython3
doesn't like but MicroPython is ok about.
Fix the obvious by using correct indentation.
Fixes: 889115f ("wasp: Allow app initialization to fail")
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Colmi has released a new revision of the P8 hardware based on a different
accelerometer. That makes it impossible for the StepCounterApp to
initialize and currently this takes down the whole GUI due to the
uncaught exception.
Fix this by skipping applications that will not initialize.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This is useful for devices that do not have touchscreens. It can be used
to cycle through the quick ring and to check out notifications.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This requires a modified version of Gadgetbridge and currently works by
implementing the BangleJS protocol.
In Gadgetbridge ensure "Sync time" is *not* set and choose "Don't pair"
when adding the PineTime device.
This has two useful properties. Firstly it means the watch will be
maintained in the background, allowing the REPL to be used for
notifications and other updates. Secondly it will save a little bit
of power by reducing the work needed to handle spurious wake ups.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
The heart rate analysis step is still a work in progress but the current
app allows us to visualize the the results of the signal conditioning.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Currently there's no fancy algorithms to estimate stride length. Just
pure simple step counting directly from the hardware's "intelligence
engine".
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
wasp-os contains circular import dependancies (wasp includes apps which
include wasp) but this is normally harmless.
However using __init__.py exagerated to the problem and since the benefit
of the __init__ file is pretty anyway the let's just remove it.
On nRF devices if we print with the NUS console disconnected (instead
of never connected) then things we can end up hanging. Better only
to print an exception if the watch class contains a method to do
that.
This is getting us much closer to the final UI concept. We have a
quick ring from which we can select typical apps such as clock and
stopwatch which will (eventually) be supplemented with step counting
and heart rate monitoriing. More exotic apps (currenrtly torch, self
test, settings) are all relagated to the launcher ring.
If an application crashes let's report it on the device so it can be
distinguished from a hang (if nothing else it should mean we get better
bug reports).
This might be a reasonable preference for the setings but, more importantly,
we can also set blank_after to very high values to ensure the watch doesn't
sleep during the voice over in videos!
Here the biggest changes are in the test application because we
refactor a number of the tests to make better use of the button.
Although applications may consume button events it does have a
default behavior which is to switch to the default application
(usually the clock).
This is a big change that break compatiblity with existing applications
*and* with existing installed versions of main.py.
When upgrading it is import to update main.py:
./tools/wasptool --upload wasp/main.py