1
0
Fork 0
Commit graph

371 commits

Author SHA1 Message Date
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
Daniel Thompson
5abae5a7f6 drivers: st7789: Optimize set_window()
For small graphical items (line drawing, font glyphs) the performance
of the set_window() method is critical.

Emit native code for this function and optimize the SPI write_cmd()
method to avoid memory allocation. This give a performance boost of
a little over 15% for (24pt) font rendering and 30% for line drawing.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-17 16:08:27 +00:00
Daniel Thompson
2fe3ac1388 draw565: Optimize string drawing
Avoid needless bouncing the chip select when drawing glyphs. This
improved performance by around 15% for 24pt fonts.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-17 16:03:42 +00:00
George Griffin
ae6e2ff289 Disallow swipes while confirmation prompt is displayed
Signed-off-by: George Griffin <george@menomnom.com>
2021-01-15 20:08:57 +00:00
Daniel Thompson
f4f7aac7fd system: Move free memory capture into the switch method
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-15 20:07:09 +00:00
Daniel Thompson
64d03fcc11 simulator: test_qa: Update to match latest policy
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-13 22:14:33 +00:00
Daniel Thompson
39d8783055 simulator: test_qa: Add some basic docstring tests
This one picked up a lot of inconsistancy so the changes here are pretty
big.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-13 21:51:17 +00:00
Daniel Thompson
f7ef165433 simulator: test_qa: Check that apps are includes in the library
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-12 22:33:25 +00:00
Daniel Thompson
aab718f917 simulator: test_qa: Add some simply QA tests for app screenshots
Add tests to make sure every app has a screenshot... and fix the
problems picked up by the new tests!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-12 22:02:31 +00:00
Daniel Thompson
cca72ef348 apps: settings: Allow date and time to be set on the watch
Currently many first-time users excitedly install wasp-os and then
struggle to set the time using the various BLE based methods
(REPL, wasptool, GadgetBridge, etc). This results in "is there
another way to set the time" being *the* frequently asked
question.

Whilst getting the BLE tools is highly recommened to get the best
from wasp-os we can delivery a better out-of-the-box experience
for first time users is we provide on board date/time setting.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-12 20:27:52 +00:00
Daniel Thompson
05310a82f8 widgets: Clarity whether spinner max is inclusive or exclusive
Currently the spinner uses exclusive max when wrapping from low to high
and inclusive max when wrapping from high to low. Fix this by adopting
*inclusive* max everywhere. The call sites are similarly confused.

Fix this!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-12 20:22:44 +00:00
ChristianRomberg
bf27f1e351 system: Fix app unregister function
Replace undefined 'instanceof' with 'isinstance'

Signed-off-by: Christian Romberg <distjubo@gmail.com>
2021-01-12 19:11:57 +00:00
Daniel Thompson
62288cc81e apps: software: Fix some scrolling bugs
Currently the number of pages is (acidentally) hardcoded where it need
not be and the scroll directions aren't right as soon as we go beyond
two pages (where scroll up and down are equivalent actions).

Fix both.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 18:14:36 +00:00
Daniel Thompson
79db167ed9 apps: play2048: Optimized the icon a little
wasp-os uses a rather eccentric "2-bit" RLE encoding which works best
when there are only three colors (and black) in a single line. Modify
the screenshot slightly to allow it to be encoded with fewer palette
updated.
2021-01-10 18:14:36 +00:00
Miguel Rochefort
ffff5ae52b apps: play2048: Add the 2048 game application
2048 is a popular sliding block puzzle game in which tiles are combined
to make the number 2048.

It's one of the few games that are enjoyable to play on such a small
form factor.

This started as a port of a TkInter implementation of the 2048 game. I
implemented all of the TkInter APIs used by the game and it worked on
wasp-os without any code change in the game. However, the performance
was very poor and it consumed too much RAM. I have since reimplemented
the whole game from scratch and managed to achieve acceptable
performance, although more improvements could still be made.

