void part2_ex9_real_arc_gauge(void)
{
/* ===== HARDWARE INITIALIZATION (Part II addition) ===== */
aic_sensors_init();
aic_tilt_init(NULL); /* Initialize Tilt Analysis with defaults */
/* ===== UI CODE FROM Ex2 (part2_ex2_arc_gauge) ===== */
/* Background */
lv_obj_set_style_bg_color(lv_screen_active(),
lv_color_hex(0x0f0f23), LV_PART_MAIN);
/* Title - Updated for Tilt */
lv_obj_t * title = lv_label_create(lv_screen_active());
lv_label_set_text(title, "Part 2 Ex9: Arc Gauge (Roll Angle)");
lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0);
lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 10);
/* Create Arc - same as Ex2 */
ex9_arc = lv_arc_create(lv_screen_active());
lv_obj_set_size(ex9_arc, 200, 200);
lv_arc_set_rotation(ex9_arc, 135);
lv_arc_set_bg_angles(ex9_arc, 0, 270);
lv_arc_set_range(ex9_arc, 0, 100);
lv_arc_set_value(ex9_arc, 50);
lv_obj_center(ex9_arc);
/* Style the arc - same as Ex2 */
lv_obj_set_style_arc_width(ex9_arc, 20, LV_PART_MAIN);
lv_obj_set_style_arc_width(ex9_arc, 20, LV_PART_INDICATOR);
lv_obj_set_style_arc_color(ex9_arc,
lv_palette_main(LV_PALETTE_CYAN),
LV_PART_INDICATOR);
/* Remove knob for read-only display */
lv_obj_remove_style(ex9_arc, NULL, LV_PART_KNOB);
lv_obj_remove_flag(ex9_arc, LV_OBJ_FLAG_CLICKABLE);
/* Value label in center - same as Ex2 */
ex9_value_label = lv_label_create(lv_screen_active());
lv_label_set_text(ex9_value_label, "50%");
lv_obj_set_style_text_color(ex9_value_label, lv_color_hex(0xFFFFFF), 0);
lv_obj_set_style_text_font(ex9_value_label, &lv_font_montserrat_24, 0);
lv_obj_center(ex9_value_label);
/* Roll angle label */
ex9_raw_label = lv_label_create(lv_screen_active());
lv_label_set_text(ex9_raw_label, "Roll: 0.0 deg");
lv_obj_set_style_text_color(ex9_raw_label, lv_color_hex(0x00FF00), 0);
lv_obj_align(ex9_raw_label, LV_ALIGN_CENTER, 0, 130);
/* Auto-update timer - uses Tilt Analysis */
ex9_timer = lv_timer_create(ex9_timer_cb, 100, NULL);
/* Description - Updated for Tilt */
lv_obj_t * desc = lv_label_create(lv_screen_active());
lv_label_set_text(desc, "[Part II] Complementary Filter (Accel + Gyro)\n"
"Tilt board left/right to change gauge");
lv_obj_set_style_text_color(desc, lv_color_hex(0xAAAAAA), 0);
lv_obj_set_style_text_align(desc, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_align(desc, LV_ALIGN_BOTTOM_MID, 0, -30);
/* Footer */
aic_create_footer(lv_screen_active());
printf("[Week4] Ex9: Arc Gauge (Roll Angle) with Complementary Filter\r\n");
}