atctwo / watch-ii Goto Github PK
View Code? Open in Web Editor NEWFirmware for my custom smart-ish-watch, mark II
License: MIT License
Firmware for my custom smart-ish-watch, mark II
License: MIT License
icons are now loaded from spiffs into ram, and drawn using the drawImage()
function. this function uses TFT_eSPI::drawPixel()
for each pixel, so this could probably be rewritten or modified to use DMA methods, like TFT_eSPI::pushPixelsDMA()
.
maybe load small icons into a structure in psram from spiffs (like the app icons). this might reduce heap usage???
when the watch is left awake for a while
Commit 9612d23 added Bluetooth support, but weird issues arise when you try to enable Wifi and Bluetooth at the same time. I used a separate test sketch and verified that you can run Wifi and BT at the same time on the ESP32, so i think that if you are running the watch 2 system and Wifi and Bluetooth, then the internal RAM is filled up.
I can think of a few workarounds for this, but I don't really know what the best option is. For now, I'm going to disable bluetooth until I think of a good idea. Here are the ideas I've had:
This issue might take a while to solve. I'm going to do any Bluetooth stuff in the wifi_bt_coex branch, so new states and stuff can be worked on in the master branch (or another specialised branch).
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Also, i'm an idiot, and the commit that adds bluetooth support removes wifi profile support so when merging that branch remember this you idiot
The on screen keyboard shows that the system can have pop up windows. I think the control centre could be moved to a pop up window so that it can be accessed from every app. it will need a way to open it, one idea is having a capacitive touch panel at the top of the screen? this could also be used to implement a kind of notifications system.
maybe use this for the system screen
you can't select any box to the left or right of the currently selected box (though you can go up and down) in the calculator app. this isn't an issue in the ir remote app.
I'm experimenting with the music player app, using an I2S amplifier (max98357a), and there are some differences in the sound reproduction and watch system functioning depending on how the audio task is configured.
Core | Priority | Task Delay | Audio Quality | TFT | watch main loop |
---|---|---|---|---|---|
1 | 2 | 0 | Perfect | breaks | doesn't execute |
1 | 2 | 1 | mostly ok | breaks | executes |
0 | max - 2 | 1 | really bad | works | doesn't execute |
0 | max - 2 | 0 | really bad | works | doesn't execute |
I'm probably not going to get it working on core 0, so I will probably implement some system where the ESP soft resets once you exit playback. I've tried to reinit the screen after exiting, but that doesn't work. I wonder if the screen dies because the main loop is suspended while writing to the screen? I should also consider if I can update the screen from the audio loop.
when you have stopped playing a song, return to the directory the music file was in. this might be an issue with the file browser dialogue, though... ๐ต
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
if the profile list file doesn't contain valid json, then profiles aren't loaded at all. this has a knock-on effect, meaning that most operations that involve profiles fail (including appending profiles).
it takes a while for the watch to wake up from sleep, i think it's because the sprite that shows the time is taking ages to render before the brightness is turned up. idk what do do about this.
Here's a list of things I should do when designing v2 of the PCB:
bugs
improvements
I really want to write actual documentation for the watch2 namespace members in watch2.h, and maybe system documentation about how the system works.
This isn't really an issue concerning one specific thing; it's just a big list of ideas or things i want to research or implement. If an item is feasible, and has been mostly implemented (to a usable degree), it will be checked off the list. A lot of more specific or small or existing in-development improvements aren't listed here, but are probably listed as a separate issue
It might be a good idea to run the wifi and bluetooth state update routines on core 0. Currently, the run in the end loop method on core 1, and take up some of core 1's processor time. If the routines run on core 0, they can run independent of core 1, and if core 1 is busy (eg: music player) the wifi and bluetooth states can still be updated. This might cause issues with wifi and bluetooth, because their tasks will have to share processor time with the state tasks.
when the audio is being looped, code is used to keep track of looping. there's a library function to do this, so it might be better to use that
The on screen keyboard has arrow keys that don't do anything yet. Pls add a cursor system
the clear settings dialogue when holding down and waking the watch up doesn't work anymore. no matter what the user selects, the settings will not be erased
you could add file info to the sd test app, and use it as a kind of "file browser". if you add a file association system, you could have an open with button. file details could include
maybe print any metadata that the file has?
Whenever NTP gets the time, it always assumes the timezone is set to 0, even if it set to something that isn't 0 in the settings app.
I rely on debug messages being printed over serial to see what's happening when the device is booting (and if any errors occur). Adding a boot screen to the TFT would add another visual boot indicator (and it would look nice)
add a numeric keypad that let's you enter numbers and maybe some symbols. it could be a popup dialogue, like the keyboard. I don't really need one yet, but it might be useful later.
when the watch goes into sleep, the tft isn't turned off (just the backlight). maybe turn it off on sleep?????????????
at the minute, the json deserialisation object has 10k of heap memory, which is freed after the profile data is copied into the blah blah data structures. maybe try to calculate how much memory the json profile would need at runtime? fix it fix it fix it fix it except it isn't really broken, i just think there could be a more efficient way to do the thing
maybe use littlevgl for more stable gui stuff
this would rely on #5 working and not eating too much current
In case the screen doesn't turn back on properly on wakeup, you could pull the tft reset pin low for a bit, qnd reinit the screen. idk if that would add wakeup time or mess up TFT_eSPI.
i could add message boxes based on the on screen keyboard. i want to have an interface that lets you specify custom buttons, or just a yes/no box, or just an "ok" box.
the sdcard seems to mount fine, but i can't get a directory listing, or read any files (from hardcoded file names)
maybe add readme files to describe the layout of the codebase (eg: what each of the watch2_*.cpp files do)
It would be cool to add a error message to the weather app. if you haven't set a location, show a message that says "please set or a location" (or just skip straight to the location selection screen)
also, i should implement something similar for "not connected to wifi"
I can't design my own icons, because they look awful. Mabe i could use an existing icon set (like Papyrus). These icons will probably be in SVG format, so it might be a good idea to load the SVGs into memory on system boot (from SPIFFS or SD).
The main loop should pass the stateMeta of the current app to the function for the current app. You could refer to the current state using state
rather than watch2::states[watch2::state]
.
i want to add a state_init macro that can be used in place of if (!watch2::state_init || watch2::force_redraw)
Commit 2e6735d mostly works, although the tft backlight brightness isn't being changed when switching states. You can still set the maximum brightness and torch brightness, so ledc probably still works.
The library used for audio playback (https://github.com/earlephilhower/ESP8266Audio) supports loads of different file formats and stream types. Here is a list of what the watch 2 music player app supports (ie: what does the app have an interface for).
format | supported | date support added | performance |
---|---|---|---|
AAC | [x] | 08.06.20 | pretty good, crackly |
FLAC | [ ] | doesn't make any sound | |
MIDI | [ ] | crashes ESP | |
RTTTL | [ ] | ||
WAV | [x]ย | 08.06.20 | awful (dependant on file?) |
MP3 | [x] | 30.05.20 | pretty good |
MOD | [x] | 08.06.20 | pretty good, quiet, doesn't work with .it or .xm files |
HTTP streams | [ ] | ||
ICY streams | [ ] |
it means that lists with loads of items take ages to draw, making scrolling really awkward
maybe don't draw items if their y is less than 0 or their y is greater than screen height.
the alarms and timers don't redraw after any dialogue closes
Settings menus and the alarm and timer menus don't have any kind of scrolling.
My idea was to add a temperature reading to the control centre, beside the weather icon
I still want to make a micropython app, and I tried to get micropython working as an arduino library, but there were many issues with that. Now that the project uses ESP-IDF, it might be a lot easier to build micropython as part of the watch, and it might be easier to link to and use.
Also, this repo might help: https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo
pls fix
maybe draw the control centre, and do the weather in another task (or at least do the weather after the control centre has finished drawing)
at the moment, all the system functions are defined in one file (watch2.ino), and things are specifically targeted to the esp32. at some point, the functions should be moved to a class system.
for example:
switchState()
when compiling the watch firmware, the user can change what class is instantiated (by changing one line of code) to target different systems
Add comments to imageconverter.py please
currently, tinyexpr is installed as a custom arduino library, meaning that people who want to build the system from scratch have to install it themselves. it would make more sense to include tinyexpr's source in the src
directory of the sketch. this means that users can install one less library
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.