<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pine64.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kieranc</id>
	<title>PINE64 - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pine64.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kieranc"/>
	<link rel="alternate" type="text/html" href="https://wiki.pine64.org/wiki/Special:Contributions/Kieranc"/>
	<updated>2026-04-26T06:08:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19660</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19660"/>
		<updated>2023-05-20T08:11:55Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PineTimeStyle Watchface ==&lt;br /&gt;
&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim 2023-04-12 225527.png|PineTimeStyle Watchface]]&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting. An indicator will appear in the bottom left corner if 12h is selected.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected, and a lower case '''i''' which indicates unread notifications are available, generally only if notifications are disabled via the quick settings screen.&lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count, the needle will rotate in a clockwise direction as the step count increases. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. As of version 1.11, an addition page of customisation has been added which allows the user to customise the sidebar. These settings can be accessed by long pressing on the watchface which will display two buttons, one with a palette icon to access the color settings, one with a cog icon for the sidebar options.&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim 2023-04-12 225546.png|PineTimeStyle Settings Button]] &lt;br /&gt;
&lt;br /&gt;
=== The color picker ===&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim 2023-04-12 225551.png|PineTimeStyle Color Settings Interface]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, a 'Rst' button which resets the colors to standard teal and black, and a cross which closes the settings interface. It can also be closed using the physical button.&lt;br /&gt;
&lt;br /&gt;
=== The sidebar settings ===&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim_2023-04-12_225559.png|PineTimeStyle Sidebar Settings]]&lt;br /&gt;
&lt;br /&gt;
As of Infinitime version 1.13, there are 2 options available in the sidebar settings page - Steps style and Weather.&lt;br /&gt;
&lt;br /&gt;
By pressing the 'Steps style' button you can toggle between 3 options, the original full gauge, a half size gauge plus seconds display, or a numerical step count display. The second button, Weather, enables or disables this function. When no weather data is available a ban icon will be displayed with 2 dashes below, and when weather data is available the current temperature plus an icon showing conditions based on the cloud cover and precipitation amount.&lt;br /&gt;
To learn more about the sending weather data to the watch, [https://wiki.pine64.org/wiki/Infinitime-Weather click here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=Infinitime-Weather&amp;diff=19659</id>
		<title>Infinitime-Weather</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=Infinitime-Weather&amp;diff=19659"/>
		<updated>2023-05-19T20:32:44Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: /* Displaying weather data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Infinitime features a weather subsystem which stores weather data on the watch in a timeline which can be queried by apps or watchfaces. It can store many different types of data (see [https://github.com/InfiniTimeOrg/InfiniTime/blob/main/src/components/ble/weather/WeatherData.h here]) and each entry includes a timestamp and an expiry time. When entries expire they are removed from the timeline automatically.&lt;br /&gt;
&lt;br /&gt;
== Sending weather data to the watch ==&lt;br /&gt;
&lt;br /&gt;
Weather data must be sent to the watch via a companion app, currently Gadgetbridge and ITD have this functionality implemented. &lt;br /&gt;
ITD is the easiest option as the feature simply needs enabling in the config file with a location specified. It uses MET.no data and provides one hour of data at a time.&lt;br /&gt;
Gadgetbridge is slightly more difficult to set up as it requires a separate app to fetch the weather data. Details are available on the [https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Weather Gadgetbridge wiki]. There is currently (May 2023) a bug in the Pinetime implementation within Gadgetbridge which sets the expiry time to 5 minutes instead of the desired 6 hours, it should be resolved in the next available Gadgetbridge release.&lt;br /&gt;
&lt;br /&gt;
== Displaying weather data ==&lt;br /&gt;
&lt;br /&gt;
Currently there are 2 ways to display weather data on the watch, a debug app  which is disabled by default, and the PineTimeStyle watchface.&lt;br /&gt;
&lt;br /&gt;
The easiest way to enable the debug app is to change the entry for the navigation app in DisplayApp.cpp to load the weather debug app instead:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    case Apps::Navigation:&lt;br /&gt;
      //currentScreen = std::make_unique&amp;lt;Screens::Navigation&amp;gt;(this, systemTask-&amp;gt;nimble().navigation());&lt;br /&gt;
      currentScreen = std::make_unique&amp;lt;Screens::Weather&amp;gt;(this, systemTask-&amp;gt;nimble().weather());&lt;br /&gt;
      break;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19658</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19658"/>
		<updated>2023-05-19T20:24:19Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PineTimeStyle Watchface ==&lt;br /&gt;
&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim 2023-04-12 225527.png|PineTimeStyle Watchface]]&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting. An indicator will appear in the bottom left corner if 12h is selected.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected, and a lower case '''i''' which indicates unread notifications are available, generally only if notifications are disabled via the quick settings screen.&lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count, the needle will rotate in a clockwise direction as the step count increases. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. As of version 1.11, an addition page of customisation has been added which allows the user to customise the sidebar. These settings can be accessed by long pressing on the watchface which will display two buttons, one with a palette icon to access the color settings, one with a cog icon for the sidebar options.&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim 2023-04-12 225546.png|PineTimeStyle Settings Button]] &lt;br /&gt;
&lt;br /&gt;
=== The color picker ===&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim 2023-04-12 225551.png|PineTimeStyle Color Settings Interface]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, a 'Rst' button which resets the colors to standard teal and black, and a cross which closes the settings interface. It can also be closed using the physical button.&lt;br /&gt;
&lt;br /&gt;
=== The sidebar settings ===&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim_2023-04-12_225559.png|PineTimeStyle Sidebar Settings]]&lt;br /&gt;
&lt;br /&gt;
As of Infinitime version 1.13, there are 2 options available in the sidebar settings page - Steps style and Weather.&lt;br /&gt;
&lt;br /&gt;
By pressing the 'Steps style' button you can toggle between 3 options, the original full gauge, a half size gauge plus seconds display, or a numerical step count display. The image above shows the half gauge plus seconds. The second button, Weather, enables or disables this function. When no weather data is available a ban icon will be displayed with 2 dashes below, and when weather data is available the current temperature plus an icon showing conditions based on the cloud cover and precipitation amount.&lt;br /&gt;
To learn more about the sending weather data to the watch, [https://wiki.pine64.org/wiki/Infinitime-Weather click here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:InfiniSim_2023-04-12_225527.png&amp;diff=19657</id>
		<title>File:InfiniSim 2023-04-12 225527.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:InfiniSim_2023-04-12_225527.png&amp;diff=19657"/>
		<updated>2023-05-19T20:24:01Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Licensing ==&lt;br /&gt;
{{PD|PD}}&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19656</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19656"/>
		<updated>2023-05-19T20:23:30Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PineTimeStyle Watchface ==&lt;br /&gt;
&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Watchface.png|PineTimeStyle Watchface]]&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting. An indicator will appear in the bottom left corner if 12h is selected.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected, and a lower case '''i''' which indicates unread notifications are available, generally only if notifications are disabled via the quick settings screen.&lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count, the needle will rotate in a clockwise direction as the step count increases. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. As of version 1.11, an addition page of customisation has been added which allows the user to customise the sidebar. These settings can be accessed by long pressing on the watchface which will display two buttons, one with a palette icon to access the color settings, one with a cog icon for the sidebar options.&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim 2023-04-12 225546.png|PineTimeStyle Settings Button]] &lt;br /&gt;
&lt;br /&gt;
=== The color picker ===&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim 2023-04-12 225551.png|PineTimeStyle Color Settings Interface]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, a 'Rst' button which resets the colors to standard teal and black, and a cross which closes the settings interface. It can also be closed using the physical button.&lt;br /&gt;
&lt;br /&gt;
=== The sidebar settings ===&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim_2023-04-12_225559.png|PineTimeStyle Sidebar Settings]]&lt;br /&gt;
&lt;br /&gt;
As of Infinitime version 1.13, there are 2 options available in the sidebar settings page - Steps style and Weather.&lt;br /&gt;
&lt;br /&gt;
By pressing the 'Steps style' button you can toggle between 3 options, the original full gauge, a half size gauge plus seconds display, or a numerical step count display. The image above shows the half gauge plus seconds. The second button, Weather, enables or disables this function. When no weather data is available a ban icon will be displayed with 2 dashes below, and when weather data is available the current temperature plus an icon showing conditions based on the cloud cover and precipitation amount.&lt;br /&gt;
To learn more about the sending weather data to the watch, [https://wiki.pine64.org/wiki/Infinitime-Weather click here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:InfiniSim_2023-04-12_225546.png&amp;diff=19655</id>
		<title>File:InfiniSim 2023-04-12 225546.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:InfiniSim_2023-04-12_225546.png&amp;diff=19655"/>
		<updated>2023-05-19T20:23:13Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Licensing ==&lt;br /&gt;
{{PD|PD}}&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19654</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19654"/>
		<updated>2023-05-19T20:22:54Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PineTimeStyle Watchface ==&lt;br /&gt;
&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Watchface.png|PineTimeStyle Watchface]]&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting. An indicator will appear in the bottom left corner if 12h is selected.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected, and a lower case '''i''' which indicates unread notifications are available, generally only if notifications are disabled via the quick settings screen.&lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count, the needle will rotate in a clockwise direction as the step count increases. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. As of version 1.11, an addition page of customisation has been added which allows the user to customise the sidebar. These settings can be accessed by long pressing on the watchface which will display two buttons, one with a palette icon to access the color settings, one with a cog icon for the sidebar options.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Settings-1.11.png|PineTimeStyle Settings Button]] &lt;br /&gt;
&lt;br /&gt;
=== The color picker ===&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim 2023-04-12 225551.png|PineTimeStyle Color Settings Interface]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, a 'Rst' button which resets the colors to standard teal and black, and a cross which closes the settings interface. It can also be closed using the physical button.&lt;br /&gt;
&lt;br /&gt;
=== The sidebar settings ===&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim_2023-04-12_225559.png|PineTimeStyle Sidebar Settings]]&lt;br /&gt;
&lt;br /&gt;
As of Infinitime version 1.13, there are 2 options available in the sidebar settings page - Steps style and Weather.&lt;br /&gt;
&lt;br /&gt;
By pressing the 'Steps style' button you can toggle between 3 options, the original full gauge, a half size gauge plus seconds display, or a numerical step count display. The image above shows the half gauge plus seconds. The second button, Weather, enables or disables this function. When no weather data is available a ban icon will be displayed with 2 dashes below, and when weather data is available the current temperature plus an icon showing conditions based on the cloud cover and precipitation amount.&lt;br /&gt;
To learn more about the sending weather data to the watch, [https://wiki.pine64.org/wiki/Infinitime-Weather click here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:InfiniSim_2023-04-12_225551.png&amp;diff=19653</id>
		<title>File:InfiniSim 2023-04-12 225551.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:InfiniSim_2023-04-12_225551.png&amp;diff=19653"/>
		<updated>2023-05-19T20:22:36Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Licensing ==&lt;br /&gt;
{{PD|PD}}&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19651</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19651"/>
		<updated>2023-05-19T20:05:56Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PineTimeStyle Watchface ==&lt;br /&gt;
&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Watchface.png|PineTimeStyle Watchface]]&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting. An indicator will appear in the bottom left corner if 12h is selected.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected, and a lower case '''i''' which indicates unread notifications are available, generally only if notifications are disabled via the quick settings screen.&lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count, the needle will rotate in a clockwise direction as the step count increases. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. As of version 1.11, an addition page of customisation has been added which allows the user to customise the sidebar. These settings can be accessed by long pressing on the watchface which will display two buttons, one with a palette icon to access the color settings, one with a cog icon for the sidebar options.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Settings-1.11.png|PineTimeStyle Settings Button]] &lt;br /&gt;
&lt;br /&gt;
=== The color picker ===&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Settings.png|PineTimeStyle Color Settings Interface]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, a 'Rst' button which resets the colors to standard teal and black, and a cross which closes the settings interface. It can also be closed using the physical button.&lt;br /&gt;
&lt;br /&gt;
=== The sidebar settings ===&lt;br /&gt;
&lt;br /&gt;
[[File:InfiniSim_2023-04-12_225559.png|PineTimeStyle Sidebar Settings]]&lt;br /&gt;
&lt;br /&gt;
As of Infinitime version 1.13, there are 2 options available in the sidebar settings page - Steps style and Weather.&lt;br /&gt;
&lt;br /&gt;
By pressing the 'Steps style' button you can toggle between 3 options, the original full gauge, a half size gauge plus seconds display, or a numerical step count display. The image above shows the half gauge plus seconds. The second button, Weather, enables or disables this function. When no weather data is available a ban icon will be displayed with 2 dashes below, and when weather data is available the current temperature plus an icon showing conditions based on the cloud cover and precipitation amount.&lt;br /&gt;
To learn more about the sending weather data to the watch, [https://wiki.pine64.org/wiki/Infinitime-Weather click here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:InfiniSim_2023-04-12_225559.png&amp;diff=19650</id>
		<title>File:InfiniSim 2023-04-12 225559.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:InfiniSim_2023-04-12_225559.png&amp;diff=19650"/>
		<updated>2023-05-19T20:05:22Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: PineTimeStyle options page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
PineTimeStyle options page&lt;br /&gt;
== Licensing ==&lt;br /&gt;
{{PD|PD}}&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19649</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=19649"/>
		<updated>2023-05-19T20:00:42Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PineTimeStyle Watchface ==&lt;br /&gt;
&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Watchface.png|PineTimeStyle Watchface]]&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting. An indicator will appear in the bottom left corner if 12h is selected.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected, and a lower case '''i''' which indicates unread notifications are available, generally only if notifications are disabled via the quick settings screen.&lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count, the needle will rotate in a clockwise direction as the step count increases. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
== Customisation ==&lt;br /&gt;
&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. As of version 1.11, an addition page of customisation has been added which allows the user to customise the sidebar. These settings can be accessed by long pressing on the watchface which will display two buttons, one with a palette icon to access the color settings, one with a cog icon for the sidebar options.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Settings-1.11.png|PineTimeStyle Settings Button]] &lt;br /&gt;
&lt;br /&gt;
=== The color picker ===&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Settings.png|PineTimeStyle Color Settings Interface]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, a 'Rst' button which resets the colors to standard teal and black, and a cross which closes the settings interface. It can also be closed using the physical button.&lt;br /&gt;
&lt;br /&gt;
=== The sidebar settings ===&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-SidebarSettings.png|PineTimeStyle Sidebar Settings]]&lt;br /&gt;
&lt;br /&gt;
As of Infinitime version 1.13, there are 2 options available in the sidebar settings page - Steps style and Weather.&lt;br /&gt;
By pressing the 'Steps style' button you can toggle between 3 options, the original full gauge, a half size gauge plus seconds display, or a numerical step count display. The image above shows the half gauge plus seconds. The second button, Weather, enables or disables this function. When no weather data is available a ban icon will be displayed with 2 dashes below, and when weather data is available the current temperature plus an icon showing conditions based on the cloud cover and precipitation amount.&lt;br /&gt;
To learn more about the sending weather data to the watch, [https://wiki.pine64.org/wiki/Infinitime-Weather click here].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:PineTimeStyle-SidebarSettings.png&amp;diff=19648</id>
		<title>File:PineTimeStyle-SidebarSettings.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:PineTimeStyle-SidebarSettings.png&amp;diff=19648"/>
		<updated>2023-05-19T19:58:59Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: Kieranc uploaded a new version of File:PineTimeStyle-SidebarSettings.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=Infinitime-Weather&amp;diff=19647</id>
		<title>Infinitime-Weather</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=Infinitime-Weather&amp;diff=19647"/>
		<updated>2023-05-19T19:55:29Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: Removed redirect to User:Kieranc/Infinitime-Weather&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Infinitime features a weather subsystem which stores weather data on the watch in a timeline which can be queried by apps or watchfaces. It can store many different types of data (see [https://github.com/InfiniTimeOrg/InfiniTime/blob/main/src/components/ble/weather/WeatherData.h here]) and each entry includes a timestamp and an expiry time. When entries expire they are removed from the timeline automatically.&lt;br /&gt;
&lt;br /&gt;
== Sending weather data to the watch ==&lt;br /&gt;
&lt;br /&gt;
Weather data must be sent to the watch via a companion app, currently Gadgetbridge and ITD have this functionality implemented. &lt;br /&gt;
ITD is the easiest option as the feature simply needs enabling in the config file with a location specified. It uses MET.no data and provides one hour of data at a time.&lt;br /&gt;
Gadgetbridge is slightly more difficult to set up as it requires a separate app to fetch the weather data. Details are available on the [https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Weather Gadgetbridge wiki]. There is currently (May 2023) a bug in the Pinetime implementation within Gadgetbridge which sets the expiry time to 5 minutes instead of the desired 6 hours, it should be resolved in the next available Gadgetbridge release.&lt;br /&gt;
&lt;br /&gt;
== Displaying weather data ==&lt;br /&gt;
&lt;br /&gt;
Currently there are 2 ways to display weather data on the watch, a debug app  which is disabled by default, and the PineTimeStyle watchface.&lt;br /&gt;
&lt;br /&gt;
TODO: Add details for enabling debug app&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=User:Kieranc/Infinitime-Weather&amp;diff=19571</id>
		<title>User:Kieranc/Infinitime-Weather</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=User:Kieranc/Infinitime-Weather&amp;diff=19571"/>
		<updated>2023-05-01T12:39:33Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: Initial draft of info about weather data on Infinitime&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Infinitime Weather==&lt;br /&gt;
&lt;br /&gt;
Infinitime features a weather subsystem which stores weather data on the watch in a timeline which can be queried by apps or watchfaces. It can store many different types of data ([https://github.com/InfiniTimeOrg/InfiniTime/blob/main/src/components/ble/weather/WeatherData.h see here]) and each entry includes a timestamp and an expiry time. When entries expire they are removed from the timeline automatically.&lt;br /&gt;
&lt;br /&gt;
===Sending weather data to the watch===&lt;br /&gt;
&lt;br /&gt;
Weather data must be sent to the watch via a companion app, currently Gadgetbridge and ITD have this functionality implemented. &lt;br /&gt;
ITD is the easiest option as the feature simply needs enabling in the config file with a location specified. It uses MET.no data and provides one hour of data at a time.&lt;br /&gt;
Gadgetbridge is slightly more difficult to set up as it requires a separate app to fetch the weather data. Details are available on the [https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Weather Gadgetbridge wiki]. There is currently (May 2023) a bug in the Pinetime implementation within Gadgetbridge which sets the expiry time to 5 minutes instead of the desired 6 hours, it should be resolved in the next available Gadgetbridge release.&lt;br /&gt;
&lt;br /&gt;
===Displaying weather data===&lt;br /&gt;
Currently there are 2 ways to display weather data on the watch, a debug app  which is disabled by default, and the PineTimeStyle watchface.&lt;br /&gt;
&amp;lt;Add details for enabling debug app&amp;gt;&lt;br /&gt;
PineTimeStyle can display basic weather data in the sidebar when the option is enabled, see details here [[PineTimeStyle]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=14515</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=14515"/>
		<updated>2022-10-18T19:10:51Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: /* Customisation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTimeStyle Watchface=&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Watchface.png|PineTimeStyle Watchface]]&lt;br /&gt;
&lt;br /&gt;
==Layout==&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting. An indicator will appear in the bottom left corner if 12h is selected.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected, and a lower case '''i''' which indicates unread notifications are available, generally only if notifications are disabled via the quick settings screen.&lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count, the needle will rotate in a clockwise direction as the step count increases. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
=Customisation=&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. As of version 1.11, an addition page of customisation has been added which allows the user to customise the sidebar. These settings can be accessed by long pressing on the watchface which will display two buttons, one with a palette icon to access the color settings, one with a cog icon for the sidebar options.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Settings-1.11.png|PineTimeStyle Settings Button]] &lt;br /&gt;
&lt;br /&gt;
==The color picker==&lt;br /&gt;
[[File:PineTimeStyle-Settings.png|PineTimeStyle Color Settings Interface]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, a 'Rst' button which resets the colors to standard teal and black, and a cross which closes the settings interface. It can also be closed using the physical button.&lt;br /&gt;
&lt;br /&gt;
==The sidebar settings==&lt;br /&gt;
[[File:PineTimeStyle-SidebarSettings.png|PineTimeStyle Sidebar Settings]]&lt;br /&gt;
&lt;br /&gt;
The sidebar settings currently only has one option, for the step gauge style. By pressing the 'Steps style' button you can toggle between 3 options, the original full gauge, a half size gauge plus seconds display, or a numerical step count display. The image above shows the half gauge plus seconds. Further options will be added in the future!&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:PineTimeStyle-SidebarSettings.png&amp;diff=14514</id>
		<title>File:PineTimeStyle-SidebarSettings.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:PineTimeStyle-SidebarSettings.png&amp;diff=14514"/>
		<updated>2022-10-18T19:06:29Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:PineTimeStyle-Settings-1.11.png&amp;diff=14513</id>
		<title>File:PineTimeStyle-Settings-1.11.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:PineTimeStyle-Settings-1.11.png&amp;diff=14513"/>
		<updated>2022-10-18T19:04:21Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=13199</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=13199"/>
		<updated>2022-06-18T11:56:39Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: /* Layout */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTimeStyle Watchface=&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Watchface.png|PineTimeStyle Watchface]]&lt;br /&gt;
&lt;br /&gt;
==Layout==&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting. An indicator will appear in the bottom left corner if 12h is selected.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected, and a lower case '''i''' which indicates unread notifications are available, generally only if notifications are disabled via the quick settings screen.&lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count, the needle will rotate in a clockwise direction as the step count increases. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
==Customisation==&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. It can be accessed by long pressing on the watchface which will display a button with a cog icon - if you press this button, the settings will open. &lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-SettingsButton.png|PineTimeStyle Settings Button]] [[File:PineTimeStyle-Settings.png|PineTimeStyle Settings Interface]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, a 'Rst' button which resets the colors to standard teal and black, and a cross which closes the settings interface. It can also be closed using the physical button.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=13198</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=13198"/>
		<updated>2022-06-18T11:55:27Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: /* Layout */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTimeStyle Watchface=&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Watchface.png|PineTimeStyle Watchface]]&lt;br /&gt;
&lt;br /&gt;
==Layout==&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting. An indicator will appear in the bottom left corner if 12h is selected.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected, and a lower case '''i''' which indicates unread notifications are available, generally only if notifications are disabled via the quick settings screen.&lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
==Customisation==&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. It can be accessed by long pressing on the watchface which will display a button with a cog icon - if you press this button, the settings will open. &lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-SettingsButton.png|PineTimeStyle Settings Button]] [[File:PineTimeStyle-Settings.png|PineTimeStyle Settings Interface]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, a 'Rst' button which resets the colors to standard teal and black, and a cross which closes the settings interface. It can also be closed using the physical button.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=13197</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=13197"/>
		<updated>2022-06-18T11:53:46Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: Update documentation and images for new version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTimeStyle Watchface=&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-Watchface.png|PineTimeStyle Watchface]]&lt;br /&gt;
&lt;br /&gt;
==Layout==&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting. An indicator will appear in the bottom left corner if 12h is selected.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected, and a lower case '''i''' which indicates unread notifications are available. The notification icon only appears when notifications are disabled via the quick settings screen.&lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Customisation==&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. It can be accessed by long pressing on the watchface which will display a button with a cog icon - if you press this button, the settings will open. &lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-SettingsButton.png|PineTimeStyle Settings Button]] [[File:PineTimeStyle-Settings.png|PineTimeStyle Settings Interface]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, a 'Rst' button which resets the colors to standard teal and black, and a cross which closes the settings interface. It can also be closed using the physical button.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:PineTimeStyle-Settings.png&amp;diff=13196</id>
		<title>File:PineTimeStyle-Settings.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:PineTimeStyle-Settings.png&amp;diff=13196"/>
		<updated>2022-06-18T11:50:28Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:PineTimeStyle-SettingsButton.png&amp;diff=13195</id>
		<title>File:PineTimeStyle-SettingsButton.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:PineTimeStyle-SettingsButton.png&amp;diff=13195"/>
		<updated>2022-06-18T11:49:46Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:PineTimeStyle-Watchface.png&amp;diff=13194</id>
		<title>File:PineTimeStyle-Watchface.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:PineTimeStyle-Watchface.png&amp;diff=13194"/>
		<updated>2022-06-18T11:48:19Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=Switching_your_PineTime_between_InfiniTime_and_Wasp-os&amp;diff=12606</id>
		<title>Switching your PineTime between InfiniTime and Wasp-os</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=Switching_your_PineTime_between_InfiniTime_and_Wasp-os&amp;diff=12606"/>
		<updated>2022-02-27T13:50:44Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Flash-reloader-mcuboot.jpg|600px|thumb|right|Flashing &amp;lt;code&amp;gt;reloader-mcuboot.zip&amp;lt;/code&amp;gt;]]&lt;br /&gt;
