| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4296 人关注过本帖
标题:标志位的设置问题
只看楼主 加入收藏
黑猫警长
Rank: 1
来 自:东莞
等 级:新手上路
帖 子:2
专家分:0
注 册:2015-9-29
收藏
 问题点数:0 回复次数:0 
标志位的设置问题
//在给一个数字终端写一个时间屏保,有在从屏保界面转向first界面的时候,时间数字会停留在first界面上,请
//问要怎么修改?求大神指导

void InitRdBigClockWindow(void)       //初始化大时钟窗口
{
  int i, j;
    //大时钟背景图像
  if(big_rd_clock_image[0].image != NULL)
    FreeImage(&big_rd_clock_image[0]);
  sprintf(big_rd_clock_image[0].name, "%s/big_clock_image1.jpg\0", currpath);
  big_rd_clock_image[0].width = SCRWIDTH;
  big_rd_clock_image[0].height = SCRHEIGHT;
  big_rd_clock_image[0].xLeft = 0;
  big_rd_clock_image[0].yTop = 0;

  //星期图像
  for(i=0; i<7; i++)
    FreeImage(&big_rd_clock_week_image[i]);
  for(i=0; i<7; i++)
   {
    sprintf(big_rd_clock_week_image[i].name, "%s/week_%d.jpg\0", currpath, i+1);
    big_rd_clock_week_image[i].width = 183;//116;
    big_rd_clock_week_image[i].height = 28;//44;
    big_rd_clock_week_image[i].xLeft = 424;//475;
    big_rd_clock_week_image[i].yTop =  270;//297;
    ImageLoadFromFile(big_rd_clock_week_image[i].name, &big_rd_clock_week_image[i]);
   }

  for(i=0; i<10; i++)
    FreeImage(&big_rd_clock_date_image[i]);
  for(i=0; i<10; i++)
   {
    sprintf(big_rd_clock_date_image[i].name, "%s/date_%d.jpg\0", currpath, i);
    big_rd_clock_date_image[i].width = 12;//116;
    big_rd_clock_date_image[i].height = 18;//44;
    big_rd_clock_date_image[i].xLeft = 252;//475;
    big_rd_clock_date_image[i].yTop =  276;//297;
    ImageLoadFromFile(big_rd_clock_date_image[i].name, &big_rd_clock_date_image[i]);
   }


  for(i=0; i<10; i++)
    FreeImage(&big_rd_clock_time_image[i]);
  for(i=0; i<10; i++)
   {
    sprintf(big_rd_clock_time_image[i].name, "%s/%d.jpg\0", currpath, i);
    big_rd_clock_time_image[i].width = 44;//116;
    big_rd_clock_time_image[i].height = 58;//44;
    big_rd_clock_time_image[i].xLeft = 296;//475;
    big_rd_clock_time_image[i].yTop =  168;//297;
    ImageLoadFromFile(big_rd_clock_time_image[i].name, &big_rd_clock_time_image[i]);
   }


  for(i=0; i<10; i++)
    FreeImage(&big_rd_clock_year_image[i]);
  for(i=0; i<10; i++)
   {
    sprintf(big_rd_clock_year_image[i].name, "%s/date_%d.jpg\0", currpath, i);
    big_rd_clock_year_image[i].width = 12;//116;
    big_rd_clock_year_image[i].height = 18;//44;
    big_rd_clock_year_image[i].xLeft = 252;//475;
    big_rd_clock_year_image[i].yTop =  276;//297;
    ImageLoadFromFile(big_rd_clock_year_image[i].name, &big_rd_clock_year_image[i]);
   }



}

//************************************************************************************************************************
int clock_flag = 0;
unsigned char *BigClockScreen;
pthread_t big_clock_thread;
sem_t big_clock_sem;
int Old_Box = 0;
//---------------------------------------------------------------------------
void UnInitRdBigClockWindow(void)       //释放大时钟窗口
{
  int i, j;
  //大时钟背景图像
  if(big_rd_clock_image[0].image != NULL)
    FreeImage(&big_rd_clock_image[0]);

  for(i=0; i<10; i++)
    FreeImage(&big_rd_clock_time_image[i]);
//Local.isDisplayWindowFlag == 1;
  for(i=0; i<10; i++)
    FreeImage(&big_rd_clock_date_image[i]);
//    Local.isDisplayWindowFlag == 1;
  //星期图像
  for(i=0; i<7; i++)
    FreeImage(&big_rd_clock_week_image[i]);
//Local.isDisplayWindowFlag == 1;
  //分隔符
  //for(i=0; i<4; i++)
    //FreeImage(&big_rd_clock_box_image[i]);
}
//---------------------------------------------------------------------------
void DisplayRdBigClockWindow(void)    //显示大时钟窗口
{
  ClearOsdScreen();   //清OSD屏

  //pthread_mutex_lock(&Local.show_window_lock);     //锁定
  Local.isDisplayWindowFlag = 1;
  clock_flag == 1;
  Local.CurrentWindow = 200;
  CheckMainFbPage(); //检查是否在framebuffer 的第0页

  DisplayImage(&big_rd_clock_image[0], Local.CurrFbPage, FROMFILE);

  RefreshRdBigClock(REFRESH);

 // pthread_mutex_unlock(&Local.show_window_lock);  //解锁
  Local.isDisplayWindowFlag = 0;
 
}