Because names in Python can't start with numbers, I had some trouble
naming things. The module is called "ttfe" (two-thousand-forty-eight),
the class name is Play2048App, and the software.py entry is "Play 2048".

Signed-off-by: Miguel Rochefort <miguelrochefort@gmail.com>
[daniel@redfelineninja.org.uk: Renamed the python filename, normalized
the screenshot and included the app in the docs]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 18:14:36 +00:00
Miguel Rochefort
8a07edb4d8 widgets: ConfirmationView: Restore default font
The title will render with the last font used, and this isn't always
right for the ConfirmationView. Setting the font explicitly solves that
issue.

Signed-off-by: Miguel Rochefort <miguelrochefort@gmail.com>
2021-01-10 18:13:31 +00:00
Daniel Thompson
bc9000c1a5 simulator: tests: Update after renaming the stopwatch app
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 16:07:15 +00:00
Wolfgang Ginolas
5b74c45e58 apps: timer: Add a countdown timer application
Signed-off-by: Wolfgang Ginolas <wolfgang.ginolas@gwif.eu>
[daniel@redfelineninja.org.uk: squashed into a single commit, rebase to
latest master, integrate with the Software application and rename the
screenshots to match the application name]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 16:02:35 +00:00
Daniel Thompson
1670be2672 apps: music: Update the application icon
Switch from a headphone to music notation metaphor and take the (lazy?)
approach of using the watch chassis to frame the icon.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 15:17:27 +00:00
Daniel Thompson
61c56598de boards: simulator: Add basic mute simulation
Currently the simulator shows redraw artifacts that are concealed
on the real device by using display on/off. We can improve this by
avoiding the refresh when the display is off. This does not match
the behaviour of the real hardware (which goes dark during transitions)
but does make the simulator feel much more comfortable to use.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 10:43:50 +00:00
Daniel Thompson
637f5d6e8a boards: simulator: Enable TestApp by default
Relaunching the simulator to run tests quickly gets frustrating if
the Self Test is disabled by default. Change this.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 10:40:03 +00:00
Daniel Thompson
a6eab3e7ff system: Allows apps to be registered using strings
Use instance tests to identify strings and substitute then for an
instanciated class.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 10:37:25 +00:00
Daniel Thompson
ed242b84a6 widgets: ConfirmationView: Adopt the button widget
Replace the pixelated Yes/No buttons with text based alternatives.
This also required changes to the pager to change the way the
redraw after changing view is implemented (improved muting and a reset
of the colours).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 10:34:37 +00:00
Daniel Thompson
b6b30238c6 widgets: button: Add a simple Button widget
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 10:30:27 +00:00
Daniel Thompson
8325177ec8 sphinx: Fix docs build regression
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-03 17:29:35 +00:00
Daniel Thompson
3813eb2911 manager: Enable Software by default
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>
2021-01-03 14:59:14 +00:00
Daniel Thompson
231f3b6fdd apps: software: Add an apps to enable/disable other apps
Currently wasp-os enables a narrow set of applications because we don't
want to consume RAM by importing the module and constructing the
application. We can improve on this situation by providing a small
(stateless) application that can be used to enable or diable applications.
This allows all the ROMed applications to be enabled using the GUI
without compromising on the ability to develop applications.

