#include "ui.h" #include "../Drivers/lcd.h" // 引入外部菜单项定义 extern char *code menu_items[5]; void UI_ShowClockPage(SystemState state, u8 hour, u8 min) { char time_str[6]; LCD_Clear(COLOR_BLACK); // 左上角锁图标 if (state == STATE_ARMED) { LCD_DrawRectBorder(10, 23, 20, 15, COLOR_RED); LCD_FillRect(15, 15, 2, 8, COLOR_RED); LCD_FillRect(17, 15, 10, 2, COLOR_RED); LCD_FillRect(25, 15, 2, 8, COLOR_RED); } else { LCD_DrawRectBorder(10, 23, 20, 15, COLOR_GREEN); LCD_FillRect(15, 15, 2, 8, COLOR_GREEN); LCD_FillRect(17, 15, 8, 2, COLOR_GREEN); LCD_FillRect(25, 17, 2, 6, COLOR_GREEN); } // 右上角电量 LCD_ShowString(62, 24, "85%", COLOR_GRAY, COLOR_BLACK); LCD_DrawMonoBitmap(92, 27, 20, 10, bmp_battery_20x10, COLOR_GRAY, COLOR_BLACK); // 中间时间 time_str[0] = '0' + (hour / 10); time_str[1] = '0' + (hour % 10); time_str[2] = ':'; time_str[3] = '0' + (min / 10); time_str[4] = '0' + (min % 10); time_str[5] = '\0'; LCD_ShowString16x32Centered(100, time_str, COLOR_WHITE, COLOR_BLACK); // AM/PM LCD_ShowStringCentered(150, "AM", COLOR_WHITE, COLOR_BLACK); // 日期 (法语) LCD_ShowStringCentered(195, "VEN 10-07", COLOR_GRAY, COLOR_BLACK); } void UI_ShowPairMenuPage(u8 selected_index) { LCD_Clear(COLOR_BLACK); LCD_ShowStringCentered(30, "MENU APPAI.", COLOR_AMBER, COLOR_BLACK); if (selected_index > 0) { LCD_ShowStringCentered(78, menu_items[selected_index - 1], COLOR_GRAY, COLOR_BLACK); } LCD_DrawRectBorder(8, 110, 104, 28, COLOR_CYAN); LCD_ShowStringCentered(118, menu_items[selected_index], COLOR_CYAN, COLOR_BLACK); if (selected_index < 4) { LCD_ShowStringCentered(158, menu_items[selected_index + 1], COLOR_GRAY, COLOR_BLACK); } } void UI_ShowPairWaitPage(u8 frame_index) { LCD_Clear(COLOR_BLACK); LCD_ShowStringCentered(35, "APPAIRAGE", COLOR_GRAY, COLOR_BLACK); if (frame_index == 0) LCD_DrawMonoBitmap(44, 75, 32, 32, bmp_radar_32x32_f1, COLOR_CYAN, COLOR_BLACK); else if (frame_index == 1) LCD_DrawMonoBitmap(44, 75, 32, 32, bmp_radar_32x32_f2, COLOR_CYAN, COLOR_BLACK); else LCD_DrawMonoBitmap(44, 75, 32, 32, bmp_radar_32x32_f3, COLOR_CYAN, COLOR_BLACK); LCD_ShowStringCentered(165, "RECHERCHE", COLOR_WHITE, COLOR_BLACK); LCD_ShowStringCentered(200, "DECLENCH. CAPT", COLOR_CYAN, COLOR_BLACK); } void UI_ShowPairConfirmPage(u8 type, u8 zone_index) { char zone_str[3]; LCD_Clear(COLOR_BLACK); LCD_ShowStringCentered(32, "v RECU", COLOR_GREEN, COLOR_BLACK); if (type == 0) { LCD_DrawMonoBitmap(44, 55, 32, 32, bmp_door_32x32, COLOR_WHITE, COLOR_BLACK); } else if (type == 2 || type == 3) { LCD_DrawMonoBitmap(44, 55, 32, 32, bmp_siren_32x32, COLOR_WHITE, COLOR_BLACK); } else { LCD_DrawMonoBitmap(44, 55, 32, 32, bmp_confirm_lock_32x32, COLOR_WHITE, COLOR_BLACK); } LCD_ShowStringCentered(105, sensor_names_fr[type], COLOR_WHITE, COLOR_BLACK); LCD_DrawRectBorder(15, 140, 90, 44, COLOR_CYAN); zone_str[0] = '0' + (zone_index / 10); zone_str[1] = '0' + (zone_index % 10); zone_str[2] = '\0'; LCD_ShowString16x32(44, 146, zone_str, COLOR_CYAN, COLOR_BLACK); LCD_ShowStringCentered(215, "CONFIRMER", COLOR_GRAY, COLOR_BLACK); } void UI_ShowPairSuccessPage(void) { LCD_Clear(COLOR_BLACK); LCD_DrawMonoBitmap(44, 75, 32, 32, bmp_checkmark_32x32, COLOR_GREEN, COLOR_BLACK); LCD_ShowStringCentered(145, "SUCCES", COLOR_GREEN, COLOR_BLACK); LCD_ShowStringCentered(180, "ENREGISTRE", COLOR_GRAY, COLOR_BLACK); } void UI_ShowPairFailPage(u8 is_timeout) { LCD_Clear(COLOR_BLACK); LCD_DrawMonoBitmap(44, 75, 32, 32, bmp_cross_32x32, COLOR_RED, COLOR_BLACK); LCD_ShowStringCentered(145, "ECHEC", COLOR_RED, COLOR_BLACK); if (is_timeout) { LCD_ShowStringCentered(180, "DELAI DEPASSE", COLOR_GRAY, COLOR_BLACK); } else { LCD_ShowStringCentered(180, "TYPE INCORRECT", COLOR_GRAY, COLOR_BLACK); } } void UI_ShowAlarmPage(u8 type, u8 zone_index) { char zone_info[20]; LCD_Clear(COLOR_BLACK); LCD_DrawRectBorder(4, 4, 112, 232, COLOR_RED); LCD_DrawRectBorder(6, 6, 108, 228, COLOR_RED); if (type == 0) { LCD_DrawMonoBitmap(44, 50, 32, 32, bmp_door_32x32, COLOR_RED, COLOR_BLACK); } else if (type == 2 || type == 3) { LCD_DrawMonoBitmap(44, 50, 32, 32, bmp_siren_32x32, COLOR_RED, COLOR_BLACK); } else { LCD_DrawMonoBitmap(44, 50, 32, 32, bmp_confirm_lock_32x32, COLOR_RED, COLOR_BLACK); } { u8 len = 0; char *p = sensor_names_fr[type]; while(*p) { zone_info[len++] = *p++; } zone_info[len++] = ' '; zone_info[len++] = '0' + (zone_index / 10); zone_info[len++] = '0' + (zone_index % 10); zone_info[len] = '\0'; } LCD_ShowStringCentered(135, zone_info, COLOR_RED, COLOR_BLACK); LCD_ShowStringCentered(175, "INTRUSION!", COLOR_WHITE, COLOR_BLACK); } void UI_ShowSosPage(void) { LCD_Clear(COLOR_BLACK); LCD_DrawRectBorder(4, 4, 112, 232, COLOR_RED); LCD_DrawRectBorder(5, 5, 110, 230, COLOR_RED); LCD_DrawRectBorder(8, 8, 104, 224, COLOR_WHITE); // 警灯组合绘制 LCD_FillRect(44, 45, 32, 2, COLOR_RED); LCD_FillRect(48, 47, 24, 12, COLOR_RED); LCD_FillRect(40, 59, 40, 4, COLOR_GRAY); LCD_FillRect(57, 51, 6, 6, COLOR_WHITE); LCD_FillRect(58, 36, 4, 6, COLOR_RED); LCD_FillRect(46, 38, 4, 4, COLOR_RED); LCD_FillRect(70, 38, 4, 4, COLOR_RED); LCD_ShowStringCentered(120, "SOS", COLOR_RED, COLOR_BLACK); LCD_ShowStringCentered(150, "ENVOI", COLOR_RED, COLOR_BLACK); LCD_ShowStringCentered(195, "APPEL...", COLOR_WHITE, COLOR_BLACK); } void UI_ShowBindingPage(u32 addr) { char id_str[20]; LCD_Clear(COLOR_BLACK); // 摄像机组合绘制 LCD_DrawRectBorder(36, 46, 32, 26, COLOR_CYAN); LCD_FillRect(44, 56, 6, 6, COLOR_CYAN); LCD_FillRect(68, 48, 2, 22, COLOR_CYAN); LCD_FillRect(70, 50, 2, 18, COLOR_CYAN); LCD_FillRect(72, 52, 2, 14, COLOR_CYAN); LCD_ShowStringCentered(120, "LIAISON", COLOR_WHITE, COLOR_BLACK); LCD_ShowStringCentered(155, "ENVOI EN COURS", COLOR_CYAN, COLOR_BLACK); id_str[0] = 'I'; id_str[1] = 'D'; id_str[2] = ':'; id_str[3] = ' '; id_str[4] = '0'; id_str[5] = 'x'; { u8 val1 = (u8)(addr >> 16); u8 val2 = (u8)(addr >> 8); u8 val3 = (u8)addr; u8 nibble = val1 >> 4; id_str[6] = (nibble < 10) ? ('0' + nibble) : ('A' + (nibble - 10)); nibble = val1 & 0x0F; id_str[7] = (nibble < 10) ? ('0' + nibble) : ('A' + (nibble - 10)); nibble = val2 >> 4; id_str[8] = (nibble < 10) ? ('0' + nibble) : ('A' + (nibble - 10)); nibble = val2 & 0x0F; id_str[9] = (nibble < 10) ? ('0' + nibble) : ('A' + (nibble - 10)); nibble = val3 >> 4; id_str[10] = (nibble < 10) ? ('0' + nibble) : ('A' + (nibble - 10)); nibble = val3 & 0x0F; id_str[11] = (nibble < 10) ? ('0' + nibble) : ('A' + (nibble - 10)); id_str[12] = '\0'; } LCD_ShowStringCentered(205, id_str, COLOR_GRAY, COLOR_BLACK); } void UI_ShowMainMenu(u8 selected_index) { LCD_Clear(COLOR_BLACK); LCD_FillRect(58, 20, 4, 2, COLOR_GRAY); LCD_FillRect(56, 22, 8, 2, COLOR_GRAY); LCD_FillRect(54, 24, 12, 2, COLOR_GRAY); if (selected_index == 0) { LCD_DrawRectBorder(44, 70, 32, 32, COLOR_CYAN); LCD_FillRect(59, 76, 2, 10, COLOR_CYAN); LCD_FillRect(59, 85, 8, 2, COLOR_CYAN); LCD_ShowStringCentered(150, "1. HORLOGE", COLOR_WHITE, COLOR_BLACK); } else if (selected_index == 1) { LCD_DrawMonoBitmap(44, 70, 32, 32, bmp_radar_32x32_f3, COLOR_CYAN, COLOR_BLACK); LCD_ShowStringCentered(150, "2. APPAIRAGE", COLOR_WHITE, COLOR_BLACK); } else if (selected_index == 2) { LCD_DrawRectBorder(44, 74, 20, 16, COLOR_CYAN); LCD_FillRect(52, 80, 4, 4, COLOR_CYAN); LCD_FillRect(64, 76, 2, 12, COLOR_CYAN); LCD_FillRect(66, 78, 2, 8, COLOR_CYAN); LCD_FillRect(68, 80, 2, 4, COLOR_CYAN); LCD_ShowStringCentered(150, "3. LIAISON", COLOR_WHITE, COLOR_BLACK); } LCD_FillRect(54, 210, 12, 2, COLOR_GRAY); LCD_FillRect(56, 212, 8, 2, COLOR_GRAY); LCD_FillRect(58, 214, 4, 2, COLOR_GRAY); } void UI_ShowSetTimePage(u8 hour, u8 min, u8 selection, u8 blink_on) { char time_str[6]; LCD_Clear(COLOR_BLACK); LCD_DrawRectBorder(10, 23, 20, 15, COLOR_GREEN); LCD_FillRect(15, 15, 2, 8, COLOR_GREEN); LCD_FillRect(17, 15, 8, 2, COLOR_GREEN); LCD_FillRect(25, 17, 2, 6, COLOR_GREEN); LCD_ShowString(62, 24, "85%", COLOR_GRAY, COLOR_BLACK); LCD_DrawMonoBitmap(92, 27, 20, 10, bmp_battery_20x10, COLOR_GRAY, COLOR_BLACK); if (selection == 1 && !blink_on) { time_str[0] = ' '; time_str[1] = ' '; } else { time_str[0] = '0' + (hour / 10); time_str[1] = '0' + (hour % 10); } time_str[2] = '\0'; LCD_ShowString16x32(12, 100, time_str, COLOR_CYAN, COLOR_BLACK); LCD_ShowString16x32(48, 98, ":", COLOR_WHITE, COLOR_BLACK); if (selection == 2 && !blink_on) { time_str[0] = ' '; time_str[1] = ' '; } else { time_str[0] = '0' + (min / 10); time_str[1] = '0' + (min % 10); } time_str[2] = '\0'; LCD_ShowString16x32(64, 100, time_str, COLOR_CYAN, COLOR_BLACK); LCD_ShowStringCentered(150, "AM", COLOR_WHITE, COLOR_BLACK); LCD_ShowStringCentered(195, "VEN 10-07", COLOR_GRAY, COLOR_BLACK); }