//---------------------------------------------------------------------------
void OperateRdBigClockWindow(short wintype, int currwindow)    //大时钟窗口操作
{
   if(Local.CurrentWindow == 200)
   {
     if(clock_flag == 1)
   {
    //20101119 增加延时,避免在返回主界面时花屏
    clock_flag == 0;
    usleep(400*1000);   
    if(pthread_cancel(big_clock_thread) ==0)
      printf("clock_thread cancel success\n");
    else
      printf("clock_thread cancel fail\n");
    sem_destroy(&big_clock_sem);
    clock_flag = 0;
   }

   #if 1
    if(BigClockScreen != NULL)
     {
      free(BigClockScreen);
      BigClockScreen = NULL;
     }
    #endif

    DisplayFirstWindow();
   }
}

//************************************************************************************************************************
void RefreshRdBigClock(int refreshtype)

{


  char CurrClock[20];

  char CurrDate[10];
  char CurrMonth[10];
  char CurrYear[10];   

  int tindex, i;
  int Curr_Week;

  if(Local.CurrentWindow != 200)
    return;

  //tm_wday 星期 0-6

  sprintf(CurrClock, "%02d%02d\0", curr_tm_t->tm_hour, curr_tm_t->tm_min);

  sprintf(CurrDate, "%02d\0", curr_tm_t->tm_mday);

  sprintf(CurrMonth, "%02d\0", curr_tm_t->tm_mon + 1);
  sprintf(CurrYear, "%04d\0", curr_tm_t->tm_year + 1900);
  Curr_Week = curr_tm_t->tm_wday;

   for(i=0; i<4; i++)
    {
     tindex = 0;
   
     if((CurrClock[i] >= '0')&&(CurrClock[i] <= '9'))
     {
       tindex = CurrClock[i] - '0';   
     }
     if(i>=2)
     {
        big_rd_clock_time_image[tindex].xLeft = 424 + 44*(i-2);
             big_rd_clock_time_image[tindex].yTop = 168;
     }
     else
      {
        big_rd_clock_time_image[tindex].xLeft = 296 + 44*i;
             big_rd_clock_time_image[tindex].yTop = 168;
      }
     DisplayImage(&big_rd_clock_time_image[tindex], Local.CurrFbPage, FROMMEMORY);

    }


  for(i=0; i<2; i++)
   {
            tindex = 0;
       if((CurrDate[i] >= '0')&&(CurrDate[i] <= '9'))
         tindex = CurrDate[i] - '0';
        big_rd_clock_date_image[tindex].xLeft = 354 + 12*i;
        big_rd_clock_date_image[tindex].yTop = 276;
         DisplayImage(&big_rd_clock_date_image[tindex], Local.CurrFbPage, FROMMEMORY);
   
   }


  for(i=0; i<2; i++)
   {
            tindex = 0;
       if((CurrMonth[i] >= '0')&&(CurrMonth[i] <= '9'))
         tindex = CurrMonth[i] - '0';
        big_rd_clock_date_image[tindex].xLeft = 314 + 12*i;
        big_rd_clock_date_image[tindex].yTop = 276;
         DisplayImage(&big_rd_clock_date_image[tindex], Local.CurrFbPage, FROMMEMORY);
   
   }

  for(i=0; i<4; i++)
   {
       tindex = CurrYear[i] - '0';
        big_rd_clock_year_image[tindex].xLeft = 252 + 12*i;
        big_rd_clock_year_image[tindex].yTop = 276;
         DisplayImage(&big_rd_clock_year_image[tindex], Local.CurrFbPage, FROMMEMORY);
   
   }
 // clock_flag == 1;

  DisplayImage(&big_rd_clock_week_image[Curr_Week], Local.CurrFbPage, FROMMEMORY);
  
  if(refreshtype != REFRESH)
   {
    if(Old_Box == 1)
      Old_Box = 0;
    else
      Old_Box = 1;

    if(Local.CurrentWindow == 200)
    {
 //      Local.isDisplayWindowFlag = 1;
        usleep(10*1000);
        if(Local.CurrentWindow == 200)
        {
            usleep(5*1000);
            if(Local.CurrentWindow == 200)
            {
                usleep(5*1000);
                //DisplayImage(&big_rd_clock_box_image[Old_Box], Local.CurrFbPage, FROMMEMORY);
               
            }
            else
              return;
            
        }
        else
        {
            return;
            
        }
 //       Local.isDisplayWindowFlag = 0;
              
    }
    else
        return;
   }
clock_flag == 0;



}
2015-09-29 13:33
快速回复:标志位的设置问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.035439 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved