Subversion Repositories shark

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Project: S.Ha.R.K.
 *
 * Coordinators:
 *   Giorgio Buttazzo    <giorgio@sssup.it>
 *   Paolo Gai           <pj@gandalf.sssup.it>
 *
 * Authors     :
 *   Paolo Gai           <pj@gandalf.sssup.it>
 *   (see the web pages for full authors list)
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://shark.sssup.it
 */


/**
 ------------
 CVS :        $Id: draw.c,v 1.1.1.1 2004-05-24 18:03:47 giacomo Exp $

 File:        $File$
 Revision:    $Revision: 1.1.1.1 $
 Last update: $Date: 2004-05-24 18:03:47 $
 ------------

 This file is similar to the configuration of Hartik 3.3.1

**/


/*
 * Copyright (C) 2000 Paolo Gai and ALLEN-DESTRO
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */


#include "eli.h"

void draw_static()
{
  int i;
  /************************************/
  /* Sezione esecutiva della funzione */
  /************************************/

  grx_rect(X0min,Y0min,X0max,Y0max,COL_CORNICE);
  //       grx_rect(X0min+100,Y0min+100,X0max,Y0max,COL_CORNICE);
  grx_line(X0min,Y0min+100,X0min+100,Y0min+100,COL_CORNICE);
  //       grx_line(X0min,Y0min+350,X0min+100,Y0min+350,COL_CORNICE);

  grx_line(X0min+25,Y0min+100,X0min+25,Y0max,COL_CORNICE);
  grx_line(X0min+50,Y0min+100,X0min+50,Y0max,COL_CORNICE);
  grx_line(X0min+75,Y0min+100,X0min+75,Y0max,COL_CORNICE);

  grx_line(X0min,Y0min+100+127,X0min+25,Y0min+100+127,LIGHTBLUE);
  grx_line(X0min+50,Y0min+100+127,X0min+100,Y0min+100+127,LIGHTBLUE);
  grx_line(X0min+50,Y0min+100+127+250,X0min+100,Y0min+100+127+250,LIGHTBLUE);

       
  grx_box(X0min+101+50,400,X0min+230+50,Y0max-1,BROWN);
  for(i=1;i<6;i++){
    grx_box(X0min+101+50+38,400+35*i-10,X0min+101+50+48,400+35*i,CYAN);
    grx_box(X0min+101+50+81,400+35*i-10,X0min+101+50+91,400+35*i,CYAN);
  }
  grx_box(X0min+101+50+60,Y0max-30,X0min+101+50+70,Y0max-1,GREEN);


  grx_box(700,520,X0max-1,Y0max-1,CYAN);



  grx_text("Fx", X0min+5, Y0min+90, COL_TESTO, COL_SFONDO);
  grx_text("Fy", X0min+30, Y0min+90, COL_TESTO, COL_SFONDO);
  grx_text("Ax", X0min+55, Y0min+90, COL_TESTO, COL_SFONDO);
  grx_text("Ay", X0min+80, Y0min+90, COL_TESTO, COL_SFONDO);
  //       grx_text("M", X0min+10, Y0min+351, COL_TESTO, COL_SFONDO);
  //       grx_text("P", X0min+35, Y0min+351, COL_TESTO, COL_SFONDO);
  grx_text("Vx", X0min+55, Y0min+351, COL_TESTO, COL_SFONDO);
  grx_text("Vy", X0min+80, Y0min+351, COL_TESTO, COL_SFONDO);

  grx_text("S   : Su", X0min+110, Y0min+15, COL_TESTO, COL_SFONDO);
  grx_text("Z   : Sinistra", X0min+110, Y0min+25, COL_TESTO, COL_SFONDO);
  grx_text("X   : Giu", X0min+110, Y0min+35, COL_TESTO, COL_SFONDO);
  grx_text("C   : Destra", X0min+110, Y0min+45, COL_TESTO, COL_SFONDO);
  grx_text("P   : aggancia Peso", X0min+110, Y0min+55, COL_TESTO, COL_SFONDO);
  grx_text("L   : Libera peso", X0min+110, Y0min+65, COL_TESTO, COL_SFONDO);
  grx_text("Esc : Usita Programma", X0min+110, Y0min+75, COL_TESTO, COL_SFONDO);


}       // Fine della funzione draw_static

