Skip to content

Canvas Clockface

Jonathas Barbosa edited this page Jun 30, 2023 · 8 revisions

Clockface 0x07 is a special type of theme. Unlike the previous ones that are of a specific theme like Mario or Time in Words, this is a blank canvas that is capable of rendering different themes that are described in a JSON file, that's why it is called Canvas .

How does it work?

Clockface 0x07 adds two extra parameters to Clockwise's Settings page, the server address and the name of the file describing the theme:

  • [Canvas] Server Address: by default it will point to the Clock-Club repository where the themes are located, but this parameter can be used to point to your machine, so it is possible to develop your themes locally.
  • [Canvas] Description file: is the name of the JSON file without extension that describes how the theme will be, more details on how this file is created can be seen below. For example, if the file is called my-theme.json, just enter my-theme.

Once the parameters are filled in correctly, starting Clockwise with the "Canvas" clockface will download the JSON file and render it on the display automatically.

JSON Structure

{
    "name": "My Theme",   // String. Name of the theme
    "version": 1,         // Number. Version of the theme   
    "author": "@jnthas",  // String. Name, handle or email of the author
    "bgColor": 0,         // Number. Background color of the display. In decimal format.
    "delay": 300,         // Number. Delay in milliseconds 
    "setup": [],          // Obj.Array. The 'setup' array is executed once as the clockface starts up 
    "sprites": [],        // Obj.Array. The 'sprites' array contains the images to be rendered and updated in the clock
    "loop": []            // Obj.Array. The 'loop' array contain elements that will be rendered in every loop respecting the delay param
}

Open a Pull Request to Clock-Club and make it available to other users!

Next steps

A visual editor to generate the JSON will be a nice tool.

Common errors

Local server is not running:

[HTTP] GET request to '192.168.3.19/hello-world.json' on port 4443
[  4176][E][ssl_client.cpp:129] start_ssl_client(): socket error on fd 49, errno: 104, "Connection reset by peer"
[  4177][E][WiFiClientSecure.cpp:144] connect(): start_ssl_client: -1
Connection failed
deserializeJson() failed: EmptyInput
Clone this wiki locally