summaryrefslogtreecommitdiff
path: root/wasp/wasp.py
AgeCommit message (Collapse)Author
2022-02-27fix: switch app to itself cancel vibrationsthiswillbeyourgithub
Signed-off-by: thiswillbeyourgithub <github@32mail.33mail.comm>
2021-08-23apps: Fixed weather app with GadgetBridge.Tait Berlette
When I created the weather app I didn't have GadgetBridge installed, so I tried to follow the protocol on the [espurino website](https://www.espruino.com/Gadgetbridge), but it wasn't very helpful and I made some mistakes. This commit should fix these mistakes to stop the weather app from crashing, and so it displays the correct values. I have also added a new settings option called "Units", where apps can see what units the user would prefer (metric/imperial). Signed-off-by: Tait Berlette <54515877+taitberlette@users.noreply.github.com>
2021-06-21wasp: Manager: Fix the capture of the post-init free RAMDaniel Thompson
Fixes: b59a5b1d37c3 ("wasp: Manager: Rewrite the startup logic") Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20wasp: Manager: Rewrite the startup logicDaniel Thompson
Reduce the number of applications imported by the manager and alter the way applications are initially registered to allow main.py complete control over the initial applications (but only if it wants it). Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20apps: FacesApp: Add a watch face chooserDaniel Thompson
This app is enabled by default and allows users to select a watch face based on a fullscreen preview of how the app will draw the screen. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-04manager/rtc: Experimental power saving techniqueDaniel Thompson
Currently the time is calculated 8 times per second from (relatively) slow python code. Optimize the power consumed by reducing the number of times we check for wall time updates to only once-per-second and use native code generation to reduce VM overhead when executing this critical code. At the time of writing the difference is battery life has not yet been measured (but we know the current master branch is worse than v0.4 and, in theory at least, this should close the gap). Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-03MemoryError exception now shows custom message instead of CrashApp.Tait Berlette
Signed-off-by: Tait Berlette <54515877+taitberlette@users.noreply.github.com>
2021-06-03Added weather application.Tait Berlette
Signed-off-by: Tait Berlette <54515877+taitberlette@users.noreply.github.com>
2021-06-03manager: Improve application registrationDaniel Thompson
When an application is registered using a string that gives the class name (e.g. "apps.chrono.ChronoApp") when we automatically delete the module from a couple of namespaces. This ensures the garbage collector can do a deeper clean when the application is unregistered. We also provide a means to directly register watch faces (e.g. to replace the default clock). Fixes: #214 Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-02-25apps: steps: Add a history graphDaniel Thompson
The steplogger records steps but currently there is no way to see the data recorded on the device itself. Make a first attempt at graphing the step data. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-15system: Move free memory capture into the switch methodDaniel Thompson
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-12system: Fix app unregister functionChristianRomberg
Replace undefined 'instanceof' with 'isinstance' Signed-off-by: Christian Romberg <distjubo@gmail.com>
2021-01-10system: Allows apps to be registered using stringsDaniel Thompson
Use instance tests to identify strings and substitute then for an instanciated class. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-03manager: Enable Software by defaultDaniel Thompson
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>
2020-12-31manager: Recategorize the theme labels for appsDaniel Thompson
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-31wasp: manager: Byte-swap the theme encodingDaniel Thompson
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-13widgets: BatteryMeter: Fix theme handlingDaniel Thompson
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-13Added basic theming engine.kozova1
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-13apps: testapp: Automatically report free memoryDaniel Thompson
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29Notify level in settings appCarlosgg
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-14apps: testapp: Add an alarm testDaniel Thompson
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-14manager: Implement alarm callbacks for applications to useDaniel Thompson
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-12apps: Add music player app with GadgetBridge supportCarlosgg
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-04manager: Introduce shared "system bar"Daniel Thompson
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-09-22wasp: Fix broken indentionDaniel Thompson
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-16wasp: Allow app initialization to failDaniel Thompson
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-08-15wasp: Introduce a NEXT eventDaniel Thompson
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-07-19Introduction basic notification supportDaniel Thompson
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-06-30wasp: Switch to scheduling from interruptDaniel Thompson
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-22apps: heart: Introduce simple app for the heart rate sensorDaniel Thompson
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-11drivers: cst816s: optimize for power saving and responsivenessFuji Pebri
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-09wasp: apps: Step counter applicationDaniel Thompson
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-05-14Make wasp-os namig consistantDaniel Thompson
Rename WASP to wasp-os (or Wasp-os)
2020-05-14wasp: Even more docstringsDaniel Thompson
2020-05-10wasp: apps: Remove __init__.pyDaniel Thompson
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-04-26wasp: Manager: Avoid printing the stack trace when it can cause problemsDaniel Thompson
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-14wasp: Manager: Bring in proper separation of appsDaniel Thompson
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-14wasp: Manager: Push exceptions to the console as well as the crash appDaniel Thompson
2020-04-12WIP: Introduce the quick_ringDaniel Thompson
2020-04-12wasp: apps: Add shortcuts to all appsDaniel Thompson
2020-04-11docs: Fix warnings and add a few extra apps to the docsDaniel Thompson
2020-04-11wasp: On-device crash reportingDaniel Thompson
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-10wasp: apps: Add a new (super simple) settings appDaniel Thompson
2020-04-06wasp: launcher: Experimental launcher implementationDaniel Thompson
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-06wasp: manager: make sleep() and background() callbacks optionalDaniel Thompson
Making callbacks optional reduces pointless boilerplate in applications.
2020-04-06wasp: Manager: Parameterize the keep awake timerDaniel Thompson
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-06wasp: Rename Debounce to PinHandlerDaniel Thompson
Debounce was a lousy name...
2020-04-06wasp: draw565: Allow the drawing context to be resetDaniel Thompson
The main reason to reset the drawing context is so that it can be reset before we call foreground() on an application.
2020-04-06wasp: Add button presses to the event system.Daniel Thompson
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-06wasp: Get the terminology straightDaniel Thompson
As it turned out Direction was only a Direction because there were things missing from the enumeration!