In fact this application significantlly reduces the RAM consumed in the
default case becasue the Self Test app does not need to maintain its
state.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-03 14:54:34 +00:00
Daniel Thompson
ed6b126e2e widgets: checkbox: Add a label property
The checkbox uses the _im(mutable) idiom to minimize the RAM overhead
of its immutable properties (position and label). However it can be useful
to retrieve the label to provide a property accessor.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-03 14:50:04 +00:00
Daniel Thompson
75a1a15f45 widgets: Use theme colours for text labels
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-03 14:48:19 +00:00
Daniel Thompson
0ab34249fa apps: settings: Use theme colours for text labels
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-03 14:47:23 +00:00
Daniel Thompson
8ed2537062 apps: launcher: Use theme colours for text labels
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-03 14:46:58 +00:00
Daniel Thompson
93cd03219e apps: heart: Use theme colours for text labels
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-03 14:46:47 +00:00
Daniel Thompson
71069e0170 apps: calc: Use the UI colours to generate a background
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-31 19:26:34 +00:00
Daniel Thompson
ad9714b0dc manager: Recategorize the theme labels for apps
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>
2020-12-31 19:22:54 +00:00
Daniel Thompson
1eada36ff4 wasp: manager: Byte-swap the theme encoding
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>
2020-12-31 10:09:38 +00:00
Daniel Thompson
6212a6275a drivers: bma421: Switch over to reset_step_counter()
Currently the bma421 driver simple re-initializes the sensor when asked
to set the step counter to zero. Switch over to the proper function
for this.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-31 09:31:47 +00:00
Daniel Thompson
bb1bee8feb apps: steps: Fix typo in docstrings
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-30 10:29:37 +00:00
Daniel Thompson
b8ba1a9eba widgets: ConfirmationView: Fix hit box problems
The ConfirmationView became broken when we converted it's images over to
2-bit RLE. That happened because the confirmation view relied on the
the 1-bit RLE to dynamically generate hit boxes.

Currently the code pre-calculates the hit box which is a waste of RAM.
Let's rip out the existing hit box logic and replace it with much larger
("fat finger") hit targets.

We make the touch() method more closely adopt the idioms of other UI
components (e.g. don't return the dialog status... just whether or
not we handled the touch).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-30 10:29:02 +00:00
Daniel Thompson
116c138079 bma42x-upy: Implement step counter reset
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-30 09:56:22 +00:00
Daniel Thompson
86002b4188 apps: alarm: add a full colour icon
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 20:14:13 +00:00
Daniel Thompson
e4ce90d2eb apps: alarm: Adopt the spinner widget
Replace the open coded spinner widget with the newly introduced system
one.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 20:13:18 +00:00
Daniel Thompson
f19188b962 apps: alarm: avoid setting a "silly" alarm during app init
The alarm is off by default so there's no reason to set an alarm that
is disabled. Let's stop doing that.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 20:09:47 +00:00
Daniel Thompson
2641616ff6 widgets: Spinner: Add a simple spinner widget
We are able to add this to the self tests without having to create a
special page. Instead we can modify the existing notifications test
to utilize the spinner.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 20:07:50 +00:00
Daniel Thompson
62bca4d288 simulator: Better align simulator RTC API with the nRF API
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 16:07:37 +00:00
Daniel Thompson
b47298d446 apps: alarm: Adopt the checkbox widget
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 12:33:05 +00:00
Daniel Thompson
632ec713a4 widgets: Checkbox: Add a simple checkbox widget
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 12:32:38 +00:00
Daniel Thompson
3ddb7fc13d widgets: ConfirmationView: minor docstring tweak
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 12:32:04 +00:00
Daniel Thompson
f8231bc0ac widgets: Slider: Adopt draw565.lighten for palette management
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 12:31:38 +00:00
Daniel Thompson
ff76abfb8b draw565: Add lighten/darken functions
Add functions to generate shades from a single (usually theme provided)
basic palette colour.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 12:30:20 +00:00
Daniel Thompson
0318640f62 apps: calc: Remember the results between invocations
Currently if you spend more then 15 seconds looking up figures or
transcribing the answer then the system will switch back to the
clock and the answer will be lost.

Fix this by remembering the output between invocations.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 08:59:53 +00:00
Daniel Thompson
21210c5c07 apps: calc: Rewrite the display and calculation engine
Currently calculations such as 22/7 do not work correctly on the
simulator (which uses double precision floating point). Fix this
by explicitly truncating the strings when needed.

