├── monkey.jungle
├── .gitignore
├── screenshot.png
├── resources
├── fonts
│ ├── led.png
│ ├── moon.png
│ ├── smol.png
│ ├── .DS_Store
│ ├── icons.png
│ ├── xsmol.png
│ ├── segments80.png
│ ├── fonts.xml
│ ├── moon.fnt
│ ├── icons.fnt
│ ├── led.fnt
│ ├── segments80.fnt
│ ├── segments80wide.fnt
│ ├── segments80narrow.fnt
│ ├── xsmol.fnt
│ └── smol.fnt
├── drawables
│ ├── clear.png
│ ├── w_fog.png
│ ├── w_dust.png
│ ├── w_hail.png
│ ├── w_haze.png
│ ├── w_rain.png
│ ├── w_snow.png
│ ├── parts.aseprite
│ ├── w_cloudy.png
│ ├── w_default.png
│ ├── w_thunder.png
│ ├── w_tornado.png
│ ├── sun_up_down.png
│ ├── w_heavy_rain.png
│ ├── w_heavy_snow.png
│ ├── w_hurricane.png
│ ├── w_light_rain.png
│ ├── w_light_snow.png
│ ├── w_rain_snow.png
│ ├── launcher_icon.png
│ ├── w_mostly_cloudy.png
│ ├── w_partly_cloudy.png
│ └── drawables.xml
├── strings
│ └── strings.xml
└── layouts
│ └── layout.xml
├── source
├── Segment34App.mc
└── Segment34View.mc
├── LICENSE
├── README.md
├── resources-round-240x240
└── layouts
│ └── layout.xml
├── resources-round-280x280
└── layouts
│ └── layout.xml
└── manifest.xml
/monkey.jungle:
--------------------------------------------------------------------------------
1 | project.manifest = manifest.xml
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | .DS_Store
3 | **/.DS_Store
4 | .vscode
5 | build_devices.sh
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/screenshot.png
--------------------------------------------------------------------------------
/resources/fonts/led.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/fonts/led.png
--------------------------------------------------------------------------------
/resources/fonts/moon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/fonts/moon.png
--------------------------------------------------------------------------------
/resources/fonts/smol.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/fonts/smol.png
--------------------------------------------------------------------------------
/resources/fonts/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/fonts/.DS_Store
--------------------------------------------------------------------------------
/resources/fonts/icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/fonts/icons.png
--------------------------------------------------------------------------------
/resources/fonts/xsmol.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/fonts/xsmol.png
--------------------------------------------------------------------------------
/resources/drawables/clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/clear.png
--------------------------------------------------------------------------------
/resources/drawables/w_fog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_fog.png
--------------------------------------------------------------------------------
/resources/strings/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Segment34
3 |
4 |
--------------------------------------------------------------------------------
/resources/drawables/w_dust.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_dust.png
--------------------------------------------------------------------------------
/resources/drawables/w_hail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_hail.png
--------------------------------------------------------------------------------
/resources/drawables/w_haze.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_haze.png
--------------------------------------------------------------------------------
/resources/drawables/w_rain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_rain.png
--------------------------------------------------------------------------------
/resources/drawables/w_snow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_snow.png
--------------------------------------------------------------------------------
/resources/fonts/segments80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/fonts/segments80.png
--------------------------------------------------------------------------------
/resources/drawables/parts.aseprite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/parts.aseprite
--------------------------------------------------------------------------------
/resources/drawables/w_cloudy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_cloudy.png
--------------------------------------------------------------------------------
/resources/drawables/w_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_default.png
--------------------------------------------------------------------------------
/resources/drawables/w_thunder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_thunder.png
--------------------------------------------------------------------------------
/resources/drawables/w_tornado.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_tornado.png
--------------------------------------------------------------------------------
/resources/drawables/sun_up_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/sun_up_down.png
--------------------------------------------------------------------------------
/resources/drawables/w_heavy_rain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_heavy_rain.png
--------------------------------------------------------------------------------
/resources/drawables/w_heavy_snow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_heavy_snow.png
--------------------------------------------------------------------------------
/resources/drawables/w_hurricane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_hurricane.png
--------------------------------------------------------------------------------
/resources/drawables/w_light_rain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_light_rain.png
--------------------------------------------------------------------------------
/resources/drawables/w_light_snow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_light_snow.png
--------------------------------------------------------------------------------
/resources/drawables/w_rain_snow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_rain_snow.png
--------------------------------------------------------------------------------
/resources/drawables/launcher_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/launcher_icon.png
--------------------------------------------------------------------------------
/resources/drawables/w_mostly_cloudy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_mostly_cloudy.png
--------------------------------------------------------------------------------
/resources/drawables/w_partly_cloudy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ludw/Segment34/HEAD/resources/drawables/w_partly_cloudy.png
--------------------------------------------------------------------------------
/resources/fonts/fonts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/source/Segment34App.mc:
--------------------------------------------------------------------------------
1 | import Toybox.Application;
2 | import Toybox.Lang;
3 | import Toybox.WatchUi;
4 |
5 | class Segment34App extends Application.AppBase {
6 |
7 | function initialize() {
8 | AppBase.initialize();
9 | }
10 |
11 | // onStart() is called on application start up
12 | function onStart(state as Dictionary?) as Void {
13 | }
14 |
15 | // onStop() is called when your application is exiting
16 | function onStop(state as Dictionary?) as Void {
17 | }
18 |
19 | // Return the initial view of your application here
20 | function getInitialView() {
21 | return [ new Segment34View() ] ;
22 | }
23 |
24 | }
25 |
26 | function getApp() as Segment34App {
27 | return Application.getApp() as Segment34App;
28 | }
--------------------------------------------------------------------------------
/resources/fonts/moon.fnt:
--------------------------------------------------------------------------------
1 | info face="Moon" size=20 bold=0 italic=0 smooth=1 spacing=1,1
2 | common lineHeight=20 base=20 scaleW=156 scaleH=20 pages=1
3 | page id=0 file="moon.png"
4 | chars count=8
5 |
6 | char id=48 x=0 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0
7 | char id=49 x=21 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0
8 | char id=50 x=42 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0
9 | char id=51 x=63 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0
10 | char id=52 x=84 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0
11 | char id=53 x=105 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0
12 | char id=54 x=126 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0
13 | char id=55 x=147 y=0 width=20 height=20 xoffset=0 yoffset=0 xadvance=20 page=0
--------------------------------------------------------------------------------
/resources/fonts/icons.fnt:
--------------------------------------------------------------------------------
1 | info face="Icons" size=20 bold=0 italic=0 smooth=1 spacing=1,1
2 | common lineHeight=20 base=20 scaleW=200 scaleH=20 pages=1
3 | page id=0 file="icons.png"
4 | chars count=3
5 | char id=104 x=0 y=0 width=15 height=20 xoffset=3 yoffset=0 xadvance=22 page=0
6 | char id=72 x=16 y=0 width=15 height=20 xoffset=3 yoffset=0 xadvance=22 page=0
7 |
8 | char id=48 x=32 y=0 width=7 height=20 xoffset=0 yoffset=0 xadvance=8 page=0
9 | char id=49 x=41 y=0 width=11 height=20 xoffset=0 yoffset=0 xadvance=12 page=0
10 | char id=50 x=54 y=0 width=13 height=20 xoffset=0 yoffset=0 xadvance=14 page=0
11 | char id=51 x=69 y=0 width=11 height=20 xoffset=0 yoffset=0 xadvance=12 page=0
12 | char id=52 x=82 y=0 width=7 height=20 xoffset=0 yoffset=0 xadvance=8 page=0
13 | char id=53 x=91 y=0 width=11 height=20 xoffset=0 yoffset=0 xadvance=12 page=0
14 | char id=54 x=104 y=0 width=13 height=20 xoffset=0 yoffset=0 xadvance=14 page=0
15 | char id=55 x=119 y=0 width=11 height=20 xoffset=0 yoffset=0 xadvance=12 page=0
--------------------------------------------------------------------------------
/resources/fonts/led.fnt:
--------------------------------------------------------------------------------
1 | info face="LED" size=20 bold=0 italic=0 smooth=1 spacing=1,1
2 | common lineHeight=20 base=20 scaleW=204 scaleH=20 pages=1
3 | page id=0 file="led.png"
4 | chars count=11
5 | char id=48 x=0 y=0 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0
6 | char id=49 x=18 y=0 width=8 height=20 xoffset=3 yoffset=0 xadvance=14 page=0
7 | char id=50 x=30 y=0 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0
8 | char id=51 x=48 y=0 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0
9 | char id=52 x=66 y=0 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0
10 | char id=53 x=84 y=0 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0
11 | char id=54 x=102 y=0 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0
12 | char id=55 x=120 y=0 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0
13 | char id=56 x=138 y=0 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0
14 | char id=57 x=156 y=0 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0
15 | char id=45 x=172 y=0 width=14 height=20 xoffset=2 yoffset=0 xadvance=18 page=0
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 Ludvig Wadenstein
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/resources/fonts/segments80.fnt:
--------------------------------------------------------------------------------
1 | info face="Segments 80" size=80 bold=0 italic=0 smooth=1 spacing=2,2
2 | common lineHeight=80 base=80 scaleW=503 scaleH=80 pages=1
3 | page id=0 file="segments80.png"
4 | chars count=11
5 | char id=35 x=0 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
6 | char id=49 x=42 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
7 | char id=50 x=84 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
8 | char id=51 x=126 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
9 | char id=52 x=168 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
10 | char id=53 x=210 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
11 | char id=54 x=252 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
12 | char id=55 x=294 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
13 | char id=56 x=336 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
14 | char id=57 x=378 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
15 | char id=48 x=420 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
16 | char id=58 x=462 y=0 width=42 height=80 xoffset=3 yoffset=0 xadvance=46 page=0
--------------------------------------------------------------------------------
/resources/fonts/segments80wide.fnt:
--------------------------------------------------------------------------------
1 | info face="Segments 80" size=80 bold=0 italic=0 smooth=1 spacing=2,2
2 | common lineHeight=80 base=80 scaleW=503 scaleH=80 pages=1
3 | page id=0 file="segments80.png"
4 | chars count=11
5 | char id=35 x=0 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
6 | char id=49 x=42 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
7 | char id=50 x=84 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
8 | char id=51 x=126 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
9 | char id=52 x=168 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
10 | char id=53 x=210 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
11 | char id=54 x=252 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
12 | char id=55 x=294 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
13 | char id=56 x=336 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
14 | char id=57 x=378 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
15 | char id=48 x=420 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
16 | char id=58 x=462 y=0 width=42 height=80 xoffset=4 yoffset=0 xadvance=48 page=0
--------------------------------------------------------------------------------
/resources/fonts/segments80narrow.fnt:
--------------------------------------------------------------------------------
1 | info face="Segments 80" size=80 bold=0 italic=0 smooth=1 spacing=2,2
2 | common lineHeight=80 base=80 scaleW=503 scaleH=80 pages=1
3 | page id=0 file="segments80.png"
4 | chars count=11
5 | char id=35 x=0 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
6 | char id=49 x=42 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
7 | char id=50 x=84 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
8 | char id=51 x=126 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
9 | char id=52 x=168 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
10 | char id=53 x=210 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
11 | char id=54 x=252 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
12 | char id=55 x=294 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
13 | char id=56 x=336 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
14 | char id=57 x=378 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
15 | char id=48 x=420 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
16 | char id=58 x=462 y=0 width=42 height=80 xoffset=1 yoffset=0 xadvance=44 page=0
--------------------------------------------------------------------------------
/resources/drawables/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Segment34
2 | A watchface for Garmin Fenix 6 with a 34 Segment display
3 |
4 | 
5 |
6 | The watchface features the following:
7 |
8 | - Time displayed with a 34 segment display
9 | - Phase of the moon with graphic display
10 | - Heartrate
11 | - Weather (conditions, temperature and windspeed)
12 | - Sunrise/Sunset
13 | - Date, week number
14 | - Notification count
15 | - Time to recovery
16 | - Active minutes per week
17 | - Steps
18 | - Battery days remaining as bar
19 |
20 | The watchface have no settings screen and is currently not published to the IQ Connect store.
21 |
22 | ## Buy me a coffee (if you want to)
23 | [](https://ko-fi.com/M4M51A1RGV)
24 |
25 | ## Builds
26 | There are pre-made builds for compatible watches in the builds folder.
27 |
28 | Use the build in the:
29 | - fenix6 folder for Fenix 6 and Fenix 6 Pro.
30 | - fenix7 folder for Fenix 7, Fenix 7 Pro and Fenix 8 Solar 47mm.
31 | - fr255 folder for Forerunner 255 and 255 Music.
32 | - fr955 folder for Forerunner 955.
33 | - fenix6xpro folder for Fenix 6X Pro, Enduro and Decent Mk2
34 | - fenix7x folder for Fenix 7X, Fenix 7X Pro, Fenix 7X Pro Solar, Fenix 8 Solar 51mm, Enduro 3
35 |
36 | Connect your watch via usb and transfer the Segment34.prg file to the GARMIN/Apps folder on the watch.
37 |
--------------------------------------------------------------------------------
/resources/layouts/layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/resources-round-240x240/layouts/layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/resources-round-280x280/layouts/layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
59 |
60 |
61 |
62 |
63 |
67 |
68 | eng
69 |
70 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/resources/fonts/xsmol.fnt:
--------------------------------------------------------------------------------
1 | info face="XSmol" size=5 bold=0 italic=0 smooth=1 spacing=1,1
2 | common lineHeight=5 base=5 scaleW=179 scaleH=13 pages=1
3 | page id=0 file="xsmol.png"
4 | chars count=30
5 |
6 | char id=65 x=0 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
7 | char id=66 x=6 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
8 | char id=67 x=13 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
9 | char id=68 x=20 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
10 | char id=69 x=26 y=0 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
11 | char id=70 x=32 y=0 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
12 | char id=71 x=38 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
13 | char id=72 x=44 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
14 | char id=73 x=51 y=0 width=1 height=5 xoffset=0 yoffset=0 xadvance=2 page=0
15 | char id=74 x=55 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
16 | char id=75 x=61 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
17 | char id=76 x=68 y=0 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
18 | char id=77 x=74 y=0 width=5 height=5 xoffset=0 yoffset=0 xadvance=6 page=0
19 | char id=78 x=81 y=0 width=5 height=5 xoffset=0 yoffset=0 xadvance=6 page=0
20 | char id=79 x=89 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
21 | char id=80 x=96 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
22 | char id=81 x=102 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
23 | char id=82 x=109 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
24 | char id=83 x=116 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
25 | char id=84 x=122 y=0 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
26 | char id=85 x=128 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
27 | char id=86 x=135 y=0 width=5 height=5 xoffset=0 yoffset=0 xadvance=6 page=0
28 | char id=87 x=142 y=0 width=5 height=5 xoffset=0 yoffset=0 xadvance=6 page=0
29 | char id=88 x=150 y=0 width=5 height=5 xoffset=0 yoffset=0 xadvance=6 page=0
30 | char id=89 x=158 y=0 width=5 height=5 xoffset=0 yoffset=0 xadvance=6 page=0
31 | char id=90 x=165 y=0 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
32 | char id=91 x=171 y=0 width=2 height=5 xoffset=0 yoffset=0 xadvance=3 page=0
33 | char id=93 x=175 y=0 width=2 height=5 xoffset=0 yoffset=0 xadvance=3 page=0
34 | char id=32 x=177 y=0 width=1 height=5 xoffset=0 yoffset=0 xadvance=3 page=0
35 |
36 | char id=33 x=0 y=7 width=1 height=5 xoffset=0 yoffset=0 xadvance=2 page=0
37 | char id=34 x=3 y=7 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
38 | char id=35 x=9 y=7 width=5 height=5 xoffset=0 yoffset=0 xadvance=6 page=0
39 | char id=36 x=18 y=7 width=2 height=5 xoffset=0 yoffset=0 xadvance=3 page=0
40 | char id=37 x=23 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
41 | char id=38 x=31 y=7 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
42 | char id=39 x=38 y=7 width=1 height=5 xoffset=0 yoffset=0 xadvance=2 page=0
43 | char id=40 x=41 y=7 width=2 height=5 xoffset=0 yoffset=0 xadvance=3 page=0
44 | char id=41 x=46 y=7 width=2 height=5 xoffset=0 yoffset=0 xadvance=3 page=0
45 | char id=42 x=51 y=7 width=5 height=5 xoffset=0 yoffset=0 xadvance=6 page=0
46 | char id=43 x=59 y=7 width=5 height=5 xoffset=0 yoffset=0 xadvance=6 page=0
47 | char id=44 x=65 y=7 width=2 height=5 xoffset=0 yoffset=0 xadvance=3 page=0
48 | char id=45 x=70 y=7 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
49 | char id=46 x=75 y=7 width=1 height=5 xoffset=0 yoffset=0 xadvance=2 page=0
50 | char id=47 x=79 y=7 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
51 | char id=48 x=84 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
52 | char id=49 x=91 y=7 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
53 | char id=50 x=97 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
54 | char id=51 x=103 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
55 | char id=52 x=110 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
56 | char id=53 x=117 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
57 | char id=54 x=123 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
58 | char id=55 x=130 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
59 | char id=56 x=137 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
60 | char id=57 x=143 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
61 | char id=58 x=149 y=7 width=1 height=5 xoffset=0 yoffset=0 xadvance=2 page=0
62 | char id=59 x=152 y=7 width=2 height=5 xoffset=0 yoffset=0 xadvance=3 page=0
63 | char id=60 x=157 y=7 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
64 | char id=61 x=162 y=7 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
65 | char id=62 x=168 y=7 width=3 height=5 xoffset=0 yoffset=0 xadvance=4 page=0
66 | char id=63 x=174 y=7 width=4 height=5 xoffset=0 yoffset=0 xadvance=5 page=0
--------------------------------------------------------------------------------
/resources/fonts/smol.fnt:
--------------------------------------------------------------------------------
1 | info face="Smol" size=8 bold=0 italic=0 smooth=1 spacing=1,1
2 | common lineHeight=8 base=8 scaleW=244 scaleH=16 pages=1
3 | page id=0 file="smol.png"
4 | chars count=60
5 |
6 | char id=65 x=0 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
7 | char id=66 x=8 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
8 | char id=67 x=16 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
9 | char id=68 x=24 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
10 | char id=69 x=32 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
11 | char id=70 x=41 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
12 | char id=71 x=48 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
13 | char id=72 x=56 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
14 | char id=73 x=65 y=0 width=3 height=8 xoffset=0 yoffset=0 xadvance=4 page=0
15 | char id=74 x=72 y=0 width=4 height=8 xoffset=0 yoffset=0 xadvance=5 page=0
16 | char id=75 x=80 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
17 | char id=76 x=89 y=0 width=4 height=8 xoffset=0 yoffset=0 xadvance=5 page=0
18 | char id=77 x=95 y=0 width=6 height=8 xoffset=0 yoffset=0 xadvance=7 page=0
19 | char id=78 x=104 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
20 | char id=79 x=113 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
21 | char id=80 x=120 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
22 | char id=81 x=128 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
23 | char id=82 x=136 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
24 | char id=83 x=144 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
25 | char id=84 x=152 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
26 | char id=85 x=160 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
27 | char id=86 x=168 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
28 | char id=87 x=175 y=0 width=7 height=8 xoffset=0 yoffset=0 xadvance=8 page=0
29 | char id=88 x=184 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
30 | char id=89 x=192 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
31 | char id=90 x=200 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
32 | char id=91 x=210 y=0 width=2 height=8 xoffset=0 yoffset=0 xadvance=3 page=0
33 | char id=92 x=217 y=0 width=4 height=8 xoffset=0 yoffset=0 xadvance=5 page=0
34 | char id=93 x=226 y=0 width=2 height=8 xoffset=0 yoffset=0 xadvance=3 page=0
35 | char id=32 x=205 y=0 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
36 | char id=97 x=231 y=0 width=3 height=8 xoffset=0 yoffset=0 xadvance=4 page=0
37 | char id=98 x=236 y=0 width=2 height=8 xoffset=0 yoffset=0 xadvance=3 page=0
38 | char id=99 x=240 y=0 width=3 height=8 xoffset=0 yoffset=0 xadvance=4 page=0
39 |
40 | char id=33 x=0 y=8 width=1 height=8 xoffset=0 yoffset=0 xadvance=2 page=0
41 | char id=34 x=7 y=8 width=4 height=8 xoffset=0 yoffset=0 xadvance=5 page=0
42 | char id=35 x=14 y=8 width=6 height=8 xoffset=0 yoffset=0 xadvance=7 page=0
43 | char id=36 x=22 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
44 | char id=37 x=30 y=8 width=7 height=8 xoffset=0 yoffset=0 xadvance=8 page=0
45 |
46 | char id=38 x=38 y=8 width=6 height=8 xoffset=0 yoffset=0 xadvance=7 page=0
47 | char id=39 x=48 y=8 width=2 height=8 xoffset=0 yoffset=0 xadvance=3 page=0
48 | char id=40 x=56 y=8 width=2 height=8 xoffset=0 yoffset=0 xadvance=3 page=0
49 | char id=41 x=64 y=8 width=2 height=8 xoffset=0 yoffset=0 xadvance=3 page=0
50 | char id=42 x=70 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
51 | char id=43 x=78 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
52 | char id=44 x=88 y=8 width=2 height=8 xoffset=0 yoffset=0 xadvance=3 page=0
53 | char id=45 x=95 y=8 width=4 height=8 xoffset=0 yoffset=0 xadvance=5 page=0
54 | char id=46 x=104 y=8 width=1 height=8 xoffset=0 yoffset=0 xadvance=2 page=0
55 | char id=47 x=111 y=8 width=4 height=8 xoffset=0 yoffset=0 xadvance=5 page=0
56 | char id=48 x=118 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
57 | char id=49 x=126 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
58 | char id=50 x=134 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
59 | char id=51 x=142 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
60 | char id=52 x=150 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
61 | char id=53 x=158 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
62 | char id=54 x=166 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
63 | char id=55 x=174 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
64 | char id=56 x=182 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
65 | char id=57 x=190 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
66 | char id=58 x=200 y=8 width=1 height=8 xoffset=0 yoffset=0 xadvance=2 page=0
67 | char id=59 x=208 y=8 width=2 height=8 xoffset=0 yoffset=0 xadvance=3 page=0
68 | char id=60 x=215 y=8 width=3 height=8 xoffset=0 yoffset=0 xadvance=4 page=0
69 | char id=61 x=222 y=8 width=6 height=8 xoffset=0 yoffset=0 xadvance=7 page=0
70 | char id=62 x=232 y=8 width=3 height=8 xoffset=0 yoffset=0 xadvance=4 page=0
71 | char id=63 x=238 y=8 width=5 height=8 xoffset=0 yoffset=0 xadvance=6 page=0
--------------------------------------------------------------------------------
/source/Segment34View.mc:
--------------------------------------------------------------------------------
1 | import Toybox.Graphics;
2 | import Toybox.Lang;
3 | import Toybox.System;
4 | import Toybox.WatchUi;
5 | import Toybox.ActivityMonitor;
6 | import Toybox.Application;
7 | import Toybox.Weather;
8 | import Toybox.Time;
9 | import Toybox.Math;
10 | import Toybox.SensorHistory;
11 |
12 | const INTEGER_FORMAT = "%d";
13 |
14 | class Segment34View extends WatchUi.WatchFace {
15 |
16 | private var isSleeping = false;
17 | private var lastCondition = null;
18 | private var lastUpdate = null;
19 |
20 | function initialize() {
21 | WatchFace.initialize();
22 | }
23 |
24 | // Load your resources here
25 | function onLayout(dc as Dc) as Void {
26 | setLayout(Rez.Layouts.WatchFace(dc));
27 | }
28 |
29 | // Called when this View is brought to the foreground. Restore
30 | // the state of this View and prepare it to be shown. This includes
31 | // loading resources into memory.
32 | function onShow() as Void {
33 | }
34 |
35 | // Update the view
36 | function onUpdate(dc as Dc) as Void {
37 | // Get and show the current time
38 | var clockTime = System.getClockTime();
39 | var now = Time.now().value();
40 |
41 | var secLabel = View.findDrawableById("SecondsLabel") as Text;
42 | if(isSleeping) {
43 | secLabel.setText("");
44 | } else {
45 | var secString = Lang.format("$1$", [clockTime.sec.format("%02d")]);
46 | secLabel.setText(secString);
47 | }
48 |
49 | if(clockTime.sec % 2 == 0) {
50 | setHR(dc);
51 | setHRIcons(dc);
52 | setNotif(dc);
53 | }
54 |
55 | if(lastUpdate != null && now - lastUpdate < 30 && clockTime.sec % 60 != 0) {
56 | View.onUpdate(dc);
57 | setStressAndBodyBattery(dc);
58 | setWeatherIcon(dc);
59 | return;
60 | }
61 | var hour = clockTime.hour;
62 | if(!System.getDeviceSettings().is24Hour) {
63 | hour = hour % 12;
64 | if(hour == 0) { hour = 12; }
65 | }
66 | var timeString = Lang.format("$1$:$2$", [hour.format("%02d"), clockTime.min.format("%02d")]);
67 | var timelabel = View.findDrawableById("TimeLabel") as Text;
68 | timelabel.setText(timeString);
69 |
70 |
71 | // time background
72 | var timebg = View.findDrawableById("TimeBg") as Text;
73 | timebg.setText("#####");
74 |
75 | setMoon(dc);
76 | setWeather(dc);
77 | setSunUpDown(dc);
78 | setDate(dc);
79 | setStep(dc);
80 | setTraining(dc);
81 | setBatt(dc);
82 |
83 | View.onUpdate(dc);
84 | setStressAndBodyBattery(dc);
85 | setWeatherIcon(dc);
86 |
87 | lastUpdate = now;
88 | }
89 |
90 | function onPartialUpdate(dc) {
91 | }
92 |
93 | function onPowerBudgetExceeded() {
94 | System.println("Power budget exceeded");
95 | }
96 |
97 | hidden function setHRIcons(dc) as Void {
98 | var hrIconW = View.findDrawableById("HRIconW") as Text;
99 | var hrIconR = View.findDrawableById("HRIconR") as Text;
100 |
101 | if (isSleeping) {
102 | hrIconR.setText("h");
103 | hrIconW.setText("H");
104 | } else {
105 | hrIconR.setText("H");
106 | hrIconW.setText("h");
107 | }
108 |
109 | }
110 |
111 | hidden function setMoon(dc) as Void {
112 | var now = Time.now();
113 | var today = Time.Gregorian.info(now, Time.FORMAT_SHORT);
114 | var moonVal = moon_phase(today);
115 | var moonLabel = View.findDrawableById("MoonLabel") as Text;
116 | moonLabel.setText(moonVal);
117 | }
118 |
119 | hidden function setHR(dc) as Void {
120 | var value = "";
121 | // Try to retrieve live HR from Activity::Info
122 | var activityInfo = Activity.getActivityInfo();
123 | var sample = activityInfo.currentHeartRate;
124 | if (sample != null) {
125 | value = sample.format(INTEGER_FORMAT);
126 | } else if (ActivityMonitor has :getHeartRateHistory) {
127 | // Falling back to historical HR from ActivityMonitor
128 | sample = ActivityMonitor.getHeartRateHistory(1, /* newestFirst */ true).next();
129 | if ((sample != null) && (sample.heartRate != ActivityMonitor.INVALID_HR_SAMPLE)) {
130 | value = sample.heartRate.format(INTEGER_FORMAT);
131 | }
132 | }
133 |
134 | var hrLabel = View.findDrawableById("HRLabel") as Text;
135 | hrLabel.setText(value);
136 | hrLabel.draw(dc);
137 | }
138 |
139 | hidden function setBatt(dc) as Void {
140 | var value = "";
141 | var sample = System.getSystemStats().battery / 5;
142 | for(var i = 0; i < sample; i++) {
143 | value += "$";
144 | }
145 | var battLabel = View.findDrawableById("BattLabel") as Text;
146 | battLabel.setText(value);
147 | }
148 |
149 | hidden function setWeather(dc) as Void {
150 | var weather = Weather.getCurrentConditions();
151 | if (weather == null) { return; }
152 | lastCondition = weather.condition;
153 | if(lastCondition == null) { return; }
154 |
155 | if(weather.temperature != null) {
156 | var tempUnit = System.getDeviceSettings().temperatureUnits;
157 | var temp = weather.temperature;
158 | var tempLabel = View.findDrawableById("TempLabel") as Text;
159 | if(tempUnit != System.UNIT_METRIC) {
160 | temp = (temp * 9/5) + 32;
161 | }
162 | tempLabel.setText(temp.format(INTEGER_FORMAT));
163 | }
164 |
165 | var windLabel = View.findDrawableById("WindLabel") as Text;
166 | if(weather.windSpeed != null) {
167 | windLabel.setText(weather.windSpeed.format(INTEGER_FORMAT));
168 | }
169 |
170 | if(weather.windBearing != null) {
171 | var windIcon = View.findDrawableById("WindIcon") as Text;
172 | var bearing = (Math.round((weather.windBearing.toFloat() + 180) / 45.0).toNumber() % 8).format(INTEGER_FORMAT);
173 | windIcon.setText(bearing);
174 | }
175 | }
176 |
177 | hidden function setWeatherIcon(dc) as Void {
178 | var icon;
179 | if(lastCondition == null) {
180 | return;
181 | }
182 | /*
183 |
184 | Remaining weathers:
185 |
186 | CONDITION_WINDY
187 | CONDITION_ICE
188 | CONDITION_SQUALL
189 | CONDITION_FLURRIES
190 | CONDITION_FREEZING_RAIN
191 | CONDITION_ICE_SNOW
192 |
193 | */
194 |
195 |
196 | switch(lastCondition) {
197 | case Weather.CONDITION_MOSTLY_CLEAR:
198 | case Weather.CONDITION_CLEAR:
199 | icon = Application.loadResource( Rez.Drawables.w_clear ) as BitmapResource;
200 | break;
201 | case Weather.CONDITION_FAIR:
202 | case Weather.CONDITION_THIN_CLOUDS:
203 | case Weather.CONDITION_PARTLY_CLEAR:
204 | case Weather.CONDITION_PARTLY_CLOUDY:
205 | icon = Application.loadResource( Rez.Drawables.w_partly_cloudy ) as BitmapResource;
206 | break;
207 | case Weather.CONDITION_MOSTLY_CLOUDY:
208 | icon = Application.loadResource( Rez.Drawables.w_mostly_cloudy ) as BitmapResource;
209 | break;
210 | case Weather.CONDITION_CLOUDY:
211 | icon = Application.loadResource( Rez.Drawables.w_cloudy ) as BitmapResource;
212 | break;
213 | case Weather.CONDITION_CLOUDY_CHANCE_OF_RAIN:
214 | case Weather.CONDITION_CHANCE_OF_SHOWERS:
215 | case Weather.CONDITION_SHOWERS:
216 | case Weather.CONDITION_SCATTERED_SHOWERS:
217 | case Weather.CONDITION_UNKNOWN_PRECIPITATION:
218 | case Weather.CONDITION_RAIN:
219 | icon = Application.loadResource( Rez.Drawables.w_rain ) as BitmapResource;
220 | break;
221 | case Weather.CONDITION_LIGHT_SHOWERS:
222 | case Weather.CONDITION_DRIZZLE:
223 | case Weather.CONDITION_LIGHT_RAIN:
224 | icon = Application.loadResource( Rez.Drawables.w_light_rain ) as BitmapResource;
225 | break;
226 | case Weather.CONDITION_HEAVY_SHOWERS:
227 | case Weather.CONDITION_HEAVY_RAIN:
228 | icon = Application.loadResource( Rez.Drawables.w_heavy_rain ) as BitmapResource;
229 | break;
230 | case Weather.CONDITION_CLOUDY_CHANCE_OF_RAIN_SNOW:
231 | case Weather.CONDITION_CHANCE_OF_RAIN_SNOW:
232 | case Weather.CONDITION_LIGHT_RAIN_SNOW:
233 | case Weather.CONDITION_HEAVY_RAIN_SNOW:
234 | case Weather.CONDITION_SLEET:
235 | case Weather.CONDITION_WINTRY_MIX:
236 | case Weather.CONDITION_RAIN_SNOW:
237 | icon = Application.loadResource( Rez.Drawables.w_rain_snow ) as BitmapResource;
238 | break;
239 | case Weather.CONDITION_CLOUDY_CHANCE_OF_SNOW:
240 | case Weather.CONDITION_CHANCE_OF_SNOW:
241 | case Weather.CONDITION_FLURRIES:
242 | case Weather.CONDITION_SNOW:
243 | icon = Application.loadResource( Rez.Drawables.w_snow ) as BitmapResource;
244 | break;
245 | case Weather.CONDITION_LIGHT_SNOW:
246 | icon = Application.loadResource( Rez.Drawables.w_light_snow ) as BitmapResource;
247 | break;
248 | case Weather.CONDITION_HEAVY_SNOW:
249 | icon = Application.loadResource( Rez.Drawables.w_heavy_snow ) as BitmapResource;
250 | break;
251 | case Weather.CONDITION_MIST:
252 | case Weather.CONDITION_FOG:
253 | icon = Application.loadResource( Rez.Drawables.w_fog ) as BitmapResource;
254 | break;
255 | case Weather.CONDITION_HAZY:
256 | case Weather.CONDITION_HAZE:
257 | icon = Application.loadResource( Rez.Drawables.w_haze ) as BitmapResource;
258 | break;
259 | case Weather.CONDITION_VOLCANIC_ASH:
260 | case Weather.CONDITION_SMOKE:
261 | case Weather.CONDITION_SAND:
262 | case Weather.CONDITION_SANDSTORM:
263 | case Weather.CONDITION_DUST:
264 | icon = Application.loadResource( Rez.Drawables.w_dust ) as BitmapResource;
265 | break;
266 | case Weather.CONDITION_HAIL:
267 | icon = Application.loadResource( Rez.Drawables.w_hail ) as BitmapResource;
268 | break;
269 | case Weather.CONDITION_THUNDERSTORMS:
270 | case Weather.CONDITION_SCATTERED_THUNDERSTORMS:
271 | case Weather.CONDITION_CHANCE_OF_THUNDERSTORMS:
272 | icon = Application.loadResource( Rez.Drawables.w_thunder ) as BitmapResource;
273 | break;
274 | case Weather.CONDITION_TROPICAL_STORM:
275 | case Weather.CONDITION_HURRICANE:
276 | icon = Application.loadResource( Rez.Drawables.w_hurricane ) as BitmapResource;
277 | break;
278 | case Weather.CONDITION_TORNADO:
279 | icon = Application.loadResource( Rez.Drawables.w_tornado ) as BitmapResource;
280 | break;
281 | default:
282 | icon = Application.loadResource( Rez.Drawables.w_default ) as BitmapResource;
283 | }
284 | dc.drawBitmap((dc.getWidth() / 2) - 30, 23, icon);
285 |
286 | }
287 |
288 | hidden function setSunUpDown(dc) as Void {
289 | var weather = Weather.getCurrentConditions();
290 | var sunUpLabel = View.findDrawableById("SunUpLabel") as Text;
291 | var sunDownLabel = View.findDrawableById("SunDownLabel") as Text;
292 | var now = Time.now();
293 | if(weather == null) {
294 | return;
295 | }
296 | var loc = weather.observationLocationPosition;
297 | if(loc == null) {
298 | return;
299 | }
300 | var sunrise = Time.Gregorian.info(Weather.getSunrise(loc, now), Time.FORMAT_SHORT);
301 | var sunset = Time.Gregorian.info(Weather.getSunset(loc, now), Time.FORMAT_SHORT);
302 | sunUpLabel.setText(sunrise.hour.format(INTEGER_FORMAT));
303 | sunDownLabel.setText(sunset.hour.format(INTEGER_FORMAT));
304 | }
305 |
306 | hidden function setNotif(dc) as Void {
307 | var value = "";
308 | var sample = System.getDeviceSettings().notificationCount;
309 | if(sample > 0) {
310 | value = sample.format("%01d");
311 | }
312 | var notifLabel = View.findDrawableById("NotifLabel") as Text;
313 | notifLabel.setText(value);
314 | }
315 |
316 | hidden function setDate(dc) as Void {
317 | var dateLabel = View.findDrawableById("DateLabel") as Text;
318 | var now = Time.now();
319 | var today = Time.Gregorian.info(now, Time.FORMAT_SHORT);
320 | var week = iso_week_number(today.year, today.month, today.day).toString();
321 |
322 | var value = Lang.format("$1$, $2$ $3$ $4$ (W $5$)" , [
323 | day_name(today.day_of_week),
324 | today.day,
325 | month_name(today.month),
326 | today.year,
327 | week
328 | ]).toUpper();
329 | dateLabel.setText(value);
330 | }
331 |
332 | hidden function setStep(dc) as Void {
333 | var stepLabel = View.findDrawableById("StepLabel") as Text;
334 | var stepCount = ActivityMonitor.getInfo().steps.format("%05d");
335 | stepLabel.setText(stepCount);
336 | }
337 |
338 | hidden function setStressAndBodyBattery(dc) as Void {
339 | var batt = 0;
340 | var stress = 0;
341 |
342 | if ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory) && (Toybox.SensorHistory has :getStressHistory)) {
343 | // Set up the method with parameters
344 | var bbIterator = Toybox.SensorHistory.getBodyBatteryHistory({:period => 1});
345 | var stIterator = Toybox.SensorHistory.getStressHistory({:period => 1});
346 | var bb = bbIterator.next();
347 | var st = stIterator.next();
348 | var barTop = 91;
349 | var fromEdge = 10;
350 | var barWidth = 3;
351 | var bbAdjustment = 0;
352 | if(dc.getHeight() == 240) {
353 | barTop = 81;
354 | fromEdge = 6;
355 | barWidth = 2;
356 | bbAdjustment = 1;
357 | }
358 | if(dc.getHeight() == 280) {
359 | fromEdge = 14;
360 | barWidth = 4;
361 | bbAdjustment = -1;
362 | }
363 | if(bb != null) {
364 | batt = Math.round(bb.data * 0.80);
365 | dc.setColor(0x00AAFF, -1);
366 | dc.fillRectangle(dc.getWidth() - fromEdge - barWidth - bbAdjustment, barTop + (80 - batt), barWidth, batt);
367 | }
368 | if(st != null) {
369 | stress = Math.round(st.data * 0.80);
370 | dc.setColor(0xFFAA00, -1);
371 | dc.fillRectangle(fromEdge, barTop + (80 - stress), barWidth, stress);
372 | }
373 | }
374 | }
375 |
376 | hidden function setTraining(dc) as Void {
377 | var TTRDesc = View.findDrawableById("TTRDesc") as Text;
378 | var TTRLabel = View.findDrawableById("TTRLabel") as Text;
379 | var TTRReady = View.findDrawableById("TTRReady") as Text;
380 |
381 | if(ActivityMonitor.getInfo().timeToRecovery == null || ActivityMonitor.getInfo().timeToRecovery == 0) {
382 | TTRReady.setText("FULLY\nRECOVERED");
383 | TTRLabel.setText("");
384 | TTRDesc.setText("");
385 | } else {
386 | TTRReady.setText("");
387 | TTRDesc.setText("HOURS TO\nRECOVERY");
388 | if(dc.getHeight() == 240) {
389 | TTRDesc.setText("HRS TO\nRECOV.");
390 | }
391 |
392 | var ttr = ActivityMonitor.getInfo().timeToRecovery.format("%03d");
393 | TTRLabel.setText(ttr);
394 | }
395 |
396 | var ActiveDesc = View.findDrawableById("ActiveDesc") as Text;
397 | ActiveDesc.setText("WEEKLY\nACTIVE MIN");
398 |
399 | if(dc.getHeight() == 240) {
400 | ActiveDesc.setText("WEEKLY\nMIN");
401 | }
402 |
403 | var ActiveLabel = View.findDrawableById("ActiveLabel") as Text;
404 | var active = "";
405 | if(ActivityMonitor.getInfo().activeMinutesWeek != null) {
406 | if(ActivityMonitor.getInfo().activeMinutesWeek.total > 999) {
407 | active = ActivityMonitor.getInfo().activeMinutesWeek.total.format("%04d");
408 | ActiveDesc.setText("");
409 | } else {
410 | active = ActivityMonitor.getInfo().activeMinutesWeek.total.format("%03d");
411 | }
412 | ActiveLabel.setText(active);
413 | }
414 |
415 | }
416 |
417 | // Called when this View is removed from the screen. Save the
418 | // state of this View here. This includes freeing resources from
419 | // memory.
420 | function onHide() as Void {
421 | }
422 |
423 | // The user has just looked at their watch. Timers and animations may be started here.
424 | function onExitSleep() as Void {
425 | isSleeping = false;
426 | }
427 |
428 | // Terminate any active timers and prepare for slow updates.
429 | function onEnterSleep() as Void {
430 | isSleeping = true;
431 | }
432 |
433 | hidden function day_name(day_of_week) {
434 | var names = [
435 | "SUNDAY",
436 | "MONDAY",
437 | "TUESDAY",
438 | "WEDNESDAY",
439 | "THURSDAY",
440 | "FRIDAY",
441 | "SATURDAY",
442 | ];
443 | return names[day_of_week - 1];
444 | }
445 |
446 | hidden function month_name(month) {
447 | var names = [
448 | "JANUARY",
449 | "FEBRUARY",
450 | "MARCH",
451 | "APRIL",
452 | "MAY",
453 | "JUNE",
454 | "JULY",
455 | "AUGUST",
456 | "SEPTEMBER",
457 | "OCTOBER",
458 | "NOVEMBER",
459 | "DECEMBER"
460 | ];
461 | return names[month - 1];
462 | }
463 |
464 | hidden function iso_week_number(year, month, day) {
465 | var first_day_of_year = julian_day(year, 1, 1);
466 | var given_day_of_year = julian_day(year, month, day);
467 | var day_of_week = (first_day_of_year + 3) % 7;
468 | var week_of_year = (given_day_of_year - first_day_of_year + day_of_week + 4) / 7;
469 | if (week_of_year == 53) {
470 | if (day_of_week == 6) {
471 | return week_of_year;
472 | } else if (day_of_week == 5 && is_leap_year(year)) {
473 | return week_of_year;
474 | } else {
475 | return 1;
476 | }
477 | }
478 | else if (week_of_year == 0) {
479 | first_day_of_year = julian_day(year - 1, 1, 1);
480 | day_of_week = (first_day_of_year + 3) % 7;
481 | return (given_day_of_year - first_day_of_year + day_of_week + 4) / 7;
482 | }
483 | else {
484 | return week_of_year;
485 | }
486 | }
487 |
488 |
489 | hidden function julian_day(year, month, day) {
490 | var a = (14 - month) / 12;
491 | var y = (year + 4800 - a);
492 | var m = (month + 12 * a - 3);
493 | return day + ((153 * m + 2) / 5) + (365 * y) + (y / 4) - (y / 100) + (y / 400) - 32045;
494 | }
495 |
496 |
497 | hidden function is_leap_year(year) {
498 | if (year % 4 != 0) {
499 | return false;
500 | } else if (year % 100 != 0) {
501 | return true;
502 | } else if (year % 400 == 0) {
503 | return true;
504 | }
505 | return false;
506 | }
507 |
508 | hidden function moon_phase(time) {
509 | var jd = julian_day(time.year, time.month, time.day);
510 |
511 | var days_since_new_moon = jd - 2459966;
512 | var lunar_cycle = 29.53;
513 | var phase = ((days_since_new_moon / lunar_cycle) * 100).toNumber() % 100;
514 | var into_cycle = (phase / 100.0) * lunar_cycle;
515 |
516 | if (into_cycle < 3) { // 2+1
517 | return "0";
518 | } else if (into_cycle < 6) { // 4
519 | return "1";
520 | } else if (into_cycle < 10) { // 4
521 | return "2";
522 | } else if (into_cycle < 14) { // 4
523 | return "3";
524 | } else if (into_cycle < 18) { // 4
525 | return "4";
526 | } else if (into_cycle < 22) { // 4
527 | return "5";
528 | } else if (into_cycle < 26) { // 4
529 | return "6";
530 | } else if (into_cycle < 29) { // 3
531 | return "7";
532 | } else {
533 | return "0";
534 | }
535 |
536 | }
537 |
538 | }
539 |
--------------------------------------------------------------------------------