1
0
Fork 0
Commit Graph

369 Commits (jebbatime)

Author SHA1 Message Date
Daniel Thompson 4c0120aa1e apps: settings: Avoid circular dependancies during app init
wasp.system cannot be safely be used from app __init__ methods. Move
the initial value settings to the foreground method instead.

Fixes: b1326e1609 ("apps: settings: Fix initial slider value")
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-26 21:23:38 +00:00
kozova1 b1326e1609 apps: settings: Fix initial slider value
When the Settings app is launched, it shows the "Mid" text (this is
correct), but the slider is at the lowest position. After moving the
slider it functions correctly, so this fix is mostly cosmetic.

Signed-off-by: kozova1 <mug66kk@gmail.com>
2020-11-26 21:09:22 +00:00
Daniel Thompson bfa715b488 widgets: clock: Improve the redraw logic
Currently if we wake the watch exactly N hours (where N is integer)
after it goes to sleep then the time will not be updated. Fix this the
obvious way.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-22 09:27:14 +00:00
Daniel Thompson 748e5fe65a docs: Wordsmtithing updates after review
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-22 09:25:24 +00:00
Daniel Thompson 6f0238415f apps: music: Add to application index
Additionally we rename the screenshot to conform to the naming
convention (app.NAME + 'App.png') used for simulator screenshots.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-22 09:22:50 +00:00
Daniel Thompson fd0e0d77aa [pinetime,p8,k9]: Show when main.py is running
This is yet another step towards making the role of main.py more obvious.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-14 20:40:16 +00:00
Daniel Thompson e105c8bb68 apps: testapp: Add an alarm test
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-14 20:36:41 +00:00
Daniel Thompson dd5a1e75af apps: steps: Use the alarm system to reset the step counter at midnight
This is way better than zeroing it the first time in the day we use the
step counter!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-14 12:25:32 +00:00
Daniel Thompson d0a99d5636 manager: Implement alarm callbacks for applications to use
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>
2020-11-14 12:24:28 +00:00
Daniel Thompson d2357f2325 simulator: Enable the music app in the simulator
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-12 21:47:38 +00:00
Daniel Thompson 3d0d96ee3a icons: Optimize flash size of the music player icons
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-12 21:47:38 +00:00
Daniel Thompson 5796a0c113 apps: music: Fix double track name bug
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-12 21:47:38 +00:00
Carlosgg 306a1ec0a4 apps: Add music player app with GadgetBridge support
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>
2020-11-12 21:44:22 +00:00
Daniel Thompson 294797d826 hrs3300: Defer initialization until the HRS is used
This means hardware failure won't cause the initial boot to fail. This
won't stop the heart rate app from crashing when it starts up but at
least it will give a comprehensible crash report.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-11 22:07:21 +00:00
Daniel Thompson 06f1ed36b0 docs: Add an Application Library chapter
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-08 14:28:38 +00:00
Daniel Thompson 8e89e38175 manager: Introduce shared "system bar"
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>
2020-11-04 19:00:37 +00:00
Daniel Thompson f95f45cda3 apps: fibonacci clock: Updates to structure like clock app
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-25 08:55:58 +00:00
Daniel Thompson 1b99764e8d apps: clock: Simplify and increase commenting
The main simplification is to adopt the status bar (with the status bar
clock disabled) and to restructure the way draw and redraw are handled.
Since the clock application is one of the most popular to customize it
has also had extensive commenting added to describe how it works.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-25 08:55:20 +00:00
Daniel Thompson 37f8a47220 apps: steps: Switch over the status bar widget
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-21 21:29:15 +01:00
Daniel Thompson fd4017c729 apps: stopwatch: Switch over the status bar widget
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-21 21:28:49 +01:00
Daniel Thompson 398ce598fc widgets: status: Add a status bar combo widget
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-21 21:28:09 +01:00
Daniel Thompson 9f3c75d512 widgets: battery: Fix a redraw bug
Currently if the real battery level is <5% then a redraw from scratch will
not draw the outline of the battery. Fix this by adding a special case for
negative previous states (-1 charging, -2 redraw).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-21 21:10:16 +01:00
Daniel Thompson 6cd1e86295 widgets: clock: Add a simple clock widget
This is intended to be reused by any app that shows the clock as part
of the status bar at the top of the display.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-21 21:10:16 +01:00
Daniel Thompson fc502cdcaa widgets: Rename StatusBar to NotificaitonBar
This is not (yet) a useful change but we'll be creating a new StatusBar
soon.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-20 18:56:08 +01:00
Daniel Thompson 52de478682 apps: fibonacci_clock: Nudge the clock down a few pixels
The better manages the space between the battery meter and the clock.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 21:42:51 +01:00
Daniel Thompson a5f69ffe26 apps: fibonacci_clock: Enable status bar for notifications
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 21:42:51 +01:00
Daniel Thompson 89d91f7e5b widgets: Fix a broken docstring
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 21:42:51 +01:00
Daniel Thompson aef95e6d80 apps: fibonacci_clock: Add an simple icon
For some users the icon is pointless because they would rather install
the clock on the quick ring but this clock is something of a novelty so
it would be quite reasonable to only launch it when in the mood for
decoding something!