Additionally the current calculate() method has some problems when
the calculation cannot be evaluated since it will needlessly clear out
the calculation. Push calculate (and the exception handling) into the
caller and report errors using the vibration motor instead.

Finally we rename display_output() to the more idiomatic _update().

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 08:59:53 +00:00
Daniel Thompson
e570bf4f26 apps: calc: Optimize the fields lookup structure
Currently the fields is a list of lists of strings. This will needlessly
consume RAM so lets switch it over to a simple string (which is immutable
and can be stored in flash).

We also replace indices with simple x and y variables. In addition to
avoiding a (temporary) memory allocation this is also easier to use
when looking up in fields.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 08:59:53 +00:00
Daniel Thompson
60fecc9469 apps: calc: Draw a closed grid
Currently the calculator uses an open grid. It's a matter of taste but
I prefer a closed grid.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 08:59:53 +00:00
Daniel Thompson
0884d22799 apps: calc: Correct after draw565 bug fix
Currently the coordindates used for line drawing are "tuned" for a bug in
the line drawing code (and now draw off the edge of the screen). Fix this.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 08:59:53 +00:00
Daniel Thompson
314947278d draw565: Allow strings to be right justified
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 08:59:48 +00:00
Daniel Thompson
01a7ad4d78 draw565: Handle empty strings when calculating the bounding box
Currently the empty string cannot be drawn into a fixed width box.
Fix this by adding a special case for empty strings.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-28 14:28:54 +00:00
Daniel Thompson
8c1ab85257 draw565: Fix bug in the straight line optimization
Currently the line drawing code does not draw the final pixel of
straight lines. Thus a line from (0, 0) to (10, 10) finishes on a
different pixel to (10, 0) to (10, 10).

Fix this by removing the spurious subtract one from the end point

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-28 14:27:10 +00:00
Daniel Thompson
6d74d4f585 apps: calc: Adopt the system theme for accent colors
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-28 14:24:00 +00:00
Daniel Thompson
77b693414e apps: calc: Move the copyright header to the top of the file.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-28 14:20:17 +00:00
Johannes Wache
a1ee40016d apps: calc: Created memory-saving calculator app
Signed-off-by: Johannes Wache <jbwa@posteo.de>
2020-12-28 12:06:51 +00:00
Daniel Thompson
0edee8067e simulator: Start with a higher initial voltage
Starting with the battery full makes testing the battery meter easier...

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-28 12:01:51 +00:00
Daniel Thompson
aef6466550 icons, fonts.digits: Switch over to 2-bit RLE encoding
The 2-bit RLE encoding, in addition to supporting colour is also fully
ROMable meaning we can save 32 bytes of RAM per image by switching to
2-bit encoding.

Switch everything in icons and font.clock over to 2-bit encoding.

Note: this requires all the clock PNG files to be reencoded (because
      they were originally in 1-bit grayscale format and this is no
      longer supported by the encoder).

