Skip to content

Commit 653a437

Browse files
committed
Remove unused loading spinner overlay and helpers
Remove the loading spinner overlay and related helper code. Deleted spinner and spinner_overlay declarations, the showLoadingOverlay()/hideLoadingOverlay() functions, the spinner creation/styling in setupMainScreen, and the spinner styling update in lvgl_updates.cpp. Cleans up unused UI overlay code and simplifies main screen implementation.
1 parent 71daefa commit 653a437

3 files changed

Lines changed: 0 additions & 57 deletions

File tree

inc/sp140/lvgl/lvgl_main_screen.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ extern lv_obj_t* batt_temp_label;
4242
extern lv_obj_t* esc_temp_label;
4343
extern lv_obj_t* motor_temp_label;
4444
extern lv_obj_t* arm_indicator;
45-
extern lv_obj_t* spinner; // For the spinning animation
46-
extern lv_obj_t* spinner_overlay; // Overlay for the spinner
4745
extern lv_obj_t* batt_letter_label; // Letter label for Battery temp
4846
extern lv_obj_t* esc_letter_label; // Letter label for ESC temp
4947
extern lv_obj_t* motor_letter_label; // Letter label for Motor temp
@@ -63,10 +61,6 @@ extern lv_obj_t* climb_rate_fill_sections[12];
6361
// Critical border (used by flash animations)
6462
extern lv_obj_t* critical_border;
6563

66-
// Loading overlay functions
67-
void showLoadingOverlay();
68-
void hideLoadingOverlay();
69-
7064
// Helper functions
7165
void setAltitudeVisibility(bool visible);
7266
lv_obj_t* createTempBackground(lv_obj_t* parent, int x, int y, int width, int height);

src/sp140/lvgl/lvgl_main_screen.cpp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ lv_obj_t* batt_temp_label = NULL;
3030
lv_obj_t* esc_temp_label = NULL;
3131
lv_obj_t* motor_temp_label = NULL;
3232
lv_obj_t* arm_indicator = NULL;
33-
lv_obj_t* spinner = NULL; // For the spinning animation
34-
lv_obj_t* spinner_overlay = NULL; // Overlay for the spinner
3533
lv_obj_t* batt_letter_label = NULL; // Letter label for Battery temp
3634
lv_obj_t* esc_letter_label = NULL; // Letter label for ESC temp
3735
lv_obj_t* motor_letter_label = NULL; // Letter label for Motor temp
@@ -101,20 +99,6 @@ void init_temp_styles(bool darkMode) {
10199
lv_style_set_bg_opa(&style_critical, LV_OPA_100);
102100
}
103101

104-
// Function to show the loading overlay
105-
void showLoadingOverlay() {
106-
if (spinner_overlay != NULL) {
107-
lv_obj_remove_flag(spinner_overlay, LV_OBJ_FLAG_HIDDEN);
108-
}
109-
}
110-
111-
// Function to hide the loading overlay
112-
void hideLoadingOverlay() {
113-
if (spinner_overlay != NULL) {
114-
lv_obj_add_flag(spinner_overlay, LV_OBJ_FLAG_HIDDEN);
115-
}
116-
}
117-
118102
// Setup the main screen layout once
119103
void setupMainScreen(bool darkMode) {
120104
if (main_screen != NULL) {
@@ -540,35 +524,6 @@ void setupMainScreen(bool darkMode) {
540524
lv_obj_move_foreground(arm_fail_warning_icon_img); // Ensure icon is on top
541525
lv_obj_add_flag(arm_fail_warning_icon_img, LV_OBJ_FLAG_HIDDEN); // Hide initially
542526

543-
// Create semi-transparent overlay for the spinner
544-
spinner_overlay = lv_obj_create(main_screen);
545-
lv_obj_set_size(spinner_overlay, SCREEN_WIDTH, SCREEN_HEIGHT);
546-
lv_obj_set_pos(spinner_overlay, 0, 0);
547-
lv_obj_set_style_bg_color(spinner_overlay, darkMode ? LVGL_BLACK : LVGL_WHITE, LV_PART_MAIN);
548-
lv_obj_set_style_bg_opa(spinner_overlay, LV_OPA_70, LV_PART_MAIN); // 70% opacity
549-
lv_obj_set_style_border_width(spinner_overlay, 0, LV_PART_MAIN);
550-
551-
// Create spinning animation at the top center - now place on top of overlay
552-
spinner = lv_spinner_create(spinner_overlay);
553-
lv_spinner_set_anim_params(spinner, 1000, 60); // 1000ms period, 60 arc width
554-
lv_obj_set_size(spinner, 80, 80); // Even larger spinner for visibility
555-
lv_obj_align(spinner, LV_ALIGN_CENTER, 0, 0); // Position at center of screen
556-
557-
// Make the spinner more visible with strong colors and good contrast
558-
lv_obj_set_style_arc_width(spinner, 8, LV_PART_INDICATOR); // Thicker arc for indicator
559-
lv_obj_set_style_arc_width(spinner, 8, LV_PART_MAIN); // Thicker background arc
560-
561-
// Apply proper shading and gradients for a more attractive appearance
562-
lv_obj_set_style_arc_rounded(spinner, true, LV_PART_INDICATOR);
563-
lv_obj_set_style_arc_rounded(spinner, true, LV_PART_MAIN);
564-
565-
// Set spinner colors with better contrast
566-
lv_obj_set_style_arc_color(spinner, darkMode ? lv_color_make(100, 100, 100) : lv_color_make(230, 230, 230), LV_PART_MAIN);
567-
lv_obj_set_style_arc_color(spinner, lv_palette_main(LV_PALETTE_BLUE), LV_PART_INDICATOR);
568-
569-
// Hide the overlay by default
570-
lv_obj_add_flag(spinner_overlay, LV_OBJ_FLAG_HIDDEN);
571-
572527
// Create climb rate indicator horizontal divider lines in the far-right section
573528
const int climb_section_start_y = 37;
574529
const int climb_section_end_y = 128;

src/sp140/lvgl/lvgl_updates.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,6 @@ void updateLvglMainScreen(
359359
bool bmsConnected = (bmsTelemetry.bmsState == TelemetryState::CONNECTED);
360360
bool escConnected = (escTelemetry.escState == TelemetryState::CONNECTED);
361361

362-
// Check if spinner exists before styling it
363-
if (spinner != NULL) {
364-
lv_obj_set_style_arc_color(spinner, darkMode ? lv_color_make(100, 100, 100) : lv_color_make(230, 230, 230), LV_PART_MAIN);
365-
lv_obj_set_style_arc_color(spinner, lv_palette_main(LV_PALETTE_BLUE), LV_PART_INDICATOR);
366-
}
367-
368362
// Update battery bar and percentage
369363
if (bmsConnected && batteryPercent >= 0) {
370364
lv_bar_set_value(battery_bar, (int)batteryPercent, LV_ANIM_OFF);

0 commit comments

Comments
 (0)