@ -32,14 +32,6 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
motionController { motionController } {
settingsController . SetClockFace ( 3 ) ;
batteryIcon = lv_label_create ( lv_scr_act ( ) , nullptr ) ;
lv_label_set_text ( batteryIcon , Symbols : : batteryFull ) ;
lv_obj_align ( batteryIcon , lv_scr_act ( ) , LV_ALIGN_IN_BOTTOM_RIGHT , - 5 , 2 ) ;
batteryPlug = lv_label_create ( lv_scr_act ( ) , nullptr ) ;
lv_label_set_text ( batteryPlug , Symbols : : plug ) ;
lv_obj_align ( batteryPlug , batteryIcon , LV_ALIGN_OUT_LEFT_MID , - 5 , 0 ) ;
batteryValue = lv_label_create ( lv_scr_act ( ) , nullptr ) ;
lv_label_set_recolor ( batteryValue , true ) ;
lv_obj_align ( batteryValue , lv_scr_act ( ) , LV_ALIGN_IN_LEFT_MID , 0 , - 20 ) ;
@ -58,11 +50,11 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
label_prompt_1 = lv_label_create ( lv_scr_act ( ) , nullptr ) ;
lv_obj_align ( label_prompt_1 , lv_scr_act ( ) , LV_ALIGN_IN_LEFT_MID , 0 , - 80 ) ;
lv_label_set_text ( label_prompt_1 , " user@watch:~ $ now " ) ;
lv_label_set_text _static ( label_prompt_1 , " user@watch:~ $ now " ) ;
label_prompt_2 = lv_label_create ( lv_scr_act ( ) , nullptr ) ;
lv_obj_align ( label_prompt_2 , lv_scr_act ( ) , LV_ALIGN_IN_LEFT_MID , 0 , 60 ) ;
lv_label_set_text ( label_prompt_2 , " user@watch:~ $ " ) ;
lv_label_set_text _static ( label_prompt_2 , " user@watch:~ $ " ) ;
label_time = lv_label_create ( lv_scr_act ( ) , nullptr ) ;
lv_label_set_recolor ( label_time , true ) ;
@ -73,16 +65,14 @@ WatchFaceTerminal::WatchFaceTerminal(DisplayApp* app,
lv_label_set_long_mode ( backgroundLabel , LV_LABEL_LONG_CROP ) ;
lv_obj_set_size ( backgroundLabel , 240 , 240 ) ;
lv_obj_set_pos ( backgroundLabel , 0 , 0 ) ;
lv_label_set_text ( backgroundLabel , " " ) ;
lv_label_set_text _static ( backgroundLabel , " " ) ;
heartbeatValue = lv_label_create ( lv_scr_act ( ) , nullptr ) ;
lv_label_set_recolor ( heartbeatValue , true ) ;
lv_label_set_text ( heartbeatValue , " [L_HR]#ee3311 0 bpm# " ) ;
lv_obj_align ( heartbeatValue , lv_scr_act ( ) , LV_ALIGN_IN_LEFT_MID , 0 , 20 ) ;
stepValue = lv_label_create ( lv_scr_act ( ) , nullptr ) ;
lv_label_set_recolor ( stepValue , true ) ;
lv_label_set_text ( stepValue , " [STEP]#ee3377 0 steps# " ) ;
lv_obj_align ( stepValue , lv_scr_act ( ) , LV_ALIGN_IN_LEFT_MID , 0 , 0 ) ;
taskRefresh = lv_task_create ( RefreshTaskCallback , LV_DISP_DEF_REFR_PERIOD , LV_TASK_PRIO_MID , this ) ;
@ -96,20 +86,12 @@ WatchFaceTerminal::~WatchFaceTerminal() {
void WatchFaceTerminal : : Refresh ( ) {
powerPresent = batteryController . IsPowerPresent ( ) ;
if ( powerPresent . IsUpdated ( ) ) {
lv_label_set_text_static ( batteryPlug , BatteryIcon : : GetPlugIcon ( powerPresent . Get ( ) ) ) ;
}
batteryPercentRemaining = batteryController . PercentRemaining ( ) ;
if ( batteryPercentRemaining . IsUpdated ( ) ) {
auto batteryPercent = batteryPercentRemaining . Get ( ) ;
if ( batteryPercent = = 100 ) {
lv_obj_set_style_local_text_color ( batteryIcon , LV_LABEL_PART_MAIN , LV_STATE_DEFAULT , LV_COLOR_GREEN ) ;
} else {
lv_obj_set_style_local_text_color ( batteryIcon , LV_LABEL_PART_MAIN , LV_STATE_DEFAULT , LV_COLOR_WHITE ) ;
if ( batteryPercentRemaining . IsUpdated ( ) | | powerPresent . IsUpdated ( ) ) {
lv_label_set_text_fmt ( batteryValue , " [BATT]#387b54 %d%% " , batteryPercentRemaining . Get ( ) ) ;
if ( batteryController . IsPowerPresent ( ) ) {
lv_label_ins_text ( batteryValue , LV_LABEL_POS_LAST , " Charging " ) ;
}
lv_label_set_text ( batteryIcon , BatteryIcon : : GetBatteryIcon ( batteryPercent ) ) ;
lv_label_set_text_fmt ( batteryValue , " [BATT]#387b54 %d% \ %# " , batteryPercent ) ;
}
bleState = bleController . IsConnected ( ) ;