This reduces RAM overhead by 480 bytes and has only a negligable effect
on FLASH usage (+4 bytes).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-28 12:01:15 +00:00
Daniel Thompson
8abb6f3f4d widgets: Reduce the size of the battery icon
Currently the battery icon is overlarge compared to other status bar
icons such as the BT and notification icons (both of which are 32px
high). Fix this by redrawing the battery artwork and updating
the widgets in the status bar.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-28 11:12:16 +00:00
Daniel Thompson
ff958d154f apps: snake: Update artwork
Update the icon so it more closely resembles the in-game visual style
(and also so it compresses better) and update the screenshot since the
old one is the wrong size (FullHD instead of 358x406) and doesn't render
correctly in the documentation.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-28 10:08:15 +00:00
Daniel Thompson
f38e7f8936 apps: snake: Fix screenshots
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-27 19:35:09 +00:00
Daniel Thompson
286a5ffe2d apps: chrono: Minor visual improvements
Make the ticks and hands larger and shorten the hands slightly to avoid
visual glitches during "undraw".

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-27 18:19:07 +00:00
Daniel Thompson
b7c622c03d draw565: fix width handling for vertical and horizontal lines
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-27 18:18:14 +00:00
Johannes Wache
6d3f2126bf apps: snake: fix a couple of errors
Signed-off-by: Johannes Wache <jbwa@posteo.de>
2020-12-27 18:16:03 +00:00
Daniel Thompson
726d5c8554 apps: chrono: Implement a simple analogue watch face
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-27 09:13:49 +00:00
Daniel Thompson
0ae31a53b3 draw565: Add a polar line drawing function.
Polar coordinates are very convenient for implementing anything with
radial lines (such as a traditional watch face).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-27 09:07:06 +00:00
Daniel Thompson
8c03ddbb7a draw565: Add width to the line drawing function
Currently all lines are a single pixel wide. To draw wider lines we
must draw two parallel lines with a single pixel offset and this is
a *very* inefficient approach, espeically on ST7789 where we spend
longer setting the clipping window than we do drawing each pixel.

Fix this by constructing a line using a variable sized square rather than
a single pixel. This will "overdraw" (some pixels will be drawn more than
once) but since square blocks can be efficiently transferred to the
display the overdraw is acceptable.

Note: It is a difficult decision whether to maintain the convention that
      color is the last argument or to keep compatibility with existing
      line drawing tests. This patch opts for the former and fixes up
      all uses within the existing codebase.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-27 08:52:54 +00:00
Daniel Thompson
8a14faa668 draw565: Improve default argument values for line()
Currently there are default argument values for the start and end
coordinates but the defaults don't really make any sense since there
is no reason to prefer the value 0 over any other. Remove them.

Similarly color currently defaults to 0xffff which isn't right. It
should default to the foreground colour.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-27 08:40:45 +00:00
Daniel Thompson
2034340f3b tests: Auto-discover applications and try to switch to them
Currently `make check` doesn't test any not-default applications.
Fix this by automatically discovering constructors and ensure that the
application can be started and stopped without generating an exception.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-26 18:07:45 +00:00
Daniel Thompson
4468285c34 widgets: BatteryMeter: Fix theme handling
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>
2020-12-13 16:51:07 +00:00
Daniel Thompson
e44e605b7a apps: clock: Fix theme handling
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-13 16:51:07 +00:00
kozova1
2624a6e998 Added basic theming engine.
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>
2020-12-13 16:51:07 +00:00
Daniel Thompson
784c9bb36d apps: testapp: Automatically report free memory
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-13 16:07:24 +00:00
Daniel Thompson
338925b4a8 apps: testapp: Make the line benchmark use 360 degrees
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-12 18:19:57 +00:00
Kozova1
c17abd1728 draw565: Added line drawing function
This is the API:
drawable.line(x1, y1, x2, y2, color)

The function has optimizations for the case of vertical or horizontal lines.

Signed-off-by: Kozova1 <mug66kk@gmail.com>
[daniel@redfelineninja.org.uk: Minor update to commit message]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-12 18:18:01 +00:00
Daniel Thompson
339b835782 apps: snake: Remove redundant import
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-12 18:15:33 +00:00
Daniel Thompson
941d4a264d boards: simulator: Additional tests
Start to work (most of) the code paths in the self test application.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-12 18:15:15 +00:00
Daniel Thompson
e3b2c7bf7d boards: simulator: Improve spi.write() simulation
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-12 12:57:06 +00:00
kozova1
502efa7493 apps: settings: Add Scroll Indicator
This commit adds a ScrollIndicator widget to the settings app,
to help users realize they can scroll there.

