Compare commits

...

7 Commits

29 changed files with 8516 additions and 3297 deletions

View File

@ -53,7 +53,7 @@
* @brief lcd display
*
*/
#define LCD_ROTATION 0
#define LCD_ROTATION (0)
#define LCD_CLOCK_CLOCK WM_IO_PB_06
#define LCD_DATA_LINE WM_IO_PB_07
#define LCD_CHIP_SELECT WM_IO_PB_10

View File

@ -10,6 +10,7 @@
#include "bma456w.h"
#include "CST816D.h"
#include "app_utils.h"
#include "watch_settings.h"
#define INTERRUPT_POLICY (0)
#define POLL_POLICY (1)
@ -374,6 +375,34 @@ void watch_peripherals_vibrate_with_pattern(uint8_t strength, const uint16_t pat
tls_timer_start(_vibration_motor_timer_id);
}
void watch_peripherals_vibrate_on_item_click(void)
{
if(!persistency_get_settings()->display.display_vibrate_on_touch_duration)
return;
uint16_t vibration_strength = (persistency_get_settings()->display.display_vibrate_on_touch_strength + 1)*32;
uint32_t vibration_duration_ms = 0;
if(persistency_get_settings()->display.display_vibrate_on_touch_duration)
vibration_duration_ms = persistency_get_settings()->display.display_vibrate_on_touch_duration*50 + 50;
watch_peripherals_vibrate(vibration_strength > 255 ? 255 : vibration_strength, vibration_duration_ms);
}
void watch_peripherals_vibrate_on_message_notifications(void)
{
if(!persistency_get_settings()->notification.notification_vibration_duration)
return;
uint16_t vibration_strength = (persistency_get_settings()->notification.notification_vibration_strength + 1) * 32;
uint32_t vibration_duration_ms = 0;
if(persistency_get_settings()->notification.notification_vibration_duration)
vibration_duration_ms = persistency_get_settings()->notification.notification_vibration_duration * 50 + 50;
uint16_t vibration_pattern[VIBRATION_PATTERN_SLOTS] = {vibration_duration_ms, vibration_duration_ms, vibration_duration_ms};
watch_peripherals_vibrate_with_pattern(vibration_strength > 255 ? 255 : vibration_strength, vibration_pattern);
}
void watch_peripherals_set_brightness(uint8_t brightness)
{
extern LCDConfig_t LCDConfig;
@ -749,7 +778,8 @@ void watch_peripherals_watch_sleep(void)
// First, we disable the display backlight and we set all the peripherals in their low power mode
lcd_set_backlight(&LCDConfig, 0);
lcd_sleep(&LCDConfig, true);
watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Standby);
// Set a restore function to apply the correct power mode when we leave sleep
//watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Standby);
if(CST816D_sleep())
APP_LOG_DEBUG("CST816D Sleep cmd ok");
else

View File

