Esempio n. 1
0
void    key_Automatic1(void)
{
  if (bKey == bKEY_ENTER)
  {
    if (enKeyboard == KBD_ENTER)
    {
      Automatic(0,bCANALS);
    }
  }
}
Esempio n. 2
0
void    key_Automatic2(void)
{
  if (bKey == bKEY_ENTER)
  {
    if (enKeyboard == KBD_ENTER)
    {
      enKeyboard = KBD_INPUT1;

      ShowHi(szAutomatic);
      Clear(); DelayInf();

      ShowHi(szCana1s);
      strcpy(szLo+0,szCana1FromMask);
    }
    else if (enKeyboard == KBD_POSTINPUT1)
    {
      ibXmin = GetCharLo(5,6) - 1;
      if (ibXmin < bCANALS)
      {
        enKeyboard = KBD_INPUT2;
        strcpy(szLo+8,szCana1ToMask);
      }
      else Beep();
    }
    else if (enKeyboard == KBD_POSTINPUT2)
    {
      ibXmax = GetCharLo(13,14) - 1;
      if ((ibXmax < bCANALS) && (ibXmax >= ibXmin))
      {
        Automatic(ibXmin,ibXmax+1);
      }
      else Beep();
    }
    else Beep();
  }



  else if (bKey < 10)
  {
    if ((enKeyboard == KBD_INPUT1) || (enKeyboard == KBD_POSTINPUT1))
    {
      enKeyboard = KBD_POSTINPUT1;
      ShiftLo(5,6);
    }
    else
    if ((enKeyboard == KBD_INPUT2) || (enKeyboard == KBD_POSTINPUT2))
    {
      enKeyboard = KBD_POSTINPUT2;
      ShiftLo(13,14);
    }
    else Beep();
  }
  else Beep();
}
Esempio n. 3
0
void Proceed()
{
    /* This is a transition effect */
    int ScreenWide;
    RLE_SPRITE *rle0, *rle1;

    strcpy(FName, "logs/");
    strcat(FName, Name);
    strcat(FName, " - ");
    strcat(FName, Number);
    strcat(FName, ".log");
    outfile = fopen(FName,"w");

    if(Option=='A')
    {
        system("mp3blaster /home/mentesuprema/Residencia/sounds/swing2.wav &");
        rest(5);
        rle0= get_rle_sprite(Screen1);
        rle1= get_rle_sprite(Screen2);

        for(ScreenWide=0; ScreenWide<=1024; ScreenWide=ScreenWide+10)
        {
            draw_rle_sprite(screen, rle0, ScreenWide, 0);
            draw_rle_sprite(screen, rle1, -1024+ScreenWide, 0);
        }
        destroy_rle_sprite(rle0);
        release_screen();
        Automatic();
    }
    if(Option=='M')
    {
        system("mp3blaster /home/mentesuprema/Residencia/sounds/swing2.wav &");
        rest(5);
        rle0= get_rle_sprite(Screen1);
        rle1= get_rle_sprite(Screen2);

        for(ScreenWide=0; ScreenWide<=1024; ScreenWide=ScreenWide+10)
        {
            draw_rle_sprite(screen, rle0, ScreenWide, 0);
            draw_rle_sprite(screen, rle1, -1024+ScreenWide, 0);
        }
        destroy_rle_sprite(rle0);
        destroy_rle_sprite(rle1);
        destroy_bitmap(Screen1);
        destroy_bitmap(Screen2);
        release_screen();
        Manual();
    }

    release_screen();
}
Esempio n. 4
0
int Simulator()
{

  set_config_file("IR.config");  /* Read configuration file */
  Delay= (get_config_float("content", "Delay", 0));  

  fd = open("/dev/parport0", O_RDWR );

  Screen3= load_bitmap("images/Simulator/Base.pcx", pal);
  blit(Screen3, screen, 0, 0, 0, 0, 1024, 768);  
  /* Boxes to show numerical values */
  rectfill(screen, 895, 270, 945, 303, WHITE);   
  rect(screen, 895, 270, 945, 303, 1);	// x1, y1, x2, y2
  
  textprintf_ex(screen, font, 320, 0, BLACK, -1, "Simulacion de la Planta");  


  while (!key[KEY_LEFT])	/* Only pressing KEY_LEFT will return */
    {
      /* This line reads data from the interfase which is
	 the process variable(measured variable) of the system */
      ioctl(fd, PPRDATA, &PVi);
      //PV= PVi;

      if(PVi<=48)
      {
	PVi= 51;
        system("festival --tts Messages/Disconnected &");
      }

//      if(PV<=48)
//        PVi= 51;

      PV= 1.367647*(PVi-51);//      279= X 204


      if(key[KEY_PGUP])
	SP= SP+45;

      if(key[KEY_PGDN])
	SP= SP-45;
      
      if(key[KEY_UP])
	SP= SP+5;

      if(key[KEY_DOWN])
	{
	  if(SP>=1)
	    SP= SP-5;
	}

      if(PVi>=253)
	{
	  textprintf_ex(screen, font, 320, 50, BLACK, RED, "Nivel Critico, revise el controlador");  
	  system("/usr/bin/mpg123 Sounds/Alarm.wav &");
	}

//      PV= (200/298)*100;

//	504  381  544  381
//	504  83   544  381
//      rectfill(screen, 832, 513-(SP/300), 883, 513, LIGHT_BLUE);
//      rectfill(screen, 832, 213, 883, 513-(SP/300), GRAY);

      /* Fill the tank with clear water */
      rectfill(screen, 687, 386-(SP/300), 710, 381, LIGHT_BLUE);
      rectfill(screen, 687, 83, 710, 386-(SP/300), GRAY);

      float K, BIAS;   K=-2; BIAS=184;
      K=(K/368)*100;

      /* (P) Proportional only control mode */
      OP= ((((SP/298)-(PV/298))*100)*K)+(OP/298);

	
      /* PV bar */
      rectfill(screen, 440, 381-(PV/298), 480, 381, RED);
      rectfill(screen, 440, 83, 480, 381-(PV/298), GRAY);

      /* SP bar */
      if (SP>=88734)	SP=88734;      
      if (SP<=1)	SP=1;
      rectfill(screen, 504, 381-(SP/298), 544, 381, GREEN);
      rectfill(screen, 504, 83, 544, 381-(SP/298), GRAY);

      /* OP bar */
      if (OP>=88734)	OP=88734;      
      if (OP<=1)	OP=1;
      rectfill(screen, 569, 381-(OP/298), 609, 381, BLUE);
      rectfill(screen, 569, 83, 609, 381-(OP/298), GRAY);


      textprintf_ex(screen, font, 900, 264, BLACK, WHITE, "%3.1fOP", (OP/88734)*100);
//      textprintf_ex(screen, font, 900, 364, BLACK, WHITE, "%3.1fOP", (OP/298)*100);      
      textprintf_ex(screen, font, 900, 364, BLACK, WHITE, "%3.1fSP", (SP/88734)*100);

      rest(Delay);
    }
  Automatic();      
  return 1;
}