Signed-off-by: kozova1 <mug66kk@gmail.com>
2020-12-05 20:51:27 +00:00
Daniel Thompson
896a4e1a8d simulator: Suppress the pysdl2/numpy warning
This makes the simulator look nicer when it starts up... but it
doesn't help the simulator.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-04 20:35:16 +00:00
Daniel Thompson
46bd454392 simulator: test: Grey box stopwatch test
Currently we can act on the controls but we cannot "see" the display
in the test suite. That leads us to a slightly odd form of "grey box"
testing. It's functionally black box testing but some of the asserts
have to reach inside the components instead of looking at the display.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-04 20:34:23 +00:00
Daniel Thompson
901e43870e simulator: tests: Parameterize the basic app tests
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-04 20:32:40 +00:00
Daniel Thompson
f1f5cc9e0c simulator: Introduce fully automatic testint
Currently the tests do little more than fire up the simulator and
switch into (and out of) the built in applications. However this is
useful and allows us to fully integrate as a CI job.

Unfortunately the numpy warning from pysdl2 mean we have been forced
to disable all warnings to prevent pytest from collecting and reporting
them.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-04 20:11:41 +00:00
Carlosgg
3fb1faceab Notify level in settings app
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>
2020-11-29 20:20:03 +00:00
Johannes Wache
e450ccf9f0 apps: snake: Add a snake game application
Signed-off-by: Johannes Wache <jbwa@posteo.de>
[daniel@redfelineninja.org.uk: Removed some couple of unwanted merge artifacts]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 20:08:59 +00:00
Daniel Thompson
233c136a5c apps: alarm: Add the alarm app to the library
Like the other library applications this is enabled in the simulator and
included in the flash image but is disabled by default to conserve RAM
(and to give time to new apps to mature and receive improvements).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 19:14:31 +00:00
Daniel Thompson
39c9344b14 apps: alarm: Fix touch handling when the alarm is ringing
Currently the widgets react to touch when the alarm is ringing (and they
are invisible. For now we fix this by disabling the alarm on a touch
event. Maybe the app should reject touch events since they could acidentally
dismiss the alarm... but we already disable the alarm if we get a swipe
event so this doesn't make things much worse than they already are!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 19:14:31 +00:00
Daniel Thompson
707c4e2fa7 apps: alarm: Adopt 2-bit RLE for the icon
The long term plan is to retire and remove the 1-bit RLE code from wasp-os
so we don't want new icons using that encoding.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 19:14:31 +00:00
Siroj42
27413eb5e1 apps: alarm: Add Alarm application based on the new alarm system
Signed-off-by: Joris Warmbier <siroj42@t-online.de>
2020-11-29 19:14:31 +00:00
Daniel Thompson
66cbfa20e8 sphinx: icons: Get the doc build working again
Fixes: 393dfefc86 ("apps: pager: notifications: Added remove all notifications dialog")
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 19:12:54 +00:00
Daniel Thompson
057c140f0e apps: pager: notifications: improve swipe handling
Currently the swipe handling added for the confirmation view has a number
of prolems: it does not work at all for multi-screen notifications, it
interferes with the haptic feedback if we keep swiping down and an up
swipe incorrectly dismisses whole notification app.

Fix these.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 09:12:14 +00:00
Daniel Thompson
c6d5e841a0 apps: pager: notifications: dismiss confirmation view on app exit
Currently the confirmation view remains active when we switch away from
the notification view. Ensure we dismiss when we background the
application.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 09:12:14 +00:00
Daniel Thompson
bcf616f7bc apps: pager: notifications: fix handling of touch messages
Currently there are detailed hit boxes in the confirmation view widget
but any inaccurate hit is treated as No anyway by the notification app.
Additionally selecting 'No' dismisses the whole notification app rather
than just the confirmation view.

Fix the event handling so that we ignore touches outside the hit box and
only dismiss the whole notification app if we actually clear the
notifications.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 09:12:14 +00:00
Daniel Thompson
167173e9ba widgets: ConfirmationView: Allow the widget to manage its own visibility
When the buttons are pressed then the widget should be dismissed. There
is no reason to make the caller handle that.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 09:12:14 +00:00