wasp-os: MicroPython for PineTime!
#91
(12-07-2020, 07:05 AM)purlupar Wrote:
(12-07-2020, 05:25 AM)danielt Wrote: To be honest I've never seen the simulator unreactive to these things. There are a couple of ways a broken application could cause this but you've done a fresh clone and the built-in applications are unlikely to cause this.

Either way I'd recommend starting by adding a couple of prints:

1. Check the lowest level of the simulator is correctly handling events by printing event here: https://github.com/daniel-thompson/wasp-...ay.py#L221
2. Check wasp-os is handling interrupts from the (simulated) touch screen by printing dbuf here: https://github.com/daniel-thompson/wasp-...ay.py#L105

After that follow where the prints lead and add further prints further through the stack to zoom in. If you need to learn more about the structure of wasp-os you might be able to use traceback.print_tb or pdb.set_trace from critical bits of code (the former prints a stack trace, the later enters a text mode debugger allowing you to explore dynamically)... or you can just ask here once you have gathered more evidence!

1. Gives back <sdl2.events.SDL_Event object at 0x.....
2. Gives back bytearray(b'\x03\...

Now, I realized that the simulator seems to be working -- it tells me "volume down" (for the mock music app), for example -- but not updating the simulator display (the time does not change either, for example). I'm a bit overwhelmed by deciding where to look next. What I've been doing is removing the dependencies of the simulator (requirements.txt) via pip and installing them via my distro's package manager, which my distro's wiki says is the preferred way to install python packages. The point being, this looks like a sdl-related problem if I understand correctly, and well, I have very little experience with that. Oh and the simulator's stdout tells that it does in fact refresh (I put a print there), and a lot so. What would you do next? Thanks for the advice so far!

A simple trick might be to reverse the comments in lines 57/58: https://github.com/daniel-thompson/wasp-...lay.py#L58

Using sdl2.ext.PixelView instead of sdl2.ext.pixels2d makes screen updates incredibly slow but there is a warning issued by pixels2d to say it is experimental so it is worth a try.

Might also be useful to know what distro you are running.
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye
#92
(12-10-2020, 03:55 AM)danielt Wrote: A simple trick might be to reverse the comments in lines 57/58: https://github.com/daniel-thompson/wasp-...lay.py#L58

Using sdl2.ext.PixelView instead of sdl2.ext.pixels2d makes screen updates incredibly slow but there is a warning issued by pixels2d to say it is experimental so it is worth a try.
I'm afraid that did not make it work either.

(12-10-2020, 03:55 AM)danielt Wrote: Might also be useful to know what distro you are running.

Arch, with the python modules installed as Arch (Pacman) packages. I remembered that in the beginning (spring 2020), I had exactly this problem, and then in the fall at some point it worked (i.e. the simulator was controllable by swipes/keyboard). Seems I messed it up again now. What I am up to next is further minimize down sdl hello world examples to find the issue. Or maybe start a virtual environment and install the py-modules via pip. Any pointers would be appreciated, (anyone on Arch reading this?) I feel kind of stuck!
#93
Daniel,

I have tried your OS its really good I like it Smile

Just a quick question, what is the best way to change the time?

I used to use my PinePhone to connect to the watch using bluetoothctl and manually setting the HEX bits needed to change the time using the Time Service

I tried this with wasp OS and I keep getting 

[CHG] Device D3:14:37:A9:BB:32 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device D3:14:37:A9:BB:32 Connected: no


When I look at the nrf app I can't see the time service anymore.


===========

ok I found the below, I just need to figure out how to do it.

At the end of the install process your watch will show the time (03:00) together with a date and a battery meter. When the watch goes into power saving mode you can use the button to wake it again.
At this point you will also be able to use the Nordic UART Service to access the MicroPython REPL. You can use 
Code:
tools/wasptool --console
 to access the MicroPython REPL.
To set the time and restart the main application:
[color=var(--color-prettylights-syntax-constant)]^[color=var(--color-prettylights-syntax-variable)]C[/color]
watch.rtc.[color=var(--color-prettylights-syntax-entity)]set_localtime[/color]((yyyy, mm, dd, [color=var(--color-prettylights-syntax-variable)]HH[/color], [color=var(--color-prettylights-syntax-variable)]MM[/color], [color=var(--color-prettylights-syntax-variable)]SS[/color]))
wasp.system.[color=var(--color-prettylights-syntax-entity)]run[/color]()
[/color]
Or, if you have a suitable GNU/Linux workstation, just use:
./tools/wasptool --rtc


=============================

Never mind I found what I needed now

Simply run the script (using Python 3 - Python 2 is not supported!) and it automatically connects to the first NUS console it can find. Exit using 

Code:
Ctrl-X
.
#94
If you have an Android device then you can just use GadgetBridge. I've sent the patches upstream but they are not applied at this point so you'll need to grab the .apk from the CI loop: https://github.com/daniel-thompson/gadge.../445429267

For regular laptops then ./tools/wasptool --rtc is the way to go (if they have good Bluetooth Low Energy support).

I've not 100% sure that wasptool is running on PinePhone although, in principle, it is exactly the same as running it on regular Linux (clone the repo, grab the prerequisites mentioned in the install guide and run wasptool... it will help to be using one of the desktop-ish distros such as Debian or Manjaro on the phone). Either way I suspect Marteen de Jong would almost certainly know since he has started adopting wasptool as the backend for a GUI tool he is working on: https://gitlab.com/arteeh/wasp-companion .
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye
#95
Got the modified build of gadgetbridge installed. (What an ordeal! This was not easy to do, and not very well explained.)

What functionality do we have with it? I can see it sets the time. I tried the music player. I got it to work once (I think, maybe) and pause the music, but that's all it did. Hung the watch and I had to long-press for a reboot.

UPDATE: I actually got a few more features of the music app working, it did pause/unpause and I got it to skip tracks (didn't know you could do that until I looked at the source code for it). But it's a little crashy, and locks the watch up eventually. Unsure why, just stops responding and all you can do is long-press for a reboot.
#96
To be honest I didn't know it was explained at all!

Anyhow the main thing GadgetBridge is useful for is to ensure notifications on your phone appear on your watch (and clearing them on the phone should also clear them on the watch to avoid the watch getting swamped with old messages).
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye
#97
(02-04-2020, 01:43 PM)danielt Wrote: Update 22 Nov 2020:
The wasp project is proud to announce the release of wasp-os v0.3. This release is long overdue given the step counter and heart rate monitor (which was the original target for this release) have been running since mid-July. Anyhow, the long gap between releases has allowed lots more new stuff to be added. This includes the infrastructure for notifications (just the infrastructure... a GadgetBridge port it available as a companion app for Android but currently it is available only as a source-only pre-release) together with extensive support for over-the-air updates, including support for the OTA updates to and from the new factory firmware for Pine64 PineTime devices.

https://github.com/daniel-thompson/wasp-...s/tag/v0.3

As ever all the new features have corresponding updates to the documentation meaning you can read all about the new apps and features right now at: at: https://wasp-os.readthedocs.io . You can also watch many of the new features in action by looking at some of the most recent wasp-os video blogs:

Step counting and heart rate monitoring on Pine64 PineTime
* Installing on a Pine64 PineTime running the latest factory firmware



Since I received my PineTime a couple of weeks ago I have been working whenever I have a spare moment to make my PineTime wearable. At this point I have, more or less, reached this goal! Admitedly It's not any smarter than the dumbest of my dumb watches but I've been wearing my PineTime for the last two days and I haven't been late to any meetings. That means I think its time to talk a bit more about what I have been doing.

Firstly, if you just want the code please visit: https://github.com/daniel-thompson/wasp-os (there is also a short intro video if you'd prefer)

If you're still interested in a bit more of the story... there are a great many different possible approaches to developing a firmware for a wearable like the PineTime and I wanted to experiment a bit with MicroPython to see whether I could "go fast" during development by using tools that allow for easy interactive hacking on the device itself and that also naturally shares a stack trace when I mess something up.


I've not got far enough to draw conclusions on whether MicroPython helps me get more done in my limited free time but I can certainly attest that having a REPL to send interactive commands to the ST7789 display was really good for helping me get to grips with how it actually worked (something I hope can be repeated for some of the other drivers).

As mentioned in the intro, wasp-os currently provides nothing more than a simple digital clock application for PineTime together with access to the MicroPython REPL for interactive testing and tweaking. However it keeps time well and has enough power saving functions implemented that it can survive for well over 72 hours between charges so even at this early stage it is functional as a wearable timepiece.


It also includes a bootloader based on the Adafruit nRF52 Bootloader which has been extended to make it robust for development on form-factor devices without a reset button, power switch, SWD debugger or UART. This is working well and allows me to update the main application over-the-air but there remain a few extra features that I want to get right before glueing the back on my own device (currently I am relying on double sided tape).

[Image: 0.jpg]
wasp-os: The M2 pre-release running on Pine64 PineTime
Hello, new player here. May I ask how do I launch the simulator? I am currently using a macOS system with python 3.9 installed. Where should I be typing <make sim>? Thanks in advance.
#98
TenSparklez

Hello, new player here. May I ask how do I launch the simulator? I am currently using a macOS system with python 3.9 installed. Where should I be typing <make sim>? Thanks in advance.


Update: Manage to figure it out myself and make the simulator running. Now I have a new question. If I develop a new application for the watch, how do I compile it into a new zip file that can be uploaded into the watch? Thank you very much.
#99
(02-06-2021, 09:34 PM)TenSparklez Wrote: Update: Manage to figure it out myself and make the simulator running. Now I have a new question. If I develop a new application for the watch, how do I compile it into a new zip file that can be uploaded into the watch? Thank you very much.

For small applications there is no need to compile the app into the zip file since you can just install you application over bluetooth. However if you do want to add it to the zip file (a.k.a. freezing your application into the binary), either because your laptop does not support wasptool or because the application is too large to fit into RAM then that is also possible.

All the various approaches to running your app on real hardware are described in the Application Writer's Guide: https://wasp-os.readthedocs.io/en/latest/appguide.html
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye
The wasp-os project is proud to announce the release of wasp-os v0.4. Wasp-os is a firmware for smart watches that are based on the nRF52 family of microcontrollers, and especially for hacker friendly watches such as the Pine64 PineTime. Wasp-os features full heart rate monitoring and step counting support together with multiple clock faces, a stopwatch, an alarm clock, a countdown timer, a caclulator and lots of other games and utilities. All of this, and still with access to the MicroPython REPL for interactive tweaking, development and testing.


During the v0.4 development cycle our focus was on improving the watch/phone integration whilst also taking steps to improve the general fit and finish. This release introduces a new clean-and-simple analog watch face, new button, checkbox and spinner widdgets to make UI more consist, new customization options such as a theming engine and a configuration tool that provides access to most of the new goodies without having to write a line of Python code (although Python is still fully available to those that want to make very deep customizations).

In this development cycle we have worked with the Gadgetbridge project to add wasp-os support to the latest versions of Gadgetbridge. For more information on how to obtain Gadgetbridge (hint: don't use the Play store) take a look at the appropriate wiki page.

As usual documentation is an important part of making wasp-os awesome so you can read up on how to install wasp-os and take look at all the new apps and features right now at: at: https://wasp-os.readthedocs.io

You can also see many of the new features in action by looking at some of the most recent wasp-os video blogs:

* A tour of the new applications for wasp-os
* Step counting and heart rate monitoring on Pine64 PineTime
PineTime: wasp-os and MicroPython, Pinebook Pro:  Debian Bullseye


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pinetime - Kids with special needs hidara 0 552 06-11-2024, 10:42 PM
Last Post: hidara
  Develop a new firmware for PineTime belushi 2 1,992 09-25-2023, 12:32 PM
Last Post: ccchan234
  Bluetooth BLE-MIDI-controller app for PineTime / InfiniTime Luno 0 885 08-20-2023, 05:17 AM
Last Post: Luno
  Zephyr Backlight Examples for PineTime lcj 0 1,065 05-06-2023, 02:54 PM
Last Post: lcj
  Zephyr is ready for pinetime jandy 1 2,690 05-06-2023, 02:15 PM
Last Post: lcj
  Send a message from Android to pinetime via BLE razrosman 0 1,263 11-05-2022, 08:24 AM
Last Post: razrosman
  PineTime Stuck in DFU Mode Eesha Barua 1 2,636 07-25-2022, 09:17 PM
Last Post: heyhewmike
  Idle tracking with PineTime: how versatile it is? schaman 1 2,141 07-13-2022, 12:50 AM
Last Post: wibble
  PineTime implemented with partial of pebble API jandy 0 1,879 03-20-2022, 08:58 PM
Last Post: jandy
  "Pine64 USB JTAG Adapter + OpenOCD + PineTime" should it work? ITCactus 4 4,915 03-02-2022, 05:58 AM
Last Post: wibble

Forum Jump:


Users browsing this thread: 4 Guest(s)