Skip to content

Commit

Permalink
add multiple watchfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
fbiego committed Mar 31, 2024
1 parent d9d818f commit 2dbc15f
Show file tree
Hide file tree
Showing 158 changed files with 55,194 additions and 981 deletions.
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,31 @@ A demo Watch project for ESP32 C3 mini 240*240 touch display development board

## Video

[`Watch Demo video on YouTube`](https://youtu.be/u96OkjxC0Ro)
[`Demo video`](https://youtu.be/u96OkjxC0Ro)
[`Watchfaces demo`](https://youtu.be/lvRsTp9v6_k)

## Screenshot

![screens](c3-screens.png?raw=true "screens")

## Screens
- Time (Time, Date, Day, Weather[Icon, Temp])
- Time (Time, Date, Day, Weather[Icon, Temp]) + Custom Watchfaces
- Weather (City,Icon, Temp, Update time) (1 week forecast [Day, Icon, Temp])
- Notifications (Icon, Time, Text) (List [Icon, Text] - 10 notifications)
- Settings (Brightness, Timeout, Battery, About)
- Control (Music Control, Find Phone, Bluetooth State)

#### Watchfaces

| | | |
| -- | -- | -- |
| !["Analog"](src/faces/75_2_dial/watchface.png?raw=true "75_2_dial") | !["Shadow"](src/faces/34_2_dial/watchface.png?raw=true "34_2_dial") | !["Blue"](src/faces/79_2_dial/watchface.png?raw=true "79_2_dial") |
| !["Radar"](src/faces/radar/watchface.png?raw=true "radar") | !["Outline"](src/faces/116_2_dial/watchface.png?raw=true "116_2_dial") | !["Red"](src/faces/756_2_dial/watchface.png?raw=true "756_2_dial") |
| !["Tix"](src/faces/tix_resized/watchface.png?raw=true "tix_resized") | !["Pixel"](src/faces/pixel_resized/watchface.png?raw=true "pixel_resized") | !["Smart"](src/faces/smart_resized/watchface.png?raw=true "smart_resized") |

Check out [`esp32-lvgl-watchface`](https://github.com/fbiego/esp32-lvgl-watchface) project to see how watchfaces are converted from binary to LVGL code. You can add more watchfaces but you will be limited by the ESP32 flash size.
In that case you can only compile your favorite watchfaces. Links to the pre-built binary watchfaces are included.

## Chronos App
Click to download
[<img src="chronos.png?raw=true" width=100 align=left>](https://fbiego.com/chronos/app?id=c3-mini)
Expand All @@ -33,12 +45,6 @@ Click to download

| Button 1 | Button 2 | Color Selector | Result action |
| --- | --- | --- | --- |
| Style 1 | Top | Choose color | Change hour color |
| Style 1 | Center | Choose color | Change minute color |
| Style 1 | Bottom | Choose color | Change other text color |
| Style 2 | Top | -- | Set `Forest` background |
| Style 2 | Center | -- | Set `Lake` background |
| Style 2 | Bottom | -- | Set `Mountain` background |
| Style 3 | Top | -- | Set `Stars` background |
| Style 3 | Center | -- | Set `Night` background |
| Style 3 | Bottom | -- | -- |
| Style 1 | Top | Choose color | Change hour color (default face) |
| Style 1 | Center | Choose color | Change minute color (default face) |
| Style 1 | Bottom | Choose color | Change other text color (default face) |
23 changes: 23 additions & 0 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*/

#ifdef ESPC3

// touch
#define I2C_SDA 4
Expand All @@ -48,3 +49,25 @@
#define RST -1

#define BL 3

#else

// touch
#define I2C_SDA 21
#define I2C_SCL 22
#define TP_INT 14
#define TP_RST 5

// display
#define SPI VSPI_HOST

#define SCLK 18
#define MOSI 23
#define MISO -1
#define DC 4
#define CS 15
#define RST 13

#define BL 2

#endif
2 changes: 1 addition & 1 deletion lib/lv_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#if LV_MEM_CUSTOM == 0
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
//#define LV_MEM_SIZE (192U*1024U) /*[bytes]*/
#define LV_MEM_SIZE (128U*1024U)
#define LV_MEM_SIZE (64U*1024U)

/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
#define LV_MEM_ADR 0 /*0: unused*/
Expand Down
6 changes: 6 additions & 0 deletions partitions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x3D8000,
spiffs, data, spiffs, 0x3E8000,0x8000,
coredump, data, coredump,0x3F0000,0x10000,
18 changes: 16 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,24 @@ platform = espressif32
platform_packages = toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
board = lolin_c3_mini
framework = arduino
board_build.partitions = huge_app.csv
board_build.partitions = partitions.csv
lib_deps =
lvgl/lvgl@^8.3.1
lovyan03/LovyanGFX@^0.4.18
fbiego/ChronosESP32@^1.0.4
fbiego/ChronosESP32@^1.3.0
fbiego/Timber@^1.0.0
build_flags = -I lib
-D ESPC3=1

[env:esp32doit-devkit-v1]
platform = espressif32
platform_packages = toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
board = esp32doit-devkit-v1
framework = arduino
board_build.partitions = partitions.csv
lib_deps =
lvgl/lvgl@^8.3.1
lovyan03/LovyanGFX@^0.4.18
fbiego/ChronosESP32@^1.3.0
fbiego/Timber@^1.0.0
build_flags = -I lib
225 changes: 225 additions & 0 deletions src/faces/116_2_dial/116_2_dial.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@

// File generated by bin2lvgl
// developed by fbiego.
// https://github.com/fbiego
// Watchface: 116_2_DIAL

#include "116_2_dial.h"

lv_obj_t *face_116_2_dial;
lv_obj_t *face_116_2_dial_0_384;
lv_obj_t *face_116_2_dial_1_59716;
lv_obj_t *face_116_2_dial_2_59716;
lv_obj_t *face_116_2_dial_3_62316;
lv_obj_t *face_116_2_dial_4_62316;
lv_obj_t *face_116_2_dial_5_114030;
lv_obj_t *face_116_2_dial_6_114030;
lv_obj_t *face_116_2_dial_8_58492;
lv_obj_t *face_116_2_dial_18_162424;


#if LV_COLOR_DEPTH != 16
#error "LV_COLOR_DEPTH should be 16bit for watchfaces"
#endif
#if LV_COLOR_16_SWAP != 1
#error "LV_COLOR_16_SWAP should be 1 for watchfaces"
#endif


const lv_img_dsc_t *face_116_2_dial_dial_img_1_59716_group[] = {
&face_116_2_dial_dial_img_1_59716_0,
&face_116_2_dial_dial_img_1_59716_1,
&face_116_2_dial_dial_img_1_59716_2,
&face_116_2_dial_dial_img_1_59716_3,
&face_116_2_dial_dial_img_1_59716_4,
&face_116_2_dial_dial_img_1_59716_5,
&face_116_2_dial_dial_img_1_59716_6,
&face_116_2_dial_dial_img_1_59716_7,
&face_116_2_dial_dial_img_1_59716_8,
&face_116_2_dial_dial_img_1_59716_9,
};
const lv_img_dsc_t *face_116_2_dial_dial_img_3_62316_group[] = {
&face_116_2_dial_dial_img_3_62316_0,
&face_116_2_dial_dial_img_3_62316_1,
&face_116_2_dial_dial_img_3_62316_2,
&face_116_2_dial_dial_img_3_62316_3,
&face_116_2_dial_dial_img_3_62316_4,
&face_116_2_dial_dial_img_3_62316_5,
&face_116_2_dial_dial_img_3_62316_6,
&face_116_2_dial_dial_img_3_62316_7,
&face_116_2_dial_dial_img_3_62316_8,
&face_116_2_dial_dial_img_3_62316_9,
};
const lv_img_dsc_t *face_116_2_dial_dial_img_5_114030_group[] = {
&face_116_2_dial_dial_img_5_114030_0,
&face_116_2_dial_dial_img_5_114030_1,
&face_116_2_dial_dial_img_5_114030_2,
&face_116_2_dial_dial_img_5_114030_3,
&face_116_2_dial_dial_img_5_114030_4,
&face_116_2_dial_dial_img_5_114030_5,
&face_116_2_dial_dial_img_5_114030_6,
&face_116_2_dial_dial_img_5_114030_7,
&face_116_2_dial_dial_img_5_114030_8,
&face_116_2_dial_dial_img_5_114030_9,
};
const lv_img_dsc_t *face_116_2_dial_dial_img_weather[] = {
&face_116_2_dial_dial_img_8_58492_0,
&face_116_2_dial_dial_img_9_157828_0,
&face_116_2_dial_dial_img_10_156106_0,
&face_116_2_dial_dial_img_11_153152_0,
&face_116_2_dial_dial_img_12_151838_0,
&face_116_2_dial_dial_img_13_154678_0,
&face_116_2_dial_dial_img_14_165314_0,
&face_116_2_dial_dial_img_15_60830_0,
&face_116_2_dial_dial_img_16_150496_0,
};
const lv_img_dsc_t *face_116_2_dial_dial_img_17_159548_group[] = {
&face_116_2_dial_dial_img_17_159548_0,
&face_116_2_dial_dial_img_17_159548_1,
&face_116_2_dial_dial_img_17_159548_2,
&face_116_2_dial_dial_img_17_159548_3,
&face_116_2_dial_dial_img_17_159548_4,
&face_116_2_dial_dial_img_17_159548_5,
&face_116_2_dial_dial_img_17_159548_6,
};
const lv_img_dsc_t *face_116_2_dial_dial_img_18_162424_group[] = {
&face_116_2_dial_dial_img_18_162424_0,
&face_116_2_dial_dial_img_18_162424_1,
&face_116_2_dial_dial_img_18_162424_2,
&face_116_2_dial_dial_img_18_162424_3,
&face_116_2_dial_dial_img_18_162424_4,
&face_116_2_dial_dial_img_18_162424_5,
&face_116_2_dial_dial_img_18_162424_6,
};


void init_face_116_2_dial(void){
face_116_2_dial = lv_obj_create(NULL);
lv_obj_clear_flag(face_116_2_dial, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_style_bg_color(face_116_2_dial, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(face_116_2_dial, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_width(face_116_2_dial, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(face_116_2_dial, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(face_116_2_dial, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(face_116_2_dial, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(face_116_2_dial, 0, LV_PART_MAIN| LV_STATE_DEFAULT);

lv_obj_add_event_cb(face_116_2_dial, onFaceEvent, LV_EVENT_ALL, NULL);


face_116_2_dial_0_384 = lv_img_create(face_116_2_dial);
lv_img_set_src(face_116_2_dial_0_384, &face_116_2_dial_dial_img_0_384_0);
lv_obj_set_width(face_116_2_dial_0_384, LV_SIZE_CONTENT);
lv_obj_set_height(face_116_2_dial_0_384, LV_SIZE_CONTENT);
lv_obj_set_x(face_116_2_dial_0_384, 0);
lv_obj_set_y(face_116_2_dial_0_384, 0);
lv_obj_add_flag(face_116_2_dial_0_384, LV_OBJ_FLAG_ADV_HITTEST );
lv_obj_clear_flag(face_116_2_dial_0_384, LV_OBJ_FLAG_SCROLLABLE );

face_116_2_dial_1_59716 = lv_img_create(face_116_2_dial);
lv_img_set_src(face_116_2_dial_1_59716, &face_116_2_dial_dial_img_1_59716_0);
lv_obj_set_width(face_116_2_dial_1_59716, LV_SIZE_CONTENT);
lv_obj_set_height(face_116_2_dial_1_59716, LV_SIZE_CONTENT);
lv_obj_set_x(face_116_2_dial_1_59716, 59);
lv_obj_set_y(face_116_2_dial_1_59716, 54);
lv_obj_add_flag(face_116_2_dial_1_59716, LV_OBJ_FLAG_ADV_HITTEST );
lv_obj_clear_flag(face_116_2_dial_1_59716, LV_OBJ_FLAG_SCROLLABLE );

face_116_2_dial_2_59716 = lv_img_create(face_116_2_dial);
lv_img_set_src(face_116_2_dial_2_59716, &face_116_2_dial_dial_img_1_59716_0);
lv_obj_set_width(face_116_2_dial_2_59716, LV_SIZE_CONTENT);
lv_obj_set_height(face_116_2_dial_2_59716, LV_SIZE_CONTENT);
lv_obj_set_x(face_116_2_dial_2_59716, 49);
lv_obj_set_y(face_116_2_dial_2_59716, 54);
lv_obj_add_flag(face_116_2_dial_2_59716, LV_OBJ_FLAG_ADV_HITTEST );
lv_obj_clear_flag(face_116_2_dial_2_59716, LV_OBJ_FLAG_SCROLLABLE );

face_116_2_dial_3_62316 = lv_img_create(face_116_2_dial);
lv_img_set_src(face_116_2_dial_3_62316, &face_116_2_dial_dial_img_3_62316_0);
lv_obj_set_width(face_116_2_dial_3_62316, LV_SIZE_CONTENT);
lv_obj_set_height(face_116_2_dial_3_62316, LV_SIZE_CONTENT);
lv_obj_set_x(face_116_2_dial_3_62316, 144);
lv_obj_set_y(face_116_2_dial_3_62316, 38);
lv_obj_add_flag(face_116_2_dial_3_62316, LV_OBJ_FLAG_ADV_HITTEST );
lv_obj_clear_flag(face_116_2_dial_3_62316, LV_OBJ_FLAG_SCROLLABLE );

face_116_2_dial_4_62316 = lv_img_create(face_116_2_dial);
lv_img_set_src(face_116_2_dial_4_62316, &face_116_2_dial_dial_img_3_62316_0);
lv_obj_set_width(face_116_2_dial_4_62316, LV_SIZE_CONTENT);
lv_obj_set_height(face_116_2_dial_4_62316, LV_SIZE_CONTENT);
lv_obj_set_x(face_116_2_dial_4_62316, 87);
lv_obj_set_y(face_116_2_dial_4_62316, 38);
lv_obj_add_flag(face_116_2_dial_4_62316, LV_OBJ_FLAG_ADV_HITTEST );
lv_obj_clear_flag(face_116_2_dial_4_62316, LV_OBJ_FLAG_SCROLLABLE );

face_116_2_dial_5_114030 = lv_img_create(face_116_2_dial);
lv_img_set_src(face_116_2_dial_5_114030, &face_116_2_dial_dial_img_5_114030_0);
lv_obj_set_width(face_116_2_dial_5_114030, LV_SIZE_CONTENT);
lv_obj_set_height(face_116_2_dial_5_114030, LV_SIZE_CONTENT);
lv_obj_set_x(face_116_2_dial_5_114030, 169);
lv_obj_set_y(face_116_2_dial_5_114030, 129);
lv_obj_add_flag(face_116_2_dial_5_114030, LV_OBJ_FLAG_ADV_HITTEST );
lv_obj_clear_flag(face_116_2_dial_5_114030, LV_OBJ_FLAG_SCROLLABLE );

face_116_2_dial_6_114030 = lv_img_create(face_116_2_dial);
lv_img_set_src(face_116_2_dial_6_114030, &face_116_2_dial_dial_img_5_114030_0);
lv_obj_set_width(face_116_2_dial_6_114030, LV_SIZE_CONTENT);
lv_obj_set_height(face_116_2_dial_6_114030, LV_SIZE_CONTENT);
lv_obj_set_x(face_116_2_dial_6_114030, 112);
lv_obj_set_y(face_116_2_dial_6_114030, 129);
lv_obj_add_flag(face_116_2_dial_6_114030, LV_OBJ_FLAG_ADV_HITTEST );
lv_obj_clear_flag(face_116_2_dial_6_114030, LV_OBJ_FLAG_SCROLLABLE );

face_116_2_dial_8_58492 = lv_img_create(face_116_2_dial);
lv_img_set_src(face_116_2_dial_8_58492, &face_116_2_dial_dial_img_8_58492_0);
lv_obj_set_width(face_116_2_dial_8_58492, LV_SIZE_CONTENT);
lv_obj_set_height(face_116_2_dial_8_58492, LV_SIZE_CONTENT);
lv_obj_set_x(face_116_2_dial_8_58492, 41);
lv_obj_set_y(face_116_2_dial_8_58492, 169);
lv_obj_add_flag(face_116_2_dial_8_58492, LV_OBJ_FLAG_ADV_HITTEST );
lv_obj_clear_flag(face_116_2_dial_8_58492, LV_OBJ_FLAG_SCROLLABLE );

face_116_2_dial_18_162424 = lv_img_create(face_116_2_dial);
lv_img_set_src(face_116_2_dial_18_162424, &face_116_2_dial_dial_img_18_162424_0);
lv_obj_set_width(face_116_2_dial_18_162424, LV_SIZE_CONTENT);
lv_obj_set_height(face_116_2_dial_18_162424, LV_SIZE_CONTENT);
lv_obj_set_x(face_116_2_dial_18_162424, 43);
lv_obj_set_y(face_116_2_dial_18_162424, 40);
lv_obj_add_flag(face_116_2_dial_18_162424, LV_OBJ_FLAG_ADV_HITTEST );
lv_obj_clear_flag(face_116_2_dial_18_162424, LV_OBJ_FLAG_SCROLLABLE );

}

void update_time_116_2_dial(int second, int minute, int hour, bool mode, bool am, int day, int month, int year, int weekday)
{
lv_img_set_src(face_116_2_dial_1_59716, face_116_2_dial_dial_img_1_59716_group[(day / 1) % 10]);
lv_img_set_src(face_116_2_dial_2_59716, face_116_2_dial_dial_img_1_59716_group[(day / 10) % 10]);
lv_img_set_src(face_116_2_dial_3_62316, face_116_2_dial_dial_img_3_62316_group[(hour / 1) % 10]);
lv_img_set_src(face_116_2_dial_4_62316, face_116_2_dial_dial_img_3_62316_group[(hour / 10) % 10]);
lv_img_set_src(face_116_2_dial_5_114030, face_116_2_dial_dial_img_5_114030_group[(minute / 1) % 10]);
lv_img_set_src(face_116_2_dial_6_114030, face_116_2_dial_dial_img_5_114030_group[(minute / 10) % 10]);
lv_img_set_src(face_116_2_dial_18_162424, face_116_2_dial_dial_img_18_162424_group[((weekday + 6) / 1) % 7]);

}

void update_weather_116_2_dial(int temp, int icon)
{
lv_img_set_src(face_116_2_dial_8_58492, face_116_2_dial_dial_img_weather[icon % 8]);

}

void update_status_116_2_dial(int battery, bool connection){

}

void update_activity_116_2_dial(int steps, int distance, int kcal)
{

}

void update_health_116_2_dial(int bpm, int oxygen)
{

}


Loading

0 comments on commit 2dbc15f

Please sign in to comment.