Happily the icon compresses nicely too!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 14:06:44 +01:00
Daniel Thompson c1c66fb487 boards: Introduce a shared manifest for all 240x240 devices
This also adds the Fibonaci Clock, Haiku viewer and the Game of Life
to the manifest. They are *not* registered by default at this point
since, although we can currently spare the internal flash space there
is more competition for RAM so we have to trade off out-of-the-box
convenience with keeping as much RAM as possible for users to do
"cool things".

Given the zen of wasp-os is to try to make is as easy as possible for
users to become coders we currently favour reserving the space for the
cool things (and implicitly encouraging them to write a couple of lines
of python to enable the bonus applications.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 14:04:44 +01:00
Johannes Wache 4942e3e935 apps: fibonacci_clock: Add a Fibonacci clock application
Signed-off-by: Johannes Wache <jbwa@posteo.de>
[daniel@redfelineninja.org.uk: Tidy up the "git soup", dropped the manifest
changes and integrated the description from the original PR into the
docstring for the app]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 13:12:39 +01:00
Daniel Thompson 11640d8362 apps: haiku: Add a simple Haiku viewer
This app serves as an example of using the filesystem to make an
application more flexible. Both the verses and the icon will be
loaded from the filesystem rather than being burned into the
wasp-os binaries.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 12:12:59 +01:00
Daniel Thompson 6e91e0e414 drivers: flash: Automatic wake/sleep to minimise idle current
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 11:45:25 +01:00
Daniel Thompson b9daf05fbc boards: pinetime: Don't add nor_cs to the namespace
Having an extra identifier for the Pin() is a waste of RAM... if you need
the CS pin then grab it from watch.flash._cspins instead.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 11:30:32 +01:00
Daniel Thompson 942e9f0bb4 apps: pager: Avoid crashes for notifications with no body
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 11:28:25 +01:00
Jeffrey Bailey f924bb6414 boards: Remove flash wake up commands
Wake from deep power down is now handled in the driver. Remove attempt
to wake the board files.

Signed-off-by: Jeffrey Bailey <wb.jeffrey@gmail.com>
[daniel@redfelineninja.org.uk: Update commit message, simplify
slightly, extended to all boards with spinor flash and update
gitmodules to bring in the flash driver updates.]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-09-27 14:26:29 +01:00
Daniel Thompson 7075f5689e wasp: Fix broken indention
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>
2020-09-22 21:14:45 +01:00
Daniel Thompson 6bf350a6e9 drivers: cst816s: Clear the event buffer during a wake up
Currently with CST816S controllers (but not CST716S controllers) then a
swipe delivered whilst the device is asleep will sometimes be processed
after we wake it up. That's never likely to be useful. Fix this by
explicitly clearing the event buffer as part of the wakeup sequence.

Reported-by: Siroj42 <siroj42@users.noreply.github.com>
Fixes: #65
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-09-21 20:12:38 +01:00
Daniel Thompson 889115f4b0 wasp: Allow app initialization to fail
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>
2020-09-16 21:47:22 +01:00
Daniel Thompson e8ae2ed47e boards: simulator: Add an screenshot facility
The screenshot is automatically named after the application currently
running and copied into the res/ directory. This allows the application
screenshots to be quickly updates if/when the screenshots get out of date
as the applications are improved.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-16 18:49:40 +01:00
Daniel Thompson 9877ea99bd README: Add a (fairly) comprehensive screenshot tour
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-16 18:48:15 +01:00
Daniel Thompson cd97893d2c apps: stopwatch: Add NEXT support
On a device with NEXT support we need to make sure we reset the stopwatch
when switching away from it (if it is not running) since there may not
be any other way to reset it.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-15 20:43:22 +01:00
Daniel Thompson 44ba8ebd22 drivers: cst816s: Handle a failure to sleep
Exceptions on th sleep path more or less kill the device (it is half
alseep and is not on... but not off enough for the power button to work.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-15 20:40:26 +01:00
Daniel Thompson 34ca73ee60 gadgetbridge: Disable the not-implemented message
Currently the not-implemented message provokes GadgetBridget into
issuing lots of annoying toaster messages. It's still useful for debugging
but let's disable it by default.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-15 20:37:52 +01:00
Daniel Thompson 5ae327ea54 wasp: Introduce a NEXT event
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>
2020-08-15 17:00:49 +01:00
Daniel Thompson a87b3faa4a k9: Disable safe-mode
Currently the K9 is wedged in safe-mode. Oops! Fix this.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-15 16:56:28 +01:00
Daniel Thompson d535b8b16c k9: watch.py.in: Fix backlight
Currently the backlight is permanently on at its lowest level. The
backlight is so dim that this is almost impossible to detect. I only
found it when lying in a field in total darkness and observing that the
screen wasn't quite as black as I expected.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-15 16:55:56 +01:00
Daniel Thompson a47e0921b3
Merge pull request #48 from Siroj42/master
Fix background color of strings.
2020-08-09 21:23:39 +01:00
Daniel Thompson 2d1942f76a k9: Add support for Senbono K9
The K9 is similar to the PineTime and P8 devices but does not appear
to use the CST[78]16 touch screen controllers. At present the protocol
is not known (readfrom yields all zeros, readfrom_mem provokes an
exception) so we have a hugely limited interface consisting of the side
button and the touchscreen interrupts (in other words we can treat the
touchscreen like a second button).

Works suprisingly well considering...

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-08-09 20:06:45 +01:00
Siroj42 cc34c5d46d draw565: Fix wrong background color of strings
Signed-off-by: Joris Warmbier <siroj42@t-online.de>
2020-08-02 21:55:04 +02:00
Daniel Thompson 13b35611e2 boards: p8: Full support for Colmi P8
All the components (bootloader, reloader, micropython) has P8 support added
some time back but without full integration at the wasp-os level. Let's
add it!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-07-27 22:15:42 +01:00
Daniel Thompson 326e06bc6b StatusBar: Rename and add BLE connection status icon
Notifier was a dumb name so make it better. Now that we have a decent
name it should be obvious how to handle the BLE connection status icon!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-07-24 17:04:46 +01:00
Daniel Thompson a01fb7df57 Introduction basic notification support
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.
2020-07-19 20:50:33 +01:00
Daniel Thompson c739df119b boards: simulator: Swap up/down swipe detection
Fix swipe detection so it matches the real device.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-07-09 22:29:57 +01:00
Daniel Thompson eac72188cf simulator: Provide a special main.py for the simulator
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-07-07 21:22:12 +01:00
Daniel Thompson ae5743529f wasp: Switch to scheduling from interrupt
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>
2020-06-30 23:04:01 +01:00
Daniel Thompson 11be7ca328 apps: stopwatch: Improve splits... and colour scheme
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-27 14:34:36 +01:00
Daniel Thompson 7b3e0f917d boards: simulator: Add swipe detection and button support
Currently the simulator relies on the keyboard to issue touchscreen
gestures and button presses. Fix this by adding swipe detection and
introducing a skin which gives us the capability to press the button
using touchscreens or pointer devices.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-27 12:22:23 +01:00
Daniel Thompson eb8dfcc57c boards: spinx: Fix the documentation generation
Currently the template app documentation will not generate. Fix that!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-25 22:08:02 +01:00
Daniel Thompson 95e129e331 ppg: Pull the PPG signal processing into a seperate library
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-25 21:59:32 +01:00
Daniel Thompson e6811bb693 apps: heart: Initial heart rate detection
The algorithm is fairly crude and the GUI is pretty simple but, if you stay
still for 10 seconds, there's a good chance of an accurate pulse
reading.

Of course if you jog on the spot for ten seconds it more likely to
calculate how many steps per minutes you are performing!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-24 21:20:47 +01:00
Daniel Thompson b1faec667d simulator: Reverse the simulated PPG waveform
This avoids an implusive change in base value and makes the waveform a
little more interesting.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-24 21:20:47 +01:00
Daniel Thompson 88418fd1b5 apps: heart: Introduce simple app for the heart rate sensor
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>
2020-06-22 22:51:06 +01:00
Daniel Thompson 417e408dc4 drivers: hrs3300: Add a basic HRS3300 sensor driver
Add the driver and enable it on PineTime.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-22 22:22:40 +01:00
Daniel Thompson bbe8add40c wasp: Switch to the faster fill routines
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-22 22:21:13 +01:00
Daniel Thompson 04a8daeff4 draw565: Optimize filled rectangle drawing
The original approach is *really* bad at drawing vertical lines (it ends
up working a pixel at a time and works the chip select for each one.

Optimize both the pixel fill and the use of the line buffer. The result
is 20% faster for quarter screen fills, 3x for horizontal lines and 6x
for vertical lines.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-22 22:20:34 +01:00
Daniel Thompson d81e8e75ac apps: testapp: Filled rectangle drawing benchmarks
Measure the performance of the quarter screen fill, horizontal lines and
vertical lines.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-22 22:17:06 +01:00
Daniel Thompson 6c7337fb1e dsd6, nitrogen: Make them build again
Fixes: 9eb9b74 ("Update preprocess to use $(BOARD)").
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-17 21:35:19 +01:00
Daniel Thompson 823e85584d apps: [steps,stopwatch]: Increase font size of clock
We also change the colour scheme slightly because the increased size of
the clock interferes visually with the main display when it is bright
white.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-12 08:53:32 +01:00
Daniel Thompson bd41368d2b apps: steps: Fix the overnight step counter reset
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-12 08:52:36 +01:00
Daniel Thompson ab33027fff drivers: bma421: Reduce the post-reset delay
There nothing in the docs to give the delay time required after a
reset. Currently we use 200ms because that appears on some older
code for BMA423 but is removed in more recent drivers. 50ms is still
a long time (for hardware) and has held up in testing.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-12 08:51:44 +01:00
Daniel Thompson 93b3c2bf1a wasp: simulator: Improve the RTC
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-12 08:49:54 +01:00
Fuji Pebri df9d80f6f7 drivers: cst816s: optimize for power saving and responsiveness
Signed-off-by: Fuji Pebri <pebri86@gmail.com>
[daniel@redfelineinja.org.uk: removed leading underscore from method
arguments, removed redundant state tracking, adopt i2c.writeto_mem]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-11 21:17:16 +01:00
Daniel Thompson acf318c122 wasp: simulator: Add interupt support for CST816S
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-06-11 21:15:47 +01:00
Daniel Thompson 93d10f74fb fonts: Add sans28 (numerals only) 2020-06-11 20:37:03 +01:00
Daniel Thompson 12e883e68b boards: pinetime: Improve safe mode implementation 2020-06-10 08:52:46 +01:00
Daniel Thompson ccaf12750b wasp: apps: Step counter application
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>
2020-06-09 21:31:55 +01:00
Daniel Thompson d62e6a22c7 Fix symbol lookup error (knob2) 2020-06-04 22:57:50 +01:00
Daniel Thompson 4c7e92d964 apps: settings: Adopt the slider... it looks more interesting 2020-05-24 14:20:20 +01:00
Daniel Thompson de647b324c widgets: Introduce a slider widget
Currently the slider doesn't actually slide (because we process touch
events rather than swipe events) but we've called is a slider anyway.
2020-05-24 14:20:02 +01:00
Daniel Thompson 57999226fd draw565: rle2bit: Add support for palette overrides
This allows some interesting manipulations of 2-bit images.
2020-05-24 14:19:04 +01:00
Daniel Thompson 60bb43e87b apps: gameoflife: Better pixel colour selection 2020-05-18 22:19:19 +01:00
Daniel Thompson 7f6b1b9059 draw565: Switch to a different palette for RLE 2-bit images
This is an incompatible change... older 2-bit images will need to be
re-encoded to display correctly.
2020-05-18 22:17:51 +01:00
Daniel Thompson d9bdb0c82f boards: Remove demo.py from the manifests
Fixes: #25
2020-05-18 08:12:00 +01:00
Daniel Thompson b9e82424e9 apps: demo: Move the logo into the demo app
The logo module is currently unused but it simply sits there consuming
flash. Let's shift it to the demo app to is can consume RAM instead (but
only when we upload the demo to the watch).
2020-05-17 14:37:44 +01:00
Daniel Thompson ac1a799bfa draw565: Fix line optimization code
sx is measured in pixels (2-bytes) and len(display.linebuffer) gives
a value in bytes so the divisor isn't right.

Whilst we are here let's make sure we use integer division too.

Fixes: #18
2020-05-17 09:47:15 +01:00
Daniel Thompson 4906d46ff4 apps: demo: Move the demo code into a fully fledged application 2020-05-17 09:45:16 +01:00
Daniel Thompson e391480b50 wasp: watch: docstrings for the watch namespace 2020-05-14 23:22:57 +01:00
Daniel Thompson d11e6eb4a1 Make wasp-os namig consistant
Rename WASP to wasp-os (or Wasp-os)
2020-05-14 22:41:05 +01:00
Daniel Thompson b8efcd3053 wasp: Even more docstrings 2020-05-14 22:29:35 +01:00
Daniel Thompson f07fb6d22a wasp: draw565: docstrings for headings and __init__ 2020-05-14 21:44:05 +01:00
Daniel Thompson 42fe7bf352 drivers: vibrator: Finalize docstrings 2020-05-14 21:42:16 +01:00
Daniel Thompson 95f1788347 drivers: st7789: Finalize docstrings 2020-05-14 21:41:02 +01:00
Daniel Thompson 9274d8cc2d drivers: signal: Finalize docstrings 2020-05-14 21:39:14 +01:00
Daniel Thompson 880083977c drivers: nrf_rtc: Finalize docstrings 2020-05-14 21:36:33 +01:00
Daniel Thompson d5c629a9ac drivers: cst816s: Finalize docstrings 2020-05-14 21:36:09 +01:00
Daniel Thompson 85079c149b drivers: battery: Finalize docstrings 2020-05-14 21:32:01 +01:00
Daniel Thompson 93ad0e6972 wasp: draw565: docstring improvements 2020-05-11 23:07:35 +01:00
Daniel Thompson a2fd52ef2b docs: Introduce the Application Writer's Guide. 2020-05-11 21:44:30 +01:00
Daniel Thompson fe1bbbac52 apps: template: Fix broken docstring 2020-05-10 09:34:57 +01:00
Daniel Thompson 09071427e4 drivers: nrf_rtc: Fix some tab/space issues
These issues do not appear when parsing with micropython but when we
import this file into sphinx then things go a bit south.
2020-05-10 09:34:22 +01:00
Daniel Thompson a4c62bb818 wasp: apps: Remove __init__.py
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.
2020-05-10 09:33:26 +01:00
Daniel Thompson c1f8823f61 Add PNVRAM support to avoid forgetting the time during a reboot. 2020-05-09 14:19:10 +01:00
Daniel Thompson 2d437b0f68 wasp: drivers: nrf_rtc: Fix a nasty bug when setting the time
The code to recalculate the uptime to walltime adjustment was broken
(e.g. the longer we leave it after reboot the more inaccurate the time
setting becomes).

Fixes: 80079e4 ("wasp: nrf_rtc: Add a tiny bit of extra resolution")
2020-04-26 15:01:48 +01:00
Daniel Thompson 6729ac67a5 apps: launcher: Add a scroll ready indicator 2020-04-26 15:01:48 +01:00
Daniel Thompson 8b2ba4e79c apps: launcher: Make app.ICON optional 2020-04-26 15:01:48 +01:00
Daniel Thompson e854998268 apps: stopwatch: Fix redraw bug (and remove some old test code) 2020-04-26 15:01:48 +01:00
Daniel Thompson 9348e758b2 wasp: nrf_rtc: Add a tiny bit of extra resolution
We now have a couple of applications (stopwatch, Game of Life) that benefit
from sub-second precision. The micropython RTC/utime code for nrf still
needs a major overhaul but this allows us to paper over the cracks for
just a little longer.
2020-04-26 15:01:48 +01:00
Daniel Thompson 5b277e94f1 wasp: Manager: Avoid printing the stack trace when it can cause problems
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.
2020-04-26 15:01:48 +01:00
Daniel Thompson 880764da7d wasp: apps: Conway's Game of Life 2020-04-18 11:54:03 +01:00
Daniel Thompson bfd914a5d1 boards: simulator: Add ptr32 support 2020-04-17 17:19:11 +01:00
Daniel Thompson 66743d42c8 wasp: Manager: Bring in proper separation of apps
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.
2020-04-14 20:05:57 +01:00
Daniel Thompson 10706a9704 wasp: stopwatch: Replace the stub with a "real" implementation
There are still some holes here. In particular the RTC resolution on
nRF devices (such as PineTime) is currently a full second (meaning
the centiseconds will always be zero. Nevertheless that isn't the apps
fault... as we can see when we run on the simulator.
2020-04-14 20:03:04 +01:00
Daniel Thompson 5fc802fb78 wasp: Manager: Push exceptions to the console as well as the crash app 2020-04-14 20:00:49 +01:00
Daniel Thompson a77301ec64 fonts: Add sans36 (numerals only)
At 36pt this is already gobbling a fair bit of flash so, for now, we've
restricted this only numerals (and colon).
2020-04-14 20:00:04 +01:00
Daniel Thompson 64afea0d07 WIP: Introduce the quick_ring 2020-04-12 08:59:37 +01:00
Daniel Thompson b649cd1b24 wasp: template: Implement optional application methods 2020-04-12 08:41:31 +01:00
Daniel Thompson 80d518b75b wasp: apps: Add shortcuts to all apps 2020-04-12 08:40:49 +01:00
Daniel Thompson 64a97fce58 wasp: testapp: Sort tests alphabetically 2020-04-12 08:40:11 +01:00
Daniel Thompson 50ecff29ef wasp: Automatically generate watch.py for PineTime
This should ensure that main.py is always up to date.
2020-04-11 21:12:18 +01:00
Daniel Thompson 4c09add2d8 docs: Add text descriptions of icons
Having the raw hex strings makes the docs look really unclean. Fix this
by providing a special version of icons for the "sphinx" board.
2020-04-11 20:49:06 +01:00
Daniel Thompson 683c3497e0 docs: Fix warnings and add a few extra apps to the docs 2020-04-11 20:26:12 +01:00
Daniel Thompson af1379806c wasp: simulator: Use Tab to replicate the physical button 2020-04-11 20:15:20 +01:00
Daniel Thompson f68eb610c5 wasp: On-device crash reporting
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).
2020-04-11 20:15:02 +01:00
Daniel Thompson 23368a659b wasp: apps: Add a new (super simple) settings app 2020-04-10 20:30:20 +01:00
Daniel Thompson f734568ad2 wasp: draw565: Optimize the bit expansion blitter slightly. 2020-04-10 20:23:12 +01:00
Daniel Thompson 22ca8886c2 wasp: draw565: Automatic RLE format conversion
From here we can also bring colour to the launcher!
2020-04-10 20:22:51 +01:00
Daniel Thompson a1badfd95d wasp: draw565: Fix colors when burst filling a line. 2020-04-10 20:20:01 +01:00
Daniel Thompson 3bcda8d546 Merge branch 'master' of https://github.com/daniel-thompson/wasp-os 2020-04-10 14:32:22 +01:00
Daniel Thompson 74511a1e1c
Merge pull request #7 from salcedo/master
wasp: pinetime: Release SPI NOR from deep power-down
2020-04-10 14:32:14 +01:00
Daniel Thompson fd64abe882 wasp: draw565: Optimize the 2-bit RLE drawing functions
There's a bunch of different changes here but there are only really three
big wins. The biggest win comes from restructuring the 2-bit RLE decode
loop to avoid the inner function (~20%) but the switch to 16-bit writes in
_fill() and adoption of quick_write (e.g. no CS toggling) are also
note worthy (and about 5% each).
2020-04-08 21:50:42 +01:00
Daniel Thompson 841fbef8a6 wasp: testapp: Add RLE drawing benchmarks. 2020-04-06 22:04:21 +01:00
Daniel Thompson 8ed80eeeba wasp: launcher: Experimental launcher implementation
It is not really the launcher itself that is immature. Rather that the
framework and UI concepts to move between applications isn't complete
yet.
2020-04-06 22:04:21 +01:00
Daniel Thompson 59bb70fa64 wasp: simulator: Optimize the drawing process
This makes per-pixel access more than double the performnace of a regular
pixelview (but at the expense of requiring numpy).
2020-04-06 22:04:21 +01:00
Daniel Thompson a1a8f3f8a3 wasp: draw565: Add 2-bit RLE decoder 2020-04-06 22:04:21 +01:00
Daniel Thompson 2b5ebcef72 wasp: widgets: Add a scrolling indicator
As we enrich the navigation options we will increasinly need to visualize
between apps where up/down will switch us between rings and there
up/down is needed to scroll through content.
2020-04-06 22:04:21 +01:00
Daniel Thompson bb4e76d852 wasp: testapp: Add an option to force an exception
We will shortly be adding machinary to handle application errors more
gracefully. This is a useful way to force an application error!
2020-04-06 22:04:20 +01:00
Daniel Thompson 83cc56969e wasp: manager: make sleep() and background() callbacks optional
Making callbacks optional reduces pointless boilerplate in applications.
2020-04-06 22:04:20 +01:00
Daniel Thompson 6a6e393d1f wasp: vibrator: Better default for pulse
These defaults are good for giving quick UI feedback.
2020-04-06 22:04:20 +01:00
Daniel Thompson b5e69aead3 wasp: Manager: Parameterize the keep awake timer
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!
2020-04-06 22:04:20 +01:00
Daniel Thompson 8c35282214 wasp: Rename Debounce to PinHandler
Debounce was a lousy name...
2020-04-06 22:04:20 +01:00
Daniel Thompson 40b2482165 wasp: simulator: Swap up/down and left/right
This gives the simulator a more natural feel since the "swipe left" action
usually means "more a screen to the right". This will probably make
testing games impossible but makes it much easier to navigate the menus.
2020-04-06 22:04:20 +01:00
Daniel Thompson c593e1e9f9 wasp: draw565: Allow the drawing context to be reset
The main reason to reset the drawing context is so that it can be reset
before we call foreground() on an application.
2020-04-06 22:04:20 +01:00
Daniel Thompson b2622b579d wasp: Add button presses to the event system.
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).
2020-04-06 22:04:20 +01:00
Daniel Thompson 0cc7987689 apps: Remove unused support for effect animation
After a bit of testing I have not yet come up with a fast, visually
acceptable horizontal animated effect. Instead we simply reply on
screen blanking during the redraw... meaning there is no need for an
effect hint.
2020-04-06 22:04:20 +01:00
Daniel Thompson d10f3dbc49 wasp: Get the terminology straight
As it turned out Direction was only a Direction because there were things
missing from the enumeration!
2020-04-06 22:04:20 +01:00
Daniel Thompson 0ac2321e82 wasp: Factor out the sleep/wake code
Pulling this out into a method allows it to be called by an application.
2020-04-06 22:04:20 +01:00
Daniel Thompson afb9bd16b6 wasp: Add support for brightness caching and keep-awake signalling 2020-03-26 22:12:05 +00:00
Daniel Thompson af33c7d79b wasp: Major documentation string improvements. 2020-03-26 21:46:10 +00:00
Daniel Thompson a9413db5cf wasp: Move the constants into seperate container classes 2020-03-26 20:42:03 +00:00
Daniel Thompson b9fe31241c Add licensing information for all wasp-os files. 2020-03-22 15:40:18 +00:00
Daniel Thompson f8bd1a7461 Rename manager.py and expose its interfaces to all applications
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
2020-03-22 12:37:19 +00:00
Brian Salcedo dcc51cd094 wasp: pinetime: Release SPI NOR from deep power-down 2020-03-15 09:38:47 -04:00
Daniel Thompson 5a234c16ad wasp: Rotate the swipe UI by 90 degrees
This is something of an experiment but now the app roll is traversed using
horizontal swipes and applications should primarily use vertical swipes
to navigate internally. This is mostly because if "feels" better but it
also leaves the vertical scrolling hardware available for use by the
app.
2020-03-13 19:02:29 +00:00
Daniel Thompson 3ded49c5ef fonts: sans24: Minor refactor to reduce memory allocation
This is a useful but modest optimization (maybe 3% in string
rendering.
2020-03-09 21:33:29 +00:00
Daniel Thompson 820764081e drivers: st7789: Automatically park ready for the next call to write data
This makes line-by-line drawing more efficient because don't have to
handle the dc line. The optimization targets font rendering and if good
for slightly less than 10% rendering improvement.
2020-03-09 21:32:34 +00:00
Daniel Thompson 69bc452c65 draw565: Optimize the font rendering
This is a big one... more than 4x increase in font rendering performance!
2020-03-09 21:29:35 +00:00
Daniel Thompson 031d139b7c wasp: draw565: Refactor to allow apps to focus on the drawable. 2020-03-09 00:00:13 +00:00
Daniel Thompson 5413d826d7 wasp: Re-factor how Draw565 is used.
Moving it from applications into the watch is useful for two reasons.
Firstly it means applications don't need to know as much about the
display color depth and secondly it makes it easier to replace the
drawing routines with wasptool.
2020-03-08 23:16:30 +00:00
Daniel Thompson 24438ad05d testapp: Smoother transitions between tests 2020-03-08 21:31:17 +00:00
Daniel Thompson d236db68dc testapp: Show the render time for the string test 2020-03-08 21:22:54 +00:00
Daniel Thompson cfffeddd77 wasp: testapp: Extend with a string render test 2020-03-08 20:48:48 +00:00
Daniel Thompson a864a93706 wasp: manager: Blankt the display during app transitions 2020-03-08 20:47:19 +00:00
Daniel Thompson adf9a33c9e drivers: cst816s: Minor tweaks to the generated documentation. 2020-03-08 17:40:54 +00:00
Daniel Thompson d2058fb87f docs: Increase the scope of the documentation
We now generate documentation for everything included in the PineTime
manifest (although, at this stage, not everything in the manifest has
all the required docstrings).
2020-03-08 17:40:27 +00:00
Daniel Thompson 799a66c9b9 wasp: Move the apps into their own directory. 2020-03-08 17:39:39 +00:00
Daniel Thompson b5b96bd776 wasp: Integrate the touch driver
At this point we are starting to bring an event model for applications
but there's still a long way to go!
2020-03-08 10:18:08 +00:00
Daniel Thompson 138425f4d4 wasp: manager: Start refining the application interface
This is the first step in starting to formalize the seperation of
applications from the system manager.
2020-03-07 11:52:42 +00:00
Daniel Thompson 1ebafc083b wasp: simulator: Add CST816S simulation 2020-03-07 11:50:26 +00:00
Daniel Thompson 9664c394a6 drivers: nrf_rtc: Add a higher res monotonic timer 2020-03-07 11:49:35 +00:00
Daniel Thompson 1b334f7ad9 wasp: pinetime: Enable the cst816s by default 2020-03-07 11:48:17 +00:00
Daniel Thompson e5f455b5ba drivers: cst816s: Decouple from the watch module 2020-03-07 11:47:25 +00:00
Daniel Thompson 948454a33b wasp: cst816s: Initial PoC driver 2020-03-06 21:09:43 +00:00
Daniel Thompson 7fc4592383 wasp: draw565: Add some docstrings 2020-02-23 20:52:09 +00:00
Daniel Thompson c3d4ddafbc wasp: clock: Add some docstrings 2020-02-23 20:51:58 +00:00
Daniel Thompson 5c0d86d938 docs: Fix some errors in the sphinx board 2020-02-23 20:51:26 +00:00
Daniel Thompson 41647556c1 clock: Reduce the update rate of the battery meter
In addition to the fix (which is simple) we also modify the button handling
of the simulator because, rather by acident, it relies on the bugs in the
battery meter redraw to ensure the simulator stays active.
2020-02-23 20:19:37 +00:00
Daniel Thompson 3ba356f6c4 docs: Add a sphinx board
The simulator board does rather too much when we import watch.py. This
change means we don't need SDL just to generate the documentation!
2020-02-23 20:16:23 +00:00
Daniel Thompson 019ca1b4ed wasp: clock: Add date indication 2020-02-19 19:57:08 +00:00
Daniel Thompson b508f4dc26 wasp: Add a simple font renderer 2020-02-19 19:57:08 +00:00
Daniel Thompson 0c4754fc74 wasp: Start collecting the fonts in a single directory 2020-02-19 19:57:08 +00:00
Daniel Thompson df11539c29 wasp: Simple shell commands (based on upysh) 2020-02-19 19:57:08 +00:00
Daniel Thompson f689c90498 wasp: Add full dd-mm-yyyy calender tracking 2020-02-19 19:57:08 +00:00
Daniel Thompson b2c5b482d5 wasp: pinetime: Enable filesystem support 2020-02-09 19:49:52 +00:00
Daniel Thompson 9c299afe41 wasp: Add pure-python SPI NOR FLASH drivers 2020-02-09 19:47:02 +00:00
Daniel Thompson bb033577da drivers: st7789: Optimize RLE decoding loop
Migrate the filling of the line buffer into a seperate function.
This does naturally reduce the cost of the loop management but
much more importantly allows us to use viper native code
generator.
2020-02-08 07:49:38 +00:00
Daniel Thompson b48df32eb1 wasp: manager: Wake up on a change of charging state 2020-02-04 08:49:10 +00:00
Daniel Thompson 2d0df5aed5 wasp: clock: Tweak the greying of the high order digits 2020-02-04 08:48:13 +00:00
Daniel Thompson be6c6b02b0 wasp: clock: Reduce battery meter redraws
The ADC on nRF doesn't run precisely stable which means the battery
meter can flicker if updated too often. This will eventually
be fixed by the framework but, for now, let's just force the
update rate to be fairly slow.
2020-02-04 08:47:14 +00:00
Daniel Thompson 5489437f78 wasp: demo: Power up the display before launching the demo 2020-02-04 08:44:21 +00:00
Daniel Thompson 1d8b900d40 waps: widgets: Improve the battery meter athtetics
Add some extra internal padding and draw the battery in red when
power is critically low.
2020-02-04 08:43:49 +00:00
Daniel Thompson 3e0cb4eed5 wasp: manager: Avoid spurious garbage collection
Running garbage collection when idle it a waste of power...
2020-02-03 22:45:12 +00:00
Daniel Thompson 1f2c25a7bd wasp: clock: Add a simple battery meter 2020-02-03 22:35:16 +00:00
Daniel Thompson 57035ce080 wasp: st7789: Make fill() control sizing 2020-02-03 22:34:54 +00:00
Daniel Thompson 118b7bab00 wasp: st7789: Reuse the pre-allocated linebuffer 2020-02-03 22:32:53 +00:00
Daniel Thompson b124a747dd wasp: simulator: Add battery level simulation
In order to get best test coverage the act of reading the battery
results in the battery either charging or discharging.
2020-02-03 22:29:57 +00:00
Daniel Thompson 3892f07e62 wasp: Add simple clock app
At this point both the simulator and a PineTime will come up
and show a clock (although in the case of the PineTime the clock
will just come up at 12:00).
2020-02-03 19:26:08 +00:00
Daniel Thompson fc74f7e37b wasp: simulator: Add RTC support 2020-02-03 19:23:10 +00:00
Daniel Thompson a5caa845b7 wasp: simulator: Add support for machine.[light|deep]sleep() 2020-02-03 19:22:54 +00:00
Daniel Thompson d0f18a15fa wasp: simulator: Fix column and row select 2020-02-03 19:14:44 +00:00
Daniel Thompson 127df66335 wasp: pinetime: Basic RTC support
Currently this supports time only (no date) and it based on the
RTCounter class which is customized for nRF ports. At present
the nRF port doesn't have proper machine.rtc support so we have
implemented within wasp instead.
2020-02-03 19:12:04 +00:00