Renamed some file's header guards to be more consistent, clean some useless object in the UI, renamed a watch settings which name could be misleading
This commit is contained in:
parent
6e2a3e88fa
commit
66a3c87131
@ -1,5 +1,5 @@
|
||||
#ifndef APPCONFIG_H
|
||||
#define APPCONFIG_H
|
||||
#ifndef APP_CONFIG_H
|
||||
#define APP_CONFIG_H
|
||||
|
||||
#include "wm_gpio.h"
|
||||
|
||||
@ -79,4 +79,4 @@
|
||||
#define VIBRATION_MOTOR_ENABLE WM_IO_PB_00
|
||||
#define VIBRATION_MOTOR_PWM_CHANNEL (0)
|
||||
|
||||
#endif //APPCONFIG_H
|
||||
#endif //APP_CONFIG_H
|
@ -1,5 +1,5 @@
|
||||
#ifndef APPLOG_H
|
||||
#define APPLOG_G
|
||||
#ifndef APP_LOG_H
|
||||
#define APP_LOG_G
|
||||
|
||||
#include "app_common.h"
|
||||
#include "app_config.h"
|
||||
@ -34,4 +34,4 @@
|
||||
#define APP_LOG_DEBUG(message, ...) do{}while(0)
|
||||
#endif
|
||||
|
||||
#endif //APPLOG_H
|
||||
#endif //APP_LOG_H
|
||||
|
@ -7,6 +7,7 @@ void common_screen_header_component(lv_obj_t *parent, const char * title, lv_coo
|
||||
lv_obj_set_size(header, lv_disp_get_hor_res(NULL), height);
|
||||
lv_obj_set_style_radius(header, 0, LV_PART_MAIN);
|
||||
lv_obj_set_style_border_width(header, 0, LV_PART_MAIN);
|
||||
lv_obj_clear_flag(header, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t *header_title = lv_label_create(header);
|
||||
lv_label_set_text_static(header_title, title);
|
||||
|
@ -84,7 +84,7 @@ static void setTimeCb(uint8_t hour, uint8_t minute, uint8_t second, uint8_t day,
|
||||
|
||||
static void setTimeoutCb(uint8_t timeout)
|
||||
{
|
||||
persistency_get_settings()->display.sleep_timeout = timeout;
|
||||
persistency_get_settings()->display.sleep_delay = timeout;
|
||||
}
|
||||
|
||||
static void setOrientationCb(uint8_t orientation)
|
||||
@ -363,8 +363,8 @@ void gfx_task(void *param)
|
||||
}
|
||||
|
||||
/* Handle inactivity periods : */
|
||||
if( persistency_get_settings()->display.sleep_timeout != 0 &&
|
||||
lv_disp_get_inactive_time(NULL) > (persistency_get_settings()->display.sleep_timeout * 1000))
|
||||
if( persistency_get_settings()->display.sleep_delay != 0 &&
|
||||
lv_disp_get_inactive_time(NULL) > (persistency_get_settings()->display.sleep_delay * 1000))
|
||||
{
|
||||
// First, we disable the display backlight and we set all the peripherals in their low power mode
|
||||
setBrightness(0);
|
||||
|
@ -60,10 +60,11 @@ void menu_screen_init(MenuScreen_t * const menuScreen)
|
||||
static void menu_screen_add_item(lv_obj_t *scroll_item_container, uint8_t position, const lv_img_dsc_t *itemImg,const char *itemTitle, lv_event_cb_t itemClickEventCb)
|
||||
{
|
||||
//We add the image button with the icon of the item
|
||||
lv_obj_t *item_btn = lv_imgbtn_create(scroll_item_container);
|
||||
lv_obj_t *item_btn = lv_img_create(scroll_item_container);
|
||||
lv_obj_set_size(item_btn, itemImg->header.w, itemImg->header.h);
|
||||
lv_obj_add_flag(item_btn, LV_OBJ_FLAG_ADV_HITTEST | LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_pos(item_btn, 42, 52 * position);
|
||||
lv_imgbtn_set_src(item_btn, LV_IMGBTN_STATE_RELEASED, NULL, itemImg, NULL);
|
||||
lv_img_set_src(item_btn, itemImg);
|
||||
lv_obj_add_event_cb(item_btn, itemClickEventCb, LV_EVENT_CLICKED, (void *)(uint32_t)position);
|
||||
|
||||
//We add the click-able label with the title of the item
|
||||
@ -105,12 +106,12 @@ void menu_screen_create(MenuScreen_t * const menuScreen)
|
||||
menuScreen->display = lv_obj_create(NULL);
|
||||
|
||||
//We add the screen header
|
||||
common_screen_header_component(menuScreen->display, "Menu", 65);
|
||||
common_screen_header_component(menuScreen->display, "Menu", 50);
|
||||
|
||||
lv_obj_t *scroll_item_container = lv_obj_create(menuScreen->display);
|
||||
lv_obj_set_style_bg_color(scroll_item_container, lv_color_make(0xFF,0xFF,0xFF), LV_PART_MAIN);
|
||||
lv_obj_set_size(scroll_item_container, lv_pct(100), 240-65);
|
||||
lv_obj_set_pos(scroll_item_container, 0, 65);
|
||||
lv_obj_set_size(scroll_item_container, lv_pct(100), 240-50);
|
||||
lv_obj_set_pos(scroll_item_container, 0, 50);
|
||||
lv_obj_set_style_pad_all(scroll_item_container, 0, LV_PART_MAIN);
|
||||
lv_obj_set_style_pad_top(scroll_item_container, 10, LV_PART_MAIN);
|
||||
lv_obj_set_style_pad_bottom(scroll_item_container, 20, LV_PART_MAIN);
|
||||
|
@ -148,12 +148,12 @@ void watch_face_create(WatchFace_t * const watchFace)
|
||||
lv_obj_del(watchFace->display);
|
||||
watchFace->display = NULL;
|
||||
}
|
||||
watchFace->display = lv_obj_create(NULL);
|
||||
//Our display is the watch face image :
|
||||
watchFace->display = lv_img_create(NULL);
|
||||
lv_img_set_src(watchFace->display, &watch_casio_face_asset);
|
||||
lv_obj_set_style_bg_color(watchFace->display, lv_color_black(), LV_PART_MAIN);
|
||||
//We load our assets :
|
||||
lv_obj_t *watchFaceImg = lv_img_create(watchFace->display);
|
||||
lv_img_set_src(watchFaceImg, &watch_casio_face_asset);
|
||||
|
||||
//We load our other assets :
|
||||
lv_obj_t *smallHandImg = lv_img_create(watchFace->display);
|
||||
lv_img_set_src(smallHandImg, &watch_casio_small_hand_asset);
|
||||
lv_obj_set_pos(smallHandImg, 69, 98);
|
||||
@ -259,6 +259,9 @@ void watch_face_create(WatchFace_t * const watchFace)
|
||||
//We set the appropriate angles to each of the hands
|
||||
update_watch_hands_angles(watchFace, 0);
|
||||
|
||||
//Don't forget to make the background image clickable to be able to use gestures on it.
|
||||
lv_obj_add_flag(watchFace->display, LV_OBJ_FLAG_CLICKABLE);
|
||||
|
||||
//We register the event callback to handle gestures
|
||||
lv_obj_add_event_cb(watchFace->display, &(gesture_event_cb), LV_EVENT_GESTURE, watchFace);
|
||||
//We register the event callback to handle the cleanup
|
||||
@ -275,19 +278,6 @@ void watch_face_create(WatchFace_t * const watchFace)
|
||||
watchFace->handAnimationTimer = lv_timer_create(&(hand_timer_anim_cb), 199, watchFace);
|
||||
}
|
||||
|
||||
void watch_face_force_sync(WatchFace_t *const watchFace)
|
||||
{
|
||||
if(!watchFace)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!watchFace->display) return;
|
||||
|
||||
update_watch_hands_angles(watchFace, 0);
|
||||
}
|
||||
|
||||
void watch_face_set_battery_indicator(WatchFace_t * const watchFace, uint8_t percentage)
|
||||
{
|
||||
if(!watchFace)
|
||||
@ -333,3 +323,15 @@ void watch_face_destroy(WatchFace_t * const watchFace)
|
||||
watchFace->batteryIndicator.label = NULL;
|
||||
}
|
||||
|
||||
void watch_face_force_sync(WatchFace_t *const watchFace)
|
||||
{
|
||||
if(!watchFace)
|
||||
{
|
||||
LV_LOG_ERROR("NULL pointer given !");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!watchFace->display) return;
|
||||
|
||||
update_watch_hands_angles(watchFace, 0);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
static WatchSettings_t watchSettings =
|
||||
{
|
||||
.timeAndDate = {.hour_format = 0, .date_format = 0, .automatic_time_and_date = 0},
|
||||
.display = {.brightness = 255, .sleep_timeout = 0,},
|
||||
.display = {.brightness = 255, .sleep_delay = 0,},
|
||||
};
|
||||
|
||||
WatchSettings_t *persistency_get_settings(void)
|
||||
|
@ -15,7 +15,7 @@ typedef struct TimeAndDate
|
||||
typedef struct Display
|
||||
{
|
||||
uint8_t brightness;
|
||||
uint8_t sleep_timeout;
|
||||
uint8_t sleep_delay;
|
||||
uint8_t orientation:2;
|
||||
} Display_t;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user