TASK disegna_stato(int i)
{ //double j;

  while (1)
    {
 
      sem_wait(&mutex);

      grx_rect(X0min+100,Y0min+100,X0max,Y0max,COL_CORNICE);

      grx_box(700,565,770,Y0max-1,LIGHTCYAN);
         
      grx_box(X0min+101+50,400,X0min+230+50,420,BROWN);


      //####################### FORZA X #############################
      if ( 0.25<=Forza_x)  grx_box(7,Y0min+210,26,Y0min+220,GREEN);
      else      grx_box(7,Y0min+210,26,Y0min+220,COL_SFONDO);
      if ( 0.5<=Forza_x)  grx_box(7,Y0min+195,26,Y0min+205,GREEN);
      else      grx_box(7,Y0min+195,26,Y0min+205,COL_SFONDO);
      if ( 0.75<=Forza_x) grx_box(7,Y0min+180,26,Y0min+190,GREEN);
      else      grx_box(7,Y0min+180,26,Y0min+190,COL_SFONDO);
      if ( 1<=Forza_x)    grx_box(7,Y0min+165,26,Y0min+175,GREEN);
      else      grx_box(7,Y0min+165,26,Y0min+175,COL_SFONDO);
      if ( 1.25<=Forza_x)  grx_box(7,Y0min+150,26,Y0min+160,GREEN);
      else      grx_box(7,Y0min+150,26,Y0min+160,COL_SFONDO);
      if ( 1.50<=Forza_x)  grx_box(7,Y0min+135,26,Y0min+145,YELLOW);
      else      grx_box(7,Y0min+135,26,Y0min+145,COL_SFONDO);
      if ( 1.75<=Forza_x)  grx_box(7,Y0min+120,26,Y0min+130,RED);
      else      grx_box(7,Y0min+120,26,Y0min+130,COL_SFONDO);
      if ( 2<=Forza_x)  grx_box(7,Y0min+105,26,Y0min+115,RED);
      else      grx_box(7,Y0min+105,26,Y0min+115,COL_SFONDO);
      //###########  ------      
      if (-0.25>=Forza_x)  grx_box(7,Y0min+230,26,Y0min+240,GREEN);
      else      grx_box(7,Y0min+230,26,Y0min+240,COL_SFONDO);
      if ( -0.5>=Forza_x)  grx_box(7,Y0min+245,26,Y0min+255,GREEN);
      else      grx_box(7,Y0min+245,26,Y0min+255,COL_SFONDO);
      if ( -0.75>=Forza_x) grx_box(7,Y0min+260,26,Y0min+270,GREEN);
      else      grx_box(7,Y0min+260,26,Y0min+270,COL_SFONDO);
      if ( -1>=Forza_x)    grx_box(7,Y0min+275,26,Y0min+285,GREEN);
      else      grx_box(7,Y0min+275,26,Y0min+285,COL_SFONDO);
      if ( -1.25>=Forza_x) grx_box(7,Y0min+290,26,Y0min+300,GREEN);
      else      grx_box(7,Y0min+290,26,Y0min+300,COL_SFONDO);
      if ( -1.50>=Forza_x) grx_box(7,Y0min+305,26,Y0min+315,YELLOW);
      else      grx_box(7,Y0min+305,26,Y0min+315,COL_SFONDO);
      if ( -1.75>=Forza_x) grx_box(7,Y0min+320,26,Y0min+330,RED);
      else      grx_box(7,Y0min+320,26,Y0min+330,COL_SFONDO);
      if ( -2>=Forza_x)    grx_box(7,Y0min+335,26,Y0min+345,RED);
      else      grx_box(7,Y0min+335,26,Y0min+345,COL_SFONDO);
      //####################### FORZA Y #############################        
      if ( -0.5>=Forza_y)  grx_box(32,Y0min+340,51,Y0min+345,GREEN);
      else  grx_box(32,Y0min+340,51,Y0min+345,COL_SFONDO);
      if ( -1>=Forza_y)  grx_box(32,Y0min+333,51,Y0min+338,GREEN);
      else  grx_box(32,Y0min+333,51,Y0min+338,COL_SFONDO);
      if ( -1.5>=Forza_y)  grx_box(32,Y0min+326,51,Y0min+331,GREEN);
      else  grx_box(32,Y0min+326,51,Y0min+331,COL_SFONDO);
      if ( -2>=Forza_y)  grx_box(32,Y0min+319,51,Y0min+324,GREEN);
      else  grx_box(32,Y0min+319,51,Y0min+324,COL_SFONDO);
      if ( -2.5>=Forza_y)  grx_box(32,Y0min+312,51,Y0min+317,GREEN);
      else  grx_box(32,Y0min+312,51,Y0min+317,COL_SFONDO);
      if ( -3>=Forza_y)  grx_box(32,Y0min+305,51,Y0min+310,GREEN);
      else  grx_box(32,Y0min+305,51,Y0min+310,COL_SFONDO);
      if ( -3.5>=Forza_y)  grx_box(32,Y0min+298,51,Y0min+303,GREEN);
      else  grx_box(32,Y0min+298,51,Y0min+303,COL_SFONDO);
      if ( -4>=Forza_y)  grx_box(32,Y0min+291,51,Y0min+296,GREEN);
      else  grx_box(32,Y0min+291,51,Y0min+296,COL_SFONDO);
      if ( -4.5>=Forza_y)  grx_box(32,Y0min+284,51,Y0min+289,GREEN);
      else  grx_box(32,Y0min+284,51,Y0min+289,COL_SFONDO);
      if ( -5>=Forza_y) grx_box(32,Y0min+277,51,Y0min+282,GREEN);
      else  grx_box(32,Y0min+277,51,Y0min+282,COL_SFONDO);
      if ( -5.5>=Forza_y) grx_box(32,Y0min+270,51,Y0min+275,GREEN);
      else  grx_box(32,Y0min+270,51,Y0min+275,COL_SFONDO);
      if ( -6>=Forza_y) grx_box(32,Y0min+263,51,Y0min+268,GREEN);
      else  grx_box(32,Y0min+263,51,Y0min+268,COL_SFONDO);
      if ( -6.5>=Forza_y) grx_box(32,Y0min+256,51,Y0min+261,GREEN);
      else  grx_box(32,Y0min+256,51,Y0min+261,COL_SFONDO);
      if ( -7>=Forza_y) grx_box(32,Y0min+249,51,Y0min+254,GREEN);
      else  grx_box(32,Y0min+249,51,Y0min+254,COL_SFONDO);
      if ( -7.5>=Forza_y) grx_box(32,Y0min+242,51,Y0min+247,GREEN);
      else  grx_box(32,Y0min+242,51,Y0min+247,COL_SFONDO);
      if ( -8>=Forza_y) grx_box(32,Y0min+235,51,Y0min+240,GREEN);
      else  grx_box(32,Y0min+235,51,Y0min+240,COL_SFONDO);
      if ( -8.5>=Forza_y) grx_box(32,Y0min+228,51,Y0min+233,GREEN);
      else  grx_box(32,Y0min+228,51,Y0min+233,COL_SFONDO);
      if ( -9>=Forza_y) grx_box(32,Y0min+221,51,Y0min+226,GREEN);
      else  grx_box(32,Y0min+221,51,Y0min+226,COL_SFONDO);
      if ( -9.5>=Forza_y) grx_box(32,Y0min+214,51,Y0min+219,GREEN);
      else  grx_box(32,Y0min+214,51,Y0min+219,COL_SFONDO);
      if ( -10>=Forza_y) grx_box(32,Y0min+207,51,Y0min+212,GREEN);
      else  grx_box(32,Y0min+207,51,Y0min+212,COL_SFONDO);
      if ( -10.5>=Forza_y) grx_box(32,Y0min+200,51,Y0min+205,GREEN);
      else  grx_box(32,Y0min+200,51,Y0min+205,COL_SFONDO);
      if ( -11>=Forza_y) grx_box(32,Y0min+193,51,Y0min+198,GREEN);
      else  grx_box(32,Y0min+193,51,Y0min+198,COL_SFONDO);
      if ( -11.5>=Forza_y) grx_box(32,Y0min+186,51,Y0min+191,GREEN);
      else  grx_box(32,Y0min+186,51,Y0min+191,COL_SFONDO);
      if ( -12>=Forza_y) grx_box(32,Y0min+179,51,Y0min+184,GREEN);
      else  grx_box(32,Y0min+179,51,Y0min+184,COL_SFONDO);
      if ( -12.5>=Forza_y) grx_box(32,Y0min+172,51,Y0min+177,GREEN);
      else  grx_box(32,Y0min+172,51,Y0min+177,COL_SFONDO);
      if ( -13>=Forza_y) grx_box(32,Y0min+165,51,Y0min+170,GREEN);
      else  grx_box(32,Y0min+165,51,Y0min+170,COL_SFONDO);
      if ( -13.5>=Forza_y) grx_box(32,Y0min+158,51,Y0min+163,GREEN);
      else  grx_box(32,Y0min+158,51,Y0min+163,COL_SFONDO);
      if ( -14>=Forza_y) grx_box(32,Y0min+151,51,Y0min+156,GREEN);
      else  grx_box(32,Y0min+151,51,Y0min+156,COL_SFONDO);
      if ( -14.5>=Forza_y) grx_box(32,Y0min+144,51,Y0min+149,GREEN);
      else  grx_box(32,Y0min+144,51,Y0min+149,COL_SFONDO);
      if ( -15>=Forza_y) grx_box(32,Y0min+137,51,Y0min+142,YELLOW);
      else  grx_box(32,Y0min+137,51,Y0min+142,COL_SFONDO);
      if ( -15.5>=Forza_y) grx_box(32,Y0min+130,51,Y0min+135,YELLOW);
      else  grx_box(32,Y0min+130,51,Y0min+135,COL_SFONDO);
      if ( -16>=Forza_y) grx_box(32,Y0min+123,51,Y0min+128,RED);
      else  grx_box(32,Y0min+123,51,Y0min+128,COL_SFONDO);
      if ( -16.5>=Forza_y) grx_box(32,Y0min+116,51,Y0min+121,RED);
      else  grx_box(32,Y0min+116,51,Y0min+121,COL_SFONDO);
      if ( -17>=Forza_y) grx_box(32,Y0min+109,51,Y0min+114,RED);
      else  grx_box(32,Y0min+109,51,Y0min+114,COL_SFONDO);
      if ( -17.5>=Forza_y) grx_box(32,Y0min+102,51,Y0min+107,RED);
      else  grx_box(32,Y0min+102,51,Y0min+107,COL_SFONDO);

      //####################### ACCELERAZIONE X #############################        
      if ( -2.125>=Acc_x)grx_box(56,Y0min+340,75,Y0min+345,RED);
      else  grx_box(55,Y0min+340,75,Y0min+345,COL_SFONDO);
      if ( -2>=Acc_x)  grx_box(56,Y0min+333,75,Y0min+338,RED);
      else  grx_box(56,Y0min+333,75,Y0min+338,COL_SFONDO);
      if ( -1.875>=Acc_x)grx_box(56,Y0min+326,75,Y0min+331,RED);
      else  grx_box(56,Y0min+326,75,Y0min+331,COL_SFONDO);
      if ( -1.750>=Acc_x)  grx_box(56,Y0min+319,75,Y0min+324,YELLOW);
      else  grx_box(56,Y0min+319,75,Y0min+324,COL_SFONDO);
      if ( -1.625>=Acc_x)grx_box(56,Y0min+312,75,Y0min+317,YELLOW);
      else  grx_box(56,Y0min+312,75,Y0min+317,COL_SFONDO);
      if ( -1.5>=Acc_x)  grx_box(56,Y0min+305,75,Y0min+310,GREEN);
      else  grx_box(56,Y0min+305,75,Y0min+310,COL_SFONDO);
      if ( -1.375>=Acc_x)grx_box(56,Y0min+298,75,Y0min+303,GREEN);
      else  grx_box(56,Y0min+298,75,Y0min+303,COL_SFONDO);
      if ( -1.250>=Acc_x)  grx_box(56,Y0min+291,75,Y0min+296,GREEN);
      else  grx_box(56,Y0min+291,75,Y0min+296,COL_SFONDO);
      if ( -1.125>=Acc_x)grx_box(56,Y0min+284,75,Y0min+289,GREEN);
      else  grx_box(56,Y0min+284,75,Y0min+289,COL_SFONDO);
      if ( -1>=Acc_x)  grx_box(56,Y0min+277,75,Y0min+282,GREEN);
      else  grx_box(56,Y0min+277,75,Y0min+282,COL_SFONDO);
      if ( -0.875>=Acc_x)grx_box(56,Y0min+270,75,Y0min+275,GREEN);
      else  grx_box(56,Y0min+270,75,Y0min+275,COL_SFONDO);
      if ( -0.750>=Acc_x)  grx_box(56,Y0min+263,75,Y0min+268,GREEN);
      else  grx_box(56,Y0min+263,75,Y0min+268,COL_SFONDO);
      if ( -0.625>=Acc_x)grx_box(56,Y0min+256,75,Y0min+261,GREEN);
      else  grx_box(56,Y0min+256,75,Y0min+261,COL_SFONDO);
      if ( -0.5>=Acc_x)  grx_box(56,Y0min+249,75,Y0min+254,GREEN);
      else  grx_box(56,Y0min+249,75,Y0min+254,COL_SFONDO);
      if ( -0.375>=Acc_x)grx_box(56,Y0min+242,75,Y0min+247,GREEN);
      else  grx_box(56,Y0min+242,75,Y0min+247,COL_SFONDO);
      if ( -0.250>=Acc_x)  grx_box(56,Y0min+235,75,Y0min+240,GREEN);
      else  grx_box(56,Y0min+235,75,Y0min+240,COL_SFONDO);
      if ( -0.125>=Acc_x)grx_box(56,Y0min+228,75,Y0min+233,GREEN);
      else  grx_box(56,Y0min+228,75,Y0min+233,COL_SFONDO);
      //#############  ------
      if ( 0.125<=Acc_x)  grx_box(56,Y0min+221,75,Y0min+226,GREEN);
      else  grx_box(56,Y0min+221,75,Y0min+226,COL_SFONDO);
      if ( 0.250<=Acc_x)grx_box(56,Y0min+214,75,Y0min+219,GREEN);
      else  grx_box(56,Y0min+214,75,Y0min+219,COL_SFONDO);
      if ( 0.375<=Acc_x) grx_box(56,Y0min+207,75,Y0min+212,GREEN);
      else  grx_box(56,Y0min+207,75,Y0min+212,COL_SFONDO);
      if (0.5<=Acc_x)grx_box(56,Y0min+200,75,Y0min+205,GREEN);
      else  grx_box(56,Y0min+200,75,Y0min+205,COL_SFONDO);
      if ( 0.625<=Acc_x) grx_box(56,Y0min+193,75,Y0min+198,GREEN);
      else  grx_box(56,Y0min+193,75,Y0min+198,COL_SFONDO);
      if (0.750<=Acc_x)grx_box(56,Y0min+186,75,Y0min+191,GREEN);
      else  grx_box(56,Y0min+186,75,Y0min+191,COL_SFONDO);
      if (0.875<=Acc_x)  grx_box(56,Y0min+179,75,Y0min+184,GREEN);
      else  grx_box(56,Y0min+179,75,Y0min+184,COL_SFONDO);
      if (1<=Acc_x)grx_box(56,Y0min+172,75,Y0min+177,GREEN);
      else  grx_box(56,Y0min+172,75,Y0min+177,COL_SFONDO);
      if (1.125<=Acc_x)  grx_box(56,Y0min+165,75,Y0min+170,GREEN);
      else  grx_box(56,Y0min+165,75,Y0min+170,COL_SFONDO);
      if (1.250<=Acc_x)grx_box(56,Y0min+158,75,Y0min+163,GREEN);
      else  grx_box(56,Y0min+158,75,Y0min+163,COL_SFONDO);
      if (1.375<=Acc_x)  grx_box(56,Y0min+151,75,Y0min+156,GREEN);
      else  grx_box(56,Y0min+151,75,Y0min+156,COL_SFONDO);
      if (1.5<=Acc_x)grx_box(56,Y0min+144,75,Y0min+149,GREEN);
      else  grx_box(56,Y0min+144,75,Y0min+149,COL_SFONDO);
      if (1.625<=Acc_x)  grx_box(56,Y0min+137,75,Y0min+142,YELLOW);
      else  grx_box(56,Y0min+137,75,Y0min+142,COL_SFONDO);
      if (1.750<=Acc_x)grx_box(56,Y0min+130,75,Y0min+135,YELLOW);
      else  grx_box(56,Y0min+130,75,Y0min+135,COL_SFONDO);
      if (1.875<=Acc_x)  grx_box(56,Y0min+123,75,Y0min+128,RED);
      else  grx_box(56,Y0min+123,75,Y0min+128,COL_SFONDO);
      if (2<=Acc_x)grx_box(56,Y0min+116,75,Y0min+121,RED);
      else  grx_box(56,Y0min+116,75,Y0min+121,COL_SFONDO);
      if (2.125<=Acc_x)  grx_box(56,Y0min+109,75,Y0min+114,RED);
      else  grx_box(56,Y0min+109,75,Y0min+114,COL_SFONDO);
      //####################### ACCELERAZIONE Y  #############################        
      if ( 2.5<=Acc_y)  {  grx_box(81,Y0min+340,100,Y0min+345,RED);
      grx_box(81+5,Y0min+340+1,100-5,Y0min+345-1,BLUE);
      }
      else    grx_box(81,Y0min+340,100,Y0min+345,COL_SFONDO);
      if ( 2.200<=Acc_y)      grx_box(81,Y0min+333,100,Y0min+338,RED);
      else    grx_box(81,Y0min+333,100,Y0min+338,COL_SFONDO);
      if ( 1.950<=Acc_y)  grx_box(81,Y0min+326,100,Y0min+331,RED);
      else    grx_box(81,Y0min+326,100,Y0min+331,COL_SFONDO);
      if ( 1.750<=Acc_y)  grx_box(81,Y0min+319,100,Y0min+324,YELLOW);
      else    grx_box(81,Y0min+319,100,Y0min+324,COL_SFONDO);
      if ( 1.625<=Acc_y)  grx_box(81,Y0min+312,100,Y0min+317,YELLOW);
      else    grx_box(81,Y0min+312,100,Y0min+317,COL_SFONDO);
      if ( 1.5<=Acc_y)    grx_box(81,Y0min+305,100,Y0min+310,GREEN);
      else    grx_box(81,Y0min+305,100,Y0min+310,COL_SFONDO);
      if ( 1.375<=Acc_y)  grx_box(81,Y0min+298,100,Y0min+303,GREEN);
      else    grx_box(81,Y0min+298,100,Y0min+303,COL_SFONDO);
      if ( 1.250<=Acc_y)  grx_box(81,Y0min+291,100,Y0min+296,GREEN);
      else    grx_box(81,Y0min+291,100,Y0min+296,COL_SFONDO);
      if ( 1.125<=Acc_y)  grx_box(81,Y0min+284,100,Y0min+289,GREEN);
      else    grx_box(81,Y0min+284,100,Y0min+289,COL_SFONDO);
      if ( 1<=Acc_y)      grx_box(81,Y0min+277,100,Y0min+282,GREEN);
      else    grx_box(81,Y0min+277,100,Y0min+282,COL_SFONDO);
      if ( 0.875<=Acc_y)  grx_box(81,Y0min+270,100,Y0min+275,GREEN);
      else    grx_box(81,Y0min+270,100,Y0min+275,COL_SFONDO);
      if ( 0.750<=Acc_y)  grx_box(81,Y0min+263,100,Y0min+268,GREEN);
      else    grx_box(81,Y0min+263,100,Y0min+268,COL_SFONDO);
      if ( 0.625<=Acc_y)  grx_box(81,Y0min+256,100,Y0min+261,GREEN);
      else    grx_box(81,Y0min+256,100,Y0min+261,COL_SFONDO);
      if ( 0.5<=Acc_y)    grx_box(81,Y0min+249,100,Y0min+254,GREEN);
      else    grx_box(81,Y0min+249,100,Y0min+254,COL_SFONDO);
      if ( 0.375<=Acc_y)  grx_box(81,Y0min+242,100,Y0min+247,GREEN);
      else    grx_box(81,Y0min+242,100,Y0min+247,COL_SFONDO);
      if ( 0.25<=Acc_y)  grx_box(81,Y0min+235,100,Y0min+240,GREEN);
      else    grx_box(81,Y0min+235,100,Y0min+240,COL_SFONDO);
      if ( 0.125<=Acc_y)  grx_box(81,Y0min+228,100,Y0min+233,GREEN);
      else    grx_box(81,Y0min+228,100,Y0min+233,COL_SFONDO);
      //#############  ------
      if ( -0.125>=Acc_y)   grx_box(81,Y0min+221,100,Y0min+226,GREEN);
      else    grx_box(81,Y0min+221,100,Y0min+226,COL_SFONDO);
      if ( -0.250>=Acc_y)   grx_box(81,Y0min+214,100,Y0min+219,GREEN);
      else    grx_box(81,Y0min+214,100,Y0min+219,COL_SFONDO);
      if ( -0.375>=Acc_y)       grx_box(81,Y0min+207,100,Y0min+212,GREEN);
      else    grx_box(81,Y0min+207,100,Y0min+212,COL_SFONDO);
      if (-0.5>=Acc_y)    grx_box(81,Y0min+200,100,Y0min+205,GREEN);
      else    grx_box(81,Y0min+200,100,Y0min+205,COL_SFONDO);
      if ( -0.625>=Acc_y)   grx_box(81,Y0min+193,100,Y0min+198,GREEN);
      else    grx_box(81,Y0min+193,100,Y0min+198,COL_SFONDO);
      if (-0.750>=Acc_y)        grx_box(81,Y0min+186,100,Y0min+191,GREEN);
      else    grx_box(81,Y0min+186,100,Y0min+191,COL_SFONDO);
      if (-0.875>=Acc_y)    grx_box(81,Y0min+179,100,Y0min+184,GREEN);
      else    grx_box(81,Y0min+179,100,Y0min+184,COL_SFONDO);
      if (-1>=Acc_y)    grx_box(81,Y0min+172,100,Y0min+177,GREEN);
      else    grx_box(81,Y0min+172,100,Y0min+177,COL_SFONDO);
      if (-1.125>=Acc_y)        grx_box(81,Y0min+165,100,Y0min+170,YELLOW);
      else    grx_box(81,Y0min+165,100,Y0min+170,COL_SFONDO);
      if (-1.250>=Acc_y)    grx_box(81,Y0min+158,100,Y0min+163,YELLOW);
      else    grx_box(81,Y0min+158,100,Y0min+163,COL_SFONDO);
      if (-1.375>=Acc_y)    grx_box(81,Y0min+151,100,Y0min+156,YELLOW);
      else    grx_box(81,Y0min+151,100,Y0min+156,COL_SFONDO);
      if (-1.5>=Acc_y)        grx_box(81,Y0min+144,100,Y0min+149,YELLOW);
      else    grx_box(81,Y0min+144,100,Y0min+149,COL_SFONDO);
      if (-1.625>=Acc_y)    grx_box(81,Y0min+137,100,Y0min+142,RED);
      else    grx_box(81,Y0min+137,100,Y0min+142,COL_SFONDO);
      if (-1.750>=Acc_y)    grx_box(81,Y0min+130,100,Y0min+135,RED);
      else    grx_box(81,Y0min+130,100,Y0min+135,COL_SFONDO);
      if (-1.875>=Acc_y)       grx_box(81,Y0min+123,100,Y0min+128,RED);
      else    grx_box(81,Y0min+123,100,Y0min+128,COL_SFONDO);
      if (-2>=Acc_y)   grx_box(81,Y0min+116,100,Y0min+121,RED);
      else    grx_box(81,Y0min+116,100,Y0min+121,COL_SFONDO);
      if (-2.3>=Acc_y)   grx_box(81,Y0min+109,100,Y0min+114,RED);
      else    grx_box(81,Y0min+109,100,Y0min+114,COL_SFONDO);
      //####################### VELOCITA X #############################        
      //if ( -21.25>=Velocita_x)grx_box(56,Y0min+340+250,75,Y0min+345+250,RED);
      //else  grx_box(55,Y0min+340+250,75,Y0min+345+250,COL_SFONDO);
      if ( -20>=Velocita_x)    grx_box(56,Y0min+333+250,75,Y0min+338+250,RED);
      else  grx_box(56,Y0min+333+250,75,Y0min+338+250,COL_SFONDO);
      if ( -18.75>=Velocita_x)grx_box(56,Y0min+326+250,75,Y0min+331+250,RED);
      else  grx_box(56,Y0min+326+250,75,Y0min+331+250,COL_SFONDO);
      if ( -17.50>=Velocita_x)grx_box(56,Y0min+319+250,75,Y0min+324+250,YELLOW);
      else  grx_box(56,Y0min+319+250,75,Y0min+324+250,COL_SFONDO);
      if ( -16.25>=Velocita_x)grx_box(56,Y0min+312+250,75,Y0min+317+250,YELLOW);
      else  grx_box(56,Y0min+312+250,75,Y0min+317+250,COL_SFONDO);
      if ( -15>=Velocita_x)  grx_box(56,Y0min+305+250,75,Y0min+310+250,GREEN);
      else  grx_box(56,Y0min+305+250,75,Y0min+310+250,COL_SFONDO);
      if ( -13.75>=Velocita_x)grx_box(56,Y0min+298+250,75,Y0min+303+250,GREEN);
      else  grx_box(56,Y0min+298+250,75,Y0min+303+250,COL_SFONDO);
      if ( -12.50>=Velocita_x)grx_box(56,Y0min+291+250,75,Y0min+296+250,GREEN);
      else  grx_box(56,Y0min+291+250,75,Y0min+296+250,COL_SFONDO);
      if ( -11.25>=Velocita_x)grx_box(56,Y0min+284+250,75,Y0min+289+250,GREEN);
      else  grx_box(56,Y0min+284+250,75,Y0min+289+250,COL_SFONDO);
      if ( -10>=Velocita_x)    grx_box(56,Y0min+277+250,75,Y0min+282+250,GREEN);
      else  grx_box(56,Y0min+277+250,75,Y0min+282+250,COL_SFONDO);
      if ( -8.75>=Velocita_x)grx_box(56,Y0min+270+250,75,Y0min+275+250,GREEN);
      else  grx_box(56,Y0min+270+250,75,Y0min+275+250,COL_SFONDO);
      if ( -7.50>=Velocita_x)grx_box(56,Y0min+263+250,75,Y0min+268+250,GREEN);
      else  grx_box(56,Y0min+263+250,75,Y0min+268+250,COL_SFONDO);
      if ( -6.25>=Velocita_x)grx_box(56,Y0min+256+250,75,Y0min+261+250,GREEN);
      else  grx_box(56,Y0min+256+250,75,Y0min+261+250,COL_SFONDO);
      if ( -5>=Velocita_x)  grx_box(56,Y0min+249+250,75,Y0min+254+250,GREEN);
      else  grx_box(56,Y0min+249+250,75,Y0min+254+250,COL_SFONDO);
      if ( -3.75>=Velocita_x)grx_box(56,Y0min+242+250,75,Y0min+247+250,GREEN);
      else  grx_box(56,Y0min+242+250,75,Y0min+247+250,COL_SFONDO);
      if ( -2.50>=Velocita_x)grx_box(56,Y0min+235+250,75,Y0min+240+250,GREEN);
      else  grx_box(56,Y0min+235+250,75,Y0min+240+250,COL_SFONDO);
      if ( -1.25>=Velocita_x)grx_box(56,Y0min+228+250,75,Y0min+233+250,GREEN);
      else  grx_box(56,Y0min+228+250,75,Y0min+233+250,COL_SFONDO);
      //#############  ------
      if ( 1.25<=Velocita_x) grx_box(56,Y0min+221+250,75,Y0min+226+250,GREEN);
      else  grx_box(56,Y0min+221+250,75,Y0min+226+250,COL_SFONDO);
      if ( 2.50<=Velocita_x) grx_box(56,Y0min+214+250,75,Y0min+219+250,GREEN);
      else  grx_box(56,Y0min+214+250,75,Y0min+219+250,COL_SFONDO);
      if ( 3.75<=Velocita_x) grx_box(56,Y0min+207+250,75,Y0min+212+250,GREEN);
      else  grx_box(56,Y0min+207+250,75,Y0min+212+250,COL_SFONDO);
      if (5<=Velocita_x)    grx_box(56,Y0min+200+250,75,Y0min+205+250,GREEN);
      else  grx_box(56,Y0min+200+250,75,Y0min+205+250,COL_SFONDO);
      if ( 6.25<=Velocita_x) grx_box(56,Y0min+193+250,75,Y0min+198+250,GREEN);
      else  grx_box(56,Y0min+193+250,75,Y0min+198+250,COL_SFONDO);
      if (7.50<=Velocita_x)  grx_box(56,Y0min+186+250,75,Y0min+191+250,GREEN);
      else  grx_box(56,Y0min+186+250,75,Y0min+191+250,COL_SFONDO);
      if (8.75<=Velocita_x)  grx_box(56,Y0min+179+250,75,Y0min+184+250,GREEN);
      else  grx_box(56,Y0min+179+250,75,Y0min+184+250,COL_SFONDO);
      if (10<=Velocita_x)      grx_box(56,Y0min+172+250,75,Y0min+177+250,GREEN);
      else  grx_box(56,Y0min+172+250,75,Y0min+177+250,COL_SFONDO);
      if (11.25<=Velocita_x)  grx_box(56,Y0min+165+250,75,Y0min+170+250,GREEN);
      else  grx_box(56,Y0min+165+250,75,Y0min+170+250,COL_SFONDO);
      if (12.50<=Velocita_x)  grx_box(56,Y0min+158+250,75,Y0min+163+250,GREEN);
      else  grx_box(56,Y0min+158+250,75,Y0min+163+250,COL_SFONDO);
      if (13.75<=Velocita_x)  grx_box(56,Y0min+151+250,75,Y0min+156+250,GREEN);
      else  grx_box(56,Y0min+151+250,75,Y0min+156+250,COL_SFONDO);
      if (15<=Velocita_x)    grx_box(56,Y0min+144+250,75,Y0min+149+250,GREEN);
      else  grx_box(56,Y0min+144+250,75,Y0min+149+250,COL_SFONDO);
      if (16.25<=Velocita_x)  grx_box(56,Y0min+137+250,75,Y0min+142+250,YELLOW);
      else  grx_box(56,Y0min+137+250,75,Y0min+142+250,COL_SFONDO);
      if (17.50<=Velocita_x)  grx_box(56,Y0min+130+250,75,Y0min+135+250,YELLOW);
      else  grx_box(56,Y0min+130+250,75,Y0min+135+250,COL_SFONDO);
      if (18.75<=Velocita_x)  grx_box(56,Y0min+123+250,75,Y0min+128+250,RED);
      else  grx_box(56,Y0min+123+250,75,Y0min+128+250,COL_SFONDO);
      if (20<=Velocita_x)      grx_box(56,Y0min+116+250,75,Y0min+121+250,RED);
      else  grx_box(56,Y0min+116+250,75,Y0min+121+250,COL_SFONDO);
      if (21.25<=Velocita_x)  grx_box(56,Y0min+109+250,75,Y0min+114+250,RED);
      else  grx_box(56,Y0min+109+250,75,Y0min+114+250,COL_SFONDO);

      //####################### VELOCITA Y #############################        
      // if ( 160<=Velocita_y)grx_box(81,Y0min+340+250,100,Y0min+345+250,RED);
      // else       grx_box(81,Y0min+340+250,100,Y0min+345+250,COL_SFONDO);
      if ( 40<=Velocita_y)   grx_box(81,Y0min+333+250,100,Y0min+338+250,RED);
      else       grx_box(81,Y0min+333+250,100,Y0min+338+250,COL_SFONDO);
      if ( 37.5<=Velocita_y)grx_box(81,Y0min+326+250,100,Y0min+331+250,RED);
      else       grx_box(81,Y0min+326+250,100,Y0min+331+250,COL_SFONDO);
      if ( 35<=Velocita_y)grx_box(81,Y0min+319+250,100,Y0min+324+250,YELLOW);
      else       grx_box(81,Y0min+319+250,100,Y0min+324+250,COL_SFONDO);
      if ( 32.5<=Velocita_y)grx_box(81,Y0min+312+250,100,Y0min+317+250,YELLOW);
      else       grx_box(81,Y0min+312+250,100,Y0min+317+250,COL_SFONDO);
      if ( 30<=Velocita_y)   grx_box(81,Y0min+305+250,100,Y0min+310+250,GREEN);
      else       grx_box(81,Y0min+305+250,100,Y0min+310+250,COL_SFONDO);
      if ( 27.5<=Velocita_y)grx_box(81,Y0min+298+250,100,Y0min+303+250,GREEN);
      else       grx_box(81,Y0min+298+250,100,Y0min+303+250,COL_SFONDO);
      if ( 25<=Velocita_y)grx_box(81,Y0min+291+250,100,Y0min+296+250,GREEN);
      else       grx_box(81,Y0min+291+250,100,Y0min+296+250,COL_SFONDO);
      if ( 22.5<=Velocita_y)grx_box(81,Y0min+284+250,100,Y0min+289+250,GREEN);
      else       grx_box(81,Y0min+284+250,100,Y0min+289+250,COL_SFONDO);
      if ( 20<=Velocita_y)   grx_box(81,Y0min+277+250,100,Y0min+282+250,GREEN);
      else       grx_box(81,Y0min+277+250,100,Y0min+282+250,COL_SFONDO);
      if ( 17.5<=Velocita_y) grx_box(81,Y0min+270+250,100,Y0min+275+250,GREEN);
      else       grx_box(81,Y0min+270+250,100,Y0min+275+250,COL_SFONDO);
      if ( 15<=Velocita_y) grx_box(81,Y0min+263+250,100,Y0min+268+250,GREEN);
      else       grx_box(81,Y0min+263+250,100,Y0min+268+250,COL_SFONDO);
      if ( 12.5<=Velocita_y) grx_box(81,Y0min+256+250,100,Y0min+261+250,GREEN);
      else       grx_box(81,Y0min+256+250,100,Y0min+261+250,COL_SFONDO);
      if ( 10<=Velocita_y)    grx_box(81,Y0min+249+250,100,Y0min+254+250,GREEN);
      else       grx_box(81,Y0min+249+250,100,Y0min+254+250,COL_SFONDO);
      if ( 7.5<=Velocita_y) grx_box(81,Y0min+242+250,100,Y0min+247+250,GREEN);
      else       grx_box(81,Y0min+242+250,100,Y0min+247+250,COL_SFONDO);
      if ( 5<=Velocita_y) grx_box(81,Y0min+235+250,100,Y0min+240+250,GREEN);
      else       grx_box(81,Y0min+235+250,100,Y0min+240+250,COL_SFONDO);
      if ( 2.5<=Velocita_y) grx_box(81,Y0min+228+250,100,Y0min+233+250,GREEN);
      else       grx_box(81,Y0min+228+250,100,Y0min+233+250,COL_SFONDO);
      //#############  ------
      if (-2.5>=Velocita_y)  grx_box(81,Y0min+221+250,100,Y0min+226+250,GREEN);
      else       grx_box(81,Y0min+221+250,100,Y0min+226+250,COL_SFONDO);
      if (-5>=Velocita_y)  grx_box(81,Y0min+214+250,100,Y0min+219+250,GREEN);
      else       grx_box(81,Y0min+214+250,100,Y0min+219+250,COL_SFONDO);
      if (-7.5>=Velocita_y)  grx_box(81,Y0min+207+250,100,Y0min+212+250,GREEN);
      else       grx_box(81,Y0min+207+250,100,Y0min+212+250,COL_SFONDO);
      if (-10>=Velocita_y)      grx_box(81,Y0min+200+250,100,Y0min+205+250,GREEN);
      else       grx_box(81,Y0min+200+250,100,Y0min+205+250,COL_SFONDO);
      if (-12.5>=Velocita_y)  grx_box(81,Y0min+193+250,100,Y0min+198+250,GREEN);
      else      grx_box(81,Y0min+193+250,100,Y0min+198+250,COL_SFONDO);
      if (-15>=Velocita_y)   grx_box(81,Y0min+186+250,100,Y0min+191+250,GREEN);
      else       grx_box(81,Y0min+186+250,100,Y0min+191+250,COL_SFONDO);
      if (-17.5>=Velocita_y)   grx_box(81,Y0min+179+250,100,Y0min+184+250,GREEN);
      else       grx_box(81,Y0min+179+250,100,Y0min+184+250,COL_SFONDO);
      if (-20>=Velocita_y)     grx_box(81,Y0min+172+250,100,Y0min+177+250,GREEN);
      else       grx_box(81,Y0min+172+250,100,Y0min+177+250,COL_SFONDO);
      if (-22.5>=Velocita_y)  grx_box(81,Y0min+165+250,100,Y0min+170+250,GREEN);
      else       grx_box(81,Y0min+165+250,100,Y0min+170+250,COL_SFONDO);
      if (-25>=Velocita_y)  grx_box(81,Y0min+158+250,100,Y0min+163+250,GREEN);
      else       grx_box(81,Y0min+158+250,100,Y0min+163+250,COL_SFONDO);
      if (-27.5>=Velocita_y)  grx_box(81,Y0min+151+250,100,Y0min+156+250,GREEN);
      else       grx_box(81,Y0min+151+250,100,Y0min+156+250,COL_SFONDO);
      if (-30>=Velocita_y)     grx_box(81,Y0min+144+250,100,Y0min+149+250,GREEN);
      else       grx_box(81,Y0min+144+250,100,Y0min+149+250,COL_SFONDO);
      if (-32.5>=Velocita_y)  grx_box(81,Y0min+137+250,100,Y0min+142+250,YELLOW);
      else       grx_box(81,Y0min+137+250,100,Y0min+142+250,COL_SFONDO);
      if (-35>=Velocita_y)  grx_box(81,Y0min+130+250,100,Y0min+135+250,YELLOW);
      else       grx_box(81,Y0min+130+250,100,Y0min+135+250,COL_SFONDO);
      if (-37.5>=Velocita_y)  grx_box(81,Y0min+123+250,100,Y0min+128+250,RED);
      else       grx_box(81,Y0min+123+250,100,Y0min+128+250,COL_SFONDO);
      if (-40>=Velocita_y)     grx_box(81,Y0min+116+250,100,Y0min+121+250,RED);
      else       grx_box(81,Y0min+116+250,100,Y0min+121+250,COL_SFONDO);
      if (-42.5>=Velocita_y)  grx_box(81,Y0min+109+250,100,Y0min+114+250,RED);
      else       grx_box(81,Y0min+109+250,100,Y0min+114+250,COL_SFONDO);


      sem_post(&mutex);

                             
      task_endcycle();
    }
}