@ -95,6 +95,27 @@ void watch_peripherals_vibrate(uint8_t strength, uint32_t durationMs);
*/
void watch_peripherals_vibrate_with_pattern(uint8_t strength, const uint16_t pattern[VIBRATION_PATTERN_SLOTS]);
/**
* @brief Helper function which vibrates the watch to indicate that an item was clicked using
* the current watch settings.
*
*/
void watch_peripherals_vibrate_on_item_click(void);
/**
* @brief Helper function which vibrates the watch to indicate the reception of a message notification using
* the current watch settings.
*
*/
void watch_peripherals_vibrate_on_message_notifications(void);
/**
* @brief Helper function which vibrates the watch to notify the user that a call is incoming using
* the current watch settings.
*
*/
void watch_peripherals_vibrate_on_call_notifications(void);
/**
* @brief Sets the brightness of the LCD display
*

View File

@ -80,6 +80,46 @@ bool watch_power_management_check_current_power_state_is(watch_power_state_e pow
return power_state == _watch_power_management.current_power_state;
}
void watch_power_management_overwrite_default_cpu_clocks(enum CPU_CLK idle, enum CPU_CLK full_speed)
{
if(CPU_CLK_NO_CHANGE != idle) _watch_power_management.cpu_clock_idle = idle;
if(CPU_CLK_NO_CHANGE != full_speed) _watch_power_management.cpu_clock_full_speed = full_speed;
// Let's apply the restored clock
switch (_watch_power_management.current_power_state)
{
case WATCH_POWER_STATE_IDLE:
_set_cpu_clock(_watch_power_management.cpu_clock_idle);
break;
case WATCH_POWER_STATE_FULL_SPEED:
_set_cpu_clock(_watch_power_management.cpu_clock_full_speed);
break;
default:
// Nothing to do
break;
}
}
void watch_power_management_restore_default_cpu_clocks(bool idle, bool full_speed)
{
if(idle) _watch_power_management.cpu_clock_idle = CPU_CLK_80M;
if(full_speed) _watch_power_management.cpu_clock_full_speed = CPU_CLK_160M;
// Let's apply the restored clock
switch (_watch_power_management.current_power_state)
{
case WATCH_POWER_STATE_IDLE:
_set_cpu_clock(_watch_power_management.cpu_clock_idle);
break;
case WATCH_POWER_STATE_FULL_SPEED:
_set_cpu_clock(_watch_power_management.cpu_clock_full_speed);
break;
default:
// Nothing to do
break;
}
}
static void _set_cpu_clock(enum CPU_CLK cpu_clock)
{
// First let's get the current clock speed

View File

@ -15,6 +15,8 @@
#include "wm_type_def.h"
#include "wm_cpu.h"
#define CPU_CLK_NO_CHANGE (0)
typedef enum watch_power_state
{
/**
@ -56,4 +58,8 @@ watch_power_state_e watch_power_management_get_current_power_state(void);
bool watch_power_management_check_current_power_state_is(watch_power_state_e power_state);
void watch_power_management_overwrite_default_cpu_clocks(enum CPU_CLK idle, enum CPU_CLK full_speed);
void watch_power_management_restore_default_cpu_clocks(bool idle, bool full_speed);
#endif //WATCH_POWER_MANAGEMENT_H

View File

@ -1,8 +1,35 @@
#ifndef FIRMWARE_VERSION_H
#define FIRMWARE_VERSION_H
//#define FIRMWARE_VERSION "0.0.1" //Firmware creation
#define FIRMWARE_VERSION "0.0.2" //Updated the music player to be more accurate, Selected category in menu setting is now highlighted
#define FIRMWARE_TIME_DATE (__TIME__" "__DATE__)
/**
* @brief Firmware creation
*
*/
//#define FIRMWARE_VERSION "0.0.1"
/**
* @brief Updated the music player to be more accurate,
* selected category in menu setting is now highlighted
*
*/
//#define FIRMWARE_VERSION "0.0.2"
/**
* @brief Added message notification support,
* corrected the year of the date overflowing,
* remap of the accelerometer wrist tilt when changing screen orientation
*
*/
//#define FIRMWARE_VERSION "0.0.3"
/**
* @brief Fonts now support accents (used for the French and German GUI text translations)
*
*/
#define FIRMWARE_VERSION "0.0.4"
#define FIRMWARE_COMPILATION_TIME_DATE (__TIME__" "__DATE__)
#endif //FIRMWARE_VERSION_H

View File

@ -1,6 +1,5 @@
#include "lvgl.h"
#include "watch_peripherals.h"
#include "watch_settings.h"
#include "app_log.h"
@ -60,13 +59,3 @@ void common_screen_header_update_title(const char * title)
if(!*header_title_p)return;
lv_label_set_text_static(*header_title_p, title);
}
void common_screen_onclick_vibration(void)
{
uint16_t vibration_strength = (persistency_get_settings()->display.display_vibrate_on_touch_strength + 1)*32;
uint32_t vibration_duration_ms = 0;
if(persistency_get_settings()->display.display_vibrate_on_touch_duration)
vibration_duration_ms = persistency_get_settings()->display.display_vibrate_on_touch_duration*50 + 50;
watch_peripherals_vibrate(vibration_strength > 255 ? 255 : vibration_strength, vibration_duration_ms);
}

View File

