-
Notifications
You must be signed in to change notification settings - Fork 9
Write your own watchface
Notes:
- The wiki is bare bones, feel free to ask if something is not clear, then I will improve the wiki
TLDR: Here is a pull request adding a watchface, you can use it as a template of sorts: https://github.com/Szybet/InkWatchy/pull/16
- Copy
src/ui/watchface/watchfaces/shades_Szybet
as a template for you watchface, likesrc/ui/watchface/watchfaces/myNewWatchface_MyNick
and rename the files in the directory accordingly - go to
config.h
(And later add it tosrc/defines/templates/gifnoc-template.h
too) and add a define for you watchface, next to the other defines of other watchfaces - In your files in your new directory, change the old macro conditions to use your new define
- In
src/defines/defines.h
add your new header file like the other watchfaces are added - rename the
const watchfaceDefOne
variable name to something new - in
src/ui/watchface/watchfaceManagers/wManageAll.cpp
add your new watchfaceDef, just like the others are, then add it watchfacesList
Now when flashing and selecting the watchface, it should just show the exact copy of the watchface you copied. Also disabling it should just disable it and still compile.
- Modify the functions that are put in your watchfaceDefOne, to know what they are doing, when they are called look up comments in
src/ui/watchface/watchfaceManagers/wManageOne.h
To know how to do things, look up other watchfaces that are using this "One" mode - If you want to implement watchface modules, it's possible but will require more work, look up inkfield watchface for reference
- If you want to use custom resources (Fonts, Images) in your watchface, for images look up
resources/tools/images/img/condition
and for fontsresources/tools/fonts/condition
. It's like that for making it modular, if you disable a watchface and regenerate resources, those that are not needed won't be generated - If you want persistent data between boots (RTC memory, RTC_DATA_ATTR), look up
src/hardware/rtcMem/rtcMem.h
and add things like the others are there. Why it's like that? To use bit fields to preserve memory (mostly with bools). Moving to this method saved a whole byte - we have only 8 to use
Some possible questions:
It's just one way of doing things, look up src/ui/watchface/watchfaces/analogSharp_Szybet/analogSharp.cpp
for something more bare bones and unlimited. Using this mode forces you to add some logic to your watchface. It's present in analogSharp already.
Develop your own, look up src/ui/watchface/watchfaceManagers
and in src/ui/watchface/watchfaceManagers/wManageAll.cpp
the watchfaceManageAll
function. Just create your own "Watchface manager". You can do it in objects and classes, or even do a compatibility layer for watchfaces from other firmwares :D