void F_EBookMenuDel(UINT8 idx) { UINT32 color ; UINT8 i ; color = 0xf0 ; osdClearScreen(0x00) ; pbDisplayMenuWord(); for(i=0 ;i<3;i++) { if(i==0) { color = 0xd0; osdStrDisp(EBOOK_TITLE_OFF_X, EBOOK_TITLE_OFF_Y+EBOOK_TEXT_HEIGHT*i, UserFont10x20, MENUTITLES, EBookStrings[0][i][sPara.language]) ; } else if(i==idx){ color = 0xde ; osdBarDraw(EBOOK_BAR_X, EBOOK_BAR_Y+EBOOK_TEXT_HEIGHT*(i-1), EBOOK_BAR_WIDTH, EBOOK_BAR_HEIGHT, 0x0e) ; osdStrDisp(EBOOK_TEXT_OFF_X, EBOOK_TEXT_OFF_Y+EBOOK_TEXT_HEIGHT*(i-1), UserFont10x20, color, EBookStrings[0][i][sPara.language]) ; } else { color = 0xf0 ; osdStrDisp(EBOOK_TEXT_OFF_X, EBOOK_TEXT_OFF_Y+EBOOK_TEXT_HEIGHT*(i-1), UserFont10x20, color, EBookStrings[0][i][sPara.language]) ; } } }
void osdInit(void) { memset(&osdState, 0, sizeof(osdState)); osdHardwareInit(); osdClearScreen(); osdDisplaySplash(); osdHardwareUpdate(); }
//列表在2模式下选中后的一个更新函数 void pbEBookRefresh() { UINT32 err = SUCCESS; osdFWBuffChange(); osdClearScreen(0x00); Pb_EbookTitle(GetBookString(TitleEBook)); if (ui32FileCnt == 0) { pbEBookShow(EBOOK_DRAW_BG ,0 ); osdStrDisp(170, 90, UserFont10x20, 0xd0, GetBookString(NoBook)); osdHWBuffChange(); #if 0 // fqdao_modify for bug press menukey 06.5.18 osTimeDly(100); hwWait(0,1000); osQuePost(uiKeyMsgQ, &keyButton[UI_KEY_FUNC_MENU]); #else osTimeDly(100); menuReturn(UI_MAINMENU, 0); #endif return; } if ((err = xdcfCurFileByPosSet(ui32FileIdx)) != SUCCESS) { osdHWBuffChange(); return; } err = xdcfCurFileAttrGet( &xdcfFileAttr );// fqdao_bug for EBook Date 06.5.30 err = xdcfCurFileAttrGet( &fileattr ); err = xdcfFileTypeGet( ui32FileIdx, &ui32Filetype); //hisIconDisp(); //hisTimeDisp(); if(ui8DispType == PB_DISP_ONE) { pbEBookShow(1,ui32FileIdx); } else if ( ui8DispType == PB_DISP_FOUR ) { //pbEBookShow(EBOOK_DRAW_BG ,0 ); pbEBookInfoShow(ui32FileIdx); pbEBookFileList(ui32FileIdx); } osdHWBuffChange(); }
void osdUpdate(void) { TIME_SECTION_BEGIN(0); uint32_t now = micros(); static bool armed = false; static uint32_t armedAt = 0; bool armedNow = fcStatus.fcState & (1 << FC_STATE_ARM); if (armed != armedNow) { if (armedNow) { armedAt = now; } armed = armedNow; } if (armed) { if (now > armedAt) { fcStatus.armedDuration = (now - armedAt) / 1000; } } osdClearScreen(); // test all timers, setting corresponding bits uint32_t timActive = 0; for(timId_e timId = 0; timId < timTimerCount; timId++) { if(cmp32(now, timerState[timId].val) < 0) continue; // not ready yet timActive |= 1 << timId; // sanitize timer value, so that it can be safely incremented. Handles inital timerVal value. // max delay is limited to 5s if(cmp32(now, timerState[timId].val) >= OSD_MS(100) || cmp32(now, timerState[timId].val) < OSD_HZ(5000) ) { timerState[timId].val = now; } } // update all timers for(unsigned i = 0; i < ARRAYLEN(timerTable); i++) { int timId = timerTable[i].timId; bool updateNow = timActive & (1 << timId); if (!updateNow) { continue; } timerState[timId].toggle = !timerState[timId].toggle; timerState[timId].counter++; timerState[timId].val += timerTable[i].delay; } bool showNowOrFlashWhenFCTimeoutOccured = !mspClientStatus.timeoutOccured || (mspClientStatus.timeoutOccured && timerState[tim10Hz].toggle); osdSetElementFlashOnDisconnectState(showNowOrFlashWhenFCTimeoutOccured); for (uint8_t elementIndex = 0; elementIndex < MAX_OSD_ELEMENT_COUNT; elementIndex++) { element_t *element = &osdElementConfig()->elements[elementIndex]; osdDrawTextElement(element); } // // flash the logo for a few seconds // then leave it on for a few more before turning it off // static bool splashDone = false; if (!splashDone) { if ( (timerState[tim1Hz].counter > 3 && timerState[tim1Hz].counter < 6) || (timerState[tim1Hz].counter <= 3 && timerState[tim10Hz].toggle) ) { osdDisplaySplash(); } if (timerState[tim1Hz].counter >= 10) { splashDone = true; } } if (timerState[tim2Hz].toggle && splashDone) { if (!osdIsCameraConnected()) { osdPrintAt(14, 4, "NO"); osdPrintAt(12, 5, "CAMERA"); } } TIME_SECTION_END(0); osdHardwareUpdate(); }
void paEBookMenuFunc() { UINT32 key = UI_KEY_MODE_ACCESSORIES; UINT32 err; UINT8 item=0, subitem = 1 ; osdClearScreen(0x00); UINT8 flag; EBookRefreshItem[item](); while(1) { switch(key) { case UI_KEY_DIR_UP: if(subitem>1) subitem -- ; EBookRefreshSubitem[item](subitem) ; break ; case UI_KEY_DIR_DOWN: if(subitem< eBookSubMax[ item ] ) subitem++ ; EBookRefreshSubitem[item](subitem ); break ; case UI_KEY_DIR_LEFT: if(item ) { item -- ; } else { item = EBOOK_ITEM_MAX - 1; } EBookRefreshItem[item](); break ; case UI_KEY_DIR_RIGHT: if(item < EBOOK_ITEM_MAX-1) { item++ ; } else { item = 0 ; } EBookRefreshItem[item]( ); break ; case UI_KEY_FUNC_OK: flag = EBookRefreshFunc[item*2 + subitem - 1 ](); if(flag) { MessageShow (MenuSuccess); } osdClearScreen(0);//fqdao pbEBookShow(EBOOK_DRAW_BG ,0 ); pbEBookRefresh(); return; break ; case UI_KEY_ACCIDENT: pbEBookRefresh(); osQuePost(uiKeyMsgQ, &keyButton[UI_KEY_ACCIDENT]); return; break; case UI_KEY_FUNC_B: case UI_KEY_FUNC_MENU: osdClearScreen(0); //fqdao_add 06.5.19 pbEBookShow(EBOOK_DRAW_BG ,0 ); pbEBookRefresh(); return ; break ; } keyGet(&key) ; } }
void uiebook() { UINT32 key = UI_KEY_MODE_EBOOK; UINT8 ui8EBookEXPName[4] = "TXT" ; UINT8 ui8EBooKTempExp1[4]= "tmp"; UINT8 ui8EBookTempExp2[4]="emx"; UINT32 err; semApp = osEventFindByName("APP_SEM"); uiKeyMsgQ = osEventFindByName("UI_KEY"); pbDispStart = 1; ui32DirIdx = 0; ui32FileIdx = 0; while ( ( uiState & UI_MODE_MASK ) ==UI_MODE_EBOOK) { hisIconDisp(); hisTimeDisp(); if (ui32NextState != uiState) { break; } switch(key) { case UI_KEY_DIR_UP: if( ui8DispType == PB_DISP_FOUR ) { if(ui32FileIdx >1) ui32FileIdx --; else ui32FileIdx = ui32FileCnt; pbEBookRefresh(); } else if ( ui8DispType == PB_DISP_ONE ) { pbEBookPrePage();//上一页 } break; case UI_KEY_DIR_DOWN: if( ui8DispType == PB_DISP_FOUR ) { if(ui32FileIdx < ui32FileCnt) ui32FileIdx ++; else ui32FileIdx = 1; pbEBookRefresh(); } else if (ui8DispType == PB_DISP_ONE) { pbEBookNextPage ();//下一页 } break; case UI_KEY_ACCIDENT: osTimeDly(20); if (pui8ReadBuf) { osMemFree (pui8ReadBuf); pui8ReadBuf = NULL; } if ( pui32SavePage ) { osMemFree (pui32SavePage); pui32SavePage = NULL; } if (handle) { vfsClose(handle); handle = 0; } if (ui8DispType == PB_DISP_ONE) { ui8DispType = PB_DISP_FOUR; ui8EBookReadNow = 0; pbEBookRefresh(); //fqdao_modify for bug 23 06.4.29 osQuePost(uiKeyMsgQ, &keyButton[UI_KEY_ACCIDENT]); } break; case UI_KEY_FUNC_B: if( ui8DispType == PB_DISP_FOUR ) //fqdao_add 06.5.16 { buttonAudio(1) ; paEBookMenuFunc(); } break ; case UI_KEY_DIR_LEFT: break; case UI_KEY_DIR_RIGHT: break; /* case UI_KEY_FUNC_ZOOMIN: break ; case UI_KEY_FUNC_ZOOMOUT: break ; */ case UI_KEY_FUNC_MENU: if( ui8DispType == PB_DISP_FOUR ) { if ( pui8ReadBuf ) { osMemFree( pui8ReadBuf ); pui8ReadBuf = NULL; } if ( pui32SavePage ) { osMemFree( pui32SavePage ); pui32SavePage = NULL; } if ( handle ) { vfsClose(handle); handle = 0; } sub_menu_acc = 0; // UI_OSQFlush(uiKeyMsgQ); menuReturn(UI_MAINMENU, 0); osTimeDly(40); return; break; // UI_OSQFlush(uiKeyMsgQ); } else if ( ui8DispType == PB_DISP_ONE ) { /* Paul@2006/05/29 add start */ IsSaveBookmark(); /* Paul@2006/05/29 add end */ #if 1 ui8DispType = PB_DISP_FOUR; if ( pui8ReadBuf ) { osMemFree(pui8ReadBuf); pui8ReadBuf = NULL; } if ( pui32SavePage ) { osMemFree( pui32SavePage ); pui32SavePage = NULL; } ui8EBookReadNow = 0; if ( handle ) { vfsClose(handle); handle = 0; } //UI_OSQFlush(uiKeyMsgQ); pbInit(); osdClearScreen(0); //fqdao_add 06.5.19 pbEBookShow(EBOOK_DRAW_BG ,0 ); pbEBookRefresh(); #endif } break ; // case UI_KEY_FUNC_MODE: // break; case UI_KEY_FUNC_OK: if (ui32FileCnt != 0 && ui8DispType == PB_DISP_FOUR ) { if(pui32SavePage==NULL) { pui32SavePage = osMemAlloc(4096); if ( !pui32SavePage ) { break; } } handle = vfsOpen( xdcfFileAttr.name, O_RDONLY, S_IREAD); if ( !handle ) { break; } ui32FileSize= vfsFileSizeGet(handle); if ( ui32FileSize == 0 ) { osdStrDisp(160, 60, UserFont10x20, 0xd0, GetBookString(EmptyFile)); osTimeDly(100); //vfsClose(handle); break; } #if 0 if ( ui32FileSize < 1024*400 ) { pui8ReadBuf = osMemAlloc( ui32FileSize ); if ( pui8ReadBuf == NULL ) { osMemFree(pui32SavePage); vfsClose(handle); break; } ui32ReadSize = vfsRead(handle, pui8ReadBuf, ui32FileSize ); } else { pui8ReadBuf = osMemAlloc( 1024*400 );/*最大400k*/ if ( pui8ReadBuf == NULL ) { osMemFree(pui32SavePage); vfsClose(handle); break; } ui32ReadSize = vfsRead(handle, pui8ReadBuf, 1024*400); } #endif ui8EBookReadNow = 1; //vfsClose(handle); ui8DispType = PB_DISP_ONE; *pui32SavePage = 0; /*第一页指向的0(开始位置)*/ ui32FileIsEnd = 0; ui32CurPageFlag = 0; ui32PrePageFlag = 0; /* Paul@2006/05/29 add start */ CheckCurBookmark(); /* Paul@2006/05/29 add end */ osdClearScreen(0); pbEBookRefresh(); osTimeDly(50); } break; // case UI_KEY_FUNC_DISP: // break; case UI_KEY_MODE_EBOOK: if ( ui8FirstInEBook ) { xdcfFileTypeAdd(ui8EBooKTempExp1); // 128 xdcfFileTypeAdd(ui8EBookTempExp2); //256 xdcfFileTypeAdd(ui8EBookEXPName);//512 相当于 1<<9 ( xDCF_FILETYPE_RESERVE2) ui8FirstInEBook = 0; } osTaskSuspend(osTaskFindByName("AAA")); sysgMemDispAddrGet(&ui32gPB); if ( pui32SavePage ) { osMemFree( pui32SavePage ); pui32SavePage = NULL; } if ( pui8ReadBuf ) { osMemFree(pui8ReadBuf); pui8ReadBuf = NULL; } //添加目录名 xdcfInit(imageDirNameStr, imageRootNameStr, xDCF_CONFIG_KEY_MIN | xDCF_CONFIG_SORT_IDX/* | xDCF_CONFIG_DCF_ONLY*/); xdcfCurRootDirSet(otherRootNameStr); xdcfFilterSet( ui32FileFilter ); //ui32FileFilter = xDCF_FILETYPE_RESERVE2; hwWait(0,100); xdcfDirCountGet(&ui32DirCnt); xdcfCurDirAttrGet(&xdcfDirAttr); xdcfFileCountGet(&ui32FileCnt); ui32FileIdx = 1; if(ui32FileCnt == 0) { ui32FileIdx = 0; } ui8DispType = PB_DISP_FOUR ; pbInit(); pbEBookShow(EBOOK_DRAW_BG ,0 ); pbEBookRefresh(); break; default: break; } EBookkeyGet(&key); } if ( pui8ReadBuf ) { osMemFree(pui8ReadBuf); pui8ReadBuf = NULL; } if ( pui32SavePage ) { osMemFree( pui32SavePage ); pui32SavePage = NULL; } if ( handle ) { vfsClose(handle); handle = 0; } uiState = ui32NextState; }
void pbEBookShow(UINT8 flag, UINT32 ui32FileIdx ) { UINT8 i, j; UINT32 err = SUCCESS; UINT32 pPBAddr, phyOsdDBAddr; UINT32 tempIdx = 1; UINT32 dispW, dispH; UINT32 pbThumbW, pbThumbH, pbThumbOffX, pbThumbOffY; pbThumbW = 120 ; // 160-40; pbThumbH = 84 ; //120-36; pbThumbOffX =150+20+2 ; pbThumbOffY = 44+14+14; //pImageBuf = (UINT8*) (((UINT32 )ui8EBookBuf) | 0xac000000); //phyOsdDBAddr = (((UINT32)pEBookBuf) & 0x00FFFFFF) >> 1; hwDateFontScalerSet(1); pbThumbBufferGet(&pPBAddr); hwDispPreviewSizeGet(&dispW, &dispH); hwPlayBufSizeSet(dispW, dispH); hwPlayBufAddrSet(ui32gPB); if( flag == EBOOK_DRAW_PREVIEW ) { err = xdcfFileTypeGet(ui32FileIdx, &ui32Filetype); } else if (flag == EBOOK_DRAW_BOOKTEXT) { pbDramImgPlay(MenupEBook[EBOOKREAD][0], MenupEBook[EBOOKREAD][1], ui32gPB, dispW, dispH); osdClearScreen(0); pbEBookTextGet(); if ( (TVFlag == 1 ) && (PANEL_TYPE_1 != getCurPanel()) ) { gpioSet(GPIO_LCD_POWER, 1); hwWait(0,300); panelSelect(PANEL_TYPE_1); sPara.TvoutFlag=TVOutOff; TVFlag=0; hwDispPvSetRead(imgBuf); // ChgPvSetting = 1; } } else if ( flag == EBOOK_DRAW_BG ) { pbMainBack(); if (ui32FileCnt == 0) { #if 0 // tzw add hwImgCopyDo((UINT32)pPBAddr, pbThumbW, pbThumbH, 0, 0, pbThumbW, pbThumbH, ui32gPB, dispW, dispH,pbThumbOffX,pbThumbOffY, 0); #endif } else { pbImagePaste( MenupEBook[EBOOKPICT][0], MenupEBook[EBOOKPICT][1], MenupEBook[EBOOKPICT][2], MenupEBook[EBOOKPICT][3] ); } } }