1
0
Fork 0
Commit Graph

646 Commits (76b6e35f9763b9e194c970658ad81bdcaefef448)

Author SHA1 Message Date
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 4e9a576a2d docs: Add some main.py examples
These still need to be integrated into the generated documentation but
there were included in the most recent wasp-os video so let's get them
into the source code.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 15:19:42 +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 e79625685d wasptool: Allow files to be renamed during an upload
For example:

    ./tools/wasptool --upload docs/main/chrono.py --as main.py

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 14:49:36 +00:00
Daniel Thompson 6de86a64ed TODO: Update the roadmap ready for a 0.4 release.
Admitedly we can become "ready" by reducing the scope a little. On the
other hand there's been some big steps forward in terms of new applications
so I'd like to refocus the 0.4 release to showcase those new apps.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 14:19:06 +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 bbfaefc97e docs: Update screenshots with new battery meter
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 20:24:16 +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 d695981323 TODO: Add new widgets to the roadmap
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 12:36:52 +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 bffd41ea44 TODO: A couple of small additions to the roadmap
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 12:28:03 +00:00
Daniel Thompson 4425d81485 tools: rle_encode: Add a parameter for direct CLUT lookup
This can be useful for hand decoding and authoring of images.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 09:05:35 +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