@ -19,10 +19,4 @@ void common_screen_header_component(lv_obj_t *parent, const char * title, lv_coo
*/
void common_screen_header_update_title(const char * title);
/**
* @brief Vibrate to give a feedback to the user when an item was clicked
*
*/
void common_screen_onclick_vibration(void);
#endif //COMMON_SCREEN_COMPONENTS_H

View File

@ -162,6 +162,7 @@ static void setDisplayVibrationDurationCb(uint8_t *duration, SettingMode_e mode)
else
{
watch_settings_display_set_vibrate_on_touch_duration(*duration);
watch_peripherals_vibrate_on_item_click();
}
}
@ -174,6 +175,7 @@ static void setDisplayVibrationStrengthCb(uint8_t *strength, SettingMode_e mode)
else
{
watch_settings_display_set_vibrate_on_touch_strength(*strength);
watch_peripherals_vibrate_on_item_click();
}
}
@ -198,6 +200,7 @@ static void setNotificationVibrationDurationCb(uint8_t *duration, SettingMode_e
else
{
watch_settings_notification_set_notification_vibration_duration(*duration);
watch_peripherals_vibrate_on_message_notifications();
}
}
@ -210,6 +213,7 @@ static void setNotificationVibrationStrengthCb(uint8_t *strength, SettingMode_e
else
{
watch_settings_notification_set_notification_vibration_strength(*strength);
watch_peripherals_vibrate_on_message_notifications();
}
}
@ -507,13 +511,15 @@ static void parser_event_cb(gadget_bridge_event_data_t *gadget_bridge_event_data
static void ble_service_nus_data_rx_cb(const uint8_t *data, uint16_t length)
{
/*for (uint16_t i = 0; i < length; i++)
#if HARDWARE_PLATFORM != SMART_WATCH_PCB_RELEASE
for (uint16_t i = 0; i < length; i++)
{
if (data[i] < 32)
printf("[%u]", data[i]);
if (data[i] < 32 || data[i] > 126)
printf("[%u]", data[i]);
else
printf("%c", data[i]);
}*/
printf("%c", data[i]);
}
#endif
gadget_bridge_parser_feed((const char *)data, length);
while(gadget_bridge_parser_run() == GADGET_BRIDGE_PARSER_CODE_PARSING);
@ -644,20 +650,14 @@ static void notification_on_state_change_cb(NotificationState_e notificationStat
switch (notificationState)
{
case NOTIFICATION_STATE_DISPLAYED:
// Let's change the MCU clocks to its max speed, this is done to get the best responsiveness when having large texts
watch_power_management_overwrite_default_cpu_clocks(CPU_CLK_240M, CPU_CLK_240M);
// Let's give a user feedback by vibrating the watch if it is configured to do so
if(persistency_get_settings()->notification.notification_vibration_duration)
{
uint16_t vibration_strength = (persistency_get_settings()->notification.notification_vibration_strength + 1)*32;
uint32_t vibration_duration_ms = 0;
if(persistency_get_settings()->notification.notification_vibration_duration)
vibration_duration_ms = persistency_get_settings()->notification.notification_vibration_duration*50 + 50;
uint16_t vibration_pattern[VIBRATION_PATTERN_SLOTS] = {vibration_duration_ms, vibration_duration_ms, vibration_duration_ms};
watch_peripherals_vibrate_with_pattern(vibration_strength > 255 ? 255 : vibration_strength, vibration_pattern);
}
watch_peripherals_vibrate_on_message_notifications();
break;
case NOTIFICATION_STATE_CLEARED:
// Let's restore MCU clocks to it's default
watch_power_management_restore_default_cpu_clocks(true, true);
default:
break;
}
@ -724,6 +724,8 @@ void gfx_task(void *param)
/* Initialize lvgl screens */
watch_face_init(&watchFace);
menu_screen_init(&menuScreen);
menu_screen_register_on_menu_item_click_cb(&menuScreen, &(watch_peripherals_vibrate_on_item_click));
compass_screen_init(&compassScreen);
compass_screen_register_on_state_change_cb(&compassScreen, &(compass_screen_on_state_change_cb));
compass_screen_register_azimuth_and_temperature_cb(&compassScreen, &(compass_screen_azimuth_and_temperature_cb));

View File

@ -12,13 +12,18 @@
static void menu_item_cb(lv_event_t *e)
{
uint32_t icon_id = (uint32_t)e->user_data;
LV_LOG_USER("Menu icon pressed : %u", icon_id);
lv_obj_t *item = lv_event_get_target(e);
uint32_t clicked_item_id = (uint32_t) lv_obj_get_user_data(item);
MenuScreen_t *menuScreen = (MenuScreen_t*) lv_event_get_user_data(e);
// Give some user feedback that an item was clicked
common_screen_onclick_vibration();
LV_LOG_USER("Menu item clicked : %u", clicked_item_id);
switch(icon_id)
// Give some user feedback that an item was clicked by calling the
// callback if one is registered
if(menuScreen->menuScreenOnMenuItemClickCb)
menuScreen->menuScreenOnMenuItemClickCb();
switch(clicked_item_id)
{
case 0:
{
@ -77,25 +82,38 @@ void menu_screen_init(MenuScreen_t * const menuScreen)
memset(menuScreen, 0, sizeof(MenuScreen_t));
}
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)
void menu_screen_register_on_menu_item_click_cb(MenuScreen_t * const menuScreen, MenuScreenOnMenuItemClickCb_t menuScreenOnMenuItemClickCb)
{
if(!menuScreen)
{
LV_LOG_ERROR("NULL pointer given !");
return;
}
menuScreen->menuScreenOnMenuItemClickCb = menuScreenOnMenuItemClickCb;
}
static void menu_screen_add_item(MenuScreen_t * const menuScreen, 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_img_create(scroll_item_container);
lv_obj_t *item_btn = lv_img_create(menuScreen->scrollItemContainer);
lv_obj_set_user_data(item_btn, (void *)(uint32_t)position);
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_img_set_src(item_btn, itemImg);
lv_obj_add_event_cb(item_btn, itemClickEventCb, LV_EVENT_CLICKED, (void *)(uint32_t)position);
lv_obj_add_event_cb(item_btn, itemClickEventCb, LV_EVENT_CLICKED, (void *)menuScreen);
//We add the click-able label with the title of the item
lv_obj_t *item_label = lv_label_create(scroll_item_container);
lv_obj_t *item_label = lv_label_create(menuScreen->scrollItemContainer);
lv_obj_set_user_data(item_label, (void *)(uint32_t)position);
lv_label_set_text_static(item_label, itemTitle);
lv_obj_set_style_text_font(item_label, &lv_font_montserrat_16, LV_PART_MAIN);
lv_obj_set_pos(item_label, 84+12, 15 + 52 * position);
lv_obj_set_style_text_color(item_label, lv_color_make(145, 145, 145), LV_PART_MAIN);
lv_obj_set_ext_click_area(item_label, 10);
lv_obj_add_flag(item_label, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(item_label, itemClickEventCb, LV_EVENT_CLICKED , (void *)(uint32_t)position);
lv_obj_add_event_cb(item_label, itemClickEventCb, LV_EVENT_CLICKED , (void *)menuScreen);
}
void menu_screen_create(MenuScreen_t * const menuScreen)
@ -147,17 +165,17 @@ void menu_screen_create(MenuScreen_t * const menuScreen)
lv_obj_set_style_border_width(menuScreen->scrollItemContainer, 0, LV_PART_MAIN);
lv_obj_set_style_pad_right(menuScreen->scrollItemContainer, 15, LV_PART_SCROLLBAR);
menu_screen_add_item(menuScreen->scrollItemContainer, 0, &watch_menu_clock_icon, translation_get_word(TRANSLATION_WATCH), &(menu_item_cb));
menu_screen_add_item(menuScreen->scrollItemContainer, 1, &watch_menu_alarm_icon, translation_get_word(TRANSLATION_ALARM), &(menu_item_cb));
menu_screen_add_item(menuScreen->scrollItemContainer, 2, &watch_menu_music_player_icon, translation_get_word(TRANSLATION_MUSIC), &(menu_item_cb));
menu_screen_add_item(menuScreen->scrollItemContainer, 3, &watch_menu_compass_icon, translation_get_word(TRANSLATION_COMPASS), &(menu_item_cb));
menu_screen_add_item(menuScreen->scrollItemContainer, 4, &watch_menu_lost_phone_icon, translation_get_word(TRANSLATION_FIND_MY_PHONE), &(menu_item_cb));
menu_screen_add_item(menuScreen, 0, &watch_menu_clock_icon, translation_get_word(TRANSLATION_WATCH), &(menu_item_cb));
menu_screen_add_item(menuScreen, 1, &watch_menu_alarm_icon, translation_get_word(TRANSLATION_ALARM), &(menu_item_cb));
menu_screen_add_item(menuScreen, 2, &watch_menu_music_player_icon, translation_get_word(TRANSLATION_MUSIC), &(menu_item_cb));
menu_screen_add_item(menuScreen, 3, &watch_menu_compass_icon, translation_get_word(TRANSLATION_COMPASS), &(menu_item_cb));
menu_screen_add_item(menuScreen, 4, &watch_menu_lost_phone_icon, translation_get_word(TRANSLATION_FIND_MY_PHONE), &(menu_item_cb));
/*
menu_screen_add_item(menuScreen->scrollItemContainer, 3, &watch_menu_messages_icon, "Text messages", &(menu_item_cb));
menu_screen_add_item(menuScreen->scrollItemContainer, 4, &watch_menu_mail_icon, "Mails", &(menu_item_cb));
menu_screen_add_item(menuScreen->scrollItemContainer, 5, &watch_menu_dialer_icon, "Phone", &(menu_item_cb));
menu_screen_add_item(menuScreen->scrollItemContainer, 6, &watch_menu_contacts_icon, "Contacts", &(menu_item_cb));*/
menu_screen_add_item(menuScreen->scrollItemContainer, 5, &watch_menu_settings_icon, translation_get_word(TRANSLATION_SETTINGS), &(menu_item_cb));
menu_screen_add_item(menuScreen, 3, &watch_menu_messages_icon, "Text messages", &(menu_item_cb));
menu_screen_add_item(menuScreen, 4, &watch_menu_mail_icon, "Mails", &(menu_item_cb));
menu_screen_add_item(menuScreen, 5, &watch_menu_dialer_icon, "Phone", &(menu_item_cb));
menu_screen_add_item(menuScreen, 6, &watch_menu_contacts_icon, "Contacts", &(menu_item_cb));*/
menu_screen_add_item(menuScreen, 5, &watch_menu_settings_icon, translation_get_word(TRANSLATION_SETTINGS), &(menu_item_cb));
//Lets restore the previous scrolling position
lv_obj_scroll_to_y(menuScreen->scrollItemContainer, menuScreen->lastScrollPosition, LV_ANIM_OFF);

View File

@ -3,19 +3,30 @@
#include "lvgl.h"
typedef void (*MenuScreenOnMenuItemClickCb_t)(void);
// Menu screen context object
typedef struct MenuScreen
{
//Can be erased attributes
// Can be erased attributes
lv_obj_t *display;
lv_obj_t *scrollItemContainer;
//Should not be erased attributes
// Should not be erased attributes
lv_coord_t lastScrollPosition;
MenuScreenOnMenuItemClickCb_t menuScreenOnMenuItemClickCb;
} MenuScreen_t;
/* Initializes the menu screen context object */
void menu_screen_init(MenuScreen_t * const menuScreen);
/**
* @brief
*
* @param menuScreen
* @param menuScreenOnMenuItemClickCb
*/
void menu_screen_register_on_menu_item_click_cb(MenuScreen_t * const menuScreen, MenuScreenOnMenuItemClickCb_t menuScreenOnMenuItemClickCb);
/* Builds the menu screen graphically */
void menu_screen_create(MenuScreen_t * const menuScreen);

View File

@ -55,6 +55,8 @@ static void _settings_screen_update_labels_language(SettingsScreen_t * const set
{
// Update the header's title
common_screen_header_update_title(translation_get_word(TRANSLATION_SETTINGS));
// Language label
lv_label_set_text_static(settingsScreen->language_label, translation_get_word(TRANSLATION_LANGUAGE_2));
// All items in the menu list
update_menu_list_item_text(settingsScreen->time_and_date_item, translation_get_word(TRANSLATION_TIME_AND_DATE));
update_menu_list_item_text(settingsScreen->display_item, translation_get_word(TRANSLATION_DISPLAY));
@ -193,13 +195,11 @@ static void vibration_typed_roller_cb(lv_event_t *e)
if (!settingsScreen->settingsScreenAPIInterface.setDisplayVibrationDurationSettingsCb)
return;
settingsScreen->settingsScreenAPIInterface.setDisplayVibrationDurationSettingsCb(&index, SETTING_MODE_SET);
common_screen_onclick_vibration();
break;
case ROLLER_ID_TOUCH_VIBRATION_STRENGTH:
if(!settingsScreen->settingsScreenAPIInterface.setDisplayVibrationStrengthSettingsCb)
return;
settingsScreen->settingsScreenAPIInterface.setDisplayVibrationStrengthSettingsCb(&index, SETTING_MODE_SET);
common_screen_onclick_vibration();
break;
case ROLLER_ID_NOTIFICATION_VIBRATION_DURATION:
if (!settingsScreen->settingsScreenAPIInterface.setNotificationVibrationDurationSettingsCb)
@ -286,7 +286,7 @@ static void activation_switch_cb(lv_event_t *e)
static void language_dropdown_cb(lv_event_t *e)
{
SettingsScreen_t *settingsScreen = e->user_data;
SettingsScreen_t *settingsScreen = lv_event_get_user_data(e);
if(!settingsScreen->settingsScreenAPIInterface.setLanguageSettingsCb) return;
@ -531,6 +531,10 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
{
// Messages notification header text
lv_obj_t *label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Messages\nNotifications :");
// Notification enable switch
lv_obj_t *notification_enable_switch = lv_switch_create(settingsScreen->side_screen);
lv_obj_set_user_data(notification_enable_switch, (void *)SWITCH_ID_NOTIFICATION_ENABLE);
@ -538,14 +542,15 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
if(settingsScreen->settingsScreenAPIInterface.setNotificationEnabledSettingsCb)
settingsScreen->settingsScreenAPIInterface.setNotificationEnabledSettingsCb(&toggled, SETTING_MODE_GET);
if(toggled)lv_obj_add_state(notification_enable_switch, LV_STATE_CHECKED);
lv_obj_align_to(notification_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
lv_obj_add_event_cb(notification_enable_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
lv_obj_t * label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Notifications");
label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Enabled");
lv_obj_align_to(label, notification_enable_switch, LV_ALIGN_OUT_RIGHT_MID, 10, 0);
label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Vibrate on\nnotifications :");
lv_label_set_text_static(label, "Vibrate On\nNotifications :");
lv_obj_align_to(label, notification_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
lv_obj_t *on_notification_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
@ -579,6 +584,11 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
lv_label_set_text_static(label, "Strength");
lv_obj_align_to(label, on_notification_vibration_strength_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
//Calls notification header text
label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Calls\nNotifications :");
lv_obj_align_to(label, on_notification_vibration_strength_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
// Call enable switch
lv_obj_t *call_enable_switch = lv_switch_create(settingsScreen->side_screen);
lv_obj_set_user_data(call_enable_switch, (void *)SWITCH_ID_CALL_ENABLED);
@ -586,15 +596,15 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
if(settingsScreen->settingsScreenAPIInterface.setCallEnabledSettingsCb)
settingsScreen->settingsScreenAPIInterface.setCallEnabledSettingsCb(&toggled, SETTING_MODE_GET);
if(toggled)lv_obj_add_state(call_enable_switch, LV_STATE_CHECKED);
lv_obj_align_to(call_enable_switch, on_notification_vibration_strength_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
lv_obj_align_to(call_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
lv_obj_add_event_cb(call_enable_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Calls");
lv_label_set_text_static(label, "Enabled");
lv_obj_align_to(label, call_enable_switch, LV_ALIGN_OUT_RIGHT_MID, 10, 0);
label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Vibrate on calls :");
lv_label_set_text_static(label, "Vibrate On Calls :");
lv_obj_align_to(label, call_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
lv_obj_t *on_call_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
@ -706,11 +716,11 @@ static void load_connectivity_side_screen(SettingsScreen_t *settingsScreen)
static void load_language_side_screen(SettingsScreen_t *settingsScreen)
{
lv_obj_t *label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Language :");
settingsScreen->language_label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(settingsScreen->language_label, translation_get_word(TRANSLATION_LANGUAGE_2));
lv_obj_t *language_dropdown = lv_dropdown_create(settingsScreen->side_screen);
lv_obj_align_to(language_dropdown, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
lv_obj_align_to(language_dropdown, settingsScreen->language_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
lv_dropdown_set_options_static(language_dropdown, language_options);
uint8_t language = 0;
if(settingsScreen->settingsScreenAPIInterface.setLanguageSettingsCb)settingsScreen->settingsScreenAPIInterface.setLanguageSettingsCb(&language, SETTING_MODE_GET);
@ -737,7 +747,7 @@ static void load_about_side_screen(SettingsScreen_t *settingsScreen)
lv_obj_align_to(compile_label, firmware_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
lv_obj_t* compile_date_label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(compile_date_label, FIRMWARE_TIME_DATE);
lv_label_set_text_static(compile_date_label, FIRMWARE_COMPILATION_TIME_DATE);
lv_obj_set_style_text_color(compile_date_label, lv_color_make(130, 130, 130), LV_PART_MAIN);
lv_obj_align_to(compile_date_label, compile_label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 5);
@ -940,6 +950,7 @@ void settings_screen_destroy(SettingsScreen_t * const settingsScreen)
settingsScreen->display = NULL;
settingsScreen->about_refresh_timer = NULL;
settingsScreen->last_selected_item = NULL;
settingsScreen->language_label = NULL;
}
static void _simulate_side_screen_item_click(SettingsScreen_t * const settingsScreen, lv_obj_t *item)

View File

@ -88,6 +88,7 @@ typedef struct SettingsScreen
lv_obj_t *ble_dev_name_label;
lv_obj_t *ble_dev_name_value;
lv_obj_t *ble_dev_mac_label;
lv_obj_t *language_label;
struct
{

View File

@ -374,7 +374,7 @@ void watch_face_create(WatchFace_t * const watchFace)
}
watchFace->dateWindow.dateWindowWidget = lv_label_create(watchFace->display);
lv_label_set_text_static(watchFace->dateWindow.dateWindowWidget, watchFace->dateWindow.dateWindowText);
lv_obj_set_pos(watchFace->dateWindow.dateWindowWidget, 180,112);
lv_obj_set_pos(watchFace->dateWindow.dateWindowWidget, 180,111);
lv_obj_set_width(watchFace->dateWindow.dateWindowWidget, 20);
lv_obj_set_style_text_align(watchFace->dateWindow.dateWindowWidget, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);

View File

@ -15,7 +15,7 @@ static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] =
[TRANSLATION_ENGLISH]= "Watch"
},
[TRANSLATION_ALARM] = {
[TRANSLATION_FRENCH] = "Reveil",
[TRANSLATION_FRENCH] = "Réveil",
[TRANSLATION_GERMAN] = "Wecker",
[TRANSLATION_ENGLISH]= "Alarm"
},
@ -30,17 +30,17 @@ static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] =
[TRANSLATION_ENGLISH]= "Compass"
},
[TRANSLATION_FIND_MY_PHONE] = {
[TRANSLATION_FRENCH] = "Trouver mon tel",
[TRANSLATION_FRENCH] = "Trouver mon tél",
[TRANSLATION_GERMAN] = "Handy finden",
[TRANSLATION_ENGLISH]= "Find my phone"
},
[TRANSLATION_ALTIMETER] = {
[TRANSLATION_FRENCH] = "Altimetre",
[TRANSLATION_FRENCH] = "Altimètre",
[TRANSLATION_GERMAN] = "Hohenmesser",
[TRANSLATION_ENGLISH]= "Altimeter"
},
[TRANSLATION_SETTINGS] = {
[TRANSLATION_FRENCH] = "Parametres",
[TRANSLATION_FRENCH] = "Paramètres",
[TRANSLATION_GERMAN] = "Einstellungen",
[TRANSLATION_ENGLISH]= "Settings"
},
@ -60,8 +60,8 @@ static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] =
[TRANSLATION_ENGLISH]= "Notifications"
},
[TRANSLATION_CONNECTIVITY] = {
[TRANSLATION_FRENCH] = "Connectivite",
[TRANSLATION_GERMAN] = "Konnektivitat",
[TRANSLATION_FRENCH] = "Connectivité",
[TRANSLATION_GERMAN] = "Konnektivität",
[TRANSLATION_ENGLISH]= "Connectivity"
},
[TRANSLATION_LANGUAGE] = {
@ -69,13 +69,18 @@ static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] =
[TRANSLATION_GERMAN] = "Sprache",
[TRANSLATION_ENGLISH]= "Language"
},
[TRANSLATION_LANGUAGE_2] = {
[TRANSLATION_FRENCH] = "Langue :",
[TRANSLATION_GERMAN] = "Sprache :",
[TRANSLATION_ENGLISH]= "Language :"
},
[TRANSLATION_ABOUT] = {
[TRANSLATION_FRENCH] = "A Propos",
[TRANSLATION_FRENCH] = "À Propos",
[TRANSLATION_GERMAN] = "Apropos",
[TRANSLATION_ENGLISH]= "About"
},
[TRANSLATION_SET_TIME_AND_DATE] = {
[TRANSLATION_FRENCH] = "Reglage de la\nDate & de l'Heure :",
[TRANSLATION_FRENCH] = "Réglage de la\nDate & de l'Heure :",
[TRANSLATION_GERMAN] = "Zeit festlegen :",
[TRANSLATION_ENGLISH]= "Set Time & Date :",
},
@ -180,7 +185,7 @@ static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] =
[TRANSLATION_ENGLISH]= "",
},
[TRANSLATION_PHONE_NOT_CONNECTED] = {
[TRANSLATION_FRENCH] = "Mobile\nnon\ncon-\nnecte !",
[TRANSLATION_FRENCH] = "Mobile\nnon\ncon-\nnecté !",
[TRANSLATION_GERMAN] = "Keine\nVerbind-\nung zum\nHandy !",
[TRANSLATION_ENGLISH]= "Phone\nnot\ncon-\nnected !",
},
@ -190,12 +195,12 @@ static const char * const translation_dictionary[][TRANSLATED_LANGUAGES_COUNT] =
[TRANSLATION_ENGLISH]= "Find\nMy\nPhone !",
},
[TRANSLATION_FOUND_MY_PHONE_BTN] = {
[TRANSLATION_FRENCH] = "Je l'ai\nTrouver !",
[TRANSLATION_FRENCH] = "Je l'ai\nTrouvé !",
[TRANSLATION_GERMAN] = "Ich\nHabe Es\nGefu-\nnden !",
[TRANSLATION_ENGLISH]= "Found\nIt !",
},
[TRANSLATION_PHONE_NOT_CONNECTED_2] = {
[TRANSLATION_FRENCH] = "\t\t\t\t\t\tMobile non connecte !",
[TRANSLATION_FRENCH] = "\t\t\t\t\t\tMobile non connecté !",
[TRANSLATION_GERMAN] = "\t\t\t\t\t\tKeine Verbindung zum Handy !",
[TRANSLATION_ENGLISH] = "\t\t\t\t\t\tPhone not connected !",
},

View File

@ -27,6 +27,7 @@ typedef enum TranslationWord
TRANSLATION_NOTIFICATIONS,
TRANSLATION_CONNECTIVITY,
TRANSLATION_LANGUAGE,
TRANSLATION_LANGUAGE_2,
TRANSLATION_ABOUT,
TRANSLATION_SET_TIME_AND_DATE,
TRANSLATION_AUTOMATIC,

View File

@ -297,7 +297,7 @@ void _display_message_notification(NotificationScreen_t * const notificationScre
lv_label_set_long_mode(notificationScreen->type_label, LV_LABEL_LONG_SCROLL_CIRCULAR);
lv_obj_set_style_anim_speed(notificationScreen->type_label, 10, LV_PART_MAIN);
lv_obj_set_width(notificationScreen->type_label, lv_pct(27));
lv_label_set_text(notificationScreen->type_label, _notification_type_to_char(notification->type));
lv_label_set_text_static(notificationScreen->type_label, _notification_type_to_char(notification->type));
if(notificationScreen->title_label)
{
@ -396,7 +396,7 @@ const char *_notification_timestamp_to_date(time_t timestamp)
static char date[9]; //Ex 7:23PM
struct tm *time = gmtime(&timestamp);
sprintf(date, "%s%d:%s%d", time->tm_hour > 10 ? "" : "0", time->tm_hour, time->tm_min > 10 ? "" : "0", time->tm_min);
sprintf(date, "%s%d:%s%d", time->tm_hour < 10 ? "0" : "", time->tm_hour, time->tm_min < 10 ? "0" : "", time->tm_min);
return date;
}

View File

@ -317,20 +317,25 @@ static void load_display_side_screen(SettingsScreen_t *settingsScreen)
static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
{
// Messages notification header text
lv_obj_t *label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Messages\nNotifications :");
// Notification enable switch
lv_obj_t *notification_enable_switch = lv_switch_create(settingsScreen->side_screen);
bool toggled = false;
//if(settingsScreen->settingsScreenAPIInterface.setWristTiltSettingsCb)
//settingsScreen->settingsScreenAPIInterface.setWristTiltSettingsCb(&toggled, SETTING_MODE_GET);
if(toggled)lv_obj_add_state(notification_enable_switch, LV_STATE_CHECKED);
lv_obj_align_to(notification_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
//lv_obj_add_event_cb(notification_enable_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
lv_obj_t * label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Notifications");
label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Enabled");
lv_obj_align_to(label, notification_enable_switch, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Vibrate on\nnotifications :");
lv_label_set_text_static(label, "Vibrate On\nNotifications :");
lv_obj_align_to(label, notification_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
lv_obj_t *on_notification_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);
@ -353,21 +358,24 @@ static void load_notifications_side_screen(SettingsScreen_t *settingsScreen)
lv_label_set_text_static(label, "Strength");
lv_obj_align_to(label, on_notification_vibration_strength_roller, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Calls\nNotifications :");
lv_obj_align_to(label, on_notification_vibration_strength_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
// Call enable switch
lv_obj_t *call_enable_switch = lv_switch_create(settingsScreen->side_screen);
toggled = false;
//if(settingsScreen->settingsScreenAPIInterface.setWristTiltSettingsCb)
//settingsScreen->settingsScreenAPIInterface.setWristTiltSettingsCb(&toggled, SETTING_MODE_GET);
if(toggled)lv_obj_add_state(call_enable_switch, LV_STATE_CHECKED);
lv_obj_align_to(call_enable_switch, on_notification_vibration_strength_roller, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
lv_obj_align_to(call_enable_switch, label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
//lv_obj_add_event_cb(notification_enable_switch, &(activation_switch_cb), LV_EVENT_VALUE_CHANGED, settingsScreen);
label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Calls");
lv_label_set_text_static(label, "Enabled");
lv_obj_align_to(label, call_enable_switch, LV_ALIGN_OUT_RIGHT_MID, 5, 0);
label = lv_label_create(settingsScreen->side_screen);
lv_label_set_text_static(label, "Vibrate on calls :");
lv_label_set_text_static(label, "Vibrate On Calls :");
lv_obj_align_to(label, call_enable_switch, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 10);
lv_obj_t *on_call_vibration_duration_roller = lv_roller_create(settingsScreen->side_screen);

View File

@ -209,7 +209,8 @@ static void hide_hour_and_minutes_hand_cb(lv_event_t *e)
strcpy(title, "JoeJohny John");
char *body = malloc(300+1);
strcpy(body, "Hey what's up dude ? What are you doing tonight ?\
char test[] = "aéb";
strcpy(body, "Héy what's up dude ? What are you doing tonight ?\
Wanna go to the fair with me ?\
This is a quite long message I agree, but it is important\
to let you know what I do for me and you bro !");
@ -386,7 +387,7 @@ void watch_face_create(WatchFace_t * const watchFace)
}
watchFace->dateWindow.dateWindowWidget = lv_label_create(watchFace->display);
lv_label_set_text_static(watchFace->dateWindow.dateWindowWidget, watchFace->dateWindow.dateWindowText);
lv_obj_set_pos(watchFace->dateWindow.dateWindowWidget, 180,112);
lv_obj_set_pos(watchFace->dateWindow.dateWindowWidget, 180,111);
lv_obj_set_width(watchFace->dateWindow.dateWindowWidget, 20);
lv_obj_set_style_text_align(watchFace->dateWindow.dateWindowWidget, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);