[[File:Flash-micropython.jpg|400px|thumb|right|Flashing &amp;lt;code&amp;gt;micropython.zip&amp;lt;/code&amp;gt;]]&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Both Infinitime and Wasp-os are very cool OS'es for the [[PineTime]] and many people will want to try both. This is possible, even with a sealed device!&lt;br /&gt;
&lt;br /&gt;
Both devices use the same Nordic (legacy) DFU protocol for updating firmware over the air. But the BLE stack and the bootloaders for both are different. That's why we need to use the [https://github.com/daniel-thompson/wasp-reloader reloader]. However, instructions you find elsewhere (including [https://www.youtube.com/watch?v=lPasAt1LJmo Daniel Thompsons video]) are somewhat outdated.&lt;br /&gt;
&lt;br /&gt;
Flashing can be done with any of&lt;br /&gt;
* nRF Connect for Mobile ([https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp Android], [https://apps.apple.com/us/app/nrf-connect-bluetooth-app/id1054362403 iOS])&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4)&lt;br /&gt;
* [https://github.com/piggz/harbour-amazfish Amazfish] (SailfishOS and Linux)&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux desktop and Pinephone) (Use the 'Manual OTA File' option)&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows)&lt;br /&gt;
* ota-dfu-python (Linux CLI) which is included in sources of both Infinitime and Wasp-os&lt;br /&gt;
** &amp;lt;code&amp;gt;InfiniTime/bootloader/ota-dfu-python/dfu.py&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;wasp-os/tools/ota-dfu-python/dfu.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This guide has been last updated for Infinitime 1.1.0 and Wasp-os 0.4.1&lt;br /&gt;
&lt;br /&gt;
== InfiniTime =&amp;gt; Wasp-os ==&lt;br /&gt;
&lt;br /&gt;
All the zips you need can be found from the [https://wasp-os.readthedocs.io/en/latest/install.html#binary-downloads wasp-os installation guide].&lt;br /&gt;
&lt;br /&gt;
* Make sure the watch is running Infinitime and can be found by your companion device (PC, phone, etc).&lt;br /&gt;
* First we need to flash the reloader, with the wasp-os bootloader as payload. To do this, flash: &amp;lt;br&amp;gt;&amp;lt;code&amp;gt;wasp-os-0.4/build-pinetime/reloader-mcuboot.zip&amp;lt;/code&amp;gt;&lt;br /&gt;
* After flashing, it will boot using the Infinitime bootloader (green large pine cone), then it'll hang for a few seconds, then it'll show the reloader animation (blue smaller pine cone), and then it'll boot the wasp-os bootloader.&lt;br /&gt;
* Make sure the watch is on the screen with the pine cone and arrow. If it is in a bootloop instead, then reboot the watch by holding the button until the arrow appears.&lt;br /&gt;
* Now you can flash micropython with wasp-os: &amp;lt;br&amp;gt;&amp;lt;code&amp;gt;wasp-os-0.4/build-pinetime/micropython.zip&amp;lt;/code&amp;gt;&lt;br /&gt;
* Wasp-os should now boot. Enjoy!&lt;br /&gt;
&lt;br /&gt;
== Wasp-os =&amp;gt; InfiniTime ==&lt;br /&gt;
[[File:Flash-reloader-infinitime-recovery.jpg|500px|thumb|right|Flashing &amp;lt;code&amp;gt;reloader-infinitime-recovery-0.14.1.zip.zip&amp;lt;/code&amp;gt;]]&lt;br /&gt;
[[File:Flash-infinitime.jpg|600px|thumb|right|Flashing &amp;lt;code&amp;gt;pinetime-mcuboot-app-dfu-1.1.0.zip.zip&amp;lt;/code&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;reloader-factory.zip&amp;lt;/code&amp;gt; was broken in the original wasp-os 0.4 but was fixed in wasp-os 0.4.1. However the Infinitime binaries are outdated the 0.4 release and I do not recommend flashing these. Older InfiniTime versions have flaky BLE which makes upgrading from there very unreliable.&lt;br /&gt;
&lt;br /&gt;
You can get newer binaries from the wasp-os projects CI system (see the [https://wasp-os.readthedocs.io/en/latest/install.html#binary-downloads wasp-os installation guide]) or alternatively, I made my own containing just the [https://github.com/JF002/InfiniTime/releases/tag/0.14.1 InfiniTime 0.14.1] [https://github.com/JF002/pinetime-mcuboot-bootloader/blob/develop/README.md#recovery-firmware recovery firmware]. This allows you to flash any future release of InfiniTime without having to find a new reloader zip. Get the [https://github.com/Peetz0r/wasp-reloader/releases/tag/infinitime-0.14.1-recovery reloader zip here] and the [https://github.com/JF002/InfiniTime/releases latest Infinitime here].&lt;br /&gt;
&lt;br /&gt;
* Reboot the watch by holding the button until the pine cone arrow appears.&lt;br /&gt;
* Flash the reloader zip: &amp;lt;br&amp;gt;&amp;lt;code&amp;gt;reloader-infinitime-recovery-0.14.1.zip&amp;lt;/code&amp;gt;&lt;br /&gt;
* After flashing, the reloader will run (blue smaller pine cone), then it'll boot the InfiniTime bootloader (large pine cone) will run.&lt;br /&gt;
* Boot the watch into recovery mode by holding the button until the pine cone turns red. It'll boot again (large pine cone will turn green) and then the InfiniTime logo will appear.&lt;br /&gt;
* You can now flash InfiniTime 1.1.0 (or any other version): &amp;lt;br&amp;gt;&amp;lt;code&amp;gt;pinetime-mcuboot-app-dfu-1.1.0.zip&amp;lt;/code&amp;gt;&lt;br /&gt;
* InfiniTime should now boot. Enjoy!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]][[Category:Guide]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=11604</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=11604"/>
		<updated>2021-10-12T08:42:18Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: Add detail about new accelerometer.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Frequently asked questions / Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime FAQ| Frequently Asked Questions about the PineTime]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.&lt;br /&gt;
* [https://github.com/xan-m/Infini-iOS Infini-iOS] (iOS) - Companion mobile app in early development which will support updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
&lt;br /&gt;
== Short overview  / Specifications ==&lt;br /&gt;
'''Dimensions:''' 37.5 x 40 x 11mm &amp;lt;br&amp;gt;&lt;br /&gt;
'''Weight:''' 38 grams &amp;lt;br&amp;gt;&lt;br /&gt;
'''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!)) &amp;lt;br&amp;gt;&lt;br /&gt;
'''Display:'''&lt;br /&gt;
: '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
: '''Display Controller:''' ST7789&lt;br /&gt;
: '''Resolution:''' 240x240 pixels &amp;lt;br&amp;gt;&lt;br /&gt;
'''System on Chip:''' Nordic Semiconductor nRF52832 &amp;lt;br&amp;gt;&lt;br /&gt;
'''Flash:''' 512KB with additional 4MB SPI NOR &amp;lt;br&amp;gt;&lt;br /&gt;
'''RAM:''' 64KB &amp;lt;br&amp;gt;&lt;br /&gt;
'''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]] &amp;lt;br&amp;gt;&lt;br /&gt;
'''Sensors:''' Accelerometer, Heart rate sensor &amp;lt;br&amp;gt;&lt;br /&gt;
'''Feedback:''' Vibration motor &amp;lt;br&amp;gt;&lt;br /&gt;
'''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
= Community =&lt;br /&gt;
&lt;br /&gt;
== Forum ==&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
== Chat ==&lt;br /&gt;
* [https://app.element.io/#/room/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Developers and coding ===&lt;br /&gt;
* [https://app.element.io/#/room/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
== Development efforts ==&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Useful articles and blog posts == &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]&lt;br /&gt;
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
&lt;br /&gt;
= Hardware =&lt;br /&gt;
&lt;br /&gt;
== Display ==&lt;br /&gt;
&lt;br /&gt;
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
== Battery measurement ==&lt;br /&gt;
&lt;br /&gt;
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.&lt;br /&gt;
&lt;br /&gt;
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
== Button ==&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
== Touch panel ==&lt;br /&gt;
&lt;br /&gt;
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).&lt;br /&gt;
&lt;br /&gt;
=== Pins ===&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
=== I²C ===&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
=== Touch events ===&lt;br /&gt;
&lt;br /&gt;
Touch information is available from the 63 first registers of the controller. Remember: the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
=== Registers ===&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|0x03 = SLEEP (reset the touchpanel using the reset pin before using this register : pin_low, delay 5ms, pin_high, delay 50ms then write 3 to register 0xA5)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Accelerometer==&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
=== Pins ===&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
= Datasheets and Schematics =&lt;br /&gt;
&lt;br /&gt;
== Schematics ==&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
Note: The part number for the SPI FLASH in the schematic diagram is not correct, the PineTime features a larger external FLASH device, see below.&lt;br /&gt;
&lt;br /&gt;
== Chip Datasheets ==&lt;br /&gt;
* NORDIC nRF52832 information:&lt;br /&gt;
** [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
** [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
* ARMv7-M information:&lt;br /&gt;
** [https://static.docs.arm.com/ddi0403/eb/DDI0403E_B_armv7m_arm.pdf ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
== Component Datasheets ==&lt;br /&gt;
* PMU (Power Management Unit) information:&lt;br /&gt;
** [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
** [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
* SPI Flash information:&lt;br /&gt;
** [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash])&lt;br /&gt;
** [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
** IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
* LCD Panel:&lt;br /&gt;
** [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
* Touchpad information:&lt;br /&gt;
** [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
** [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
** [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
* Sensor:&lt;br /&gt;
** [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]&lt;br /&gt;
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 3-axes ultra-low power accelerometer datasheet]&lt;br /&gt;
** [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
= Community case design =&lt;br /&gt;
&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=Upgrade_PineTime_to_InfiniTime_1.0.0&amp;diff=11424</id>
		<title>Upgrade PineTime to InfiniTime 1.0.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=Upgrade_PineTime_to_InfiniTime_1.0.0&amp;diff=11424"/>
		<updated>2021-09-16T13:30:22Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: Add note specifying which devices these instructions are applicable to&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Note|Page under construction, information subject to review and feedback.}}&lt;br /&gt;
&lt;br /&gt;
'''Devices shipped before July 2021 were pre-installed with InfiniTime 0.7.1, and an older bootloader. This features green text 'PINE TIME' on boot, and should be updated to the new bootloader as described below.'''&lt;br /&gt;
&lt;br /&gt;
'''Devices shipped after July 2021 were pre-installed with InfiniTime 1.2 and the new bootloader, which can be identified by the green Pinecone image on boot. The instructions below are unnecessary for these devices.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Congratulations on receiving your new PineTime!&lt;br /&gt;
&lt;br /&gt;
So now you're probably wondering exactly how on earth do you go about upgrading your watch to the latest and greatest version of InfiniTime - you know, that version you've seen all those great pictures, videos and reviews of. To those of us that are developing stuff for it, it's pretty easy and straightforward, but like with all technology, it is a bit tricky. &lt;br /&gt;
&lt;br /&gt;
{{warning|1=Some people ran into issues during the update process that would temporarily make their watch unusable (display frozen or blank). The only know workaround consists of waiting for the battery to drain completely and try again. With the display off, and battery fully charged, you can expect a wait of 5-7 days so it is best to not fully charge it. If it freezes with the display on, it will likely be flat by the end of the day. We've never heard of any PineTimes that were permanently bricked (were not recoverable), though. }} &lt;br /&gt;
&lt;br /&gt;
In a nutshell, you need to:&lt;br /&gt;
# Charge your watch, but '''not''' to 100% - keep it at approximately 50% - for the reason described above.&lt;br /&gt;
# Update InfiniTime&lt;br /&gt;
# Update the bootloader&lt;br /&gt;
# Install the recovery firmware&lt;br /&gt;
&lt;br /&gt;
= Update Process =&lt;br /&gt;
So how do you do this? Where do you start? Well, with a sealed PineTime, your only easy option is via Over The Air (OTA) Device Firmware Update (DFU), which is done via Bluetooth. There are a couple of different ways and apps you can use to do this. If you have an Android device, you can use [https://f-droid.org/en/packages/nodomain.freeyourgadget.gadgetbridge/ Gadgetbridge] or [https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp NRFConnect] (NRFConnect is available on iOS devices as well). Otherwise, if your laptop or desktop computer has Bluetooth and runs Linux, you can use [https://github.com/alexr4535/siglo Siglo] or [https://github.com/piggz/harbour-amazfish Amazfish]. You can also use these applications on your Pinebook Pro or Pinephone if you happen to have those devices. &lt;br /&gt;
&lt;br /&gt;
The reason for installing the updates in the specified order is because newer versions of InfiniTime have a more robust Bluetooth update process, and since we're updating everything over Bluetooth, the fewer retries and failures from that you have the better. It will still sometimes disconnect mid update, meaning you'll need to try again, and possibly restart the watch a few times as well. And since the recovery firmware is new to the 1.0.0 version of the bootloader, it's best to update that last. &lt;br /&gt;
&lt;br /&gt;
[https://video.codingfield.com/videos/watch/831077c5-16f3-47b4-9b2b-c4bbfecc6529 This video] shows the bootloader and recovery firmware installation procedure.&lt;br /&gt;
&lt;br /&gt;
[https://video.codingfield.com/videos/watch/f7bffb3d-a6a1-43c4-8f01-f4aeff4adf9e This video] shows the bootloader installation and firmware update using Amazfish.&lt;br /&gt;
&lt;br /&gt;
You can also read a [https://github.com/JF002/pinetime-mcuboot-bootloader/blob/339224cf5ed21f4e8b2d22eaeab9869120f7f752/docs/howToUpdate.md detailed installation procedure in the documentation of the bootloader].&lt;br /&gt;
&lt;br /&gt;
== Update InfiniTime ==&lt;br /&gt;
To update the main InfiniTime app, you want to flash [https://github.com/JF002/InfiniTime/releases/download/1.0.0/pinetime-mcuboot-app-dfu-1.0.0.zip pinetime-mcuboot-app-dfu-1.0.0.zip].&lt;br /&gt;
&lt;br /&gt;
After updating InfiniTime, ensure that you validate the firmware to prevent it from being automatically reverted/rolled back if your watch is reset/restarted. To do this, swipe right to access the quick actions panel, press the gear/settings icon, swipe up once to show the second page, press on the 'Firmware' option and then on 'Validate'.&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/-5lwBd60k0Q Video showing validation process]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Gadgetbridge ===&lt;br /&gt;
&lt;br /&gt;
# Connect your PineTime to GB&lt;br /&gt;
# Download the aforementioned file to your phone&lt;br /&gt;
# Find the file in your file manager&lt;br /&gt;
# 'Open With' Gadgetbridge F/W Installer (method varies by device) - on my phone, it is press and hold, select the file, and then choose 'open with app' from the more options menu&lt;br /&gt;
# Confirm that you wish to apply the update&lt;br /&gt;
# Wait for the update to complete&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/nAaaC7D5sVo Video showing how to start the update]&lt;br /&gt;
&lt;br /&gt;
=== NRFConnect ===&lt;br /&gt;
&lt;br /&gt;
# Download the aforementioned file to your phone.&lt;br /&gt;
# Open NRFConnect&lt;br /&gt;
# Scan for your device&lt;br /&gt;
# Connect to it&lt;br /&gt;
# Choose the DFU option at the top right of the screen&lt;br /&gt;
# Ensure the 'Distribution packet (ZIP)' option is selected, and press OK&lt;br /&gt;
# Select your previously downloaded file&lt;br /&gt;
# Wait for the update to complete&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/jnX7WwYDiDE Video showing how to start the update]&lt;br /&gt;
&lt;br /&gt;
=== Siglo ===&lt;br /&gt;
# If your device was not detected upon start, press &amp;quot;Rescan&amp;quot; to find it.&lt;br /&gt;
# Select the &amp;quot;1.0.0&amp;quot; tag&lt;br /&gt;
# Select the aforementioned file/asset.&lt;br /&gt;
# Select &amp;quot;Flash It!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Amazfish ===&lt;br /&gt;
# Run Amazfish (service + UI)&lt;br /&gt;
# Pair with you device:&lt;br /&gt;
## Unzip the DFU file to extract the .bin file.&lt;br /&gt;
## Click on &amp;quot;pair with watch&amp;quot; on the top&lt;br /&gt;
## Select &amp;quot;PineTime&amp;quot; (if your device is running InfiniTime 0.7.1 or lower) or &amp;quot;InfiniTime (if it's running InfiniTime 0.8+) and choose your device in the list&lt;br /&gt;
# Click on &amp;quot;Download file&amp;quot; on the top &lt;br /&gt;
# Click on &amp;quot;Choose file&amp;quot; and select the .bin file you extracted from the DFU file&lt;br /&gt;
# Click on &amp;quot;Send file&amp;quot;&lt;br /&gt;
# Wait for the update to complete.&lt;br /&gt;
&lt;br /&gt;
[https://video.codingfield.com/videos/watch/41cfcf5d-b0e6-4323-8056-b0a6682d1f25 See it in action!]&lt;br /&gt;
&lt;br /&gt;
== Update the bootloader ==&lt;br /&gt;
To update the bootloader, you want to flash [https://github.com/JF002/InfiniTime/releases/download/0.14.1/reloader-mcuboot.zip reloader-mcuboot.zip]. &lt;br /&gt;
Once the bootloader is updated, you should notice that the boot logo has changed. Previously, it was a green &amp;quot;PineTime&amp;quot; logo, and now it is a large pinecone that is progressively drawn in green.&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/fvHQ8ZeqnOo Video showing what the InfiniTime 1.0.0 bootloader looks like]&lt;br /&gt;
&lt;br /&gt;
=== Using Gadgetbridge ===&lt;br /&gt;
&lt;br /&gt;
Same process as before, but with the file for this step.&lt;br /&gt;
&lt;br /&gt;
=== Using NRFConnect ===&lt;br /&gt;
&lt;br /&gt;
Same process as before, but with the file for this step.&lt;br /&gt;
&lt;br /&gt;
=== Using Siglo ===&lt;br /&gt;
Same process as before, but select the &amp;quot;0.14.1&amp;quot; tag, and the file/asset for this step.&lt;br /&gt;
&lt;br /&gt;
=== Using Amazfish ===&lt;br /&gt;
&lt;br /&gt;
You may need to re-pair with your device by selecting &amp;quot;InfiniTime&amp;quot; (since you've already upgraded to InfiniTime 1.0) in the device type list. Then follow the same process as before, but with the file for this step.&lt;br /&gt;
&lt;br /&gt;
== Install the recovery firmware ==&lt;br /&gt;
{{warning|1=Don't do this before updating the bootloader, otherwise your PineTime will freeze at the end of the process, and you will need to wait for the battery to go flat }} &lt;br /&gt;
&lt;br /&gt;
To install the recovery firmware, you want to flash [https://github.com/JF002/InfiniTime/releases/download/0.14.1/pinetime-mcuboot-recovery-loader-dfu-0.14.1.zip pinetime-mcuboot-recovery-loader-dfu-0.14.1.zip]. You will know when this is running when it shows an InfiniTime logo with a progress bar running across the bottom whilst it is installing the recovery firmware. &lt;br /&gt;
&lt;br /&gt;
=== Using Gadgetbridge ===&lt;br /&gt;
&lt;br /&gt;
Same process as before, but with the file for this step.&lt;br /&gt;
&lt;br /&gt;
=== Using NRFConnect ===&lt;br /&gt;
&lt;br /&gt;
Same process as before, but with the file for this step.&lt;br /&gt;
&lt;br /&gt;
=== Using Siglo ===&lt;br /&gt;
Same process as before, but with the file/asset for this step.&lt;br /&gt;
&lt;br /&gt;
=== Using Amazfish ===&lt;br /&gt;
&lt;br /&gt;
Same process as before, but with the file for this step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Guides and Videos =&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
Sometimes during the update process, the connection will drop, and the update will fail. Your PineTime isn't broken, most likely the Bluetooth link dropped for a moment, so just try again. Try rebooting your phone, if it keeps failing, try restarting the watch by holding the power button down for approximately 8 seconds. Try to '''avoid''' holding down the button with the screen off. Or try with another device, just in case there are compatibility issues. &lt;br /&gt;
&lt;br /&gt;
Version 1.0.0 of InfiniTime is merely the first version that was considered sufficiently feature-complete and stable enough for daily use. This isn't to say there aren't still bugs present ('cause there are!). So there are a few bugs still present in the update process and the bootloader. One unfortunate bug appears to be that sometimes when the watch tries to restart after an update, the bootloader locks up, and the watch won't turn on. In this case, you will need to wait until the watch battery goes flat, to force the watch to reset. This will most likely involve waiting for a week, and then when you put the watch on the charging cradle, it will power up and you should be right to try again.&lt;br /&gt;
&lt;br /&gt;
If you get stuck or have any questions, join us on your preferred [[Main_Page#Chat_Platforms|chat platform]] or the product [https://forum.pine64.org/forumdisplay.php?fid=134 forum]. There's usually someone available who can help, or will get back to you in a few hours.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]][[Category:Guide]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=11207</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=11207"/>
		<updated>2021-08-31T09:06:33Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTimeStyle Watchface=&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and has been included since version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle.jpg|PineTimeStyle watchface]]&lt;br /&gt;
&lt;br /&gt;
==Layout==&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected. &lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Customisation==&lt;br /&gt;
Since version 1.4 of Infinitime, a color picker is available for PineTimeStyle. It is called 'PTS Colors' can be accessed via the settings menu, on page 3, below 'About'.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle-colorpicker.jpg|PineTimeStyle Color Picker]]&lt;br /&gt;
&lt;br /&gt;
There are 3 pairs of buttons with left and right arrows which scroll through 17 standard colors. The top pair changes the time text color, middle for the sidebar color and bottom for the time background color.&lt;br /&gt;
&lt;br /&gt;
There is also a 'Rnd' button which randomises all colors, and a 'Rst' button which resets the colors to standard teal and black.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:PineTimeStyle-colorpicker.jpg&amp;diff=11206</id>
		<title>File:PineTimeStyle-colorpicker.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:PineTimeStyle-colorpicker.jpg&amp;diff=11206"/>
		<updated>2021-08-31T09:05:27Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=10848</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=10848"/>
		<updated>2021-06-28T09:46:12Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: /* PineTimeStyle Watchface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTimeStyle Watchface=&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and is expected to be included in version 1.3 of Infinitime.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle.jpg|PineTimeStyle watchface]]&lt;br /&gt;
&lt;br /&gt;
==Layout==&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected. &lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=10847</id>
		<title>PineTimeStyle</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTimeStyle&amp;diff=10847"/>
		<updated>2021-06-28T09:45:47Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: Created page with &amp;quot;=PineTimeStyle Watchface= PineTimeStyle is a watchface created for Infinitime and is expected to be included in version 1.3.  It is based on [https://www.dantilden.com/project...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTimeStyle Watchface=&lt;br /&gt;
PineTimeStyle is a watchface created for Infinitime and is expected to be included in version 1.3.&lt;br /&gt;
&lt;br /&gt;
It is based on [https://www.dantilden.com/projects/timestyle/ TimeStyle for Pebble by Dan Tilden] with permission.&lt;br /&gt;
&lt;br /&gt;
[[File:PineTimeStyle.jpg|PineTimeStyle watchface]]&lt;br /&gt;
&lt;br /&gt;
==Layout==&lt;br /&gt;
The time is displayed on the left in either 12 or 24h format depending on the system setting.&lt;br /&gt;
&lt;br /&gt;
In the sidebar on the right there is a battery icon which displays the current charge level, and is replaced by a plug icon when charging. Below it is a bluetooth icon which appears only when bluetooth is connected. &lt;br /&gt;
&lt;br /&gt;
The current date is displayed in the middle, and at the bottom there is a small gauge which displays the step count. The gauge scales automatically based on the configured step goal, and the outside of the gauge will turn white when the step goal is reached.&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=File:PineTimeStyle.jpg&amp;diff=10846</id>
		<title>File:PineTimeStyle.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=File:PineTimeStyle.jpg&amp;diff=10846"/>
		<updated>2021-06-28T08:45:55Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Licensing ==&lt;br /&gt;
{{PD|PD}}&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9797</id>
		<title>PineTime Custom Watchface Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9797"/>
		<updated>2021-04-09T15:10:42Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: /* Add the watchface to Clock.cpp and Clock.h */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTime Custom Watchface Tutorial=&lt;br /&gt;
&lt;br /&gt;
This is a tutorial to help new users create custom watchfaces based on the InfiniTime Firmware for Pinetime made by user JF002, thanks to him for its development...&lt;br /&gt;
&lt;br /&gt;
We will explain some of the things we went through while creating some custom Watchfaces, so consider this as a log of experiments of sorts..&lt;br /&gt;
&lt;br /&gt;
So stay tuned to it as it will be dynamically updated...&lt;br /&gt;
&lt;br /&gt;
==What you need to start==&lt;br /&gt;
The entire building process will be done by GitHub, so all you need is a device which can give you a Github Web Client, a PC or tablet to give you enough screen space to review your code and a steady internet connection.&lt;br /&gt;
&lt;br /&gt;
Since the compiling and file management is done by Github online, you have nothing else to worry about other than working with the files that display the watch face.&lt;br /&gt;
&lt;br /&gt;
So with those things settled, let's start with the basics of a watchface.&lt;br /&gt;
&lt;br /&gt;
Please remember that this is a wiki, so you can make an account and help us improve this page.&lt;br /&gt;
&lt;br /&gt;
Please make sure not to unilaterally remove info though, but offer an alternative. If it is indeed a better way, in time your alternative will grow into the main text, and the latter info will be pruned.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
The Firmware (also called InfiniTime) we will be working with is made with a programming language named '''C++''':[https://en.wikipedia.org/wiki/C%2B%2B]&lt;br /&gt;
&lt;br /&gt;
Basic knowledge of C/C++ is required to to understand the advanced watch faces as that requires more complex code, but you can still do a some cool things without much knowledge of C++ programming, just some small edits to existing programs.&lt;br /&gt;
&lt;br /&gt;
InfiniTime uses the '''LVGL''':[https://lvgl.io] graphics library to provide users with a simple and clean UI without overpowering the Nordic '''nRF52832''':[http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf] microcontroller which is the brain of the watch.&lt;br /&gt;
&lt;br /&gt;
To get the watchface to work there are these basic steps. We will go over each step separately, so don't be daunted, all will become clear soon.&lt;br /&gt;
&lt;br /&gt;
For now we will, modify the the existing watchface, change the positioning of the text labels, add an icon to an existing watchface, and later on we will do a full watchface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The main file we need to focus on is the '''WatchFaceDigital.cpp''' file, it is what contains most of the data attributed to what we see on the watchface, including The time/day characters, the battery and bluetooth icons, and also pedometer count...&lt;br /&gt;
&lt;br /&gt;
so everything we will be doing in the basic modifications is purely messing with this single file.&lt;br /&gt;
&lt;br /&gt;
==Labels==&lt;br /&gt;
===What are labels?===&lt;br /&gt;
Labels are considered as &amp;quot;elemental&amp;quot; parts that make up a screen's Text-based UI by the LVGL library...&lt;br /&gt;
Each label is also considered as an &amp;quot;object&amp;quot; or &amp;quot;obj&amp;quot; and can be manipulated, by changing the data attributed with the &amp;quot;obj&amp;quot;, for example, position, internal data like the strings/text etc.&lt;br /&gt;
when can change what the label shows and where it shows it...&lt;br /&gt;
&lt;br /&gt;
===Modifying label data===&lt;br /&gt;
let's observe something small like the word &amp;quot;BPM&amp;quot; near the bottom of the watch face...&lt;br /&gt;
[[file:PineTimeCustom-1.png|right|200px]]&lt;br /&gt;
&lt;br /&gt;
If we take a look at the source file of the watchface, (a.k.a the clock.cpp file)&lt;br /&gt;
we can observe that these particular lines are what attributes to the word &amp;quot;BPM being displayed...&lt;br /&gt;
 heartbeatBpm = lv_label_create(lv_scr_act(), NULL);&lt;br /&gt;
 lv_label_set_text(heartbeatBpm, &amp;quot;BPM&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
we can modify the text inside the quotes and replace the word 'BPM' between those quotes to something like 'LOVE'&lt;br /&gt;
and the result after compiling the firmware again with the changes and flashing it to the watch would be that the text changes on the watch face and displays 'LOVE' inplace of 'BPM'...&lt;br /&gt;
&lt;br /&gt;
If this happened correctly, then you have successfully made a custom new watchface! Now we can do something a bit more complex...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now take for in instance the days of the week that we have on the bottom line with the date...&lt;br /&gt;
&lt;br /&gt;
they are stored a &amp;quot;C array&amp;quot; which is basically multiple words separated by commas..&lt;br /&gt;
the date is in a format of '''&amp;lt;day of the week&amp;gt; &amp;lt;day&amp;gt; &amp;lt;Month&amp;gt; &amp;lt;year&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
which in the source file is expressed as,&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
 lv_label_set_text(label_date, dateStr);&lt;br /&gt;
&lt;br /&gt;
here, &lt;br /&gt;
 %s %d %s %d &lt;br /&gt;
stores the print format of the variables, and&lt;br /&gt;
&lt;br /&gt;
 DayOfWeekToString(dayOfWeek), day, MonthToString(month), year  &lt;br /&gt;
are the variables themselves...&lt;br /&gt;
&lt;br /&gt;
Now, &lt;br /&gt;
if the date was a saturday 11/7/2020, you can observe that the date looks like &lt;br /&gt;
 SATURDAY 11 JUL 2020&lt;br /&gt;
as seen in the above image (the one where we changed BPM to LOVE)&lt;br /&gt;
&lt;br /&gt;
by modifying the format of the variables, we can change how those words are arranged, and add some extra characters if we like... &lt;br /&gt;
 (there is a catch to the list of characters you can use however, but it will be discussed later...)&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
We modifying the format by adding a comma... &amp;quot;,&amp;quot; in between the second &amp;quot;%s&amp;quot; and &amp;quot;%d&amp;quot; like this,&lt;br /&gt;
 &amp;quot;%s %d %s, %d&amp;quot;&lt;br /&gt;
and changing that in the line...&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s, %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
&lt;br /&gt;
we can make the date become...&lt;br /&gt;
 SATURDAY 11 JUL, 2020&lt;br /&gt;
&lt;br /&gt;
which means we now were able to modify how the text got display to make it a bit more nice...&lt;br /&gt;
&lt;br /&gt;
but if you haven't noticed, the line containing the date is already full, meaning we will get some problems while displaying the date and causing it to wrap around,&lt;br /&gt;
making a single character go to the next line and look more like,&lt;br /&gt;
&lt;br /&gt;
 SATURDAY 11 JUL, 202&lt;br /&gt;
 0&lt;br /&gt;
&lt;br /&gt;
so why don't we shorten the characters present in the date from being &amp;quot;SATURDAY&amp;quot; to simply just &amp;quot;sat.&amp;quot; (It will have the small period at the end, and is only 3 characters long) &lt;br /&gt;
I will also convert the months of the year from Capital to small letters... &lt;br /&gt;
&lt;br /&gt;
for that look into the part where the days of the week of are stored as text,&lt;br /&gt;
and also while looking at it, we can solve another question, why was their two variables in the date format that looked like, DayOfWeekToString(dayOfWeek), and MonthToString(month) ?&lt;br /&gt;
&lt;br /&gt;
It is because the system gives the date/ time as numbers (Monday-1, Tuesday-2 Wednesday-3 for the days, and 1-January, 2-February, 3-March ),&lt;br /&gt;
and so a function along with a C array is used to assign these numbers to Days/Months in text form as it is easier to read...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this is the Array containing the day of the week, (as text) &lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;MONDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;TUESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;WEDNESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;THURSDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;FRIDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SATURDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SUNDAY&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and this Array stores the months of the year, (as text)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;JAN&amp;quot;,&lt;br /&gt;
        &amp;quot;FEB&amp;quot;,&lt;br /&gt;
        &amp;quot;MAR&amp;quot;,&lt;br /&gt;
        &amp;quot;APR&amp;quot;,&lt;br /&gt;
        &amp;quot;MAY&amp;quot;,&lt;br /&gt;
        &amp;quot;JUN&amp;quot;,&lt;br /&gt;
        &amp;quot;JUL&amp;quot;,&lt;br /&gt;
        &amp;quot;AUG&amp;quot;,&lt;br /&gt;
        &amp;quot;SEP&amp;quot;,&lt;br /&gt;
        &amp;quot;OCT&amp;quot;,&lt;br /&gt;
        &amp;quot;NOV&amp;quot;,&lt;br /&gt;
        &amp;quot;DEC&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
here we can see that the days are stored in a full format as &amp;quot;SUNDAY&amp;quot;, &amp;quot;MONDAY&amp;quot;, &amp;quot;TUESDAY&amp;quot; etc.&lt;br /&gt;
we can change all of them to a shorter format like &amp;quot;sun.&amp;quot;, &amp;quot;mon.&amp;quot;, &amp;quot;tue.&amp;quot;, to make it short and nice...&lt;br /&gt;
while doing so, we can even make the months use small letters as said before..&lt;br /&gt;
&lt;br /&gt;
so the source file (clock.cpp) becomes,&lt;br /&gt;
&lt;br /&gt;
(for the days of the week)&lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;mon.&amp;quot;,&lt;br /&gt;
        &amp;quot;tue.&amp;quot;,&lt;br /&gt;
        &amp;quot;wed.&amp;quot;,&lt;br /&gt;
        &amp;quot;thu.&amp;quot;,&lt;br /&gt;
        &amp;quot;fri.&amp;quot;,&lt;br /&gt;
        &amp;quot;sat.&amp;quot;,&lt;br /&gt;
        &amp;quot;sun.&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
(for the months of the year)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;jan&amp;quot;,&lt;br /&gt;
        &amp;quot;feb&amp;quot;,&lt;br /&gt;
        &amp;quot;mar&amp;quot;,&lt;br /&gt;
        &amp;quot;apr&amp;quot;,&lt;br /&gt;
        &amp;quot;may&amp;quot;,&lt;br /&gt;
        &amp;quot;jun&amp;quot;,&lt;br /&gt;
        &amp;quot;jul&amp;quot;,&lt;br /&gt;
        &amp;quot;aug&amp;quot;,&lt;br /&gt;
        &amp;quot;sep&amp;quot;,&lt;br /&gt;
        &amp;quot;oct&amp;quot;,&lt;br /&gt;
        &amp;quot;nov&amp;quot;,&lt;br /&gt;
        &amp;quot;dec&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
which means now our original date, saturday 11/7/2020 will become...&lt;br /&gt;
 sat. 11 jul, 2020&lt;br /&gt;
&lt;br /&gt;
you now know how to change the data present in a label object, and the format of it..,&lt;br /&gt;
 &lt;br /&gt;
Here is a fun idea you can try: you can even replace the days with whatever thing that tells you (or) reminds you the day of the week &lt;br /&gt;
(like the food served in the cafe, Monday/taco, Tuesday/burger, Wednesday/pasta etc.) &lt;br /&gt;
 &lt;br /&gt;
 NOTE: when making the custom array, don't forget to leave a empty &amp;quot;&amp;quot; as the first element of the array,&lt;br /&gt;
 This is because the date is given by the system in a natural numbers format (1,2,3...) rather than a zero-starting format (0,1,2,3...), which the C array uses to index...&lt;br /&gt;
 so the C array indexes the days as &amp;quot;&amp;quot;-0, &amp;quot;Monday&amp;quot;-1, &amp;quot;Tuesday&amp;quot;-2 etc. and the months as &amp;quot;&amp;quot;-0, &amp;quot;January&amp;quot;-1, &amp;quot;February&amp;quot;-2 etc.)&lt;br /&gt;
&lt;br /&gt;
===Label positioning===&lt;br /&gt;
&lt;br /&gt;
The locational placement in LVGL is done on a cartesian plane,&lt;br /&gt;
where each object can have dynamic origin placement, and the Y-axis is inverted...&lt;br /&gt;
So going down is done with a positive Y-axis value and not negative as the it is by de-facto...&lt;br /&gt;
&lt;br /&gt;
[[File:LVGL coord system.png|200px|thumb|right|LVGL coord system]]&lt;br /&gt;
&lt;br /&gt;
The position of the various objects in clock.cpp are set by the line,&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
and the top left corner is the Cartesian origin, aka coordinates (0,0)&lt;br /&gt;
&lt;br /&gt;
this image can show you how to decide label placement for lv_obj_set_pos(...)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we use another function, that is more advanced that gives the positional alignment based on preset locations...&lt;br /&gt;
 lv_obj_align(&amp;lt;text/obj&amp;gt;, &amp;lt;image/obj&amp;gt;, &amp;lt;location_parameter&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
the &amp;quot;&amp;lt;image/obj&amp;gt;&amp;quot; data is used for putting text beside other picture icons , and so if using only text based labels, we can substitute it with,&lt;br /&gt;
 lv_scr_act() (or) NULL&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;''' are the cartesian coordinates, '''&amp;lt;location parameter&amp;gt;''' is replaced by '''LV_ALIGN_&amp;lt;preset&amp;gt;''',&lt;br /&gt;
there will be a picture showing the presets below, and '''&amp;lt;text/obj&amp;gt;''' is your text label...&lt;br /&gt;
&lt;br /&gt;
here, LV_ALIGN_&amp;lt;preset&amp;gt; sets the cartesian origin...&lt;br /&gt;
&lt;br /&gt;
Label positioning based on alignment is both a simple and complicated thing to understand, so here I have given something you can refer to while modifying the position of the various labels and objects...&lt;br /&gt;
&lt;br /&gt;
you can also refer here for LVGL's documentation of coordinate system https://docs.lvgl.io/v6/en/html/object-types/obj.html#coordinates&lt;br /&gt;
&lt;br /&gt;
It is however recommended that you use the first method to set the location&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
as it is simple and easier for beginners&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a small example.&lt;br /&gt;
&lt;br /&gt;
Take the Label that tells the date,&lt;br /&gt;
In the source file (clock.cpp) it is this line,&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);&lt;br /&gt;
by increasing the Value of the Y coordinate (60) to a higher value, we can bring the position of the Date downwards a bit away from the Time, and toward the Heartbeat count in the bottom row&lt;br /&gt;
here I will increase it to 80, so it becomes..&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80);&lt;br /&gt;
&lt;br /&gt;
and now we have made some space up top..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
now let's try something a bit complex,&lt;br /&gt;
&lt;br /&gt;
Take the position argument for the label that tells you time...&lt;br /&gt;
here, in the source file (clock.cpp),&lt;br /&gt;
 lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this line determines the position of the Label telling time, as seen in the image...&lt;br /&gt;
&lt;br /&gt;
we modifying this, by changing the origin &amp;lt;preset&amp;gt; parameter (here it is LV_ALIGN_IN_LEFT_MID) to LV_ALIGN_IN_TOP_LEFT&lt;br /&gt;
&lt;br /&gt;
you can alternatively swap the whole line to,&lt;br /&gt;
 lv_obj_set_pos(label_time, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this makes the Time label/obj. to go to the top left corner...&lt;br /&gt;
&lt;br /&gt;
but I will do something a little extra,&lt;br /&gt;
I will modify the label that store the data and Time format,&lt;br /&gt;
i.e this line,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c:%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
by removing the &amp;quot;:&amp;quot; colon in between the numbers, and replacing it with a Newline symbol &amp;quot;\n&amp;quot;&lt;br /&gt;
I change it to become,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c\n%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
this gives it a nice wrapped text format in the top corner, and gives us some space to play with in the side, for things like Pictures and icons, which we will do next..&lt;br /&gt;
&lt;br /&gt;
If you have been able to do these things, you now have completed the 2nd part of the tutorial, and now know how to change and modify the position of labels..&lt;br /&gt;
&lt;br /&gt;
==Using icons==&lt;br /&gt;
The LVGL library allows for the use of widgets known as &amp;quot;Images&amp;quot;, In short it allows you to use small Icons like pictures with a small dedicated function,&lt;br /&gt;
However when this was attempted the first time we stumbled on some problems as LVGL v6 (used on the pinetime) is not much documented as the latest release (v7 as of August 2020) &lt;br /&gt;
but also the existing code was only documented for C not C++, after some painful attempts we were able to translate it into C++, &lt;br /&gt;
&lt;br /&gt;
To bring images into Clock.cpp&lt;br /&gt;
you will need to do the following,&lt;br /&gt;
&lt;br /&gt;
1. Have a small image that cannot exceed a maximum size of 240px x 240px (pinetime max resolution)&lt;br /&gt;
&lt;br /&gt;
2. Use this Image converter (Thanks to LVGL) https://lvgl.io/tools/imageconverter&lt;br /&gt;
to convert your image to a C array and having the Color format as &amp;quot;True color&amp;quot; and the output format as &amp;quot;C array&amp;quot;&lt;br /&gt;
make sure to use something simple as the name we will be using &amp;quot;bitmap&amp;quot; as the name, but will also be referred as &amp;lt;name&amp;gt; for simplicity&lt;br /&gt;
&lt;br /&gt;
 Note: for example we shall use &amp;lt;name&amp;gt; = bitmap, but any simple word can be used, as long as it does not cause problems with system variables&lt;br /&gt;
&lt;br /&gt;
===Image size considerations===&lt;br /&gt;
since the image will be using the flash directly, we need to be considerate about flash memory usage.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;picture_X&amp;gt; x &amp;lt;picture_Y&amp;gt; x 2 &lt;br /&gt;
gives you the number of KB the image used in storage...&lt;br /&gt;
&lt;br /&gt;
where, &amp;lt;picture_X&amp;gt; &amp;lt;picture_Y&amp;gt; are the dimensions of the image horizontally and vertically&lt;br /&gt;
&lt;br /&gt;
for example,&lt;br /&gt;
 if &amp;lt;picture_X&amp;gt;=80px &amp;lt;picture_Y&amp;gt;=64px&lt;br /&gt;
then,&lt;br /&gt;
 total storage used = 80 x 60 x 2 = 10.24KB &lt;br /&gt;
&lt;br /&gt;
 please use the flash storage with consideration, when using other apps as well, excess usage of storage &lt;br /&gt;
 might mean the Firmware will not compile... the limit to storage to about 400Kb for the user, the &lt;br /&gt;
 firmware size must not exceed that...&lt;br /&gt;
&lt;br /&gt;
==Preparing the image for inclusion as an icon==&lt;br /&gt;
&lt;br /&gt;
Once you have your obtained your C array from the LVGL converter, you can take a look inside it to see all the different formats of your image, &lt;br /&gt;
try using something like Notepad++ or any of your favorite text editors to peek inside of it,&lt;br /&gt;
 &lt;br /&gt;
there will be 4 sets of Arrays inside it that look like,&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8&lt;br /&gt;
  /*Pixel format: Red: 3 bit, Green: 3 bit, Blue: 2 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP == 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 32&lt;br /&gt;
  /*Pixel format: Fix 0xFF: 8 bit, Red: 8 bit, Green: 8 bit, Blue: 8 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0xff, &lt;br /&gt;
 #endif&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
And another small bit of info we will need for later that looks like,&lt;br /&gt;
&lt;br /&gt;
 const lv_img_dsc_t bitmap = {&lt;br /&gt;
  .header.always_zero = 0,&lt;br /&gt;
  .header.w = 40,&lt;br /&gt;
  .header.h = 40,&lt;br /&gt;
  .data_size = 1600 * LV_COLOR_SIZE / 8,&lt;br /&gt;
  .header.cf = LV_IMG_CF_TRUE_COLOR,&lt;br /&gt;
  .data = bitmap_map,&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 NOTE: There are some header files at the top, which we can ignore...&lt;br /&gt;
===RGB565 image format===&lt;br /&gt;
&lt;br /&gt;
The Pinetime uses a display that uses a 16 bit color space, also known as RGB565.&lt;br /&gt;
&lt;br /&gt;
These 16 bit are assigned to RGB as 5 bits each for Red and Blue and 6 bits for Green, so 5+6+5=16 bits are required, so each pixel's color occupies 2 bytes of data,&lt;br /&gt;
and since 2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt; is equal to 65,536 it allows us to view 65,536 or 65k colors&lt;br /&gt;
&lt;br /&gt;
The way it packs these bits is by converting the bits into 2x  4+4 bit hex-code, so for example,&lt;br /&gt;
 &lt;br /&gt;
if the color of a pixel in Binary is '''10110100 01011111''' (this color is approximately Lavender purple)&lt;br /&gt;
 &lt;br /&gt;
It is split as '''1011''' &amp;amp; '''0100''' for the first byte and '''0101''' &amp;amp; '''1111''' for the second byte&lt;br /&gt;
and so, converting the binary into Hex-code,&lt;br /&gt;
&lt;br /&gt;
the two parts are '''0xB4''' and '''0xF5'''&lt;br /&gt;
&lt;br /&gt;
These two parts in conjunction are used for determining the color of one pixel...&lt;br /&gt;
&lt;br /&gt;
also from the binary, it is observed that,&lt;br /&gt;
&lt;br /&gt;
The bits '''10110''' is used for Red, '''100010''' is used for green, and '''11111''' is used for blue.&lt;br /&gt;
&lt;br /&gt;
===Flipping the bytes===&lt;br /&gt;
The LVGL library has a feature that allows you to flip the two bytes of the pixel, so if the two parts were, ...0xB4,0xF5,... ,it will change it to become, ...0xF5,0xB4,...&lt;br /&gt;
&lt;br /&gt;
The reason for this is to allow the use of 8-bit SPI interfaces, but we do not require it, and if set with  wrong parameter we could get problems with the color...&lt;br /&gt;
&lt;br /&gt;
To make sure you are ready for the next step, make sure that inside your lvgl configuration file (located at '''src/libs/lv_conf.h''')&lt;br /&gt;
&lt;br /&gt;
this parameter, &lt;br /&gt;
 '''#define LV_COLOR_16_SWAP   1'''&lt;br /&gt;
is set to &amp;quot;1&amp;quot; as seen...&lt;br /&gt;
&lt;br /&gt;
 NOTE: if you haven't modified it or tampered with it with your Github fork, you shouldn't have a problem &lt;br /&gt;
 as it is correct by default, and you can skip these steps&lt;br /&gt;
&lt;br /&gt;
===Creating an Object from the Array===&lt;br /&gt;
To include the Icon, first Identify the Array you need to copy to the source (clock.cpp)&lt;br /&gt;
&lt;br /&gt;
The one we require from it is the data below the tag that looks like,&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
 /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
from this copy the Data from the array alone...&lt;br /&gt;
I.e this part,&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00&lt;br /&gt;
&lt;br /&gt;
(Make sure to not include the comma at the end or the #endif as the entire part is going to substitute a new array)&lt;br /&gt;
&lt;br /&gt;
In clock.cpp, just below the header files and the Task creation part (I.e event_handler...),&lt;br /&gt;
&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
 Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
 screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
create a name for the label with,&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;; // remember to replace &amp;lt;name&amp;gt; with the actual name you gave to your image while converting !&lt;br /&gt;
&lt;br /&gt;
then below it create a array to hold the data with,&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {}; // paste the array you copied from the conversion file we specified above...&lt;br /&gt;
&lt;br /&gt;
so your  array is something like,&lt;br /&gt;
&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00};&lt;br /&gt;
&lt;br /&gt;
so your Entire top region of declaration looks like,&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
 #include &amp;lt;libs/date/includes/date/date.h&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 using namespace Pinetime::Applications::Screens;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_extrabold_compressed;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_bold_20;&lt;br /&gt;
 extern lv_style_t* LabelBigStyle;&lt;br /&gt;
 '''   '''&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
  Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
  screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
 '''   '''&lt;br /&gt;
 '''//Declare the descriptor here'''&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;;&lt;br /&gt;
 '''//place the Image data here&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''note: Declaring variables outside a function like we did above is known as global scope declaration, this means the variable can be used by not just one function but the Entire code...'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then inside the &lt;br /&gt;
 Clock::Clock(DisplayApp* app,...){... &lt;br /&gt;
region, (the watchface function)&lt;br /&gt;
You need to place a particular set of lines which LVGL uses to define the object declare the array as an Icon/Image, You can place this set of lines above label_time...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.always_zero = 0; //Initialization&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.w = &amp;lt;picture_X&amp;gt;;                     // Setting the Width (or) Horizontal length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.h = &amp;lt;picture_Y&amp;gt;;                     // Setting the Height (or) vertical length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.data_size = &amp;lt;Hr_length&amp;gt; * &amp;lt;Vr_length&amp;gt; * LV_COLOR_SIZE / 8; //Allocation of memory for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.cf = LV_IMG_CF_TRUE_COLOR; // Sets the color scheme for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.data = &amp;lt;name&amp;gt;_map;                // Maps the Image data to the Array&lt;br /&gt;
  lv_obj_t *img_src = lv_img_create(lv_scr_act(), NULL);  // Create an image object&lt;br /&gt;
  lv_img_set_src(img_src, &amp;amp;&amp;lt;name&amp;gt;);        // Set the created file as image (&amp;lt;name&amp;gt;)&lt;br /&gt;
  &lt;br /&gt;
again, make sure to replace &amp;lt;name&amp;gt; with the name you gave it during conversion!&lt;br /&gt;
&lt;br /&gt;
Now that we have bought in the image data, we need to set the position, you can place this just below the lines we wrote for bringing in the image, It can be done with either,&lt;br /&gt;
 lv_obj_set_pos(img_src, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); // &amp;lt;x_pos&amp;gt;, &amp;lt;y_pos&amp;gt; are the coordinates of the cartesian plane&lt;br /&gt;
or,&lt;br /&gt;
 lv_obj_align(img_src, lv_scr_act(), LV_ALIGN_&amp;lt;parameter&amp;gt;, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); &lt;br /&gt;
&lt;br /&gt;
If done correctly, you will now have a beautiful little Icon/Image in your Watch face,&lt;br /&gt;
Make sure that your Watch face can accommodate the Image by pushing the other labels farther away creating space for it...&lt;br /&gt;
&lt;br /&gt;
We have provided a small template you can use for adding even a large image comfortably&lt;br /&gt;
&lt;br /&gt;
If you have succeeded with this, you have completed part 3 of the tutorial.&lt;br /&gt;
&lt;br /&gt;
=Creating an entirely new watchface=&lt;br /&gt;
The instructions above describe how to modify the existing default watchface, if you would like to create a new watchface instead you will need to complete some additional steps. We will refer to the new watchface as WatchFaceName in these instructions.&lt;br /&gt;
&lt;br /&gt;
==Create the watchface files==&lt;br /&gt;
The watchface is composed of 2 files, WatchFaceName.cpp and WatchFaceName.h. You can copy them from one of the existing watchfaces and give it a new name to provide a basic layout to start from. It is important to increment the ClockFace number near the top of WatchFaceName.cpp otherwise the wrong watchface will be displayed when leaving the menu.&lt;br /&gt;
   settingsController.SetClockFace(0);&lt;br /&gt;
&lt;br /&gt;
==Add the watchface to Clock.cpp and Clock.h==&lt;br /&gt;
Clock.cpp now provides the ability to switch between multiple watchfaces by long-pressing the screen. You will need to make 3 modifications in Clock.cpp and 2 modifications in Clock.h. &lt;br /&gt;
&lt;br /&gt;
'''src/displayapp/screens/Clock.cpp'''&lt;br /&gt;
 #include &amp;quot;WatchFaceDigital.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;WatchFaceAnalog.h&amp;quot;&lt;br /&gt;
 '''#include &amp;quot;WatchFaceName.h&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
                [this]() -&amp;gt; std::unique_ptr&amp;lt;Screen&amp;gt; { return WatchFaceDigitalScreen(); },&lt;br /&gt;
                [this]() -&amp;gt; std::unique_ptr&amp;lt;Screen&amp;gt; { return WatchFaceAnalogScreen(); },&lt;br /&gt;
                '''[this]() -&amp;gt; std::unique_ptr&amp;lt;Screen&amp;gt; { return WatchFaceNameScreen(); },'''&lt;br /&gt;
&lt;br /&gt;
 std::unique_ptr&amp;lt;Screen&amp;gt; Clock::WatchFaceAnalogScreen() {  &lt;br /&gt;
   return std::make_unique&amp;lt;Screens::WatchFaceAnalog&amp;gt;(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 '''std::unique_ptr&amp;lt;Screen&amp;gt; Clock::WatchFaceNameScreen() {  '''&lt;br /&gt;
   '''return std::make_unique&amp;lt;Screens::WatchFaceName&amp;gt;(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, heartRateController);'''&lt;br /&gt;
 '''}'''&lt;br /&gt;
&lt;br /&gt;
'''src/displayapp/screens/Clock.h'''&lt;br /&gt;
          ScreenList&amp;lt;'''3'''&amp;gt; screens;&lt;br /&gt;
          std::unique_ptr&amp;lt;Screen&amp;gt; WatchFaceDigitalScreen();&lt;br /&gt;
          std::unique_ptr&amp;lt;Screen&amp;gt; WatchFaceAnalogScreen();&lt;br /&gt;
          '''std::unique_ptr&amp;lt;Screen&amp;gt; WatchFaceNameScreen();'''&lt;br /&gt;
&lt;br /&gt;
Be sure to increment the number of screens.&lt;br /&gt;
&lt;br /&gt;
==Add the watchface to CMakeLists.txt==&lt;br /&gt;
'''src/CMakeLists.txt'''&lt;br /&gt;
&lt;br /&gt;
        ## Watch faces&lt;br /&gt;
        displayapp/icons/bg_clock.c&lt;br /&gt;
        displayapp/screens/WatchFaceAnalog.cpp&lt;br /&gt;
        displayapp/screens/WatchFaceDigital.cpp&lt;br /&gt;
        '''displayapp/screens/WatchFaceName.cpp'''&lt;br /&gt;
&lt;br /&gt;
=Using git to work on the firmware=&lt;br /&gt;
===Cloning the repository===&lt;br /&gt;
&lt;br /&gt;
Instructions for cloning the repository are available on the [https://github.com/JF002/InfiniTime/blob/develop/doc/buildAndProgram.md Building and programming page] on github.&lt;br /&gt;
&lt;br /&gt;
===Changing the code to add the image===&lt;br /&gt;
&lt;br /&gt;
Use the editor of your choice to modify the source files. Please read the [https://github.com/JF002/InfiniTime/blob/develop/doc/contribute.md#coding-convention coding conventions] before you start.&lt;br /&gt;
&lt;br /&gt;
===Compiling the firmware===&lt;br /&gt;
&lt;br /&gt;
Information about how to compile the firmware is included on the [https://github.com/JF002/InfiniTime/blob/develop/doc/buildAndProgram.md Building and programming page] on github.&lt;br /&gt;
&lt;br /&gt;
==Testing the firmware==&lt;br /&gt;
===Installing the new firmware===&lt;br /&gt;
&lt;br /&gt;
A holistic guide on how to install different firmware using various hardware programmers is available here: [[Reprogramming the PineTime]].&lt;br /&gt;
&lt;br /&gt;
If you would like to install the firmware by OTA/DFU, you can follow these steps:&lt;br /&gt;
 cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=/path/to/gcc-arm-none-eabi-9-2020-q2-update -DNRF5_SDK_PATH=/path/to/nRF5_SDK_15.3.0_59ac345 -DUSE_OPENOCD=1 -DBUILD_DFU=1 ../&lt;br /&gt;
 make -j pinetime-mcuboot-app&lt;br /&gt;
&lt;br /&gt;
Be aware the paths for the cmake command must be absolute. The -DBUILD_DFU argument will generate a zip file which can be flashed using nRF Connect or Gadgetbridge on Android. You must have adafruit-nrfutil installed in your $PATH for this to work.&lt;br /&gt;
&lt;br /&gt;
===Activating the firmware===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How to troubleshoot===&lt;br /&gt;
==Conclusions==&lt;br /&gt;
==Next steps==&lt;br /&gt;
==More in-depth documentation==&lt;br /&gt;
==Thanks for the help==&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9794</id>
		<title>PineTime Custom Watchface Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9794"/>
		<updated>2021-04-09T12:20:05Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: Add info about OTA installation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTime Custom Watchface Tutorial=&lt;br /&gt;
&lt;br /&gt;
This is a tutorial to help new users create custom watchfaces based on the InfiniTime Firmware for Pinetime made by user JF002, thanks to him for its development...&lt;br /&gt;
&lt;br /&gt;
We will explain some of the things we went through while creating some custom Watchfaces, so consider this as a log of experiments of sorts..&lt;br /&gt;
&lt;br /&gt;
So stay tuned to it as it will be dynamically updated...&lt;br /&gt;
&lt;br /&gt;
==What you need to start==&lt;br /&gt;
The entire building process will be done by GitHub, so all you need is a device which can give you a Github Web Client, a PC or tablet to give you enough screen space to review your code and a steady internet connection.&lt;br /&gt;
&lt;br /&gt;
Since the compiling and file management is done by Github online, you have nothing else to worry about other than working with the files that display the watch face.&lt;br /&gt;
&lt;br /&gt;
So with those things settled, let's start with the basics of a watchface.&lt;br /&gt;
&lt;br /&gt;
Please remember that this is a wiki, so you can make an account and help us improve this page.&lt;br /&gt;
&lt;br /&gt;
Please make sure not to unilaterally remove info though, but offer an alternative. If it is indeed a better way, in time your alternative will grow into the main text, and the latter info will be pruned.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
The Firmware (also called InfiniTime) we will be working with is made with a programming language named '''C++''':[https://en.wikipedia.org/wiki/C%2B%2B]&lt;br /&gt;
&lt;br /&gt;
Basic knowledge of C/C++ is required to to understand the advanced watch faces as that requires more complex code, but you can still do a some cool things without much knowledge of C++ programming, just some small edits to existing programs.&lt;br /&gt;
&lt;br /&gt;
InfiniTime uses the '''LVGL''':[https://lvgl.io] graphics library to provide users with a simple and clean UI without overpowering the Nordic '''nRF52832''':[http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf] microcontroller which is the brain of the watch.&lt;br /&gt;
&lt;br /&gt;
To get the watchface to work there are these basic steps. We will go over each step separately, so don't be daunted, all will become clear soon.&lt;br /&gt;
&lt;br /&gt;
For now we will, modify the the existing watchface, change the positioning of the text labels, add an icon to an existing watchface, and later on we will do a full watchface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The main file we need to focus on is the '''WatchFaceDigital.cpp''' file, it is what contains most of the data attributed to what we see on the watchface, including The time/day characters, the battery and bluetooth icons, and also pedometer count...&lt;br /&gt;
&lt;br /&gt;
so everything we will be doing in the basic modifications is purely messing with this single file.&lt;br /&gt;
&lt;br /&gt;
==Labels==&lt;br /&gt;
===What are labels?===&lt;br /&gt;
Labels are considered as &amp;quot;elemental&amp;quot; parts that make up a screen's Text-based UI by the LVGL library...&lt;br /&gt;
Each label is also considered as an &amp;quot;object&amp;quot; or &amp;quot;obj&amp;quot; and can be manipulated, by changing the data attributed with the &amp;quot;obj&amp;quot;, for example, position, internal data like the strings/text etc.&lt;br /&gt;
when can change what the label shows and where it shows it...&lt;br /&gt;
&lt;br /&gt;
===Modifying label data===&lt;br /&gt;
let's observe something small like the word &amp;quot;BPM&amp;quot; near the bottom of the watch face...&lt;br /&gt;
[[file:PineTimeCustom-1.png|right|200px]]&lt;br /&gt;
&lt;br /&gt;
If we take a look at the source file of the watchface, (a.k.a the clock.cpp file)&lt;br /&gt;
we can observe that these particular lines are what attributes to the word &amp;quot;BPM being displayed...&lt;br /&gt;
 heartbeatBpm = lv_label_create(lv_scr_act(), NULL);&lt;br /&gt;
 lv_label_set_text(heartbeatBpm, &amp;quot;BPM&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
we can modify the text inside the quotes and replace the word 'BPM' between those quotes to something like 'LOVE'&lt;br /&gt;
and the result after compiling the firmware again with the changes and flashing it to the watch would be that the text changes on the watch face and displays 'LOVE' inplace of 'BPM'...&lt;br /&gt;
&lt;br /&gt;
If this happened correctly, then you have successfully made a custom new watchface! Now we can do something a bit more complex...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now take for in instance the days of the week that we have on the bottom line with the date...&lt;br /&gt;
&lt;br /&gt;
they are stored a &amp;quot;C array&amp;quot; which is basically multiple words separated by commas..&lt;br /&gt;
the date is in a format of '''&amp;lt;day of the week&amp;gt; &amp;lt;day&amp;gt; &amp;lt;Month&amp;gt; &amp;lt;year&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
which in the source file is expressed as,&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
 lv_label_set_text(label_date, dateStr);&lt;br /&gt;
&lt;br /&gt;
here, &lt;br /&gt;
 %s %d %s %d &lt;br /&gt;
stores the print format of the variables, and&lt;br /&gt;
&lt;br /&gt;
 DayOfWeekToString(dayOfWeek), day, MonthToString(month), year  &lt;br /&gt;
are the variables themselves...&lt;br /&gt;
&lt;br /&gt;
Now, &lt;br /&gt;
if the date was a saturday 11/7/2020, you can observe that the date looks like &lt;br /&gt;
 SATURDAY 11 JUL 2020&lt;br /&gt;
as seen in the above image (the one where we changed BPM to LOVE)&lt;br /&gt;
&lt;br /&gt;
by modifying the format of the variables, we can change how those words are arranged, and add some extra characters if we like... &lt;br /&gt;
 (there is a catch to the list of characters you can use however, but it will be discussed later...)&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
We modifying the format by adding a comma... &amp;quot;,&amp;quot; in between the second &amp;quot;%s&amp;quot; and &amp;quot;%d&amp;quot; like this,&lt;br /&gt;
 &amp;quot;%s %d %s, %d&amp;quot;&lt;br /&gt;
and changing that in the line...&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s, %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
&lt;br /&gt;
we can make the date become...&lt;br /&gt;
 SATURDAY 11 JUL, 2020&lt;br /&gt;
&lt;br /&gt;
which means we now were able to modify how the text got display to make it a bit more nice...&lt;br /&gt;
&lt;br /&gt;
but if you haven't noticed, the line containing the date is already full, meaning we will get some problems while displaying the date and causing it to wrap around,&lt;br /&gt;
making a single character go to the next line and look more like,&lt;br /&gt;
&lt;br /&gt;
 SATURDAY 11 JUL, 202&lt;br /&gt;
 0&lt;br /&gt;
&lt;br /&gt;
so why don't we shorten the characters present in the date from being &amp;quot;SATURDAY&amp;quot; to simply just &amp;quot;sat.&amp;quot; (It will have the small period at the end, and is only 3 characters long) &lt;br /&gt;
I will also convert the months of the year from Capital to small letters... &lt;br /&gt;
&lt;br /&gt;
for that look into the part where the days of the week of are stored as text,&lt;br /&gt;
and also while looking at it, we can solve another question, why was their two variables in the date format that looked like, DayOfWeekToString(dayOfWeek), and MonthToString(month) ?&lt;br /&gt;
&lt;br /&gt;
It is because the system gives the date/ time as numbers (Monday-1, Tuesday-2 Wednesday-3 for the days, and 1-January, 2-February, 3-March ),&lt;br /&gt;
and so a function along with a C array is used to assign these numbers to Days/Months in text form as it is easier to read...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this is the Array containing the day of the week, (as text) &lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;MONDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;TUESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;WEDNESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;THURSDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;FRIDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SATURDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SUNDAY&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and this Array stores the months of the year, (as text)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;JAN&amp;quot;,&lt;br /&gt;
        &amp;quot;FEB&amp;quot;,&lt;br /&gt;
        &amp;quot;MAR&amp;quot;,&lt;br /&gt;
        &amp;quot;APR&amp;quot;,&lt;br /&gt;
        &amp;quot;MAY&amp;quot;,&lt;br /&gt;
        &amp;quot;JUN&amp;quot;,&lt;br /&gt;
        &amp;quot;JUL&amp;quot;,&lt;br /&gt;
        &amp;quot;AUG&amp;quot;,&lt;br /&gt;
        &amp;quot;SEP&amp;quot;,&lt;br /&gt;
        &amp;quot;OCT&amp;quot;,&lt;br /&gt;
        &amp;quot;NOV&amp;quot;,&lt;br /&gt;
        &amp;quot;DEC&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
here we can see that the days are stored in a full format as &amp;quot;SUNDAY&amp;quot;, &amp;quot;MONDAY&amp;quot;, &amp;quot;TUESDAY&amp;quot; etc.&lt;br /&gt;
we can change all of them to a shorter format like &amp;quot;sun.&amp;quot;, &amp;quot;mon.&amp;quot;, &amp;quot;tue.&amp;quot;, to make it short and nice...&lt;br /&gt;
while doing so, we can even make the months use small letters as said before..&lt;br /&gt;
&lt;br /&gt;
so the source file (clock.cpp) becomes,&lt;br /&gt;
&lt;br /&gt;
(for the days of the week)&lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;mon.&amp;quot;,&lt;br /&gt;
        &amp;quot;tue.&amp;quot;,&lt;br /&gt;
        &amp;quot;wed.&amp;quot;,&lt;br /&gt;
        &amp;quot;thu.&amp;quot;,&lt;br /&gt;
        &amp;quot;fri.&amp;quot;,&lt;br /&gt;
        &amp;quot;sat.&amp;quot;,&lt;br /&gt;
        &amp;quot;sun.&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
(for the months of the year)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;jan&amp;quot;,&lt;br /&gt;
        &amp;quot;feb&amp;quot;,&lt;br /&gt;
        &amp;quot;mar&amp;quot;,&lt;br /&gt;
        &amp;quot;apr&amp;quot;,&lt;br /&gt;
        &amp;quot;may&amp;quot;,&lt;br /&gt;
        &amp;quot;jun&amp;quot;,&lt;br /&gt;
        &amp;quot;jul&amp;quot;,&lt;br /&gt;
        &amp;quot;aug&amp;quot;,&lt;br /&gt;
        &amp;quot;sep&amp;quot;,&lt;br /&gt;
        &amp;quot;oct&amp;quot;,&lt;br /&gt;
        &amp;quot;nov&amp;quot;,&lt;br /&gt;
        &amp;quot;dec&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
which means now our original date, saturday 11/7/2020 will become...&lt;br /&gt;
 sat. 11 jul, 2020&lt;br /&gt;
&lt;br /&gt;
you now know how to change the data present in a label object, and the format of it..,&lt;br /&gt;
 &lt;br /&gt;
Here is a fun idea you can try: you can even replace the days with whatever thing that tells you (or) reminds you the day of the week &lt;br /&gt;
(like the food served in the cafe, Monday/taco, Tuesday/burger, Wednesday/pasta etc.) &lt;br /&gt;
 &lt;br /&gt;
 NOTE: when making the custom array, don't forget to leave a empty &amp;quot;&amp;quot; as the first element of the array,&lt;br /&gt;
 This is because the date is given by the system in a natural numbers format (1,2,3...) rather than a zero-starting format (0,1,2,3...), which the C array uses to index...&lt;br /&gt;
 so the C array indexes the days as &amp;quot;&amp;quot;-0, &amp;quot;Monday&amp;quot;-1, &amp;quot;Tuesday&amp;quot;-2 etc. and the months as &amp;quot;&amp;quot;-0, &amp;quot;January&amp;quot;-1, &amp;quot;February&amp;quot;-2 etc.)&lt;br /&gt;
&lt;br /&gt;
===Label positioning===&lt;br /&gt;
&lt;br /&gt;
The locational placement in LVGL is done on a cartesian plane,&lt;br /&gt;
where each object can have dynamic origin placement, and the Y-axis is inverted...&lt;br /&gt;
So going down is done with a positive Y-axis value and not negative as the it is by de-facto...&lt;br /&gt;
&lt;br /&gt;
[[File:LVGL coord system.png|200px|thumb|right|LVGL coord system]]&lt;br /&gt;
&lt;br /&gt;
The position of the various objects in clock.cpp are set by the line,&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
and the top left corner is the Cartesian origin, aka coordinates (0,0)&lt;br /&gt;
&lt;br /&gt;
this image can show you how to decide label placement for lv_obj_set_pos(...)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we use another function, that is more advanced that gives the positional alignment based on preset locations...&lt;br /&gt;
 lv_obj_align(&amp;lt;text/obj&amp;gt;, &amp;lt;image/obj&amp;gt;, &amp;lt;location_parameter&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
the &amp;quot;&amp;lt;image/obj&amp;gt;&amp;quot; data is used for putting text beside other picture icons , and so if using only text based labels, we can substitute it with,&lt;br /&gt;
 lv_scr_act() (or) NULL&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;''' are the cartesian coordinates, '''&amp;lt;location parameter&amp;gt;''' is replaced by '''LV_ALIGN_&amp;lt;preset&amp;gt;''',&lt;br /&gt;
there will be a picture showing the presets below, and '''&amp;lt;text/obj&amp;gt;''' is your text label...&lt;br /&gt;
&lt;br /&gt;
here, LV_ALIGN_&amp;lt;preset&amp;gt; sets the cartesian origin...&lt;br /&gt;
&lt;br /&gt;
Label positioning based on alignment is both a simple and complicated thing to understand, so here I have given something you can refer to while modifying the position of the various labels and objects...&lt;br /&gt;
&lt;br /&gt;
you can also refer here for LVGL's documentation of coordinate system https://docs.lvgl.io/v6/en/html/object-types/obj.html#coordinates&lt;br /&gt;
&lt;br /&gt;
It is however recommended that you use the first method to set the location&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
as it is simple and easier for beginners&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a small example.&lt;br /&gt;
&lt;br /&gt;
Take the Label that tells the date,&lt;br /&gt;
In the source file (clock.cpp) it is this line,&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);&lt;br /&gt;
by increasing the Value of the Y coordinate (60) to a higher value, we can bring the position of the Date downwards a bit away from the Time, and toward the Heartbeat count in the bottom row&lt;br /&gt;
here I will increase it to 80, so it becomes..&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80);&lt;br /&gt;
&lt;br /&gt;
and now we have made some space up top..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
now let's try something a bit complex,&lt;br /&gt;
&lt;br /&gt;
Take the position argument for the label that tells you time...&lt;br /&gt;
here, in the source file (clock.cpp),&lt;br /&gt;
 lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this line determines the position of the Label telling time, as seen in the image...&lt;br /&gt;
&lt;br /&gt;
we modifying this, by changing the origin &amp;lt;preset&amp;gt; parameter (here it is LV_ALIGN_IN_LEFT_MID) to LV_ALIGN_IN_TOP_LEFT&lt;br /&gt;
&lt;br /&gt;
you can alternatively swap the whole line to,&lt;br /&gt;
 lv_obj_set_pos(label_time, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this makes the Time label/obj. to go to the top left corner...&lt;br /&gt;
&lt;br /&gt;
but I will do something a little extra,&lt;br /&gt;
I will modify the label that store the data and Time format,&lt;br /&gt;
i.e this line,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c:%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
by removing the &amp;quot;:&amp;quot; colon in between the numbers, and replacing it with a Newline symbol &amp;quot;\n&amp;quot;&lt;br /&gt;
I change it to become,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c\n%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
this gives it a nice wrapped text format in the top corner, and gives us some space to play with in the side, for things like Pictures and icons, which we will do next..&lt;br /&gt;
&lt;br /&gt;
If you have been able to do these things, you now have completed the 2nd part of the tutorial, and now know how to change and modify the position of labels..&lt;br /&gt;
&lt;br /&gt;
==Using icons==&lt;br /&gt;
The LVGL library allows for the use of widgets known as &amp;quot;Images&amp;quot;, In short it allows you to use small Icons like pictures with a small dedicated function,&lt;br /&gt;
However when this was attempted the first time we stumbled on some problems as LVGL v6 (used on the pinetime) is not much documented as the latest release (v7 as of August 2020) &lt;br /&gt;
but also the existing code was only documented for C not C++, after some painful attempts we were able to translate it into C++, &lt;br /&gt;
&lt;br /&gt;
To bring images into Clock.cpp&lt;br /&gt;
you will need to do the following,&lt;br /&gt;
&lt;br /&gt;
1. Have a small image that cannot exceed a maximum size of 240px x 240px (pinetime max resolution)&lt;br /&gt;
&lt;br /&gt;
2. Use this Image converter (Thanks to LVGL) https://lvgl.io/tools/imageconverter&lt;br /&gt;
to convert your image to a C array and having the Color format as &amp;quot;True color&amp;quot; and the output format as &amp;quot;C array&amp;quot;&lt;br /&gt;
make sure to use something simple as the name we will be using &amp;quot;bitmap&amp;quot; as the name, but will also be referred as &amp;lt;name&amp;gt; for simplicity&lt;br /&gt;
&lt;br /&gt;
 Note: for example we shall use &amp;lt;name&amp;gt; = bitmap, but any simple word can be used, as long as it does not cause problems with system variables&lt;br /&gt;
&lt;br /&gt;
===Image size considerations===&lt;br /&gt;
since the image will be using the flash directly, we need to be considerate about flash memory usage.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;picture_X&amp;gt; x &amp;lt;picture_Y&amp;gt; x 2 &lt;br /&gt;
gives you the number of KB the image used in storage...&lt;br /&gt;
&lt;br /&gt;
where, &amp;lt;picture_X&amp;gt; &amp;lt;picture_Y&amp;gt; are the dimensions of the image horizontally and vertically&lt;br /&gt;
&lt;br /&gt;
for example,&lt;br /&gt;
 if &amp;lt;picture_X&amp;gt;=80px &amp;lt;picture_Y&amp;gt;=64px&lt;br /&gt;
then,&lt;br /&gt;
 total storage used = 80 x 60 x 2 = 10.24KB &lt;br /&gt;
&lt;br /&gt;
 please use the flash storage with consideration, when using other apps as well, excess usage of storage &lt;br /&gt;
 might mean the Firmware will not compile... the limit to storage to about 400Kb for the user, the &lt;br /&gt;
 firmware size must not exceed that...&lt;br /&gt;
&lt;br /&gt;
==Preparing the image for inclusion as an icon==&lt;br /&gt;
&lt;br /&gt;
Once you have your obtained your C array from the LVGL converter, you can take a look inside it to see all the different formats of your image, &lt;br /&gt;
try using something like Notepad++ or any of your favorite text editors to peek inside of it,&lt;br /&gt;
 &lt;br /&gt;
there will be 4 sets of Arrays inside it that look like,&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8&lt;br /&gt;
  /*Pixel format: Red: 3 bit, Green: 3 bit, Blue: 2 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP == 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 32&lt;br /&gt;
  /*Pixel format: Fix 0xFF: 8 bit, Red: 8 bit, Green: 8 bit, Blue: 8 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0xff, &lt;br /&gt;
 #endif&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
And another small bit of info we will need for later that looks like,&lt;br /&gt;
&lt;br /&gt;
 const lv_img_dsc_t bitmap = {&lt;br /&gt;
  .header.always_zero = 0,&lt;br /&gt;
  .header.w = 40,&lt;br /&gt;
  .header.h = 40,&lt;br /&gt;
  .data_size = 1600 * LV_COLOR_SIZE / 8,&lt;br /&gt;
  .header.cf = LV_IMG_CF_TRUE_COLOR,&lt;br /&gt;
  .data = bitmap_map,&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 NOTE: There are some header files at the top, which we can ignore...&lt;br /&gt;
===RGB565 image format===&lt;br /&gt;
&lt;br /&gt;
The Pinetime uses a display that uses a 16 bit color space, also known as RGB565.&lt;br /&gt;
&lt;br /&gt;
These 16 bit are assigned to RGB as 5 bits each for Red and Blue and 6 bits for Green, so 5+6+5=16 bits are required, so each pixel's color occupies 2 bytes of data,&lt;br /&gt;
and since 2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt; is equal to 65,536 it allows us to view 65,536 or 65k colors&lt;br /&gt;
&lt;br /&gt;
The way it packs these bits is by converting the bits into 2x  4+4 bit hex-code, so for example,&lt;br /&gt;
 &lt;br /&gt;
if the color of a pixel in Binary is '''10110100 01011111''' (this color is approximately Lavender purple)&lt;br /&gt;
 &lt;br /&gt;
It is split as '''1011''' &amp;amp; '''0100''' for the first byte and '''0101''' &amp;amp; '''1111''' for the second byte&lt;br /&gt;
and so, converting the binary into Hex-code,&lt;br /&gt;
&lt;br /&gt;
the two parts are '''0xB4''' and '''0xF5'''&lt;br /&gt;
&lt;br /&gt;
These two parts in conjunction are used for determining the color of one pixel...&lt;br /&gt;
&lt;br /&gt;
also from the binary, it is observed that,&lt;br /&gt;
&lt;br /&gt;
The bits '''10110''' is used for Red, '''100010''' is used for green, and '''11111''' is used for blue.&lt;br /&gt;
&lt;br /&gt;
===Flipping the bytes===&lt;br /&gt;
The LVGL library has a feature that allows you to flip the two bytes of the pixel, so if the two parts were, ...0xB4,0xF5,... ,it will change it to become, ...0xF5,0xB4,...&lt;br /&gt;
&lt;br /&gt;
The reason for this is to allow the use of 8-bit SPI interfaces, but we do not require it, and if set with  wrong parameter we could get problems with the color...&lt;br /&gt;
&lt;br /&gt;
To make sure you are ready for the next step, make sure that inside your lvgl configuration file (located at '''src/libs/lv_conf.h''')&lt;br /&gt;
&lt;br /&gt;
this parameter, &lt;br /&gt;
 '''#define LV_COLOR_16_SWAP   1'''&lt;br /&gt;
is set to &amp;quot;1&amp;quot; as seen...&lt;br /&gt;
&lt;br /&gt;
 NOTE: if you haven't modified it or tampered with it with your Github fork, you shouldn't have a problem &lt;br /&gt;
 as it is correct by default, and you can skip these steps&lt;br /&gt;
&lt;br /&gt;
===Creating an Object from the Array===&lt;br /&gt;
To include the Icon, first Identify the Array you need to copy to the source (clock.cpp)&lt;br /&gt;
&lt;br /&gt;
The one we require from it is the data below the tag that looks like,&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
 /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
from this copy the Data from the array alone...&lt;br /&gt;
I.e this part,&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00&lt;br /&gt;
&lt;br /&gt;
(Make sure to not include the comma at the end or the #endif as the entire part is going to substitute a new array)&lt;br /&gt;
&lt;br /&gt;
In clock.cpp, just below the header files and the Task creation part (I.e event_handler...),&lt;br /&gt;
&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
 Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
 screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
create a name for the label with,&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;; // remember to replace &amp;lt;name&amp;gt; with the actual name you gave to your image while converting !&lt;br /&gt;
&lt;br /&gt;
then below it create a array to hold the data with,&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {}; // paste the array you copied from the conversion file we specified above...&lt;br /&gt;
&lt;br /&gt;
so your  array is something like,&lt;br /&gt;
&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00};&lt;br /&gt;
&lt;br /&gt;
so your Entire top region of declaration looks like,&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
 #include &amp;lt;libs/date/includes/date/date.h&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 using namespace Pinetime::Applications::Screens;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_extrabold_compressed;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_bold_20;&lt;br /&gt;
 extern lv_style_t* LabelBigStyle;&lt;br /&gt;
 '''   '''&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
  Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
  screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
 '''   '''&lt;br /&gt;
 '''//Declare the descriptor here'''&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;;&lt;br /&gt;
 '''//place the Image data here&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''note: Declaring variables outside a function like we did above is known as global scope declaration, this means the variable can be used by not just one function but the Entire code...'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then inside the &lt;br /&gt;
 Clock::Clock(DisplayApp* app,...){... &lt;br /&gt;
region, (the watchface function)&lt;br /&gt;
You need to place a particular set of lines which LVGL uses to define the object declare the array as an Icon/Image, You can place this set of lines above label_time...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.always_zero = 0; //Initialization&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.w = &amp;lt;picture_X&amp;gt;;                     // Setting the Width (or) Horizontal length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.h = &amp;lt;picture_Y&amp;gt;;                     // Setting the Height (or) vertical length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.data_size = &amp;lt;Hr_length&amp;gt; * &amp;lt;Vr_length&amp;gt; * LV_COLOR_SIZE / 8; //Allocation of memory for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.cf = LV_IMG_CF_TRUE_COLOR; // Sets the color scheme for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.data = &amp;lt;name&amp;gt;_map;                // Maps the Image data to the Array&lt;br /&gt;
  lv_obj_t *img_src = lv_img_create(lv_scr_act(), NULL);  // Create an image object&lt;br /&gt;
  lv_img_set_src(img_src, &amp;amp;&amp;lt;name&amp;gt;);        // Set the created file as image (&amp;lt;name&amp;gt;)&lt;br /&gt;
  &lt;br /&gt;
again, make sure to replace &amp;lt;name&amp;gt; with the name you gave it during conversion!&lt;br /&gt;
&lt;br /&gt;
Now that we have bought in the image data, we need to set the position, you can place this just below the lines we wrote for bringing in the image, It can be done with either,&lt;br /&gt;
 lv_obj_set_pos(img_src, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); // &amp;lt;x_pos&amp;gt;, &amp;lt;y_pos&amp;gt; are the coordinates of the cartesian plane&lt;br /&gt;
or,&lt;br /&gt;
 lv_obj_align(img_src, lv_scr_act(), LV_ALIGN_&amp;lt;parameter&amp;gt;, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); &lt;br /&gt;
&lt;br /&gt;
If done correctly, you will now have a beautiful little Icon/Image in your Watch face,&lt;br /&gt;
Make sure that your Watch face can accommodate the Image by pushing the other labels farther away creating space for it...&lt;br /&gt;
&lt;br /&gt;
We have provided a small template you can use for adding even a large image comfortably&lt;br /&gt;
&lt;br /&gt;
If you have succeeded with this, you have completed part 3 of the tutorial.&lt;br /&gt;
&lt;br /&gt;
=Creating an entirely new watchface=&lt;br /&gt;
The instructions above describe how to modify the existing default watchface, if you would like to create a new watchface instead you will need to complete some additional steps. We will refer to the new watchface as WatchFaceName in these instructions.&lt;br /&gt;
&lt;br /&gt;
==Create the watchface files==&lt;br /&gt;
The watchface is composed of 2 files, WatchFaceName.cpp and WatchFaceName.h. You can copy them from one of the existing watchfaces and give it a new name to provide a basic layout to start from. It is important to increment the ClockFace number near the top of WatchFaceName.cpp otherwise the wrong watchface will be displayed when leaving the menu.&lt;br /&gt;
   settingsController.SetClockFace(0);&lt;br /&gt;
&lt;br /&gt;
==Add the watchface to Clock.cpp and Clock.h==&lt;br /&gt;
Clock.cpp now provides the ability to switch between multiple watchfaces by long-pressing the screen. You will need to make 3 modifications in Clock.app and 2 modifications in Clock.h. &lt;br /&gt;
&lt;br /&gt;
'''src/displayapp/screens/Clock.cpp'''&lt;br /&gt;
 #include &amp;quot;WatchFaceDigital.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;WatchFaceAnalog.h&amp;quot;&lt;br /&gt;
 '''#include &amp;quot;WatchFaceName.h&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
                [this]() -&amp;gt; std::unique_ptr&amp;lt;Screen&amp;gt; { return WatchFaceDigitalScreen(); },&lt;br /&gt;
                [this]() -&amp;gt; std::unique_ptr&amp;lt;Screen&amp;gt; { return WatchFaceAnalogScreen(); },&lt;br /&gt;
                '''[this]() -&amp;gt; std::unique_ptr&amp;lt;Screen&amp;gt; { return WatchFaceNameScreen(); },'''&lt;br /&gt;
&lt;br /&gt;
 std::unique_ptr&amp;lt;Screen&amp;gt; Clock::WatchFaceAnalogScreen() {  &lt;br /&gt;
   return std::make_unique&amp;lt;Screens::WatchFaceAnalog&amp;gt;(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 '''std::unique_ptr&amp;lt;Screen&amp;gt; Clock::WatchFaceNameScreen() {  '''&lt;br /&gt;
   '''return std::make_unique&amp;lt;Screens::WatchFaceName&amp;gt;(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, heartRateController);'''&lt;br /&gt;
 '''}'''&lt;br /&gt;
&lt;br /&gt;
'''src/displayapp/screens/Clock.h'''&lt;br /&gt;
          ScreenList&amp;lt;'''3'''&amp;gt; screens;&lt;br /&gt;
          std::unique_ptr&amp;lt;Screen&amp;gt; WatchFaceDigitalScreen();&lt;br /&gt;
          std::unique_ptr&amp;lt;Screen&amp;gt; WatchFaceAnalogScreen();&lt;br /&gt;
          '''std::unique_ptr&amp;lt;Screen&amp;gt; WatchFaceNameScreen();'''&lt;br /&gt;
&lt;br /&gt;
Be sure to increment the number of screens.&lt;br /&gt;
&lt;br /&gt;
==Add the watchface to CMakeLists.txt==&lt;br /&gt;
'''src/CMakeLists.txt'''&lt;br /&gt;
&lt;br /&gt;
        ## Watch faces&lt;br /&gt;
        displayapp/icons/bg_clock.c&lt;br /&gt;
        displayapp/screens/WatchFaceAnalog.cpp&lt;br /&gt;
        displayapp/screens/WatchFaceDigital.cpp&lt;br /&gt;
        '''displayapp/screens/WatchFaceName.cpp'''&lt;br /&gt;
&lt;br /&gt;
=Using git to work on the firmware=&lt;br /&gt;
===Cloning the repository===&lt;br /&gt;
&lt;br /&gt;
Instructions for cloning the repository are available on the [https://github.com/JF002/InfiniTime/blob/develop/doc/buildAndProgram.md Building and programming page] on github.&lt;br /&gt;
&lt;br /&gt;
===Changing the code to add the image===&lt;br /&gt;
&lt;br /&gt;
Use the editor of your choice to modify the source files. Please read the [https://github.com/JF002/InfiniTime/blob/develop/doc/contribute.md#coding-convention coding conventions] before you start.&lt;br /&gt;
&lt;br /&gt;
===Compiling the firmware===&lt;br /&gt;
&lt;br /&gt;
Information about how to compile the firmware is included on the [https://github.com/JF002/InfiniTime/blob/develop/doc/buildAndProgram.md Building and programming page] on github.&lt;br /&gt;
&lt;br /&gt;
==Testing the firmware==&lt;br /&gt;
===Installing the new firmware===&lt;br /&gt;
&lt;br /&gt;
A holistic guide on how to install different firmware using various hardware programmers is available here: [[Reprogramming the PineTime]].&lt;br /&gt;
&lt;br /&gt;
If you would like to install the firmware by OTA/DFU, you can follow these steps:&lt;br /&gt;
 cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=/path/to/gcc-arm-none-eabi-9-2020-q2-update -DNRF5_SDK_PATH=/path/to/nRF5_SDK_15.3.0_59ac345 -DUSE_OPENOCD=1 -DBUILD_DFU=1 ../&lt;br /&gt;
 make -j pinetime-mcuboot-app&lt;br /&gt;
&lt;br /&gt;
Be aware the paths for the cmake command must be absolute. The -DBUILD_DFU argument will generate a zip file which can be flashed using nRF Connect or Gadgetbridge on Android. You must have adafruit-nrfutil installed in your $PATH for this to work.&lt;br /&gt;
&lt;br /&gt;
===Activating the firmware===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How to troubleshoot===&lt;br /&gt;
==Conclusions==&lt;br /&gt;
==Next steps==&lt;br /&gt;
==More in-depth documentation==&lt;br /&gt;
==Thanks for the help==&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9793</id>
		<title>PineTime Custom Watchface Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9793"/>
		<updated>2021-04-09T12:05:27Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: Add instructions for creating a new watchface&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTime Custom Watchface Tutorial=&lt;br /&gt;
&lt;br /&gt;
This is a tutorial to help new users create custom watchfaces based on the InfiniTime Firmware for Pinetime made by user JF002, thanks to him for its development...&lt;br /&gt;
&lt;br /&gt;
We will explain some of the things we went through while creating some custom Watchfaces, so consider this as a log of experiments of sorts..&lt;br /&gt;
&lt;br /&gt;
So stay tuned to it as it will be dynamically updated...&lt;br /&gt;
&lt;br /&gt;
==What you need to start==&lt;br /&gt;
The entire building process will be done by GitHub, so all you need is a device which can give you a Github Web Client, a PC or tablet to give you enough screen space to review your code and a steady internet connection.&lt;br /&gt;
&lt;br /&gt;
Since the compiling and file management is done by Github online, you have nothing else to worry about other than working with the files that display the watch face.&lt;br /&gt;
&lt;br /&gt;
So with those things settled, let's start with the basics of a watchface.&lt;br /&gt;
&lt;br /&gt;
Please remember that this is a wiki, so you can make an account and help us improve this page.&lt;br /&gt;
&lt;br /&gt;
Please make sure not to unilaterally remove info though, but offer an alternative. If it is indeed a better way, in time your alternative will grow into the main text, and the latter info will be pruned.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
The Firmware (also called InfiniTime) we will be working with is made with a programming language named '''C++''':[https://en.wikipedia.org/wiki/C%2B%2B]&lt;br /&gt;
&lt;br /&gt;
Basic knowledge of C/C++ is required to to understand the advanced watch faces as that requires more complex code, but you can still do a some cool things without much knowledge of C++ programming, just some small edits to existing programs.&lt;br /&gt;
&lt;br /&gt;
InfiniTime uses the '''LVGL''':[https://lvgl.io] graphics library to provide users with a simple and clean UI without overpowering the Nordic '''nRF52832''':[http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf] microcontroller which is the brain of the watch.&lt;br /&gt;
&lt;br /&gt;
To get the watchface to work there are these basic steps. We will go over each step separately, so don't be daunted, all will become clear soon.&lt;br /&gt;
&lt;br /&gt;
For now we will, modify the the existing watchface, change the positioning of the text labels, add an icon to an existing watchface, and later on we will do a full watchface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The main file we need to focus on is the '''WatchFaceDigital.cpp''' file, it is what contains most of the data attributed to what we see on the watchface, including The time/day characters, the battery and bluetooth icons, and also pedometer count...&lt;br /&gt;
&lt;br /&gt;
so everything we will be doing in the basic modifications is purely messing with this single file.&lt;br /&gt;
&lt;br /&gt;
==Labels==&lt;br /&gt;
===What are labels?===&lt;br /&gt;
Labels are considered as &amp;quot;elemental&amp;quot; parts that make up a screen's Text-based UI by the LVGL library...&lt;br /&gt;
Each label is also considered as an &amp;quot;object&amp;quot; or &amp;quot;obj&amp;quot; and can be manipulated, by changing the data attributed with the &amp;quot;obj&amp;quot;, for example, position, internal data like the strings/text etc.&lt;br /&gt;
when can change what the label shows and where it shows it...&lt;br /&gt;
&lt;br /&gt;
===Modifying label data===&lt;br /&gt;
let's observe something small like the word &amp;quot;BPM&amp;quot; near the bottom of the watch face...&lt;br /&gt;
[[file:PineTimeCustom-1.png|right|200px]]&lt;br /&gt;
&lt;br /&gt;
If we take a look at the source file of the watchface, (a.k.a the clock.cpp file)&lt;br /&gt;
we can observe that these particular lines are what attributes to the word &amp;quot;BPM being displayed...&lt;br /&gt;
 heartbeatBpm = lv_label_create(lv_scr_act(), NULL);&lt;br /&gt;
 lv_label_set_text(heartbeatBpm, &amp;quot;BPM&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
we can modify the text inside the quotes and replace the word 'BPM' between those quotes to something like 'LOVE'&lt;br /&gt;
and the result after compiling the firmware again with the changes and flashing it to the watch would be that the text changes on the watch face and displays 'LOVE' inplace of 'BPM'...&lt;br /&gt;
&lt;br /&gt;
If this happened correctly, then you have successfully made a custom new watchface! Now we can do something a bit more complex...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now take for in instance the days of the week that we have on the bottom line with the date...&lt;br /&gt;
&lt;br /&gt;
they are stored a &amp;quot;C array&amp;quot; which is basically multiple words separated by commas..&lt;br /&gt;
the date is in a format of '''&amp;lt;day of the week&amp;gt; &amp;lt;day&amp;gt; &amp;lt;Month&amp;gt; &amp;lt;year&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
which in the source file is expressed as,&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
 lv_label_set_text(label_date, dateStr);&lt;br /&gt;
&lt;br /&gt;
here, &lt;br /&gt;
 %s %d %s %d &lt;br /&gt;
stores the print format of the variables, and&lt;br /&gt;
&lt;br /&gt;
 DayOfWeekToString(dayOfWeek), day, MonthToString(month), year  &lt;br /&gt;
are the variables themselves...&lt;br /&gt;
&lt;br /&gt;
Now, &lt;br /&gt;
if the date was a saturday 11/7/2020, you can observe that the date looks like &lt;br /&gt;
 SATURDAY 11 JUL 2020&lt;br /&gt;
as seen in the above image (the one where we changed BPM to LOVE)&lt;br /&gt;
&lt;br /&gt;
by modifying the format of the variables, we can change how those words are arranged, and add some extra characters if we like... &lt;br /&gt;
 (there is a catch to the list of characters you can use however, but it will be discussed later...)&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
We modifying the format by adding a comma... &amp;quot;,&amp;quot; in between the second &amp;quot;%s&amp;quot; and &amp;quot;%d&amp;quot; like this,&lt;br /&gt;
 &amp;quot;%s %d %s, %d&amp;quot;&lt;br /&gt;
and changing that in the line...&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s, %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
&lt;br /&gt;
we can make the date become...&lt;br /&gt;
 SATURDAY 11 JUL, 2020&lt;br /&gt;
&lt;br /&gt;
which means we now were able to modify how the text got display to make it a bit more nice...&lt;br /&gt;
&lt;br /&gt;
but if you haven't noticed, the line containing the date is already full, meaning we will get some problems while displaying the date and causing it to wrap around,&lt;br /&gt;
making a single character go to the next line and look more like,&lt;br /&gt;
&lt;br /&gt;
 SATURDAY 11 JUL, 202&lt;br /&gt;
 0&lt;br /&gt;
&lt;br /&gt;
so why don't we shorten the characters present in the date from being &amp;quot;SATURDAY&amp;quot; to simply just &amp;quot;sat.&amp;quot; (It will have the small period at the end, and is only 3 characters long) &lt;br /&gt;
I will also convert the months of the year from Capital to small letters... &lt;br /&gt;
&lt;br /&gt;
for that look into the part where the days of the week of are stored as text,&lt;br /&gt;
and also while looking at it, we can solve another question, why was their two variables in the date format that looked like, DayOfWeekToString(dayOfWeek), and MonthToString(month) ?&lt;br /&gt;
&lt;br /&gt;
It is because the system gives the date/ time as numbers (Monday-1, Tuesday-2 Wednesday-3 for the days, and 1-January, 2-February, 3-March ),&lt;br /&gt;
and so a function along with a C array is used to assign these numbers to Days/Months in text form as it is easier to read...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this is the Array containing the day of the week, (as text) &lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;MONDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;TUESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;WEDNESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;THURSDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;FRIDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SATURDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SUNDAY&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and this Array stores the months of the year, (as text)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;JAN&amp;quot;,&lt;br /&gt;
        &amp;quot;FEB&amp;quot;,&lt;br /&gt;
        &amp;quot;MAR&amp;quot;,&lt;br /&gt;
        &amp;quot;APR&amp;quot;,&lt;br /&gt;
        &amp;quot;MAY&amp;quot;,&lt;br /&gt;
        &amp;quot;JUN&amp;quot;,&lt;br /&gt;
        &amp;quot;JUL&amp;quot;,&lt;br /&gt;
        &amp;quot;AUG&amp;quot;,&lt;br /&gt;
        &amp;quot;SEP&amp;quot;,&lt;br /&gt;
        &amp;quot;OCT&amp;quot;,&lt;br /&gt;
        &amp;quot;NOV&amp;quot;,&lt;br /&gt;
        &amp;quot;DEC&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
here we can see that the days are stored in a full format as &amp;quot;SUNDAY&amp;quot;, &amp;quot;MONDAY&amp;quot;, &amp;quot;TUESDAY&amp;quot; etc.&lt;br /&gt;
we can change all of them to a shorter format like &amp;quot;sun.&amp;quot;, &amp;quot;mon.&amp;quot;, &amp;quot;tue.&amp;quot;, to make it short and nice...&lt;br /&gt;
while doing so, we can even make the months use small letters as said before..&lt;br /&gt;
&lt;br /&gt;
so the source file (clock.cpp) becomes,&lt;br /&gt;
&lt;br /&gt;
(for the days of the week)&lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;mon.&amp;quot;,&lt;br /&gt;
        &amp;quot;tue.&amp;quot;,&lt;br /&gt;
        &amp;quot;wed.&amp;quot;,&lt;br /&gt;
        &amp;quot;thu.&amp;quot;,&lt;br /&gt;
        &amp;quot;fri.&amp;quot;,&lt;br /&gt;
        &amp;quot;sat.&amp;quot;,&lt;br /&gt;
        &amp;quot;sun.&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
(for the months of the year)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;jan&amp;quot;,&lt;br /&gt;
        &amp;quot;feb&amp;quot;,&lt;br /&gt;
        &amp;quot;mar&amp;quot;,&lt;br /&gt;
        &amp;quot;apr&amp;quot;,&lt;br /&gt;
        &amp;quot;may&amp;quot;,&lt;br /&gt;
        &amp;quot;jun&amp;quot;,&lt;br /&gt;
        &amp;quot;jul&amp;quot;,&lt;br /&gt;
        &amp;quot;aug&amp;quot;,&lt;br /&gt;
        &amp;quot;sep&amp;quot;,&lt;br /&gt;
        &amp;quot;oct&amp;quot;,&lt;br /&gt;
        &amp;quot;nov&amp;quot;,&lt;br /&gt;
        &amp;quot;dec&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
which means now our original date, saturday 11/7/2020 will become...&lt;br /&gt;
 sat. 11 jul, 2020&lt;br /&gt;
&lt;br /&gt;
you now know how to change the data present in a label object, and the format of it..,&lt;br /&gt;
 &lt;br /&gt;
Here is a fun idea you can try: you can even replace the days with whatever thing that tells you (or) reminds you the day of the week &lt;br /&gt;
(like the food served in the cafe, Monday/taco, Tuesday/burger, Wednesday/pasta etc.) &lt;br /&gt;
 &lt;br /&gt;
 NOTE: when making the custom array, don't forget to leave a empty &amp;quot;&amp;quot; as the first element of the array,&lt;br /&gt;
 This is because the date is given by the system in a natural numbers format (1,2,3...) rather than a zero-starting format (0,1,2,3...), which the C array uses to index...&lt;br /&gt;
 so the C array indexes the days as &amp;quot;&amp;quot;-0, &amp;quot;Monday&amp;quot;-1, &amp;quot;Tuesday&amp;quot;-2 etc. and the months as &amp;quot;&amp;quot;-0, &amp;quot;January&amp;quot;-1, &amp;quot;February&amp;quot;-2 etc.)&lt;br /&gt;
&lt;br /&gt;
===Label positioning===&lt;br /&gt;
&lt;br /&gt;
The locational placement in LVGL is done on a cartesian plane,&lt;br /&gt;
where each object can have dynamic origin placement, and the Y-axis is inverted...&lt;br /&gt;
So going down is done with a positive Y-axis value and not negative as the it is by de-facto...&lt;br /&gt;
&lt;br /&gt;
[[File:LVGL coord system.png|200px|thumb|right|LVGL coord system]]&lt;br /&gt;
&lt;br /&gt;
The position of the various objects in clock.cpp are set by the line,&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
and the top left corner is the Cartesian origin, aka coordinates (0,0)&lt;br /&gt;
&lt;br /&gt;
this image can show you how to decide label placement for lv_obj_set_pos(...)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we use another function, that is more advanced that gives the positional alignment based on preset locations...&lt;br /&gt;
 lv_obj_align(&amp;lt;text/obj&amp;gt;, &amp;lt;image/obj&amp;gt;, &amp;lt;location_parameter&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
the &amp;quot;&amp;lt;image/obj&amp;gt;&amp;quot; data is used for putting text beside other picture icons , and so if using only text based labels, we can substitute it with,&lt;br /&gt;
 lv_scr_act() (or) NULL&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;''' are the cartesian coordinates, '''&amp;lt;location parameter&amp;gt;''' is replaced by '''LV_ALIGN_&amp;lt;preset&amp;gt;''',&lt;br /&gt;
there will be a picture showing the presets below, and '''&amp;lt;text/obj&amp;gt;''' is your text label...&lt;br /&gt;
&lt;br /&gt;
here, LV_ALIGN_&amp;lt;preset&amp;gt; sets the cartesian origin...&lt;br /&gt;
&lt;br /&gt;
Label positioning based on alignment is both a simple and complicated thing to understand, so here I have given something you can refer to while modifying the position of the various labels and objects...&lt;br /&gt;
&lt;br /&gt;
you can also refer here for LVGL's documentation of coordinate system https://docs.lvgl.io/v6/en/html/object-types/obj.html#coordinates&lt;br /&gt;
&lt;br /&gt;
It is however recommended that you use the first method to set the location&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
as it is simple and easier for beginners&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a small example.&lt;br /&gt;
&lt;br /&gt;
Take the Label that tells the date,&lt;br /&gt;
In the source file (clock.cpp) it is this line,&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);&lt;br /&gt;
by increasing the Value of the Y coordinate (60) to a higher value, we can bring the position of the Date downwards a bit away from the Time, and toward the Heartbeat count in the bottom row&lt;br /&gt;
here I will increase it to 80, so it becomes..&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80);&lt;br /&gt;
&lt;br /&gt;
and now we have made some space up top..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
now let's try something a bit complex,&lt;br /&gt;
&lt;br /&gt;
Take the position argument for the label that tells you time...&lt;br /&gt;
here, in the source file (clock.cpp),&lt;br /&gt;
 lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this line determines the position of the Label telling time, as seen in the image...&lt;br /&gt;
&lt;br /&gt;
we modifying this, by changing the origin &amp;lt;preset&amp;gt; parameter (here it is LV_ALIGN_IN_LEFT_MID) to LV_ALIGN_IN_TOP_LEFT&lt;br /&gt;
&lt;br /&gt;
you can alternatively swap the whole line to,&lt;br /&gt;
 lv_obj_set_pos(label_time, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this makes the Time label/obj. to go to the top left corner...&lt;br /&gt;
&lt;br /&gt;
but I will do something a little extra,&lt;br /&gt;
I will modify the label that store the data and Time format,&lt;br /&gt;
i.e this line,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c:%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
by removing the &amp;quot;:&amp;quot; colon in between the numbers, and replacing it with a Newline symbol &amp;quot;\n&amp;quot;&lt;br /&gt;
I change it to become,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c\n%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
this gives it a nice wrapped text format in the top corner, and gives us some space to play with in the side, for things like Pictures and icons, which we will do next..&lt;br /&gt;
&lt;br /&gt;
If you have been able to do these things, you now have completed the 2nd part of the tutorial, and now know how to change and modify the position of labels..&lt;br /&gt;
&lt;br /&gt;
==Using icons==&lt;br /&gt;
The LVGL library allows for the use of widgets known as &amp;quot;Images&amp;quot;, In short it allows you to use small Icons like pictures with a small dedicated function,&lt;br /&gt;
However when this was attempted the first time we stumbled on some problems as LVGL v6 (used on the pinetime) is not much documented as the latest release (v7 as of August 2020) &lt;br /&gt;
but also the existing code was only documented for C not C++, after some painful attempts we were able to translate it into C++, &lt;br /&gt;
&lt;br /&gt;
To bring images into Clock.cpp&lt;br /&gt;
you will need to do the following,&lt;br /&gt;
&lt;br /&gt;
1. Have a small image that cannot exceed a maximum size of 240px x 240px (pinetime max resolution)&lt;br /&gt;
&lt;br /&gt;
2. Use this Image converter (Thanks to LVGL) https://lvgl.io/tools/imageconverter&lt;br /&gt;
to convert your image to a C array and having the Color format as &amp;quot;True color&amp;quot; and the output format as &amp;quot;C array&amp;quot;&lt;br /&gt;
make sure to use something simple as the name we will be using &amp;quot;bitmap&amp;quot; as the name, but will also be referred as &amp;lt;name&amp;gt; for simplicity&lt;br /&gt;
&lt;br /&gt;
 Note: for example we shall use &amp;lt;name&amp;gt; = bitmap, but any simple word can be used, as long as it does not cause problems with system variables&lt;br /&gt;
&lt;br /&gt;
===Image size considerations===&lt;br /&gt;
since the image will be using the flash directly, we need to be considerate about flash memory usage.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;picture_X&amp;gt; x &amp;lt;picture_Y&amp;gt; x 2 &lt;br /&gt;
gives you the number of KB the image used in storage...&lt;br /&gt;
&lt;br /&gt;
where, &amp;lt;picture_X&amp;gt; &amp;lt;picture_Y&amp;gt; are the dimensions of the image horizontally and vertically&lt;br /&gt;
&lt;br /&gt;
for example,&lt;br /&gt;
 if &amp;lt;picture_X&amp;gt;=80px &amp;lt;picture_Y&amp;gt;=64px&lt;br /&gt;
then,&lt;br /&gt;
 total storage used = 80 x 60 x 2 = 10.24KB &lt;br /&gt;
&lt;br /&gt;
 please use the flash storage with consideration, when using other apps as well, excess usage of storage &lt;br /&gt;
 might mean the Firmware will not compile... the limit to storage to about 400Kb for the user, the &lt;br /&gt;
 firmware size must not exceed that...&lt;br /&gt;
&lt;br /&gt;
==Preparing the image for inclusion as an icon==&lt;br /&gt;
&lt;br /&gt;
Once you have your obtained your C array from the LVGL converter, you can take a look inside it to see all the different formats of your image, &lt;br /&gt;
try using something like Notepad++ or any of your favorite text editors to peek inside of it,&lt;br /&gt;
 &lt;br /&gt;
there will be 4 sets of Arrays inside it that look like,&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8&lt;br /&gt;
  /*Pixel format: Red: 3 bit, Green: 3 bit, Blue: 2 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP == 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 32&lt;br /&gt;
  /*Pixel format: Fix 0xFF: 8 bit, Red: 8 bit, Green: 8 bit, Blue: 8 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0xff, &lt;br /&gt;
 #endif&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
And another small bit of info we will need for later that looks like,&lt;br /&gt;
&lt;br /&gt;
 const lv_img_dsc_t bitmap = {&lt;br /&gt;
  .header.always_zero = 0,&lt;br /&gt;
  .header.w = 40,&lt;br /&gt;
  .header.h = 40,&lt;br /&gt;
  .data_size = 1600 * LV_COLOR_SIZE / 8,&lt;br /&gt;
  .header.cf = LV_IMG_CF_TRUE_COLOR,&lt;br /&gt;
  .data = bitmap_map,&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 NOTE: There are some header files at the top, which we can ignore...&lt;br /&gt;
===RGB565 image format===&lt;br /&gt;
&lt;br /&gt;
The Pinetime uses a display that uses a 16 bit color space, also known as RGB565.&lt;br /&gt;
&lt;br /&gt;
These 16 bit are assigned to RGB as 5 bits each for Red and Blue and 6 bits for Green, so 5+6+5=16 bits are required, so each pixel's color occupies 2 bytes of data,&lt;br /&gt;
and since 2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt; is equal to 65,536 it allows us to view 65,536 or 65k colors&lt;br /&gt;
&lt;br /&gt;
The way it packs these bits is by converting the bits into 2x  4+4 bit hex-code, so for example,&lt;br /&gt;
 &lt;br /&gt;
if the color of a pixel in Binary is '''10110100 01011111''' (this color is approximately Lavender purple)&lt;br /&gt;
 &lt;br /&gt;
It is split as '''1011''' &amp;amp; '''0100''' for the first byte and '''0101''' &amp;amp; '''1111''' for the second byte&lt;br /&gt;
and so, converting the binary into Hex-code,&lt;br /&gt;
&lt;br /&gt;
the two parts are '''0xB4''' and '''0xF5'''&lt;br /&gt;
&lt;br /&gt;
These two parts in conjunction are used for determining the color of one pixel...&lt;br /&gt;
&lt;br /&gt;
also from the binary, it is observed that,&lt;br /&gt;
&lt;br /&gt;
The bits '''10110''' is used for Red, '''100010''' is used for green, and '''11111''' is used for blue.&lt;br /&gt;
&lt;br /&gt;
===Flipping the bytes===&lt;br /&gt;
The LVGL library has a feature that allows you to flip the two bytes of the pixel, so if the two parts were, ...0xB4,0xF5,... ,it will change it to become, ...0xF5,0xB4,...&lt;br /&gt;
&lt;br /&gt;
The reason for this is to allow the use of 8-bit SPI interfaces, but we do not require it, and if set with  wrong parameter we could get problems with the color...&lt;br /&gt;
&lt;br /&gt;
To make sure you are ready for the next step, make sure that inside your lvgl configuration file (located at '''src/libs/lv_conf.h''')&lt;br /&gt;
&lt;br /&gt;
this parameter, &lt;br /&gt;
 '''#define LV_COLOR_16_SWAP   1'''&lt;br /&gt;
is set to &amp;quot;1&amp;quot; as seen...&lt;br /&gt;
&lt;br /&gt;
 NOTE: if you haven't modified it or tampered with it with your Github fork, you shouldn't have a problem &lt;br /&gt;
 as it is correct by default, and you can skip these steps&lt;br /&gt;
&lt;br /&gt;
===Creating an Object from the Array===&lt;br /&gt;
To include the Icon, first Identify the Array you need to copy to the source (clock.cpp)&lt;br /&gt;
&lt;br /&gt;
The one we require from it is the data below the tag that looks like,&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
 /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
from this copy the Data from the array alone...&lt;br /&gt;
I.e this part,&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00&lt;br /&gt;
&lt;br /&gt;
(Make sure to not include the comma at the end or the #endif as the entire part is going to substitute a new array)&lt;br /&gt;
&lt;br /&gt;
In clock.cpp, just below the header files and the Task creation part (I.e event_handler...),&lt;br /&gt;
&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
 Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
 screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
create a name for the label with,&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;; // remember to replace &amp;lt;name&amp;gt; with the actual name you gave to your image while converting !&lt;br /&gt;
&lt;br /&gt;
then below it create a array to hold the data with,&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {}; // paste the array you copied from the conversion file we specified above...&lt;br /&gt;
&lt;br /&gt;
so your  array is something like,&lt;br /&gt;
&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00};&lt;br /&gt;
&lt;br /&gt;
so your Entire top region of declaration looks like,&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
 #include &amp;lt;libs/date/includes/date/date.h&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 using namespace Pinetime::Applications::Screens;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_extrabold_compressed;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_bold_20;&lt;br /&gt;
 extern lv_style_t* LabelBigStyle;&lt;br /&gt;
 '''   '''&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
  Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
  screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
 '''   '''&lt;br /&gt;
 '''//Declare the descriptor here'''&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;;&lt;br /&gt;
 '''//place the Image data here&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''note: Declaring variables outside a function like we did above is known as global scope declaration, this means the variable can be used by not just one function but the Entire code...'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then inside the &lt;br /&gt;
 Clock::Clock(DisplayApp* app,...){... &lt;br /&gt;
region, (the watchface function)&lt;br /&gt;
You need to place a particular set of lines which LVGL uses to define the object declare the array as an Icon/Image, You can place this set of lines above label_time...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.always_zero = 0; //Initialization&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.w = &amp;lt;picture_X&amp;gt;;                     // Setting the Width (or) Horizontal length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.h = &amp;lt;picture_Y&amp;gt;;                     // Setting the Height (or) vertical length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.data_size = &amp;lt;Hr_length&amp;gt; * &amp;lt;Vr_length&amp;gt; * LV_COLOR_SIZE / 8; //Allocation of memory for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.cf = LV_IMG_CF_TRUE_COLOR; // Sets the color scheme for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.data = &amp;lt;name&amp;gt;_map;                // Maps the Image data to the Array&lt;br /&gt;
  lv_obj_t *img_src = lv_img_create(lv_scr_act(), NULL);  // Create an image object&lt;br /&gt;
  lv_img_set_src(img_src, &amp;amp;&amp;lt;name&amp;gt;);        // Set the created file as image (&amp;lt;name&amp;gt;)&lt;br /&gt;
  &lt;br /&gt;
again, make sure to replace &amp;lt;name&amp;gt; with the name you gave it during conversion!&lt;br /&gt;
&lt;br /&gt;
Now that we have bought in the image data, we need to set the position, you can place this just below the lines we wrote for bringing in the image, It can be done with either,&lt;br /&gt;
 lv_obj_set_pos(img_src, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); // &amp;lt;x_pos&amp;gt;, &amp;lt;y_pos&amp;gt; are the coordinates of the cartesian plane&lt;br /&gt;
or,&lt;br /&gt;
 lv_obj_align(img_src, lv_scr_act(), LV_ALIGN_&amp;lt;parameter&amp;gt;, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); &lt;br /&gt;
&lt;br /&gt;
If done correctly, you will now have a beautiful little Icon/Image in your Watch face,&lt;br /&gt;
Make sure that your Watch face can accommodate the Image by pushing the other labels farther away creating space for it...&lt;br /&gt;
&lt;br /&gt;
We have provided a small template you can use for adding even a large image comfortably&lt;br /&gt;
&lt;br /&gt;
If you have succeeded with this, you have completed part 3 of the tutorial.&lt;br /&gt;
&lt;br /&gt;
=Creating an entirely new watchface=&lt;br /&gt;
The instructions above describe how to modify the existing default watchface, if you would like to create a new watchface instead you will need to complete some additional steps. We will refer to the new watchface as WatchFaceName in these instructions.&lt;br /&gt;
&lt;br /&gt;
==Create the watchface files==&lt;br /&gt;
The watchface is composed of 2 files, WatchFaceName.cpp and WatchFaceName.h. You can copy them from one of the existing watchfaces and give it a new name to provide a basic layout to start from. It is important to increment the ClockFace number near the top of WatchFaceName.cpp otherwise the wrong watchface will be displayed when leaving the menu.&lt;br /&gt;
   settingsController.SetClockFace(0);&lt;br /&gt;
&lt;br /&gt;
==Add the watchface to Clock.cpp and Clock.h==&lt;br /&gt;
Clock.cpp now provides the ability to switch between multiple watchfaces by long-pressing the screen. You will need to make 3 modifications in Clock.app and 2 modifications in Clock.h. &lt;br /&gt;
&lt;br /&gt;
'''src/displayapp/screens/Clock.cpp'''&lt;br /&gt;
 #include &amp;quot;WatchFaceDigital.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;WatchFaceAnalog.h&amp;quot;&lt;br /&gt;
 '''#include &amp;quot;WatchFaceName.h&amp;quot;'''&lt;br /&gt;
&lt;br /&gt;
                [this]() -&amp;gt; std::unique_ptr&amp;lt;Screen&amp;gt; { return WatchFaceDigitalScreen(); },&lt;br /&gt;
                [this]() -&amp;gt; std::unique_ptr&amp;lt;Screen&amp;gt; { return WatchFaceAnalogScreen(); },&lt;br /&gt;
                '''[this]() -&amp;gt; std::unique_ptr&amp;lt;Screen&amp;gt; { return WatchFaceNameScreen(); },'''&lt;br /&gt;
&lt;br /&gt;
 std::unique_ptr&amp;lt;Screen&amp;gt; Clock::WatchFaceAnalogScreen() {  &lt;br /&gt;
   return std::make_unique&amp;lt;Screens::WatchFaceAnalog&amp;gt;(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 '''std::unique_ptr&amp;lt;Screen&amp;gt; Clock::WatchFaceNameScreen() {  '''&lt;br /&gt;
   '''return std::make_unique&amp;lt;Screens::WatchFaceName&amp;gt;(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, heartRateController);'''&lt;br /&gt;
 '''}'''&lt;br /&gt;
&lt;br /&gt;
'''src/displayapp/screens/Clock.h'''&lt;br /&gt;
          ScreenList&amp;lt;'''3'''&amp;gt; screens;&lt;br /&gt;
          std::unique_ptr&amp;lt;Screen&amp;gt; WatchFaceDigitalScreen();&lt;br /&gt;
          std::unique_ptr&amp;lt;Screen&amp;gt; WatchFaceAnalogScreen();&lt;br /&gt;
          '''std::unique_ptr&amp;lt;Screen&amp;gt; WatchFaceNameScreen();'''&lt;br /&gt;
&lt;br /&gt;
Be sure to increment the number of screens.&lt;br /&gt;
&lt;br /&gt;
==Add the watchface to CMakeLists.txt==&lt;br /&gt;
'''src/CMakeLists.txt'''&lt;br /&gt;
&lt;br /&gt;
        ## Watch faces&lt;br /&gt;
        displayapp/icons/bg_clock.c&lt;br /&gt;
        displayapp/screens/WatchFaceAnalog.cpp&lt;br /&gt;
        displayapp/screens/WatchFaceDigital.cpp&lt;br /&gt;
        '''displayapp/screens/WatchFaceName.cpp'''&lt;br /&gt;
&lt;br /&gt;
=Using git to work on the firmware=&lt;br /&gt;
===Cloning the repository===&lt;br /&gt;
&lt;br /&gt;
Instructions for cloning the repository are available on the [https://github.com/JF002/InfiniTime/blob/develop/doc/buildAndProgram.md Building and programming page] on github.&lt;br /&gt;
&lt;br /&gt;
===Changing the code to add the image===&lt;br /&gt;
&lt;br /&gt;
Use the editor of your choice to modify the source files. Please read the [https://github.com/JF002/InfiniTime/blob/develop/doc/contribute.md#coding-convention coding conventions] before you start.&lt;br /&gt;
&lt;br /&gt;
===Compiling the firmware===&lt;br /&gt;
==Testing the firmware==&lt;br /&gt;
===Installing the new firmware===&lt;br /&gt;
&lt;br /&gt;
A holistic guide on how to install different firmware using various hardware programmers is available here: [[Reprogramming the PineTime]]. There's also the possibility of using OTA updating. ''//TODO: add that to the article!''&lt;br /&gt;
&lt;br /&gt;
===Activating the firmware===&lt;br /&gt;
===How to troubleshoot===&lt;br /&gt;
==Conclusions==&lt;br /&gt;
==Next steps==&lt;br /&gt;
==More in-depth documentation==&lt;br /&gt;
==Thanks for the help==&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9792</id>
		<title>PineTime Custom Watchface Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9792"/>
		<updated>2021-04-09T11:32:54Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: /* Changing the code to add the image */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTime Custom Watchface Tutorial=&lt;br /&gt;
&lt;br /&gt;
This is a tutorial to help new users create custom watchfaces based on the InfiniTime Firmware for Pinetime made by user JF002, thanks to him for its development...&lt;br /&gt;
&lt;br /&gt;
We will explain some of the things we went through while creating some custom Watchfaces, so consider this as a log of experiments of sorts..&lt;br /&gt;
&lt;br /&gt;
So stay tuned to it as it will be dynamically updated...&lt;br /&gt;
&lt;br /&gt;
==What you need to start==&lt;br /&gt;
The entire building process will be done by GitHub, so all you need is a device which can give you a Github Web Client, a PC or tablet to give you enough screen space to review your code and a steady internet connection.&lt;br /&gt;
&lt;br /&gt;
Since the compiling and file management is done by Github online, you have nothing else to worry about other than working with the files that display the watch face.&lt;br /&gt;
&lt;br /&gt;
So with those things settled, let's start with the basics of a watchface.&lt;br /&gt;
&lt;br /&gt;
Please remember that this is a wiki, so you can make an account and help us improve this page.&lt;br /&gt;
&lt;br /&gt;
Please make sure not to unilaterally remove info though, but offer an alternative. If it is indeed a better way, in time your alternative will grow into the main text, and the latter info will be pruned.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
The Firmware (also called InfiniTime) we will be working with is made with a programming language named '''C++''':[https://en.wikipedia.org/wiki/C%2B%2B]&lt;br /&gt;
&lt;br /&gt;
Basic knowledge of C/C++ is required to to understand the advanced watch faces as that requires more complex code, but you can still do a some cool things without much knowledge of C++ programming, just some small edits to existing programs.&lt;br /&gt;
&lt;br /&gt;
InfiniTime uses the '''LVGL''':[https://lvgl.io] graphics library to provide users with a simple and clean UI without overpowering the Nordic '''nRF52832''':[http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf] microcontroller which is the brain of the watch.&lt;br /&gt;
&lt;br /&gt;
To get the watchface to work there are these basic steps. We will go over each step separately, so don't be daunted, all will become clear soon.&lt;br /&gt;
&lt;br /&gt;
For now we will, modify the the existing watchface, change the positioning of the text labels, add an icon to an existing watchface, and later on we will do a full watchface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The main file we need to focus on is the '''WatchFaceDigital.cpp''' file, it is what contains most of the data attributed to what we see on the watchface, including The time/day characters, the battery and bluetooth icons, and also pedometer count...&lt;br /&gt;
&lt;br /&gt;
so everything we will be doing in the basic modifications is purely messing with this single file.&lt;br /&gt;
&lt;br /&gt;
==Labels==&lt;br /&gt;
===What are labels?===&lt;br /&gt;
Labels are considered as &amp;quot;elemental&amp;quot; parts that make up a screen's Text-based UI by the LVGL library...&lt;br /&gt;
Each label is also considered as an &amp;quot;object&amp;quot; or &amp;quot;obj&amp;quot; and can be manipulated, by changing the data attributed with the &amp;quot;obj&amp;quot;, for example, position, internal data like the strings/text etc.&lt;br /&gt;
when can change what the label shows and where it shows it...&lt;br /&gt;
&lt;br /&gt;
===Modifying label data===&lt;br /&gt;
let's observe something small like the word &amp;quot;BPM&amp;quot; near the bottom of the watch face...&lt;br /&gt;
[[file:PineTimeCustom-1.png|right|200px]]&lt;br /&gt;
&lt;br /&gt;
If we take a look at the source file of the watchface, (a.k.a the clock.cpp file)&lt;br /&gt;
we can observe that these particular lines are what attributes to the word &amp;quot;BPM being displayed...&lt;br /&gt;
 heartbeatBpm = lv_label_create(lv_scr_act(), NULL);&lt;br /&gt;
 lv_label_set_text(heartbeatBpm, &amp;quot;BPM&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
we can modify the text inside the quotes and replace the word 'BPM' between those quotes to something like 'LOVE'&lt;br /&gt;
and the result after compiling the firmware again with the changes and flashing it to the watch would be that the text changes on the watch face and displays 'LOVE' inplace of 'BPM'...&lt;br /&gt;
&lt;br /&gt;
If this happened correctly, then you have successfully made a custom new watchface! Now we can do something a bit more complex...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now take for in instance the days of the week that we have on the bottom line with the date...&lt;br /&gt;
&lt;br /&gt;
they are stored a &amp;quot;C array&amp;quot; which is basically multiple words separated by commas..&lt;br /&gt;
the date is in a format of '''&amp;lt;day of the week&amp;gt; &amp;lt;day&amp;gt; &amp;lt;Month&amp;gt; &amp;lt;year&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
which in the source file is expressed as,&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
 lv_label_set_text(label_date, dateStr);&lt;br /&gt;
&lt;br /&gt;
here, &lt;br /&gt;
 %s %d %s %d &lt;br /&gt;
stores the print format of the variables, and&lt;br /&gt;
&lt;br /&gt;
 DayOfWeekToString(dayOfWeek), day, MonthToString(month), year  &lt;br /&gt;
are the variables themselves...&lt;br /&gt;
&lt;br /&gt;
Now, &lt;br /&gt;
if the date was a saturday 11/7/2020, you can observe that the date looks like &lt;br /&gt;
 SATURDAY 11 JUL 2020&lt;br /&gt;
as seen in the above image (the one where we changed BPM to LOVE)&lt;br /&gt;
&lt;br /&gt;
by modifying the format of the variables, we can change how those words are arranged, and add some extra characters if we like... &lt;br /&gt;
 (there is a catch to the list of characters you can use however, but it will be discussed later...)&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
We modifying the format by adding a comma... &amp;quot;,&amp;quot; in between the second &amp;quot;%s&amp;quot; and &amp;quot;%d&amp;quot; like this,&lt;br /&gt;
 &amp;quot;%s %d %s, %d&amp;quot;&lt;br /&gt;
and changing that in the line...&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s, %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
&lt;br /&gt;
we can make the date become...&lt;br /&gt;
 SATURDAY 11 JUL, 2020&lt;br /&gt;
&lt;br /&gt;
which means we now were able to modify how the text got display to make it a bit more nice...&lt;br /&gt;
&lt;br /&gt;
but if you haven't noticed, the line containing the date is already full, meaning we will get some problems while displaying the date and causing it to wrap around,&lt;br /&gt;
making a single character go to the next line and look more like,&lt;br /&gt;
&lt;br /&gt;
 SATURDAY 11 JUL, 202&lt;br /&gt;
 0&lt;br /&gt;
&lt;br /&gt;
so why don't we shorten the characters present in the date from being &amp;quot;SATURDAY&amp;quot; to simply just &amp;quot;sat.&amp;quot; (It will have the small period at the end, and is only 3 characters long) &lt;br /&gt;
I will also convert the months of the year from Capital to small letters... &lt;br /&gt;
&lt;br /&gt;
for that look into the part where the days of the week of are stored as text,&lt;br /&gt;
and also while looking at it, we can solve another question, why was their two variables in the date format that looked like, DayOfWeekToString(dayOfWeek), and MonthToString(month) ?&lt;br /&gt;
&lt;br /&gt;
It is because the system gives the date/ time as numbers (Monday-1, Tuesday-2 Wednesday-3 for the days, and 1-January, 2-February, 3-March ),&lt;br /&gt;
and so a function along with a C array is used to assign these numbers to Days/Months in text form as it is easier to read...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this is the Array containing the day of the week, (as text) &lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;MONDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;TUESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;WEDNESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;THURSDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;FRIDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SATURDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SUNDAY&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and this Array stores the months of the year, (as text)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;JAN&amp;quot;,&lt;br /&gt;
        &amp;quot;FEB&amp;quot;,&lt;br /&gt;
        &amp;quot;MAR&amp;quot;,&lt;br /&gt;
        &amp;quot;APR&amp;quot;,&lt;br /&gt;
        &amp;quot;MAY&amp;quot;,&lt;br /&gt;
        &amp;quot;JUN&amp;quot;,&lt;br /&gt;
        &amp;quot;JUL&amp;quot;,&lt;br /&gt;
        &amp;quot;AUG&amp;quot;,&lt;br /&gt;
        &amp;quot;SEP&amp;quot;,&lt;br /&gt;
        &amp;quot;OCT&amp;quot;,&lt;br /&gt;
        &amp;quot;NOV&amp;quot;,&lt;br /&gt;
        &amp;quot;DEC&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
here we can see that the days are stored in a full format as &amp;quot;SUNDAY&amp;quot;, &amp;quot;MONDAY&amp;quot;, &amp;quot;TUESDAY&amp;quot; etc.&lt;br /&gt;
we can change all of them to a shorter format like &amp;quot;sun.&amp;quot;, &amp;quot;mon.&amp;quot;, &amp;quot;tue.&amp;quot;, to make it short and nice...&lt;br /&gt;
while doing so, we can even make the months use small letters as said before..&lt;br /&gt;
&lt;br /&gt;
so the source file (clock.cpp) becomes,&lt;br /&gt;
&lt;br /&gt;
(for the days of the week)&lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;mon.&amp;quot;,&lt;br /&gt;
        &amp;quot;tue.&amp;quot;,&lt;br /&gt;
        &amp;quot;wed.&amp;quot;,&lt;br /&gt;
        &amp;quot;thu.&amp;quot;,&lt;br /&gt;
        &amp;quot;fri.&amp;quot;,&lt;br /&gt;
        &amp;quot;sat.&amp;quot;,&lt;br /&gt;
        &amp;quot;sun.&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
(for the months of the year)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;jan&amp;quot;,&lt;br /&gt;
        &amp;quot;feb&amp;quot;,&lt;br /&gt;
        &amp;quot;mar&amp;quot;,&lt;br /&gt;
        &amp;quot;apr&amp;quot;,&lt;br /&gt;
        &amp;quot;may&amp;quot;,&lt;br /&gt;
        &amp;quot;jun&amp;quot;,&lt;br /&gt;
        &amp;quot;jul&amp;quot;,&lt;br /&gt;
        &amp;quot;aug&amp;quot;,&lt;br /&gt;
        &amp;quot;sep&amp;quot;,&lt;br /&gt;
        &amp;quot;oct&amp;quot;,&lt;br /&gt;
        &amp;quot;nov&amp;quot;,&lt;br /&gt;
        &amp;quot;dec&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
which means now our original date, saturday 11/7/2020 will become...&lt;br /&gt;
 sat. 11 jul, 2020&lt;br /&gt;
&lt;br /&gt;
you now know how to change the data present in a label object, and the format of it..,&lt;br /&gt;
 &lt;br /&gt;
Here is a fun idea you can try: you can even replace the days with whatever thing that tells you (or) reminds you the day of the week &lt;br /&gt;
(like the food served in the cafe, Monday/taco, Tuesday/burger, Wednesday/pasta etc.) &lt;br /&gt;
 &lt;br /&gt;
 NOTE: when making the custom array, don't forget to leave a empty &amp;quot;&amp;quot; as the first element of the array,&lt;br /&gt;
 This is because the date is given by the system in a natural numbers format (1,2,3...) rather than a zero-starting format (0,1,2,3...), which the C array uses to index...&lt;br /&gt;
 so the C array indexes the days as &amp;quot;&amp;quot;-0, &amp;quot;Monday&amp;quot;-1, &amp;quot;Tuesday&amp;quot;-2 etc. and the months as &amp;quot;&amp;quot;-0, &amp;quot;January&amp;quot;-1, &amp;quot;February&amp;quot;-2 etc.)&lt;br /&gt;
&lt;br /&gt;
===Label positioning===&lt;br /&gt;
&lt;br /&gt;
The locational placement in LVGL is done on a cartesian plane,&lt;br /&gt;
where each object can have dynamic origin placement, and the Y-axis is inverted...&lt;br /&gt;
So going down is done with a positive Y-axis value and not negative as the it is by de-facto...&lt;br /&gt;
&lt;br /&gt;
[[File:LVGL coord system.png|200px|thumb|right|LVGL coord system]]&lt;br /&gt;
&lt;br /&gt;
The position of the various objects in clock.cpp are set by the line,&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
and the top left corner is the Cartesian origin, aka coordinates (0,0)&lt;br /&gt;
&lt;br /&gt;
this image can show you how to decide label placement for lv_obj_set_pos(...)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we use another function, that is more advanced that gives the positional alignment based on preset locations...&lt;br /&gt;
 lv_obj_align(&amp;lt;text/obj&amp;gt;, &amp;lt;image/obj&amp;gt;, &amp;lt;location_parameter&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
the &amp;quot;&amp;lt;image/obj&amp;gt;&amp;quot; data is used for putting text beside other picture icons , and so if using only text based labels, we can substitute it with,&lt;br /&gt;
 lv_scr_act() (or) NULL&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;''' are the cartesian coordinates, '''&amp;lt;location parameter&amp;gt;''' is replaced by '''LV_ALIGN_&amp;lt;preset&amp;gt;''',&lt;br /&gt;
there will be a picture showing the presets below, and '''&amp;lt;text/obj&amp;gt;''' is your text label...&lt;br /&gt;
&lt;br /&gt;
here, LV_ALIGN_&amp;lt;preset&amp;gt; sets the cartesian origin...&lt;br /&gt;
&lt;br /&gt;
Label positioning based on alignment is both a simple and complicated thing to understand, so here I have given something you can refer to while modifying the position of the various labels and objects...&lt;br /&gt;
&lt;br /&gt;
you can also refer here for LVGL's documentation of coordinate system https://docs.lvgl.io/v6/en/html/object-types/obj.html#coordinates&lt;br /&gt;
&lt;br /&gt;
It is however recommended that you use the first method to set the location&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
as it is simple and easier for beginners&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a small example.&lt;br /&gt;
&lt;br /&gt;
Take the Label that tells the date,&lt;br /&gt;
In the source file (clock.cpp) it is this line,&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);&lt;br /&gt;
by increasing the Value of the Y coordinate (60) to a higher value, we can bring the position of the Date downwards a bit away from the Time, and toward the Heartbeat count in the bottom row&lt;br /&gt;
here I will increase it to 80, so it becomes..&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80);&lt;br /&gt;
&lt;br /&gt;
and now we have made some space up top..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
now let's try something a bit complex,&lt;br /&gt;
&lt;br /&gt;
Take the position argument for the label that tells you time...&lt;br /&gt;
here, in the source file (clock.cpp),&lt;br /&gt;
 lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this line determines the position of the Label telling time, as seen in the image...&lt;br /&gt;
&lt;br /&gt;
we modifying this, by changing the origin &amp;lt;preset&amp;gt; parameter (here it is LV_ALIGN_IN_LEFT_MID) to LV_ALIGN_IN_TOP_LEFT&lt;br /&gt;
&lt;br /&gt;
you can alternatively swap the whole line to,&lt;br /&gt;
 lv_obj_set_pos(label_time, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this makes the Time label/obj. to go to the top left corner...&lt;br /&gt;
&lt;br /&gt;
but I will do something a little extra,&lt;br /&gt;
I will modify the label that store the data and Time format,&lt;br /&gt;
i.e this line,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c:%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
by removing the &amp;quot;:&amp;quot; colon in between the numbers, and replacing it with a Newline symbol &amp;quot;\n&amp;quot;&lt;br /&gt;
I change it to become,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c\n%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
this gives it a nice wrapped text format in the top corner, and gives us some space to play with in the side, for things like Pictures and icons, which we will do next..&lt;br /&gt;
&lt;br /&gt;
If you have been able to do these things, you now have completed the 2nd part of the tutorial, and now know how to change and modify the position of labels..&lt;br /&gt;
&lt;br /&gt;
==Using icons==&lt;br /&gt;
The LVGL library allows for the use of widgets known as &amp;quot;Images&amp;quot;, In short it allows you to use small Icons like pictures with a small dedicated function,&lt;br /&gt;
However when this was attempted the first time we stumbled on some problems as LVGL v6 (used on the pinetime) is not much documented as the latest release (v7 as of August 2020) &lt;br /&gt;
but also the existing code was only documented for C not C++, after some painful attempts we were able to translate it into C++, &lt;br /&gt;
&lt;br /&gt;
To bring images into Clock.cpp&lt;br /&gt;
you will need to do the following,&lt;br /&gt;
&lt;br /&gt;
1. Have a small image that cannot exceed a maximum size of 240px x 240px (pinetime max resolution)&lt;br /&gt;
&lt;br /&gt;
2. Use this Image converter (Thanks to LVGL) https://lvgl.io/tools/imageconverter&lt;br /&gt;
to convert your image to a C array and having the Color format as &amp;quot;True color&amp;quot; and the output format as &amp;quot;C array&amp;quot;&lt;br /&gt;
make sure to use something simple as the name we will be using &amp;quot;bitmap&amp;quot; as the name, but will also be referred as &amp;lt;name&amp;gt; for simplicity&lt;br /&gt;
&lt;br /&gt;
 Note: for example we shall use &amp;lt;name&amp;gt; = bitmap, but any simple word can be used, as long as it does not cause problems with system variables&lt;br /&gt;
&lt;br /&gt;
===Image size considerations===&lt;br /&gt;
since the image will be using the flash directly, we need to be considerate about flash memory usage.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;picture_X&amp;gt; x &amp;lt;picture_Y&amp;gt; x 2 &lt;br /&gt;
gives you the number of KB the image used in storage...&lt;br /&gt;
&lt;br /&gt;
where, &amp;lt;picture_X&amp;gt; &amp;lt;picture_Y&amp;gt; are the dimensions of the image horizontally and vertically&lt;br /&gt;
&lt;br /&gt;
for example,&lt;br /&gt;
 if &amp;lt;picture_X&amp;gt;=80px &amp;lt;picture_Y&amp;gt;=64px&lt;br /&gt;
then,&lt;br /&gt;
 total storage used = 80 x 60 x 2 = 10.24KB &lt;br /&gt;
&lt;br /&gt;
 please use the flash storage with consideration, when using other apps as well, excess usage of storage &lt;br /&gt;
 might mean the Firmware will not compile... the limit to storage to about 400Kb for the user, the &lt;br /&gt;
 firmware size must not exceed that...&lt;br /&gt;
&lt;br /&gt;
==Preparing the image for inclusion as an icon==&lt;br /&gt;
&lt;br /&gt;
Once you have your obtained your C array from the LVGL converter, you can take a look inside it to see all the different formats of your image, &lt;br /&gt;
try using something like Notepad++ or any of your favorite text editors to peek inside of it,&lt;br /&gt;
 &lt;br /&gt;
there will be 4 sets of Arrays inside it that look like,&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8&lt;br /&gt;
  /*Pixel format: Red: 3 bit, Green: 3 bit, Blue: 2 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP == 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 32&lt;br /&gt;
  /*Pixel format: Fix 0xFF: 8 bit, Red: 8 bit, Green: 8 bit, Blue: 8 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0xff, &lt;br /&gt;
 #endif&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
And another small bit of info we will need for later that looks like,&lt;br /&gt;
&lt;br /&gt;
 const lv_img_dsc_t bitmap = {&lt;br /&gt;
  .header.always_zero = 0,&lt;br /&gt;
  .header.w = 40,&lt;br /&gt;
  .header.h = 40,&lt;br /&gt;
  .data_size = 1600 * LV_COLOR_SIZE / 8,&lt;br /&gt;
  .header.cf = LV_IMG_CF_TRUE_COLOR,&lt;br /&gt;
  .data = bitmap_map,&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 NOTE: There are some header files at the top, which we can ignore...&lt;br /&gt;
===RGB565 image format===&lt;br /&gt;
&lt;br /&gt;
The Pinetime uses a display that uses a 16 bit color space, also known as RGB565.&lt;br /&gt;
&lt;br /&gt;
These 16 bit are assigned to RGB as 5 bits each for Red and Blue and 6 bits for Green, so 5+6+5=16 bits are required, so each pixel's color occupies 2 bytes of data,&lt;br /&gt;
and since 2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt; is equal to 65,536 it allows us to view 65,536 or 65k colors&lt;br /&gt;
&lt;br /&gt;
The way it packs these bits is by converting the bits into 2x  4+4 bit hex-code, so for example,&lt;br /&gt;
 &lt;br /&gt;
if the color of a pixel in Binary is '''10110100 01011111''' (this color is approximately Lavender purple)&lt;br /&gt;
 &lt;br /&gt;
It is split as '''1011''' &amp;amp; '''0100''' for the first byte and '''0101''' &amp;amp; '''1111''' for the second byte&lt;br /&gt;
and so, converting the binary into Hex-code,&lt;br /&gt;
&lt;br /&gt;
the two parts are '''0xB4''' and '''0xF5'''&lt;br /&gt;
&lt;br /&gt;
These two parts in conjunction are used for determining the color of one pixel...&lt;br /&gt;
&lt;br /&gt;
also from the binary, it is observed that,&lt;br /&gt;
&lt;br /&gt;
The bits '''10110''' is used for Red, '''100010''' is used for green, and '''11111''' is used for blue.&lt;br /&gt;
&lt;br /&gt;
===Flipping the bytes===&lt;br /&gt;
The LVGL library has a feature that allows you to flip the two bytes of the pixel, so if the two parts were, ...0xB4,0xF5,... ,it will change it to become, ...0xF5,0xB4,...&lt;br /&gt;
&lt;br /&gt;
The reason for this is to allow the use of 8-bit SPI interfaces, but we do not require it, and if set with  wrong parameter we could get problems with the color...&lt;br /&gt;
&lt;br /&gt;
To make sure you are ready for the next step, make sure that inside your lvgl configuration file (located at '''src/libs/lv_conf.h''')&lt;br /&gt;
&lt;br /&gt;
this parameter, &lt;br /&gt;
 '''#define LV_COLOR_16_SWAP   1'''&lt;br /&gt;
is set to &amp;quot;1&amp;quot; as seen...&lt;br /&gt;
&lt;br /&gt;
 NOTE: if you haven't modified it or tampered with it with your Github fork, you shouldn't have a problem &lt;br /&gt;
 as it is correct by default, and you can skip these steps&lt;br /&gt;
&lt;br /&gt;
===Creating an Object from the Array===&lt;br /&gt;
To include the Icon, first Identify the Array you need to copy to the source (clock.cpp)&lt;br /&gt;
&lt;br /&gt;
The one we require from it is the data below the tag that looks like,&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
 /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
from this copy the Data from the array alone...&lt;br /&gt;
I.e this part,&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00&lt;br /&gt;
&lt;br /&gt;
(Make sure to not include the comma at the end or the #endif as the entire part is going to substitute a new array)&lt;br /&gt;
&lt;br /&gt;
In clock.cpp, just below the header files and the Task creation part (I.e event_handler...),&lt;br /&gt;
&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
 Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
 screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
create a name for the label with,&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;; // remember to replace &amp;lt;name&amp;gt; with the actual name you gave to your image while converting !&lt;br /&gt;
&lt;br /&gt;
then below it create a array to hold the data with,&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {}; // paste the array you copied from the conversion file we specified above...&lt;br /&gt;
&lt;br /&gt;
so your  array is something like,&lt;br /&gt;
&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00};&lt;br /&gt;
&lt;br /&gt;
so your Entire top region of declaration looks like,&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
 #include &amp;lt;libs/date/includes/date/date.h&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 using namespace Pinetime::Applications::Screens;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_extrabold_compressed;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_bold_20;&lt;br /&gt;
 extern lv_style_t* LabelBigStyle;&lt;br /&gt;
 '''   '''&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
  Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
  screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
 '''   '''&lt;br /&gt;
 '''//Declare the descriptor here'''&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;;&lt;br /&gt;
 '''//place the Image data here&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''note: Declaring variables outside a function like we did above is known as global scope declaration, this means the variable can be used by not just one function but the Entire code...'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then inside the &lt;br /&gt;
 Clock::Clock(DisplayApp* app,...){... &lt;br /&gt;
region, (the watchface function)&lt;br /&gt;
You need to place a particular set of lines which LVGL uses to define the object declare the array as an Icon/Image, You can place this set of lines above label_time...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.always_zero = 0; //Initialization&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.w = &amp;lt;picture_X&amp;gt;;                     // Setting the Width (or) Horizontal length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.h = &amp;lt;picture_Y&amp;gt;;                     // Setting the Height (or) vertical length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.data_size = &amp;lt;Hr_length&amp;gt; * &amp;lt;Vr_length&amp;gt; * LV_COLOR_SIZE / 8; //Allocation of memory for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.cf = LV_IMG_CF_TRUE_COLOR; // Sets the color scheme for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.data = &amp;lt;name&amp;gt;_map;                // Maps the Image data to the Array&lt;br /&gt;
  lv_obj_t *img_src = lv_img_create(lv_scr_act(), NULL);  // Create an image object&lt;br /&gt;
  lv_img_set_src(img_src, &amp;amp;&amp;lt;name&amp;gt;);        // Set the created file as image (&amp;lt;name&amp;gt;)&lt;br /&gt;
  &lt;br /&gt;
again, make sure to replace &amp;lt;name&amp;gt; with the name you gave it during conversion!&lt;br /&gt;
&lt;br /&gt;
Now that we have bought in the image data, we need to set the position, you can place this just below the lines we wrote for bringing in the image, It can be done with either,&lt;br /&gt;
 lv_obj_set_pos(img_src, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); // &amp;lt;x_pos&amp;gt;, &amp;lt;y_pos&amp;gt; are the coordinates of the cartesian plane&lt;br /&gt;
or,&lt;br /&gt;
 lv_obj_align(img_src, lv_scr_act(), LV_ALIGN_&amp;lt;parameter&amp;gt;, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); &lt;br /&gt;
&lt;br /&gt;
If done correctly, you will now have a beautiful little Icon/Image in your Watch face,&lt;br /&gt;
Make sure that your Watch face can accommodate the Image by pushing the other labels farther away creating space for it...&lt;br /&gt;
&lt;br /&gt;
We have provided a small template you can use for adding even a large image comfortably&lt;br /&gt;
&lt;br /&gt;
If you have succeeded with this, you have completed part 3 of the tutorial.&lt;br /&gt;
&lt;br /&gt;
=Using git to work on the firmware=&lt;br /&gt;
===Cloning the repository===&lt;br /&gt;
&lt;br /&gt;
Instructions for cloning the repository are available on the [https://github.com/JF002/InfiniTime/blob/develop/doc/buildAndProgram.md Building and programming page] on github.&lt;br /&gt;
&lt;br /&gt;
===Changing the code to add the image===&lt;br /&gt;
&lt;br /&gt;
Use the editor of your choice to modify the source files. Please read the [https://github.com/JF002/InfiniTime/blob/develop/doc/contribute.md#coding-convention coding conventions] before you start.&lt;br /&gt;
&lt;br /&gt;
===Compiling the firmware===&lt;br /&gt;
==Testing the firmware==&lt;br /&gt;
===Installing the new firmware===&lt;br /&gt;
&lt;br /&gt;
A holistic guide on how to install different firmware using various hardware programmers is available here: [[Reprogramming the PineTime]]. There's also the possibility of using OTA updating. ''//TODO: add that to the article!''&lt;br /&gt;
&lt;br /&gt;
===Activating the firmware===&lt;br /&gt;
===How to troubleshoot===&lt;br /&gt;
==Conclusions==&lt;br /&gt;
==Next steps==&lt;br /&gt;
==More in-depth documentation==&lt;br /&gt;
==Thanks for the help==&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9791</id>
		<title>PineTime Custom Watchface Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9791"/>
		<updated>2021-04-09T11:31:05Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTime Custom Watchface Tutorial=&lt;br /&gt;
&lt;br /&gt;
This is a tutorial to help new users create custom watchfaces based on the InfiniTime Firmware for Pinetime made by user JF002, thanks to him for its development...&lt;br /&gt;
&lt;br /&gt;
We will explain some of the things we went through while creating some custom Watchfaces, so consider this as a log of experiments of sorts..&lt;br /&gt;
&lt;br /&gt;
So stay tuned to it as it will be dynamically updated...&lt;br /&gt;
&lt;br /&gt;
==What you need to start==&lt;br /&gt;
The entire building process will be done by GitHub, so all you need is a device which can give you a Github Web Client, a PC or tablet to give you enough screen space to review your code and a steady internet connection.&lt;br /&gt;
&lt;br /&gt;
Since the compiling and file management is done by Github online, you have nothing else to worry about other than working with the files that display the watch face.&lt;br /&gt;
&lt;br /&gt;
So with those things settled, let's start with the basics of a watchface.&lt;br /&gt;
&lt;br /&gt;
Please remember that this is a wiki, so you can make an account and help us improve this page.&lt;br /&gt;
&lt;br /&gt;
Please make sure not to unilaterally remove info though, but offer an alternative. If it is indeed a better way, in time your alternative will grow into the main text, and the latter info will be pruned.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
The Firmware (also called InfiniTime) we will be working with is made with a programming language named '''C++''':[https://en.wikipedia.org/wiki/C%2B%2B]&lt;br /&gt;
&lt;br /&gt;
Basic knowledge of C/C++ is required to to understand the advanced watch faces as that requires more complex code, but you can still do a some cool things without much knowledge of C++ programming, just some small edits to existing programs.&lt;br /&gt;
&lt;br /&gt;
InfiniTime uses the '''LVGL''':[https://lvgl.io] graphics library to provide users with a simple and clean UI without overpowering the Nordic '''nRF52832''':[http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf] microcontroller which is the brain of the watch.&lt;br /&gt;
&lt;br /&gt;
To get the watchface to work there are these basic steps. We will go over each step separately, so don't be daunted, all will become clear soon.&lt;br /&gt;
&lt;br /&gt;
For now we will, modify the the existing watchface, change the positioning of the text labels, add an icon to an existing watchface, and later on we will do a full watchface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The main file we need to focus on is the '''WatchFaceDigital.cpp''' file, it is what contains most of the data attributed to what we see on the watchface, including The time/day characters, the battery and bluetooth icons, and also pedometer count...&lt;br /&gt;
&lt;br /&gt;
so everything we will be doing in the basic modifications is purely messing with this single file.&lt;br /&gt;
&lt;br /&gt;
==Labels==&lt;br /&gt;
===What are labels?===&lt;br /&gt;
Labels are considered as &amp;quot;elemental&amp;quot; parts that make up a screen's Text-based UI by the LVGL library...&lt;br /&gt;
Each label is also considered as an &amp;quot;object&amp;quot; or &amp;quot;obj&amp;quot; and can be manipulated, by changing the data attributed with the &amp;quot;obj&amp;quot;, for example, position, internal data like the strings/text etc.&lt;br /&gt;
when can change what the label shows and where it shows it...&lt;br /&gt;
&lt;br /&gt;
===Modifying label data===&lt;br /&gt;
let's observe something small like the word &amp;quot;BPM&amp;quot; near the bottom of the watch face...&lt;br /&gt;
[[file:PineTimeCustom-1.png|right|200px]]&lt;br /&gt;
&lt;br /&gt;
If we take a look at the source file of the watchface, (a.k.a the clock.cpp file)&lt;br /&gt;
we can observe that these particular lines are what attributes to the word &amp;quot;BPM being displayed...&lt;br /&gt;
 heartbeatBpm = lv_label_create(lv_scr_act(), NULL);&lt;br /&gt;
 lv_label_set_text(heartbeatBpm, &amp;quot;BPM&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
we can modify the text inside the quotes and replace the word 'BPM' between those quotes to something like 'LOVE'&lt;br /&gt;
and the result after compiling the firmware again with the changes and flashing it to the watch would be that the text changes on the watch face and displays 'LOVE' inplace of 'BPM'...&lt;br /&gt;
&lt;br /&gt;
If this happened correctly, then you have successfully made a custom new watchface! Now we can do something a bit more complex...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now take for in instance the days of the week that we have on the bottom line with the date...&lt;br /&gt;
&lt;br /&gt;
they are stored a &amp;quot;C array&amp;quot; which is basically multiple words separated by commas..&lt;br /&gt;
the date is in a format of '''&amp;lt;day of the week&amp;gt; &amp;lt;day&amp;gt; &amp;lt;Month&amp;gt; &amp;lt;year&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
which in the source file is expressed as,&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
 lv_label_set_text(label_date, dateStr);&lt;br /&gt;
&lt;br /&gt;
here, &lt;br /&gt;
 %s %d %s %d &lt;br /&gt;
stores the print format of the variables, and&lt;br /&gt;
&lt;br /&gt;
 DayOfWeekToString(dayOfWeek), day, MonthToString(month), year  &lt;br /&gt;
are the variables themselves...&lt;br /&gt;
&lt;br /&gt;
Now, &lt;br /&gt;
if the date was a saturday 11/7/2020, you can observe that the date looks like &lt;br /&gt;
 SATURDAY 11 JUL 2020&lt;br /&gt;
as seen in the above image (the one where we changed BPM to LOVE)&lt;br /&gt;
&lt;br /&gt;
by modifying the format of the variables, we can change how those words are arranged, and add some extra characters if we like... &lt;br /&gt;
 (there is a catch to the list of characters you can use however, but it will be discussed later...)&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
We modifying the format by adding a comma... &amp;quot;,&amp;quot; in between the second &amp;quot;%s&amp;quot; and &amp;quot;%d&amp;quot; like this,&lt;br /&gt;
 &amp;quot;%s %d %s, %d&amp;quot;&lt;br /&gt;
and changing that in the line...&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s, %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
&lt;br /&gt;
we can make the date become...&lt;br /&gt;
 SATURDAY 11 JUL, 2020&lt;br /&gt;
&lt;br /&gt;
which means we now were able to modify how the text got display to make it a bit more nice...&lt;br /&gt;
&lt;br /&gt;
but if you haven't noticed, the line containing the date is already full, meaning we will get some problems while displaying the date and causing it to wrap around,&lt;br /&gt;
making a single character go to the next line and look more like,&lt;br /&gt;
&lt;br /&gt;
 SATURDAY 11 JUL, 202&lt;br /&gt;
 0&lt;br /&gt;
&lt;br /&gt;
so why don't we shorten the characters present in the date from being &amp;quot;SATURDAY&amp;quot; to simply just &amp;quot;sat.&amp;quot; (It will have the small period at the end, and is only 3 characters long) &lt;br /&gt;
I will also convert the months of the year from Capital to small letters... &lt;br /&gt;
&lt;br /&gt;
for that look into the part where the days of the week of are stored as text,&lt;br /&gt;
and also while looking at it, we can solve another question, why was their two variables in the date format that looked like, DayOfWeekToString(dayOfWeek), and MonthToString(month) ?&lt;br /&gt;
&lt;br /&gt;
It is because the system gives the date/ time as numbers (Monday-1, Tuesday-2 Wednesday-3 for the days, and 1-January, 2-February, 3-March ),&lt;br /&gt;
and so a function along with a C array is used to assign these numbers to Days/Months in text form as it is easier to read...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this is the Array containing the day of the week, (as text) &lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;MONDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;TUESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;WEDNESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;THURSDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;FRIDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SATURDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SUNDAY&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and this Array stores the months of the year, (as text)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;JAN&amp;quot;,&lt;br /&gt;
        &amp;quot;FEB&amp;quot;,&lt;br /&gt;
        &amp;quot;MAR&amp;quot;,&lt;br /&gt;
        &amp;quot;APR&amp;quot;,&lt;br /&gt;
        &amp;quot;MAY&amp;quot;,&lt;br /&gt;
        &amp;quot;JUN&amp;quot;,&lt;br /&gt;
        &amp;quot;JUL&amp;quot;,&lt;br /&gt;
        &amp;quot;AUG&amp;quot;,&lt;br /&gt;
        &amp;quot;SEP&amp;quot;,&lt;br /&gt;
        &amp;quot;OCT&amp;quot;,&lt;br /&gt;
        &amp;quot;NOV&amp;quot;,&lt;br /&gt;
        &amp;quot;DEC&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
here we can see that the days are stored in a full format as &amp;quot;SUNDAY&amp;quot;, &amp;quot;MONDAY&amp;quot;, &amp;quot;TUESDAY&amp;quot; etc.&lt;br /&gt;
we can change all of them to a shorter format like &amp;quot;sun.&amp;quot;, &amp;quot;mon.&amp;quot;, &amp;quot;tue.&amp;quot;, to make it short and nice...&lt;br /&gt;
while doing so, we can even make the months use small letters as said before..&lt;br /&gt;
&lt;br /&gt;
so the source file (clock.cpp) becomes,&lt;br /&gt;
&lt;br /&gt;
(for the days of the week)&lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;mon.&amp;quot;,&lt;br /&gt;
        &amp;quot;tue.&amp;quot;,&lt;br /&gt;
        &amp;quot;wed.&amp;quot;,&lt;br /&gt;
        &amp;quot;thu.&amp;quot;,&lt;br /&gt;
        &amp;quot;fri.&amp;quot;,&lt;br /&gt;
        &amp;quot;sat.&amp;quot;,&lt;br /&gt;
        &amp;quot;sun.&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
(for the months of the year)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;jan&amp;quot;,&lt;br /&gt;
        &amp;quot;feb&amp;quot;,&lt;br /&gt;
        &amp;quot;mar&amp;quot;,&lt;br /&gt;
        &amp;quot;apr&amp;quot;,&lt;br /&gt;
        &amp;quot;may&amp;quot;,&lt;br /&gt;
        &amp;quot;jun&amp;quot;,&lt;br /&gt;
        &amp;quot;jul&amp;quot;,&lt;br /&gt;
        &amp;quot;aug&amp;quot;,&lt;br /&gt;
        &amp;quot;sep&amp;quot;,&lt;br /&gt;
        &amp;quot;oct&amp;quot;,&lt;br /&gt;
        &amp;quot;nov&amp;quot;,&lt;br /&gt;
        &amp;quot;dec&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
which means now our original date, saturday 11/7/2020 will become...&lt;br /&gt;
 sat. 11 jul, 2020&lt;br /&gt;
&lt;br /&gt;
you now know how to change the data present in a label object, and the format of it..,&lt;br /&gt;
 &lt;br /&gt;
Here is a fun idea you can try: you can even replace the days with whatever thing that tells you (or) reminds you the day of the week &lt;br /&gt;
(like the food served in the cafe, Monday/taco, Tuesday/burger, Wednesday/pasta etc.) &lt;br /&gt;
 &lt;br /&gt;
 NOTE: when making the custom array, don't forget to leave a empty &amp;quot;&amp;quot; as the first element of the array,&lt;br /&gt;
 This is because the date is given by the system in a natural numbers format (1,2,3...) rather than a zero-starting format (0,1,2,3...), which the C array uses to index...&lt;br /&gt;
 so the C array indexes the days as &amp;quot;&amp;quot;-0, &amp;quot;Monday&amp;quot;-1, &amp;quot;Tuesday&amp;quot;-2 etc. and the months as &amp;quot;&amp;quot;-0, &amp;quot;January&amp;quot;-1, &amp;quot;February&amp;quot;-2 etc.)&lt;br /&gt;
&lt;br /&gt;
===Label positioning===&lt;br /&gt;
&lt;br /&gt;
The locational placement in LVGL is done on a cartesian plane,&lt;br /&gt;
where each object can have dynamic origin placement, and the Y-axis is inverted...&lt;br /&gt;
So going down is done with a positive Y-axis value and not negative as the it is by de-facto...&lt;br /&gt;
&lt;br /&gt;
[[File:LVGL coord system.png|200px|thumb|right|LVGL coord system]]&lt;br /&gt;
&lt;br /&gt;
The position of the various objects in clock.cpp are set by the line,&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
and the top left corner is the Cartesian origin, aka coordinates (0,0)&lt;br /&gt;
&lt;br /&gt;
this image can show you how to decide label placement for lv_obj_set_pos(...)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we use another function, that is more advanced that gives the positional alignment based on preset locations...&lt;br /&gt;
 lv_obj_align(&amp;lt;text/obj&amp;gt;, &amp;lt;image/obj&amp;gt;, &amp;lt;location_parameter&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
the &amp;quot;&amp;lt;image/obj&amp;gt;&amp;quot; data is used for putting text beside other picture icons , and so if using only text based labels, we can substitute it with,&lt;br /&gt;
 lv_scr_act() (or) NULL&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;''' are the cartesian coordinates, '''&amp;lt;location parameter&amp;gt;''' is replaced by '''LV_ALIGN_&amp;lt;preset&amp;gt;''',&lt;br /&gt;
there will be a picture showing the presets below, and '''&amp;lt;text/obj&amp;gt;''' is your text label...&lt;br /&gt;
&lt;br /&gt;
here, LV_ALIGN_&amp;lt;preset&amp;gt; sets the cartesian origin...&lt;br /&gt;
&lt;br /&gt;
Label positioning based on alignment is both a simple and complicated thing to understand, so here I have given something you can refer to while modifying the position of the various labels and objects...&lt;br /&gt;
&lt;br /&gt;
you can also refer here for LVGL's documentation of coordinate system https://docs.lvgl.io/v6/en/html/object-types/obj.html#coordinates&lt;br /&gt;
&lt;br /&gt;
It is however recommended that you use the first method to set the location&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
as it is simple and easier for beginners&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a small example.&lt;br /&gt;
&lt;br /&gt;
Take the Label that tells the date,&lt;br /&gt;
In the source file (clock.cpp) it is this line,&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);&lt;br /&gt;
by increasing the Value of the Y coordinate (60) to a higher value, we can bring the position of the Date downwards a bit away from the Time, and toward the Heartbeat count in the bottom row&lt;br /&gt;
here I will increase it to 80, so it becomes..&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80);&lt;br /&gt;
&lt;br /&gt;
and now we have made some space up top..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
now let's try something a bit complex,&lt;br /&gt;
&lt;br /&gt;
Take the position argument for the label that tells you time...&lt;br /&gt;
here, in the source file (clock.cpp),&lt;br /&gt;
 lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this line determines the position of the Label telling time, as seen in the image...&lt;br /&gt;
&lt;br /&gt;
we modifying this, by changing the origin &amp;lt;preset&amp;gt; parameter (here it is LV_ALIGN_IN_LEFT_MID) to LV_ALIGN_IN_TOP_LEFT&lt;br /&gt;
&lt;br /&gt;
you can alternatively swap the whole line to,&lt;br /&gt;
 lv_obj_set_pos(label_time, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this makes the Time label/obj. to go to the top left corner...&lt;br /&gt;
&lt;br /&gt;
but I will do something a little extra,&lt;br /&gt;
I will modify the label that store the data and Time format,&lt;br /&gt;
i.e this line,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c:%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
by removing the &amp;quot;:&amp;quot; colon in between the numbers, and replacing it with a Newline symbol &amp;quot;\n&amp;quot;&lt;br /&gt;
I change it to become,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c\n%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
this gives it a nice wrapped text format in the top corner, and gives us some space to play with in the side, for things like Pictures and icons, which we will do next..&lt;br /&gt;
&lt;br /&gt;
If you have been able to do these things, you now have completed the 2nd part of the tutorial, and now know how to change and modify the position of labels..&lt;br /&gt;
&lt;br /&gt;
==Using icons==&lt;br /&gt;
The LVGL library allows for the use of widgets known as &amp;quot;Images&amp;quot;, In short it allows you to use small Icons like pictures with a small dedicated function,&lt;br /&gt;
However when this was attempted the first time we stumbled on some problems as LVGL v6 (used on the pinetime) is not much documented as the latest release (v7 as of August 2020) &lt;br /&gt;
but also the existing code was only documented for C not C++, after some painful attempts we were able to translate it into C++, &lt;br /&gt;
&lt;br /&gt;
To bring images into Clock.cpp&lt;br /&gt;
you will need to do the following,&lt;br /&gt;
&lt;br /&gt;
1. Have a small image that cannot exceed a maximum size of 240px x 240px (pinetime max resolution)&lt;br /&gt;
&lt;br /&gt;
2. Use this Image converter (Thanks to LVGL) https://lvgl.io/tools/imageconverter&lt;br /&gt;
to convert your image to a C array and having the Color format as &amp;quot;True color&amp;quot; and the output format as &amp;quot;C array&amp;quot;&lt;br /&gt;
make sure to use something simple as the name we will be using &amp;quot;bitmap&amp;quot; as the name, but will also be referred as &amp;lt;name&amp;gt; for simplicity&lt;br /&gt;
&lt;br /&gt;
 Note: for example we shall use &amp;lt;name&amp;gt; = bitmap, but any simple word can be used, as long as it does not cause problems with system variables&lt;br /&gt;
&lt;br /&gt;
===Image size considerations===&lt;br /&gt;
since the image will be using the flash directly, we need to be considerate about flash memory usage.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;picture_X&amp;gt; x &amp;lt;picture_Y&amp;gt; x 2 &lt;br /&gt;
gives you the number of KB the image used in storage...&lt;br /&gt;
&lt;br /&gt;
where, &amp;lt;picture_X&amp;gt; &amp;lt;picture_Y&amp;gt; are the dimensions of the image horizontally and vertically&lt;br /&gt;
&lt;br /&gt;
for example,&lt;br /&gt;
 if &amp;lt;picture_X&amp;gt;=80px &amp;lt;picture_Y&amp;gt;=64px&lt;br /&gt;
then,&lt;br /&gt;
 total storage used = 80 x 60 x 2 = 10.24KB &lt;br /&gt;
&lt;br /&gt;
 please use the flash storage with consideration, when using other apps as well, excess usage of storage &lt;br /&gt;
 might mean the Firmware will not compile... the limit to storage to about 400Kb for the user, the &lt;br /&gt;
 firmware size must not exceed that...&lt;br /&gt;
&lt;br /&gt;
==Preparing the image for inclusion as an icon==&lt;br /&gt;
&lt;br /&gt;
Once you have your obtained your C array from the LVGL converter, you can take a look inside it to see all the different formats of your image, &lt;br /&gt;
try using something like Notepad++ or any of your favorite text editors to peek inside of it,&lt;br /&gt;
 &lt;br /&gt;
there will be 4 sets of Arrays inside it that look like,&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8&lt;br /&gt;
  /*Pixel format: Red: 3 bit, Green: 3 bit, Blue: 2 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP == 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 32&lt;br /&gt;
  /*Pixel format: Fix 0xFF: 8 bit, Red: 8 bit, Green: 8 bit, Blue: 8 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0xff, &lt;br /&gt;
 #endif&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
And another small bit of info we will need for later that looks like,&lt;br /&gt;
&lt;br /&gt;
 const lv_img_dsc_t bitmap = {&lt;br /&gt;
  .header.always_zero = 0,&lt;br /&gt;
  .header.w = 40,&lt;br /&gt;
  .header.h = 40,&lt;br /&gt;
  .data_size = 1600 * LV_COLOR_SIZE / 8,&lt;br /&gt;
  .header.cf = LV_IMG_CF_TRUE_COLOR,&lt;br /&gt;
  .data = bitmap_map,&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 NOTE: There are some header files at the top, which we can ignore...&lt;br /&gt;
===RGB565 image format===&lt;br /&gt;
&lt;br /&gt;
The Pinetime uses a display that uses a 16 bit color space, also known as RGB565.&lt;br /&gt;
&lt;br /&gt;
These 16 bit are assigned to RGB as 5 bits each for Red and Blue and 6 bits for Green, so 5+6+5=16 bits are required, so each pixel's color occupies 2 bytes of data,&lt;br /&gt;
and since 2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt; is equal to 65,536 it allows us to view 65,536 or 65k colors&lt;br /&gt;
&lt;br /&gt;
The way it packs these bits is by converting the bits into 2x  4+4 bit hex-code, so for example,&lt;br /&gt;
 &lt;br /&gt;
if the color of a pixel in Binary is '''10110100 01011111''' (this color is approximately Lavender purple)&lt;br /&gt;
 &lt;br /&gt;
It is split as '''1011''' &amp;amp; '''0100''' for the first byte and '''0101''' &amp;amp; '''1111''' for the second byte&lt;br /&gt;
and so, converting the binary into Hex-code,&lt;br /&gt;
&lt;br /&gt;
the two parts are '''0xB4''' and '''0xF5'''&lt;br /&gt;
&lt;br /&gt;
These two parts in conjunction are used for determining the color of one pixel...&lt;br /&gt;
&lt;br /&gt;
also from the binary, it is observed that,&lt;br /&gt;
&lt;br /&gt;
The bits '''10110''' is used for Red, '''100010''' is used for green, and '''11111''' is used for blue.&lt;br /&gt;
&lt;br /&gt;
===Flipping the bytes===&lt;br /&gt;
The LVGL library has a feature that allows you to flip the two bytes of the pixel, so if the two parts were, ...0xB4,0xF5,... ,it will change it to become, ...0xF5,0xB4,...&lt;br /&gt;
&lt;br /&gt;
The reason for this is to allow the use of 8-bit SPI interfaces, but we do not require it, and if set with  wrong parameter we could get problems with the color...&lt;br /&gt;
&lt;br /&gt;
To make sure you are ready for the next step, make sure that inside your lvgl configuration file (located at '''src/libs/lv_conf.h''')&lt;br /&gt;
&lt;br /&gt;
this parameter, &lt;br /&gt;
 '''#define LV_COLOR_16_SWAP   1'''&lt;br /&gt;
is set to &amp;quot;1&amp;quot; as seen...&lt;br /&gt;
&lt;br /&gt;
 NOTE: if you haven't modified it or tampered with it with your Github fork, you shouldn't have a problem &lt;br /&gt;
 as it is correct by default, and you can skip these steps&lt;br /&gt;
&lt;br /&gt;
===Creating an Object from the Array===&lt;br /&gt;
To include the Icon, first Identify the Array you need to copy to the source (clock.cpp)&lt;br /&gt;
&lt;br /&gt;
The one we require from it is the data below the tag that looks like,&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
 /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
from this copy the Data from the array alone...&lt;br /&gt;
I.e this part,&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00&lt;br /&gt;
&lt;br /&gt;
(Make sure to not include the comma at the end or the #endif as the entire part is going to substitute a new array)&lt;br /&gt;
&lt;br /&gt;
In clock.cpp, just below the header files and the Task creation part (I.e event_handler...),&lt;br /&gt;
&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
 Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
 screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
create a name for the label with,&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;; // remember to replace &amp;lt;name&amp;gt; with the actual name you gave to your image while converting !&lt;br /&gt;
&lt;br /&gt;
then below it create a array to hold the data with,&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {}; // paste the array you copied from the conversion file we specified above...&lt;br /&gt;
&lt;br /&gt;
so your  array is something like,&lt;br /&gt;
&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00};&lt;br /&gt;
&lt;br /&gt;
so your Entire top region of declaration looks like,&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
 #include &amp;lt;libs/date/includes/date/date.h&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 using namespace Pinetime::Applications::Screens;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_extrabold_compressed;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_bold_20;&lt;br /&gt;
 extern lv_style_t* LabelBigStyle;&lt;br /&gt;
 '''   '''&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
  Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
  screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
 '''   '''&lt;br /&gt;
 '''//Declare the descriptor here'''&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;;&lt;br /&gt;
 '''//place the Image data here&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''note: Declaring variables outside a function like we did above is known as global scope declaration, this means the variable can be used by not just one function but the Entire code...'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then inside the &lt;br /&gt;
 Clock::Clock(DisplayApp* app,...){... &lt;br /&gt;
region, (the watchface function)&lt;br /&gt;
You need to place a particular set of lines which LVGL uses to define the object declare the array as an Icon/Image, You can place this set of lines above label_time...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.always_zero = 0; //Initialization&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.w = &amp;lt;picture_X&amp;gt;;                     // Setting the Width (or) Horizontal length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.h = &amp;lt;picture_Y&amp;gt;;                     // Setting the Height (or) vertical length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.data_size = &amp;lt;Hr_length&amp;gt; * &amp;lt;Vr_length&amp;gt; * LV_COLOR_SIZE / 8; //Allocation of memory for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.cf = LV_IMG_CF_TRUE_COLOR; // Sets the color scheme for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.data = &amp;lt;name&amp;gt;_map;                // Maps the Image data to the Array&lt;br /&gt;
  lv_obj_t *img_src = lv_img_create(lv_scr_act(), NULL);  // Create an image object&lt;br /&gt;
  lv_img_set_src(img_src, &amp;amp;&amp;lt;name&amp;gt;);        // Set the created file as image (&amp;lt;name&amp;gt;)&lt;br /&gt;
  &lt;br /&gt;
again, make sure to replace &amp;lt;name&amp;gt; with the name you gave it during conversion!&lt;br /&gt;
&lt;br /&gt;
Now that we have bought in the image data, we need to set the position, you can place this just below the lines we wrote for bringing in the image, It can be done with either,&lt;br /&gt;
 lv_obj_set_pos(img_src, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); // &amp;lt;x_pos&amp;gt;, &amp;lt;y_pos&amp;gt; are the coordinates of the cartesian plane&lt;br /&gt;
or,&lt;br /&gt;
 lv_obj_align(img_src, lv_scr_act(), LV_ALIGN_&amp;lt;parameter&amp;gt;, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); &lt;br /&gt;
&lt;br /&gt;
If done correctly, you will now have a beautiful little Icon/Image in your Watch face,&lt;br /&gt;
Make sure that your Watch face can accommodate the Image by pushing the other labels farther away creating space for it...&lt;br /&gt;
&lt;br /&gt;
We have provided a small template you can use for adding even a large image comfortably&lt;br /&gt;
&lt;br /&gt;
If you have succeeded with this, you have completed part 3 of the tutorial.&lt;br /&gt;
&lt;br /&gt;
=Using git to work on the firmware=&lt;br /&gt;
===Cloning the repository===&lt;br /&gt;
&lt;br /&gt;
Instructions for cloning the repository are available on the [https://github.com/JF002/InfiniTime/blob/develop/doc/buildAndProgram.md Building and programming page] on github.&lt;br /&gt;
&lt;br /&gt;
===Changing the code to add the image===&lt;br /&gt;
===Compiling the firmware===&lt;br /&gt;
==Testing the firmware==&lt;br /&gt;
===Installing the new firmware===&lt;br /&gt;
&lt;br /&gt;
A holistic guide on how to install different firmware using various hardware programmers is available here: [[Reprogramming the PineTime]]. There's also the possibility of using OTA updating. ''//TODO: add that to the article!''&lt;br /&gt;
&lt;br /&gt;
===Activating the firmware===&lt;br /&gt;
===How to troubleshoot===&lt;br /&gt;
==Conclusions==&lt;br /&gt;
==Next steps==&lt;br /&gt;
==More in-depth documentation==&lt;br /&gt;
==Thanks for the help==&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9790</id>
		<title>PineTime Custom Watchface Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9790"/>
		<updated>2021-04-09T11:30:09Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: /* Cloning the repository */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTime Custom Watchface Tutorial=&lt;br /&gt;
&lt;br /&gt;
This is a tutorial to help new users create custom watchfaces based on the InfiniTime Firmware for Pinetime made by user JF002, thanks to him for its development...&lt;br /&gt;
&lt;br /&gt;
We will explain some of the things we went through while creating some custom Watchfaces, so consider this as a log of experiments of sorts..&lt;br /&gt;
&lt;br /&gt;
So stay tuned to it as it will be dynamically updated...&lt;br /&gt;
&lt;br /&gt;
==What you need to start==&lt;br /&gt;
The entire building process will be done by GitHub, so all you need is a device which can give you a Github Web Client, a PC or tablet to give you enough screen space to review your code and a steady internet connection.&lt;br /&gt;
&lt;br /&gt;
Since the compiling and file management is done by Github online, you have nothing else to worry about other than working with the files that display the watch face.&lt;br /&gt;
&lt;br /&gt;
So with those things settled, let's start with the basics of a watchface.&lt;br /&gt;
&lt;br /&gt;
Please remember that this is a wiki, so you can make an account and help us improve this page.&lt;br /&gt;
&lt;br /&gt;
Please make sure not to unilaterally remove info though, but offer an alternative. If it is indeed a better way, in time your alternative will grow into the main text, and the latter info will be pruned.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
The Firmware (also called InfiniTime) we will be working with is made with a programming language named '''C++''':[https://en.wikipedia.org/wiki/C%2B%2B]&lt;br /&gt;
&lt;br /&gt;
Basic knowledge of C/C++ is required to to understand the advanced watch faces as that requires more complex code, but you can still do a some cool things without much knowledge of C++ programming, just some small edits to existing programs.&lt;br /&gt;
&lt;br /&gt;
InfiniTime uses the '''LVGL''':[https://lvgl.io] graphics library to provide users with a simple and clean UI without overpowering the Nordic '''nRF52832''':[http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf] microcontroller which is the brain of the watch.&lt;br /&gt;
&lt;br /&gt;
To get the watchface to work there are these basic steps. We will go over each step separately, so don't be daunted, all will become clear soon.&lt;br /&gt;
&lt;br /&gt;
For now we will, modify the the existing watchface, change the positioning of the text labels, add an icon to an existing watchface, and later on we will do a full watchface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The main file we need to focus on is the '''WatchFaceDigital.cpp''' file, it is what contains most of the data attributed to what we see on the watchface, including The time/day characters, the battery and bluetooth icons, and also pedometer count...&lt;br /&gt;
&lt;br /&gt;
so everything we will be doing in the basic modifications is purely messing with this single file.&lt;br /&gt;
&lt;br /&gt;
==Labels==&lt;br /&gt;
===What are labels?===&lt;br /&gt;
Labels are considered as &amp;quot;elemental&amp;quot; parts that make up a screen's Text-based UI by the LVGL library...&lt;br /&gt;
Each label is also considered as an &amp;quot;object&amp;quot; or &amp;quot;obj&amp;quot; and can be manipulated, by changing the data attributed with the &amp;quot;obj&amp;quot;, for example, position, internal data like the strings/text etc.&lt;br /&gt;
when can change what the label shows and where it shows it...&lt;br /&gt;
&lt;br /&gt;
===Modifying label data===&lt;br /&gt;
let's observe something small like the word &amp;quot;BPM&amp;quot; near the bottom of the watch face...&lt;br /&gt;
[[file:PineTimeCustom-1.png|right|200px]]&lt;br /&gt;
&lt;br /&gt;
If we take a look at the source file of the watchface, (a.k.a the clock.cpp file)&lt;br /&gt;
we can observe that these particular lines are what attributes to the word &amp;quot;BPM being displayed...&lt;br /&gt;
 heartbeatBpm = lv_label_create(lv_scr_act(), NULL);&lt;br /&gt;
 lv_label_set_text(heartbeatBpm, &amp;quot;BPM&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
we can modify the text inside the quotes and replace the word 'BPM' between those quotes to something like 'LOVE'&lt;br /&gt;
and the result after compiling the firmware again with the changes and flashing it to the watch would be that the text changes on the watch face and displays 'LOVE' inplace of 'BPM'...&lt;br /&gt;
&lt;br /&gt;
If this happened correctly, then you have successfully made a custom new watchface! Now we can do something a bit more complex...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now take for in instance the days of the week that we have on the bottom line with the date...&lt;br /&gt;
&lt;br /&gt;
they are stored a &amp;quot;C array&amp;quot; which is basically multiple words separated by commas..&lt;br /&gt;
the date is in a format of '''&amp;lt;day of the week&amp;gt; &amp;lt;day&amp;gt; &amp;lt;Month&amp;gt; &amp;lt;year&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
which in the source file is expressed as,&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
 lv_label_set_text(label_date, dateStr);&lt;br /&gt;
&lt;br /&gt;
here, &lt;br /&gt;
 %s %d %s %d &lt;br /&gt;
stores the print format of the variables, and&lt;br /&gt;
&lt;br /&gt;
 DayOfWeekToString(dayOfWeek), day, MonthToString(month), year  &lt;br /&gt;
are the variables themselves...&lt;br /&gt;
&lt;br /&gt;
Now, &lt;br /&gt;
if the date was a saturday 11/7/2020, you can observe that the date looks like &lt;br /&gt;
 SATURDAY 11 JUL 2020&lt;br /&gt;
as seen in the above image (the one where we changed BPM to LOVE)&lt;br /&gt;
&lt;br /&gt;
by modifying the format of the variables, we can change how those words are arranged, and add some extra characters if we like... &lt;br /&gt;
 (there is a catch to the list of characters you can use however, but it will be discussed later...)&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
We modifying the format by adding a comma... &amp;quot;,&amp;quot; in between the second &amp;quot;%s&amp;quot; and &amp;quot;%d&amp;quot; like this,&lt;br /&gt;
 &amp;quot;%s %d %s, %d&amp;quot;&lt;br /&gt;
and changing that in the line...&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s, %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
&lt;br /&gt;
we can make the date become...&lt;br /&gt;
 SATURDAY 11 JUL, 2020&lt;br /&gt;
&lt;br /&gt;
which means we now were able to modify how the text got display to make it a bit more nice...&lt;br /&gt;
&lt;br /&gt;
but if you haven't noticed, the line containing the date is already full, meaning we will get some problems while displaying the date and causing it to wrap around,&lt;br /&gt;
making a single character go to the next line and look more like,&lt;br /&gt;
&lt;br /&gt;
 SATURDAY 11 JUL, 202&lt;br /&gt;
 0&lt;br /&gt;
&lt;br /&gt;
so why don't we shorten the characters present in the date from being &amp;quot;SATURDAY&amp;quot; to simply just &amp;quot;sat.&amp;quot; (It will have the small period at the end, and is only 3 characters long) &lt;br /&gt;
I will also convert the months of the year from Capital to small letters... &lt;br /&gt;
&lt;br /&gt;
for that look into the part where the days of the week of are stored as text,&lt;br /&gt;
and also while looking at it, we can solve another question, why was their two variables in the date format that looked like, DayOfWeekToString(dayOfWeek), and MonthToString(month) ?&lt;br /&gt;
&lt;br /&gt;
It is because the system gives the date/ time as numbers (Monday-1, Tuesday-2 Wednesday-3 for the days, and 1-January, 2-February, 3-March ),&lt;br /&gt;
and so a function along with a C array is used to assign these numbers to Days/Months in text form as it is easier to read...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this is the Array containing the day of the week, (as text) &lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;MONDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;TUESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;WEDNESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;THURSDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;FRIDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SATURDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SUNDAY&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and this Array stores the months of the year, (as text)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;JAN&amp;quot;,&lt;br /&gt;
        &amp;quot;FEB&amp;quot;,&lt;br /&gt;
        &amp;quot;MAR&amp;quot;,&lt;br /&gt;
        &amp;quot;APR&amp;quot;,&lt;br /&gt;
        &amp;quot;MAY&amp;quot;,&lt;br /&gt;
        &amp;quot;JUN&amp;quot;,&lt;br /&gt;
        &amp;quot;JUL&amp;quot;,&lt;br /&gt;
        &amp;quot;AUG&amp;quot;,&lt;br /&gt;
        &amp;quot;SEP&amp;quot;,&lt;br /&gt;
        &amp;quot;OCT&amp;quot;,&lt;br /&gt;
        &amp;quot;NOV&amp;quot;,&lt;br /&gt;
        &amp;quot;DEC&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
here we can see that the days are stored in a full format as &amp;quot;SUNDAY&amp;quot;, &amp;quot;MONDAY&amp;quot;, &amp;quot;TUESDAY&amp;quot; etc.&lt;br /&gt;
we can change all of them to a shorter format like &amp;quot;sun.&amp;quot;, &amp;quot;mon.&amp;quot;, &amp;quot;tue.&amp;quot;, to make it short and nice...&lt;br /&gt;
while doing so, we can even make the months use small letters as said before..&lt;br /&gt;
&lt;br /&gt;
so the source file (clock.cpp) becomes,&lt;br /&gt;
&lt;br /&gt;
(for the days of the week)&lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;mon.&amp;quot;,&lt;br /&gt;
        &amp;quot;tue.&amp;quot;,&lt;br /&gt;
        &amp;quot;wed.&amp;quot;,&lt;br /&gt;
        &amp;quot;thu.&amp;quot;,&lt;br /&gt;
        &amp;quot;fri.&amp;quot;,&lt;br /&gt;
        &amp;quot;sat.&amp;quot;,&lt;br /&gt;
        &amp;quot;sun.&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
(for the months of the year)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;jan&amp;quot;,&lt;br /&gt;
        &amp;quot;feb&amp;quot;,&lt;br /&gt;
        &amp;quot;mar&amp;quot;,&lt;br /&gt;
        &amp;quot;apr&amp;quot;,&lt;br /&gt;
        &amp;quot;may&amp;quot;,&lt;br /&gt;
        &amp;quot;jun&amp;quot;,&lt;br /&gt;
        &amp;quot;jul&amp;quot;,&lt;br /&gt;
        &amp;quot;aug&amp;quot;,&lt;br /&gt;
        &amp;quot;sep&amp;quot;,&lt;br /&gt;
        &amp;quot;oct&amp;quot;,&lt;br /&gt;
        &amp;quot;nov&amp;quot;,&lt;br /&gt;
        &amp;quot;dec&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
which means now our original date, saturday 11/7/2020 will become...&lt;br /&gt;
 sat. 11 jul, 2020&lt;br /&gt;
&lt;br /&gt;
you now know how to change the data present in a label object, and the format of it..,&lt;br /&gt;
 &lt;br /&gt;
Here is a fun idea you can try: you can even replace the days with whatever thing that tells you (or) reminds you the day of the week &lt;br /&gt;
(like the food served in the cafe, Monday/taco, Tuesday/burger, Wednesday/pasta etc.) &lt;br /&gt;
 &lt;br /&gt;
 NOTE: when making the custom array, don't forget to leave a empty &amp;quot;&amp;quot; as the first element of the array,&lt;br /&gt;
 This is because the date is given by the system in a natural numbers format (1,2,3...) rather than a zero-starting format (0,1,2,3...), which the C array uses to index...&lt;br /&gt;
 so the C array indexes the days as &amp;quot;&amp;quot;-0, &amp;quot;Monday&amp;quot;-1, &amp;quot;Tuesday&amp;quot;-2 etc. and the months as &amp;quot;&amp;quot;-0, &amp;quot;January&amp;quot;-1, &amp;quot;February&amp;quot;-2 etc.)&lt;br /&gt;
&lt;br /&gt;
===Label positioning===&lt;br /&gt;
&lt;br /&gt;
The locational placement in LVGL is done on a cartesian plane,&lt;br /&gt;
where each object can have dynamic origin placement, and the Y-axis is inverted...&lt;br /&gt;
So going down is done with a positive Y-axis value and not negative as the it is by de-facto...&lt;br /&gt;
&lt;br /&gt;
[[File:LVGL coord system.png|200px|thumb|right|LVGL coord system]]&lt;br /&gt;
&lt;br /&gt;
The position of the various objects in clock.cpp are set by the line,&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
and the top left corner is the Cartesian origin, aka coordinates (0,0)&lt;br /&gt;
&lt;br /&gt;
this image can show you how to decide label placement for lv_obj_set_pos(...)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we use another function, that is more advanced that gives the positional alignment based on preset locations...&lt;br /&gt;
 lv_obj_align(&amp;lt;text/obj&amp;gt;, &amp;lt;image/obj&amp;gt;, &amp;lt;location_parameter&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
the &amp;quot;&amp;lt;image/obj&amp;gt;&amp;quot; data is used for putting text beside other picture icons , and so if using only text based labels, we can substitute it with,&lt;br /&gt;
 lv_scr_act() (or) NULL&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;''' are the cartesian coordinates, '''&amp;lt;location parameter&amp;gt;''' is replaced by '''LV_ALIGN_&amp;lt;preset&amp;gt;''',&lt;br /&gt;
there will be a picture showing the presets below, and '''&amp;lt;text/obj&amp;gt;''' is your text label...&lt;br /&gt;
&lt;br /&gt;
here, LV_ALIGN_&amp;lt;preset&amp;gt; sets the cartesian origin...&lt;br /&gt;
&lt;br /&gt;
Label positioning based on alignment is both a simple and complicated thing to understand, so here I have given something you can refer to while modifying the position of the various labels and objects...&lt;br /&gt;
&lt;br /&gt;
you can also refer here for LVGL's documentation of coordinate system https://docs.lvgl.io/v6/en/html/object-types/obj.html#coordinates&lt;br /&gt;
&lt;br /&gt;
It is however recommended that you use the first method to set the location&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
as it is simple and easier for beginners&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a small example.&lt;br /&gt;
&lt;br /&gt;
Take the Label that tells the date,&lt;br /&gt;
In the source file (clock.cpp) it is this line,&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);&lt;br /&gt;
by increasing the Value of the Y coordinate (60) to a higher value, we can bring the position of the Date downwards a bit away from the Time, and toward the Heartbeat count in the bottom row&lt;br /&gt;
here I will increase it to 80, so it becomes..&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80);&lt;br /&gt;
&lt;br /&gt;
and now we have made some space up top..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
now let's try something a bit complex,&lt;br /&gt;
&lt;br /&gt;
Take the position argument for the label that tells you time...&lt;br /&gt;
here, in the source file (clock.cpp),&lt;br /&gt;
 lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this line determines the position of the Label telling time, as seen in the image...&lt;br /&gt;
&lt;br /&gt;
we modifying this, by changing the origin &amp;lt;preset&amp;gt; parameter (here it is LV_ALIGN_IN_LEFT_MID) to LV_ALIGN_IN_TOP_LEFT&lt;br /&gt;
&lt;br /&gt;
you can alternatively swap the whole line to,&lt;br /&gt;
 lv_obj_set_pos(label_time, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this makes the Time label/obj. to go to the top left corner...&lt;br /&gt;
&lt;br /&gt;
but I will do something a little extra,&lt;br /&gt;
I will modify the label that store the data and Time format,&lt;br /&gt;
i.e this line,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c:%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
by removing the &amp;quot;:&amp;quot; colon in between the numbers, and replacing it with a Newline symbol &amp;quot;\n&amp;quot;&lt;br /&gt;
I change it to become,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c\n%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
this gives it a nice wrapped text format in the top corner, and gives us some space to play with in the side, for things like Pictures and icons, which we will do next..&lt;br /&gt;
&lt;br /&gt;
If you have been able to do these things, you now have completed the 2nd part of the tutorial, and now know how to change and modify the position of labels..&lt;br /&gt;
&lt;br /&gt;
==Using icons==&lt;br /&gt;
The LVGL library allows for the use of widgets known as &amp;quot;Images&amp;quot;, In short it allows you to use small Icons like pictures with a small dedicated function,&lt;br /&gt;
However when this was attempted the first time we stumbled on some problems as LVGL v6 (used on the pinetime) is not much documented as the latest release (v7 as of August 2020) &lt;br /&gt;
but also the existing code was only documented for C not C++, after some painful attempts we were able to translate it into C++, &lt;br /&gt;
&lt;br /&gt;
To bring images into Clock.cpp&lt;br /&gt;
you will need to do the following,&lt;br /&gt;
&lt;br /&gt;
1. Have a small image that cannot exceed a maximum size of 240px x 240px (pinetime max resolution)&lt;br /&gt;
&lt;br /&gt;
2. Use this Image converter (Thanks to LVGL) https://lvgl.io/tools/imageconverter&lt;br /&gt;
to convert your image to a C array and having the Color format as &amp;quot;True color&amp;quot; and the output format as &amp;quot;C array&amp;quot;&lt;br /&gt;
make sure to use something simple as the name we will be using &amp;quot;bitmap&amp;quot; as the name, but will also be referred as &amp;lt;name&amp;gt; for simplicity&lt;br /&gt;
&lt;br /&gt;
 Note: for example we shall use &amp;lt;name&amp;gt; = bitmap, but any simple word can be used, as long as it does not cause problems with system variables&lt;br /&gt;
&lt;br /&gt;
===Image size considerations===&lt;br /&gt;
since the image will be using the flash directly, we need to be considerate about flash memory usage.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;picture_X&amp;gt; x &amp;lt;picture_Y&amp;gt; x 2 &lt;br /&gt;
gives you the number of KB the image used in storage...&lt;br /&gt;
&lt;br /&gt;
where, &amp;lt;picture_X&amp;gt; &amp;lt;picture_Y&amp;gt; are the dimensions of the image horizontally and vertically&lt;br /&gt;
&lt;br /&gt;
for example,&lt;br /&gt;
 if &amp;lt;picture_X&amp;gt;=80px &amp;lt;picture_Y&amp;gt;=64px&lt;br /&gt;
then,&lt;br /&gt;
 total storage used = 80 x 60 x 2 = 10.24KB &lt;br /&gt;
&lt;br /&gt;
 please use the flash storage with consideration, when using other apps as well, excess usage of storage &lt;br /&gt;
 might mean the Firmware will not compile... the limit to storage to about 400Kb for the user, the &lt;br /&gt;
 firmware size must not exceed that...&lt;br /&gt;
&lt;br /&gt;
==Preparing the image for inclusion as an icon==&lt;br /&gt;
&lt;br /&gt;
Once you have your obtained your C array from the LVGL converter, you can take a look inside it to see all the different formats of your image, &lt;br /&gt;
try using something like Notepad++ or any of your favorite text editors to peek inside of it,&lt;br /&gt;
 &lt;br /&gt;
there will be 4 sets of Arrays inside it that look like,&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8&lt;br /&gt;
  /*Pixel format: Red: 3 bit, Green: 3 bit, Blue: 2 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP == 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 32&lt;br /&gt;
  /*Pixel format: Fix 0xFF: 8 bit, Red: 8 bit, Green: 8 bit, Blue: 8 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0xff, &lt;br /&gt;
 #endif&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
And another small bit of info we will need for later that looks like,&lt;br /&gt;
&lt;br /&gt;
 const lv_img_dsc_t bitmap = {&lt;br /&gt;
  .header.always_zero = 0,&lt;br /&gt;
  .header.w = 40,&lt;br /&gt;
  .header.h = 40,&lt;br /&gt;
  .data_size = 1600 * LV_COLOR_SIZE / 8,&lt;br /&gt;
  .header.cf = LV_IMG_CF_TRUE_COLOR,&lt;br /&gt;
  .data = bitmap_map,&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 NOTE: There are some header files at the top, which we can ignore...&lt;br /&gt;
===RGB565 image format===&lt;br /&gt;
&lt;br /&gt;
The Pinetime uses a display that uses a 16 bit color space, also known as RGB565.&lt;br /&gt;
&lt;br /&gt;
These 16 bit are assigned to RGB as 5 bits each for Red and Blue and 6 bits for Green, so 5+6+5=16 bits are required, so each pixel's color occupies 2 bytes of data,&lt;br /&gt;
and since 2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt; is equal to 65,536 it allows us to view 65,536 or 65k colors&lt;br /&gt;
&lt;br /&gt;
The way it packs these bits is by converting the bits into 2x  4+4 bit hex-code, so for example,&lt;br /&gt;
 &lt;br /&gt;
if the color of a pixel in Binary is '''10110100 01011111''' (this color is approximately Lavender purple)&lt;br /&gt;
 &lt;br /&gt;
It is split as '''1011''' &amp;amp; '''0100''' for the first byte and '''0101''' &amp;amp; '''1111''' for the second byte&lt;br /&gt;
and so, converting the binary into Hex-code,&lt;br /&gt;
&lt;br /&gt;
the two parts are '''0xB4''' and '''0xF5'''&lt;br /&gt;
&lt;br /&gt;
These two parts in conjunction are used for determining the color of one pixel...&lt;br /&gt;
&lt;br /&gt;
also from the binary, it is observed that,&lt;br /&gt;
&lt;br /&gt;
The bits '''10110''' is used for Red, '''100010''' is used for green, and '''11111''' is used for blue.&lt;br /&gt;
&lt;br /&gt;
===Flipping the bytes===&lt;br /&gt;
The LVGL library has a feature that allows you to flip the two bytes of the pixel, so if the two parts were, ...0xB4,0xF5,... ,it will change it to become, ...0xF5,0xB4,...&lt;br /&gt;
&lt;br /&gt;
The reason for this is to allow the use of 8-bit SPI interfaces, but we do not require it, and if set with  wrong parameter we could get problems with the color...&lt;br /&gt;
&lt;br /&gt;
To make sure you are ready for the next step, make sure that inside your lvgl configuration file (located at '''src/libs/lv_conf.h''')&lt;br /&gt;
&lt;br /&gt;
this parameter, &lt;br /&gt;
 '''#define LV_COLOR_16_SWAP   1'''&lt;br /&gt;
is set to &amp;quot;1&amp;quot; as seen...&lt;br /&gt;
&lt;br /&gt;
 NOTE: if you haven't modified it or tampered with it with your Github fork, you shouldn't have a problem &lt;br /&gt;
 as it is correct by default, and you can skip these steps&lt;br /&gt;
&lt;br /&gt;
===Creating an Object from the Array===&lt;br /&gt;
To include the Icon, first Identify the Array you need to copy to the source (clock.cpp)&lt;br /&gt;
&lt;br /&gt;
The one we require from it is the data below the tag that looks like,&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
 /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
from this copy the Data from the array alone...&lt;br /&gt;
I.e this part,&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00&lt;br /&gt;
&lt;br /&gt;
(Make sure to not include the comma at the end or the #endif as the entire part is going to substitute a new array)&lt;br /&gt;
&lt;br /&gt;
In clock.cpp, just below the header files and the Task creation part (I.e event_handler...),&lt;br /&gt;
&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
 Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
 screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
create a name for the label with,&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;; // remember to replace &amp;lt;name&amp;gt; with the actual name you gave to your image while converting !&lt;br /&gt;
&lt;br /&gt;
then below it create a array to hold the data with,&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {}; // paste the array you copied from the conversion file we specified above...&lt;br /&gt;
&lt;br /&gt;
so your  array is something like,&lt;br /&gt;
&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00};&lt;br /&gt;
&lt;br /&gt;
so your Entire top region of declaration looks like,&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
 #include &amp;lt;libs/date/includes/date/date.h&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 using namespace Pinetime::Applications::Screens;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_extrabold_compressed;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_bold_20;&lt;br /&gt;
 extern lv_style_t* LabelBigStyle;&lt;br /&gt;
 '''   '''&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
  Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
  screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
 '''   '''&lt;br /&gt;
 '''//Declare the descriptor here'''&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;;&lt;br /&gt;
 '''//place the Image data here&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''note: Declaring variables outside a function like we did above is known as global scope declaration, this means the variable can be used by not just one function but the Entire code...'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then inside the &lt;br /&gt;
 Clock::Clock(DisplayApp* app,...){... &lt;br /&gt;
region, (the watchface function)&lt;br /&gt;
You need to place a particular set of lines which LVGL uses to define the object declare the array as an Icon/Image, You can place this set of lines above label_time...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.always_zero = 0; //Initialization&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.w = &amp;lt;picture_X&amp;gt;;                     // Setting the Width (or) Horizontal length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.h = &amp;lt;picture_Y&amp;gt;;                     // Setting the Height (or) vertical length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.data_size = &amp;lt;Hr_length&amp;gt; * &amp;lt;Vr_length&amp;gt; * LV_COLOR_SIZE / 8; //Allocation of memory for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.cf = LV_IMG_CF_TRUE_COLOR; // Sets the color scheme for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.data = &amp;lt;name&amp;gt;_map;                // Maps the Image data to the Array&lt;br /&gt;
  lv_obj_t *img_src = lv_img_create(lv_scr_act(), NULL);  // Create an image object&lt;br /&gt;
  lv_img_set_src(img_src, &amp;amp;&amp;lt;name&amp;gt;);        // Set the created file as image (&amp;lt;name&amp;gt;)&lt;br /&gt;
  &lt;br /&gt;
again, make sure to replace &amp;lt;name&amp;gt; with the name you gave it during conversion!&lt;br /&gt;
&lt;br /&gt;
Now that we have bought in the image data, we need to set the position, you can place this just below the lines we wrote for bringing in the image, It can be done with either,&lt;br /&gt;
 lv_obj_set_pos(img_src, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); // &amp;lt;x_pos&amp;gt;, &amp;lt;y_pos&amp;gt; are the coordinates of the cartesian plane&lt;br /&gt;
or,&lt;br /&gt;
 lv_obj_align(img_src, lv_scr_act(), LV_ALIGN_&amp;lt;parameter&amp;gt;, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); &lt;br /&gt;
&lt;br /&gt;
If done correctly, you will now have a beautiful little Icon/Image in your Watch face,&lt;br /&gt;
Make sure that your Watch face can accommodate the Image by pushing the other labels farther away creating space for it...&lt;br /&gt;
&lt;br /&gt;
We have provided a small template you can use for adding even a large image comfortably&lt;br /&gt;
&lt;br /&gt;
If you have succeeded with this, you have completed part 3 of the tutorial.&lt;br /&gt;
&lt;br /&gt;
=Using git to work on the firmware=&lt;br /&gt;
===Cloning the repository===&lt;br /&gt;
 Instructions for cloning the repository are available on the [https://github.com/JF002/InfiniTime/blob/develop/doc/buildAndProgram.md Building and programming page] on github.&lt;br /&gt;
&lt;br /&gt;
===Changing the code to add the image===&lt;br /&gt;
===Compiling the firmware===&lt;br /&gt;
==Testing the firmware==&lt;br /&gt;
===Installing the new firmware===&lt;br /&gt;
&lt;br /&gt;
A holistic guide on how to install different firmware using various hardware programmers is available here: [[Reprogramming the PineTime]]. There's also the possibility of using OTA updating. ''//TODO: add that to the article!''&lt;br /&gt;
&lt;br /&gt;
===Activating the firmware===&lt;br /&gt;
===How to troubleshoot===&lt;br /&gt;
==Conclusions==&lt;br /&gt;
==Next steps==&lt;br /&gt;
==More in-depth documentation==&lt;br /&gt;
==Thanks for the help==&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9789</id>
		<title>PineTime Custom Watchface Tutorial</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime_Custom_Watchface_Tutorial&amp;diff=9789"/>
		<updated>2021-04-09T11:24:27Z</updated>

		<summary type="html">&lt;p&gt;Kieranc: Change reference to file where the watchface is stored&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=PineTime Custom Watchface Tutorial=&lt;br /&gt;
&lt;br /&gt;
This is a tutorial to help new users create custom watchfaces based on the InfiniTime Firmware for Pinetime made by user JF002, thanks to him for its development...&lt;br /&gt;
&lt;br /&gt;
We will explain some of the things we went through while creating some custom Watchfaces, so consider this as a log of experiments of sorts..&lt;br /&gt;
&lt;br /&gt;
So stay tuned to it as it will be dynamically updated...&lt;br /&gt;
&lt;br /&gt;
==What you need to start==&lt;br /&gt;
The entire building process will be done by GitHub, so all you need is a device which can give you a Github Web Client, a PC or tablet to give you enough screen space to review your code and a steady internet connection.&lt;br /&gt;
&lt;br /&gt;
Since the compiling and file management is done by Github online, you have nothing else to worry about other than working with the files that display the watch face.&lt;br /&gt;
&lt;br /&gt;
So with those things settled, let's start with the basics of a watchface.&lt;br /&gt;
&lt;br /&gt;
Please remember that this is a wiki, so you can make an account and help us improve this page.&lt;br /&gt;
&lt;br /&gt;
Please make sure not to unilaterally remove info though, but offer an alternative. If it is indeed a better way, in time your alternative will grow into the main text, and the latter info will be pruned.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
The Firmware (also called InfiniTime) we will be working with is made with a programming language named '''C++''':[https://en.wikipedia.org/wiki/C%2B%2B]&lt;br /&gt;
&lt;br /&gt;
Basic knowledge of C/C++ is required to to understand the advanced watch faces as that requires more complex code, but you can still do a some cool things without much knowledge of C++ programming, just some small edits to existing programs.&lt;br /&gt;
&lt;br /&gt;
InfiniTime uses the '''LVGL''':[https://lvgl.io] graphics library to provide users with a simple and clean UI without overpowering the Nordic '''nRF52832''':[http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf] microcontroller which is the brain of the watch.&lt;br /&gt;
&lt;br /&gt;
To get the watchface to work there are these basic steps. We will go over each step separately, so don't be daunted, all will become clear soon.&lt;br /&gt;
&lt;br /&gt;
For now we will, modify the the existing watchface, change the positioning of the text labels, add an icon to an existing watchface, and later on we will do a full watchface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The main file we need to focus on is the '''WatchFaceDigital.cpp''' file, it is what contains most of the data attributed to what we see on the watchface, including The time/day characters, the battery and bluetooth icons, and also pedometer count...&lt;br /&gt;
&lt;br /&gt;
so everything we will be doing in the basic modifications is purely messing with this single file.&lt;br /&gt;
&lt;br /&gt;
==Labels==&lt;br /&gt;
===What are labels?===&lt;br /&gt;
Labels are considered as &amp;quot;elemental&amp;quot; parts that make up a screen's Text-based UI by the LVGL library...&lt;br /&gt;
Each label is also considered as an &amp;quot;object&amp;quot; or &amp;quot;obj&amp;quot; and can be manipulated, by changing the data attributed with the &amp;quot;obj&amp;quot;, for example, position, internal data like the strings/text etc.&lt;br /&gt;
when can change what the label shows and where it shows it...&lt;br /&gt;
&lt;br /&gt;
===Modifying label data===&lt;br /&gt;
let's observe something small like the word &amp;quot;BPM&amp;quot; near the bottom of the watch face...&lt;br /&gt;
[[file:PineTimeCustom-1.png|right|200px]]&lt;br /&gt;
&lt;br /&gt;
If we take a look at the source file of the watchface, (a.k.a the clock.cpp file)&lt;br /&gt;
we can observe that these particular lines are what attributes to the word &amp;quot;BPM being displayed...&lt;br /&gt;
 heartbeatBpm = lv_label_create(lv_scr_act(), NULL);&lt;br /&gt;
 lv_label_set_text(heartbeatBpm, &amp;quot;BPM&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
we can modify the text inside the quotes and replace the word 'BPM' between those quotes to something like 'LOVE'&lt;br /&gt;
and the result after compiling the firmware again with the changes and flashing it to the watch would be that the text changes on the watch face and displays 'LOVE' inplace of 'BPM'...&lt;br /&gt;
&lt;br /&gt;
If this happened correctly, then you have successfully made a custom new watchface! Now we can do something a bit more complex...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now take for in instance the days of the week that we have on the bottom line with the date...&lt;br /&gt;
&lt;br /&gt;
they are stored a &amp;quot;C array&amp;quot; which is basically multiple words separated by commas..&lt;br /&gt;
the date is in a format of '''&amp;lt;day of the week&amp;gt; &amp;lt;day&amp;gt; &amp;lt;Month&amp;gt; &amp;lt;year&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
which in the source file is expressed as,&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
 lv_label_set_text(label_date, dateStr);&lt;br /&gt;
&lt;br /&gt;
here, &lt;br /&gt;
 %s %d %s %d &lt;br /&gt;
stores the print format of the variables, and&lt;br /&gt;
&lt;br /&gt;
 DayOfWeekToString(dayOfWeek), day, MonthToString(month), year  &lt;br /&gt;
are the variables themselves...&lt;br /&gt;
&lt;br /&gt;
Now, &lt;br /&gt;
if the date was a saturday 11/7/2020, you can observe that the date looks like &lt;br /&gt;
 SATURDAY 11 JUL 2020&lt;br /&gt;
as seen in the above image (the one where we changed BPM to LOVE)&lt;br /&gt;
&lt;br /&gt;
by modifying the format of the variables, we can change how those words are arranged, and add some extra characters if we like... &lt;br /&gt;
 (there is a catch to the list of characters you can use however, but it will be discussed later...)&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
We modifying the format by adding a comma... &amp;quot;,&amp;quot; in between the second &amp;quot;%s&amp;quot; and &amp;quot;%d&amp;quot; like this,&lt;br /&gt;
 &amp;quot;%s %d %s, %d&amp;quot;&lt;br /&gt;
and changing that in the line...&lt;br /&gt;
 sprintf(dateStr, &amp;quot;%s %d %s, %d&amp;quot;, DayOfWeekToString(dayOfWeek), day, MonthToString(month), year);&lt;br /&gt;
&lt;br /&gt;
we can make the date become...&lt;br /&gt;
 SATURDAY 11 JUL, 2020&lt;br /&gt;
&lt;br /&gt;
which means we now were able to modify how the text got display to make it a bit more nice...&lt;br /&gt;
&lt;br /&gt;
but if you haven't noticed, the line containing the date is already full, meaning we will get some problems while displaying the date and causing it to wrap around,&lt;br /&gt;
making a single character go to the next line and look more like,&lt;br /&gt;
&lt;br /&gt;
 SATURDAY 11 JUL, 202&lt;br /&gt;
 0&lt;br /&gt;
&lt;br /&gt;
so why don't we shorten the characters present in the date from being &amp;quot;SATURDAY&amp;quot; to simply just &amp;quot;sat.&amp;quot; (It will have the small period at the end, and is only 3 characters long) &lt;br /&gt;
I will also convert the months of the year from Capital to small letters... &lt;br /&gt;
&lt;br /&gt;
for that look into the part where the days of the week of are stored as text,&lt;br /&gt;
and also while looking at it, we can solve another question, why was their two variables in the date format that looked like, DayOfWeekToString(dayOfWeek), and MonthToString(month) ?&lt;br /&gt;
&lt;br /&gt;
It is because the system gives the date/ time as numbers (Monday-1, Tuesday-2 Wednesday-3 for the days, and 1-January, 2-February, 3-March ),&lt;br /&gt;
and so a function along with a C array is used to assign these numbers to Days/Months in text form as it is easier to read...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this is the Array containing the day of the week, (as text) &lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;MONDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;TUESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;WEDNESDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;THURSDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;FRIDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SATURDAY&amp;quot;,&lt;br /&gt;
        &amp;quot;SUNDAY&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and this Array stores the months of the year, (as text)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;JAN&amp;quot;,&lt;br /&gt;
        &amp;quot;FEB&amp;quot;,&lt;br /&gt;
        &amp;quot;MAR&amp;quot;,&lt;br /&gt;
        &amp;quot;APR&amp;quot;,&lt;br /&gt;
        &amp;quot;MAY&amp;quot;,&lt;br /&gt;
        &amp;quot;JUN&amp;quot;,&lt;br /&gt;
        &amp;quot;JUL&amp;quot;,&lt;br /&gt;
        &amp;quot;AUG&amp;quot;,&lt;br /&gt;
        &amp;quot;SEP&amp;quot;,&lt;br /&gt;
        &amp;quot;OCT&amp;quot;,&lt;br /&gt;
        &amp;quot;NOV&amp;quot;,&lt;br /&gt;
        &amp;quot;DEC&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
here we can see that the days are stored in a full format as &amp;quot;SUNDAY&amp;quot;, &amp;quot;MONDAY&amp;quot;, &amp;quot;TUESDAY&amp;quot; etc.&lt;br /&gt;
we can change all of them to a shorter format like &amp;quot;sun.&amp;quot;, &amp;quot;mon.&amp;quot;, &amp;quot;tue.&amp;quot;, to make it short and nice...&lt;br /&gt;
while doing so, we can even make the months use small letters as said before..&lt;br /&gt;
&lt;br /&gt;
so the source file (clock.cpp) becomes,&lt;br /&gt;
&lt;br /&gt;
(for the days of the week)&lt;br /&gt;
 char const *Clock::DaysString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;mon.&amp;quot;,&lt;br /&gt;
        &amp;quot;tue.&amp;quot;,&lt;br /&gt;
        &amp;quot;wed.&amp;quot;,&lt;br /&gt;
        &amp;quot;thu.&amp;quot;,&lt;br /&gt;
        &amp;quot;fri.&amp;quot;,&lt;br /&gt;
        &amp;quot;sat.&amp;quot;,&lt;br /&gt;
        &amp;quot;sun.&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
(for the months of the year)&lt;br /&gt;
 char const *Clock::MonthsString[] = {&lt;br /&gt;
        &amp;quot;&amp;quot;,&lt;br /&gt;
        &amp;quot;jan&amp;quot;,&lt;br /&gt;
        &amp;quot;feb&amp;quot;,&lt;br /&gt;
        &amp;quot;mar&amp;quot;,&lt;br /&gt;
        &amp;quot;apr&amp;quot;,&lt;br /&gt;
        &amp;quot;may&amp;quot;,&lt;br /&gt;
        &amp;quot;jun&amp;quot;,&lt;br /&gt;
        &amp;quot;jul&amp;quot;,&lt;br /&gt;
        &amp;quot;aug&amp;quot;,&lt;br /&gt;
        &amp;quot;sep&amp;quot;,&lt;br /&gt;
        &amp;quot;oct&amp;quot;,&lt;br /&gt;
        &amp;quot;nov&amp;quot;,&lt;br /&gt;
        &amp;quot;dec&amp;quot;&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
which means now our original date, saturday 11/7/2020 will become...&lt;br /&gt;
 sat. 11 jul, 2020&lt;br /&gt;
&lt;br /&gt;
you now know how to change the data present in a label object, and the format of it..,&lt;br /&gt;
 &lt;br /&gt;
Here is a fun idea you can try: you can even replace the days with whatever thing that tells you (or) reminds you the day of the week &lt;br /&gt;
(like the food served in the cafe, Monday/taco, Tuesday/burger, Wednesday/pasta etc.) &lt;br /&gt;
 &lt;br /&gt;
 NOTE: when making the custom array, don't forget to leave a empty &amp;quot;&amp;quot; as the first element of the array,&lt;br /&gt;
 This is because the date is given by the system in a natural numbers format (1,2,3...) rather than a zero-starting format (0,1,2,3...), which the C array uses to index...&lt;br /&gt;
 so the C array indexes the days as &amp;quot;&amp;quot;-0, &amp;quot;Monday&amp;quot;-1, &amp;quot;Tuesday&amp;quot;-2 etc. and the months as &amp;quot;&amp;quot;-0, &amp;quot;January&amp;quot;-1, &amp;quot;February&amp;quot;-2 etc.)&lt;br /&gt;
&lt;br /&gt;
===Label positioning===&lt;br /&gt;
&lt;br /&gt;
The locational placement in LVGL is done on a cartesian plane,&lt;br /&gt;
where each object can have dynamic origin placement, and the Y-axis is inverted...&lt;br /&gt;
So going down is done with a positive Y-axis value and not negative as the it is by de-facto...&lt;br /&gt;
&lt;br /&gt;
[[File:LVGL coord system.png|200px|thumb|right|LVGL coord system]]&lt;br /&gt;
&lt;br /&gt;
The position of the various objects in clock.cpp are set by the line,&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
and the top left corner is the Cartesian origin, aka coordinates (0,0)&lt;br /&gt;
&lt;br /&gt;
this image can show you how to decide label placement for lv_obj_set_pos(...)&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
we use another function, that is more advanced that gives the positional alignment based on preset locations...&lt;br /&gt;
 lv_obj_align(&amp;lt;text/obj&amp;gt;, &amp;lt;image/obj&amp;gt;, &amp;lt;location_parameter&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
the &amp;quot;&amp;lt;image/obj&amp;gt;&amp;quot; data is used for putting text beside other picture icons , and so if using only text based labels, we can substitute it with,&lt;br /&gt;
 lv_scr_act() (or) NULL&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;''' are the cartesian coordinates, '''&amp;lt;location parameter&amp;gt;''' is replaced by '''LV_ALIGN_&amp;lt;preset&amp;gt;''',&lt;br /&gt;
there will be a picture showing the presets below, and '''&amp;lt;text/obj&amp;gt;''' is your text label...&lt;br /&gt;
&lt;br /&gt;
here, LV_ALIGN_&amp;lt;preset&amp;gt; sets the cartesian origin...&lt;br /&gt;
&lt;br /&gt;
Label positioning based on alignment is both a simple and complicated thing to understand, so here I have given something you can refer to while modifying the position of the various labels and objects...&lt;br /&gt;
&lt;br /&gt;
you can also refer here for LVGL's documentation of coordinate system https://docs.lvgl.io/v6/en/html/object-types/obj.html#coordinates&lt;br /&gt;
&lt;br /&gt;
It is however recommended that you use the first method to set the location&lt;br /&gt;
 lv_obj_set_pos(&amp;lt;obj&amp;gt;, &amp;lt;new_x&amp;gt;, &amp;lt;new_y&amp;gt;)&lt;br /&gt;
as it is simple and easier for beginners&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is a small example.&lt;br /&gt;
&lt;br /&gt;
Take the Label that tells the date,&lt;br /&gt;
In the source file (clock.cpp) it is this line,&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);&lt;br /&gt;
by increasing the Value of the Y coordinate (60) to a higher value, we can bring the position of the Date downwards a bit away from the Time, and toward the Heartbeat count in the bottom row&lt;br /&gt;
here I will increase it to 80, so it becomes..&lt;br /&gt;
 lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80);&lt;br /&gt;
&lt;br /&gt;
and now we have made some space up top..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
now let's try something a bit complex,&lt;br /&gt;
&lt;br /&gt;
Take the position argument for the label that tells you time...&lt;br /&gt;
here, in the source file (clock.cpp),&lt;br /&gt;
 lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this line determines the position of the Label telling time, as seen in the image...&lt;br /&gt;
&lt;br /&gt;
we modifying this, by changing the origin &amp;lt;preset&amp;gt; parameter (here it is LV_ALIGN_IN_LEFT_MID) to LV_ALIGN_IN_TOP_LEFT&lt;br /&gt;
&lt;br /&gt;
you can alternatively swap the whole line to,&lt;br /&gt;
 lv_obj_set_pos(label_time, 0, 0);&lt;br /&gt;
&lt;br /&gt;
this makes the Time label/obj. to go to the top left corner...&lt;br /&gt;
&lt;br /&gt;
but I will do something a little extra,&lt;br /&gt;
I will modify the label that store the data and Time format,&lt;br /&gt;
i.e this line,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c:%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
by removing the &amp;quot;:&amp;quot; colon in between the numbers, and replacing it with a Newline symbol &amp;quot;\n&amp;quot;&lt;br /&gt;
I change it to become,&lt;br /&gt;
 sprintf(timeStr, &amp;quot;%c%c\n%c%c&amp;quot;, hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]);&lt;br /&gt;
&lt;br /&gt;
this gives it a nice wrapped text format in the top corner, and gives us some space to play with in the side, for things like Pictures and icons, which we will do next..&lt;br /&gt;
&lt;br /&gt;
If you have been able to do these things, you now have completed the 2nd part of the tutorial, and now know how to change and modify the position of labels..&lt;br /&gt;
&lt;br /&gt;
==Using icons==&lt;br /&gt;
The LVGL library allows for the use of widgets known as &amp;quot;Images&amp;quot;, In short it allows you to use small Icons like pictures with a small dedicated function,&lt;br /&gt;
However when this was attempted the first time we stumbled on some problems as LVGL v6 (used on the pinetime) is not much documented as the latest release (v7 as of August 2020) &lt;br /&gt;
but also the existing code was only documented for C not C++, after some painful attempts we were able to translate it into C++, &lt;br /&gt;
&lt;br /&gt;
To bring images into Clock.cpp&lt;br /&gt;
you will need to do the following,&lt;br /&gt;
&lt;br /&gt;
1. Have a small image that cannot exceed a maximum size of 240px x 240px (pinetime max resolution)&lt;br /&gt;
&lt;br /&gt;
2. Use this Image converter (Thanks to LVGL) https://lvgl.io/tools/imageconverter&lt;br /&gt;
to convert your image to a C array and having the Color format as &amp;quot;True color&amp;quot; and the output format as &amp;quot;C array&amp;quot;&lt;br /&gt;
make sure to use something simple as the name we will be using &amp;quot;bitmap&amp;quot; as the name, but will also be referred as &amp;lt;name&amp;gt; for simplicity&lt;br /&gt;
&lt;br /&gt;
 Note: for example we shall use &amp;lt;name&amp;gt; = bitmap, but any simple word can be used, as long as it does not cause problems with system variables&lt;br /&gt;
&lt;br /&gt;
===Image size considerations===&lt;br /&gt;
since the image will be using the flash directly, we need to be considerate about flash memory usage.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;picture_X&amp;gt; x &amp;lt;picture_Y&amp;gt; x 2 &lt;br /&gt;
gives you the number of KB the image used in storage...&lt;br /&gt;
&lt;br /&gt;
where, &amp;lt;picture_X&amp;gt; &amp;lt;picture_Y&amp;gt; are the dimensions of the image horizontally and vertically&lt;br /&gt;
&lt;br /&gt;
for example,&lt;br /&gt;
 if &amp;lt;picture_X&amp;gt;=80px &amp;lt;picture_Y&amp;gt;=64px&lt;br /&gt;
then,&lt;br /&gt;
 total storage used = 80 x 60 x 2 = 10.24KB &lt;br /&gt;
&lt;br /&gt;
 please use the flash storage with consideration, when using other apps as well, excess usage of storage &lt;br /&gt;
 might mean the Firmware will not compile... the limit to storage to about 400Kb for the user, the &lt;br /&gt;
 firmware size must not exceed that...&lt;br /&gt;
&lt;br /&gt;
==Preparing the image for inclusion as an icon==&lt;br /&gt;
&lt;br /&gt;
Once you have your obtained your C array from the LVGL converter, you can take a look inside it to see all the different formats of your image, &lt;br /&gt;
try using something like Notepad++ or any of your favorite text editors to peek inside of it,&lt;br /&gt;
 &lt;br /&gt;
there will be 4 sets of Arrays inside it that look like,&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8&lt;br /&gt;
  /*Pixel format: Red: 3 bit, Green: 3 bit, Blue: 2 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP == 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
  /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
 #if LV_COLOR_DEPTH == 32&lt;br /&gt;
  /*Pixel format: Fix 0xFF: 8 bit, Red: 8 bit, Green: 8 bit, Blue: 8 bit*/&lt;br /&gt;
  0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0xff, &lt;br /&gt;
 #endif&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
And another small bit of info we will need for later that looks like,&lt;br /&gt;
&lt;br /&gt;
 const lv_img_dsc_t bitmap = {&lt;br /&gt;
  .header.always_zero = 0,&lt;br /&gt;
  .header.w = 40,&lt;br /&gt;
  .header.h = 40,&lt;br /&gt;
  .data_size = 1600 * LV_COLOR_SIZE / 8,&lt;br /&gt;
  .header.cf = LV_IMG_CF_TRUE_COLOR,&lt;br /&gt;
  .data = bitmap_map,&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 NOTE: There are some header files at the top, which we can ignore...&lt;br /&gt;
===RGB565 image format===&lt;br /&gt;
&lt;br /&gt;
The Pinetime uses a display that uses a 16 bit color space, also known as RGB565.&lt;br /&gt;
&lt;br /&gt;
These 16 bit are assigned to RGB as 5 bits each for Red and Blue and 6 bits for Green, so 5+6+5=16 bits are required, so each pixel's color occupies 2 bytes of data,&lt;br /&gt;
and since 2&amp;lt;sup&amp;gt;16&amp;lt;/sup&amp;gt; is equal to 65,536 it allows us to view 65,536 or 65k colors&lt;br /&gt;
&lt;br /&gt;
The way it packs these bits is by converting the bits into 2x  4+4 bit hex-code, so for example,&lt;br /&gt;
 &lt;br /&gt;
if the color of a pixel in Binary is '''10110100 01011111''' (this color is approximately Lavender purple)&lt;br /&gt;
 &lt;br /&gt;
It is split as '''1011''' &amp;amp; '''0100''' for the first byte and '''0101''' &amp;amp; '''1111''' for the second byte&lt;br /&gt;
and so, converting the binary into Hex-code,&lt;br /&gt;
&lt;br /&gt;
the two parts are '''0xB4''' and '''0xF5'''&lt;br /&gt;
&lt;br /&gt;
These two parts in conjunction are used for determining the color of one pixel...&lt;br /&gt;
&lt;br /&gt;
also from the binary, it is observed that,&lt;br /&gt;
&lt;br /&gt;
The bits '''10110''' is used for Red, '''100010''' is used for green, and '''11111''' is used for blue.&lt;br /&gt;
&lt;br /&gt;
===Flipping the bytes===&lt;br /&gt;
The LVGL library has a feature that allows you to flip the two bytes of the pixel, so if the two parts were, ...0xB4,0xF5,... ,it will change it to become, ...0xF5,0xB4,...&lt;br /&gt;
&lt;br /&gt;
The reason for this is to allow the use of 8-bit SPI interfaces, but we do not require it, and if set with  wrong parameter we could get problems with the color...&lt;br /&gt;
&lt;br /&gt;
To make sure you are ready for the next step, make sure that inside your lvgl configuration file (located at '''src/libs/lv_conf.h''')&lt;br /&gt;
&lt;br /&gt;
this parameter, &lt;br /&gt;
 '''#define LV_COLOR_16_SWAP   1'''&lt;br /&gt;
is set to &amp;quot;1&amp;quot; as seen...&lt;br /&gt;
&lt;br /&gt;
 NOTE: if you haven't modified it or tampered with it with your Github fork, you shouldn't have a problem &lt;br /&gt;
 as it is correct by default, and you can skip these steps&lt;br /&gt;
&lt;br /&gt;
===Creating an Object from the Array===&lt;br /&gt;
To include the Icon, first Identify the Array you need to copy to the source (clock.cpp)&lt;br /&gt;
&lt;br /&gt;
The one we require from it is the data below the tag that looks like,&lt;br /&gt;
 #if LV_COLOR_DEPTH == 16 &amp;amp;&amp;amp; LV_COLOR_16_SWAP != 0&lt;br /&gt;
 /*Pixel format: Red: 5 bit, Green: 6 bit, Blue: 5 bit BUT the 2 bytes are swapped*/&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00, &lt;br /&gt;
 #endif&lt;br /&gt;
&lt;br /&gt;
from this copy the Data from the array alone...&lt;br /&gt;
I.e this part,&lt;br /&gt;
 0x00, 0x00, 0x00,...&lt;br /&gt;
 ...0x00, 0x00, 0x00&lt;br /&gt;
&lt;br /&gt;
(Make sure to not include the comma at the end or the #endif as the entire part is going to substitute a new array)&lt;br /&gt;
&lt;br /&gt;
In clock.cpp, just below the header files and the Task creation part (I.e event_handler...),&lt;br /&gt;
&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
 Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
 screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
create a name for the label with,&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;; // remember to replace &amp;lt;name&amp;gt; with the actual name you gave to your image while converting !&lt;br /&gt;
&lt;br /&gt;
then below it create a array to hold the data with,&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {}; // paste the array you copied from the conversion file we specified above...&lt;br /&gt;
&lt;br /&gt;
so your  array is something like,&lt;br /&gt;
&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00};&lt;br /&gt;
&lt;br /&gt;
so your Entire top region of declaration looks like,&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
 #include &amp;lt;libs/date/includes/date/date.h&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 using namespace Pinetime::Applications::Screens;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_extrabold_compressed;&lt;br /&gt;
 extern lv_font_t jetbrains_mono_bold_20;&lt;br /&gt;
 extern lv_style_t* LabelBigStyle;&lt;br /&gt;
 '''   '''&lt;br /&gt;
 static void event_handler(lv_obj_t * obj, lv_event_t event) {&lt;br /&gt;
  Clock* screen = static_cast&amp;lt;Clock *&amp;gt;(obj-&amp;gt;user_data);&lt;br /&gt;
  screen-&amp;gt;OnObjectEvent(obj, event);&lt;br /&gt;
 }&lt;br /&gt;
 '''   '''&lt;br /&gt;
 '''//Declare the descriptor here'''&lt;br /&gt;
 static lv_img_dsc_t &amp;lt;name&amp;gt;;&lt;br /&gt;
 '''//place the Image data here&lt;br /&gt;
 const uint8_t &amp;lt;name&amp;gt;_map[] = {0x00,0x00,0x00...&lt;br /&gt;
 ...0x00,0x00,0x00&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 '''note: Declaring variables outside a function like we did above is known as global scope declaration, this means the variable can be used by not just one function but the Entire code...'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then inside the &lt;br /&gt;
 Clock::Clock(DisplayApp* app,...){... &lt;br /&gt;
region, (the watchface function)&lt;br /&gt;
You need to place a particular set of lines which LVGL uses to define the object declare the array as an Icon/Image, You can place this set of lines above label_time...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.always_zero = 0; //Initialization&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.w = &amp;lt;picture_X&amp;gt;;                     // Setting the Width (or) Horizontal length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.h = &amp;lt;picture_Y&amp;gt;;                     // Setting the Height (or) vertical length of the image (number of px)&lt;br /&gt;
  &amp;lt;name&amp;gt;.data_size = &amp;lt;Hr_length&amp;gt; * &amp;lt;Vr_length&amp;gt; * LV_COLOR_SIZE / 8; //Allocation of memory for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.header.cf = LV_IMG_CF_TRUE_COLOR; // Sets the color scheme for the image&lt;br /&gt;
  &amp;lt;name&amp;gt;.data = &amp;lt;name&amp;gt;_map;                // Maps the Image data to the Array&lt;br /&gt;
  lv_obj_t *img_src = lv_img_create(lv_scr_act(), NULL);  // Create an image object&lt;br /&gt;
  lv_img_set_src(img_src, &amp;amp;&amp;lt;name&amp;gt;);        // Set the created file as image (&amp;lt;name&amp;gt;)&lt;br /&gt;
  &lt;br /&gt;
again, make sure to replace &amp;lt;name&amp;gt; with the name you gave it during conversion!&lt;br /&gt;
&lt;br /&gt;
Now that we have bought in the image data, we need to set the position, you can place this just below the lines we wrote for bringing in the image, It can be done with either,&lt;br /&gt;
 lv_obj_set_pos(img_src, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); // &amp;lt;x_pos&amp;gt;, &amp;lt;y_pos&amp;gt; are the coordinates of the cartesian plane&lt;br /&gt;
or,&lt;br /&gt;
 lv_obj_align(img_src, lv_scr_act(), LV_ALIGN_&amp;lt;parameter&amp;gt;, &amp;lt;x_pos, &amp;lt;y_pos&amp;gt;); &lt;br /&gt;
&lt;br /&gt;
If done correctly, you will now have a beautiful little Icon/Image in your Watch face,&lt;br /&gt;
Make sure that your Watch face can accommodate the Image by pushing the other labels farther away creating space for it...&lt;br /&gt;
&lt;br /&gt;
We have provided a small template you can use for adding even a large image comfortably&lt;br /&gt;
&lt;br /&gt;
If you have succeeded with this, you have completed part 3 of the tutorial.&lt;br /&gt;
&lt;br /&gt;
=Using git to work on the firmware=&lt;br /&gt;
===Cloning the repository===&lt;br /&gt;
===Changing the code to add the image===&lt;br /&gt;
===Compiling the firmware===&lt;br /&gt;
==Testing the firmware==&lt;br /&gt;
===Installing the new firmware===&lt;br /&gt;
&lt;br /&gt;
A holistic guide on how to install different firmware using various hardware programmers is available here: [[Reprogramming the PineTime]]. There's also the possibility of using OTA updating. ''//TODO: add that to the article!''&lt;br /&gt;
&lt;br /&gt;
===Activating the firmware===&lt;br /&gt;
===How to troubleshoot===&lt;br /&gt;
==Conclusions==&lt;br /&gt;
==Next steps==&lt;br /&gt;
==More in-depth documentation==&lt;br /&gt;
==Thanks for the help==&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Kieranc</name></author>
	</entry>
</feed>