Ejemplo n.º 1
0
void displayRssiLine()
{
  if (TELEMETRY_STREAMING()) {
    //lcd_hline(0, 55, 128, 0); // separator
    //uint8_t rssi = min((uint8_t)99, frskyData.rssi[1].value);
    //lcd_putsLeft(STATUS_BAR_Y, STR_TX); lcd_outdezNAtt(4*FW, STATUS_BAR_Y, rssi, LEADING0, 2);
    //lcd_rect(25, 57, 38, 7);
    //lcd_filled_rect(26, 58, 4*rssi/11, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
	//	uint8_t rssi = min((uint8_t)99, frskyData.rssi[0].value);
	//    lcd_putsAtt(0,STATUS_BAR_Y, PSTR("Signal"),0); lcd_outdezAtt(8*FW, STATUS_BAR_Y, rssi, 0);
	//	lcd_putsAtt(9*FW-5,STATUS_BAR_Y, PSTR("%"),0);
	//if (g_model.timers[0].mode) {										
    lcd_puts(0,STATUS_BAR_Y, PSTR("Time"));
	putsTime(6*FW+5*FWNUM+2, STATUS_BAR_Y, timersStates[0].val, 0, 0);
   // } 
	//lcd_rect(65, 57, 38, 7);
    //uint8_t v = 4*rssi/11;
    //lcd_filled_rect(66+36-v, 58, v, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
	lcd_putsAtt(11*FW-1,STATUS_BAR_Y, PSTR("TxBat"),0); putsVBat(20*FW+8,STATUS_BAR_Y,0);	
  }
  else {
    lcd_putsAtt(7*FW, STATUS_BAR_Y, STR_NODATA, BLINK);
    // lcd_status_line();
  }
}
Ejemplo n.º 2
0
void menuProcStatistic(uint8_t event)
{
  TITLE("STAT");
  switch(event)
  {
    case EVT_KEY_FIRST(KEY_UP):
      chainMenu(menuProcStatistic2);
      break;
    case EVT_KEY_FIRST(KEY_DOWN):
    case EVT_KEY_FIRST(KEY_EXIT):
      chainMenu(menuMainView);
      break;
  }

  lcd_puts_P(  1*FW, FH*1, PSTR("TME"));
  putsTime(    5*FW, FH*1, s_timeCumAbs, 0, 0);
  lcd_puts_P( 17*FW, FH*1, PSTR("TSW"));
  putsTime(   11*FW, FH*1, s_timeCumSw,      0, 0);

  lcd_puts_P(  1*FW, FH*2, PSTR("STK"));
  putsTime(    5*FW, FH*2, s_timeCumThr, 0, 0);
  lcd_puts_P( 17*FW, FH*2, PSTR("ST%"));
  putsTime(   11*FW, FH*2, s_timeCum16ThrP/16, 0, 0);

  lcd_puts_P( 17*FW, FH*0, PSTR("TOT"));
  putsTime(   11*FW, FH*0, s_timeCumTot, 0, 0);

  uint16_t traceRd = s_traceCnt>MAXTRACE ? s_traceWr : 0;
  uint8_t x=5;
  uint8_t y=60;
  lcd_hline(x-3,y,120+3+3);
  lcd_vline(x,y-32,32+3);

  for(uint8_t i=0; i<120; i+=6)
  {
    lcd_vline(x+i+6,y-1,3);
  }
  for(uint8_t i=1; i<=120; i++)
  {
    lcd_vline(x+i,y-s_traceBuf[traceRd],s_traceBuf[traceRd]);
    traceRd++;
    if(traceRd>=MAXTRACE) traceRd=0;
    if(traceRd==s_traceWr) break;
  }
}
Ejemplo n.º 3
0
void menuTraceBuffer(uint8_t event)
{
  switch(event)
  {
    case EVT_KEY_LONG(KEY_ENTER):
      dumpTraceBuffer();
      killEvents(event);
      break;
  }

  SIMPLE_SUBMENU("Trace Buffer " VERS_STR, TRACE_BUFFER_LEN);
  /* RTC time */
  struct gtm t;
  gettime(&t);
  putsTime(LCD_W+1, 0, t, TIMEBLINK);

  uint8_t y = 0;
  uint8_t k = 0;
  int8_t sub = m_posVert;

  lcd_putc(0, FH, '#');
  lcd_puts(4*FW, FH, "Time");
  lcd_puts(14*FW, FH, "Event");
  lcd_puts(20*FW, FH, "Data");

  for (uint8_t i=0; i<LCD_LINES-2; i++) {
    y = 1 + (i+2)*FH;
    k = i+s_pgOfs;

    //item
    lcd_outdezAtt(0, y, k, LEFT | (sub==k ? INVERS : 0));

    const struct TraceElement * te = getTraceElement(k);
    if (te) {
      //time
      putstime_t tme = te->time % SECS_PER_DAY;
      putsTimer(4*FW, y, tme, TIMEHOUR|LEFT, TIMEHOUR|LEFT);
      //event
      lcd_outdezNAtt(14*FW, y, te->event, LEADING0|LEFT, 3);
      //data
      lcd_putsn  (20*FW, y, "0x", 2);
      lcd_outhex4(22*FW-2, y, (uint16_t)(te->data >> 16));
      lcd_outhex4(25*FW, y, (uint16_t)(te->data & 0xFFFF));
    }

  }


}
Ejemplo n.º 4
0
void menuProcNMEA1(uint8_t event)
{
    switch(event)						// new event received, branch accordingly
    {
    case EVT_KEY_BREAK(KEY_LEFT):
        chainMenu(menuProcNMEA4);
        break;
    case EVT_KEY_BREAK(KEY_RIGHT):
        chainMenu(menuProcNMEA2);
        break;
    case EVT_KEY_LONG(KEY_UP):
        NMEA_DisableRXD();
        chainMenu(menuProcStatistic);
        break;
    case EVT_KEY_LONG(KEY_DOWN):
        NMEA_DisableRXD();
        chainMenu(menuProc0);
        break;
    case EVT_KEY_FIRST(KEY_MENU):
        if (show_timer == 0) {
            show_timer = 1;
            if (gpstimer <= 0)
                gpstimer = bintime(rbuf[2]);
        }
        else
            show_timer = 0;
        break;
    case EVT_KEY_FIRST(KEY_EXIT):
        if ((show_timer == 1) &&(rbuf[2][0]))
            gpstimer = bintime(rbuf[2]);		// get actual GPS time ->resets timer to 00:00
        break;
    }
    /*
    How to use:

    You choose the values to be displayed using the function:

      initval(<number>, <packet>, <value>);
      -------------------------------------

    That means that "<value>" of "<packet>" is stored in the <number> buffer.
    The first <number> is 0.

    Here are the packet names and the associated value names:

    Position packet (beginning with "GGA"): "PACK_GGA"
    value names: "TIM", "LAT", "NOS", "LON", "EOW", "FIX", "SAT", "DIL", "ALT", "MTR", "GEO", "MET", "AGE", "DIF",

    Required minimum packet (beginning with "RMC"): "PACK_RMC"
       value names: "TIM", "NRW", "LT1", "NSO", "LN1", "EWE", "SOG", "COG", "DAT", "MAG", "EAW"

    The buffers are accessed using the macro "VALSTR(<n>)", where "<n>" is "0"
    for the first buffer, and "1" for the second buffer.

    When a value is missing, it is replaced by the contents of val_unknown ("?").
*/

    if (ggareceived)
    {
        gpstime=bintime(rbuf[2]);
        ggareceived=0;
    }

    initval (LONG_BUF(0), PACK_RMC, TIM);					// sets rbuf[0][.]
    initval (LONG_BUF(1), PACK_RMC, DAT);					// sets rbuf[1][.]
    initval (SHORT_BUF(0), PACK_RMC, NRW);				// sets sbuf[0]
    initval (SHORT_BUF(2), PACK_GGA, SAT);				// -> sbuf[2]


    title ('1');
    lcd_puts_P        (   2*FW,   1*FH, PSTR("UTC-Time      Sat"));

    if (rbuf[0][0]) {								// show always if data have been received
	  lcd_putcAtt   (  19*FW,   1*FH, sbuf[2], 0);				// satellites in view
        lcd_putsnAtt  (   2*FW,   2*FH, &rbuf[0][0], 2, APSIZE);		// hours
        lcd_putcAtt   (   6*FW,   2*FH, ':', DBLSIZE);			// ":"
        lcd_putsnAtt  (   8*FW,   2*FH, &rbuf[0][2], 2, APSIZE);		// minutes
        lcd_putcAtt   (  12*FW,   2*FH, ':', DBLSIZE);			// ":"
        lcd_putsnAtt  (  14*FW,   2*FH, &rbuf[0][4], 2, APSIZE);		// seconds
    }
    else
        lcd_putsAtt   (   2*FW,   2*FH, val_unknown, APSIZE);		// "?"

    if ((show_timer == 1) && rbuf[0][0])  {					// show the Timer when data have been received

        lcd_puts_P    (   2*FW,   4*FH, PSTR("Timer"));			// display "Timer"
        putsTime      (   5*FW,   5*FH, (gpstime-gpstimer), DBLSIZE, DBLSIZE);	// display difference as mm:ss
    }
    else
    {
        lcd_puts_P      ( 2*FW,   4*FH, PSTR("Date"));			// show the UTC Date	

        if (rbuf[1][0])	{
            lcd_putsnAtt( 2*FW,   5*FH, &rbuf[1][0], 2, APSIZE);		// year
            lcd_putcAtt ( 6*FW,   5*FH, '/', DBLSIZE);			// "/" 
            lcd_putsnAtt( 8*FW,   5*FH, &rbuf[1][2], 2, APSIZE);		// month
            lcd_putcAtt (12*FW,   5*FH, '/', DBLSIZE);			// "/"
            lcd_putsnAtt(14*FW,   5*FH, &rbuf[1][4], 2, APSIZE);		// day
        }
        else
            lcd_putsAtt   (   2*FW,   5*FH, val_unknown, APSIZE);		// "?"
    }
}
Ejemplo n.º 5
0
void menuProcNMEA1(uint8_t event)
{
    if (rmcreceived) initval (LONG_BUF(0), PACK_RMC, TIM);		// sets rbuf[0][.]
    passes +=1;
    count=0;
    switch(event)						// new event received, branch accordingly
    {
    case EVT_KEY_BREAK(KEY_LEFT):
#if defined(HUB)
        chainMenu(menuProcNMEA5);
#else
        chainMenu(menuProcNMEA4);
#endif
        break;
    case EVT_KEY_BREAK(KEY_RIGHT):
        chainMenu(menuProcNMEA2);
        break;
    case EVT_KEY_LONG(KEY_UP):
        NMEA_DisableRXD();
        chainMenu(menuProcStatistic);
        break;
    case EVT_KEY_LONG(KEY_DOWN):
        NMEA_DisableRXD();

#if defined(OPEN9X)
        chainMenu(menuMainView);
#else
        chainMenu(menuProc0);
#endif

        break;
    case EVT_KEY_FIRST(KEY_MENU):
        if (show_timer == 0) {
            show_timer = 1;
            if (gpstimer <= 0)
                gpstimer = bintime(rbuf[0]);
        }
        else
            show_timer = 0;
        break;
    case EVT_KEY_FIRST(KEY_EXIT):
        if ((show_timer == 1) &&(rbuf[0][0])) {
            gpstimer = bintime(rbuf[0]);		// get actual GPS time ->resets timer to 00:00
		}
        break;
    }
    /*
    How to use:

    You choose the values to be displayed using the function:

      initval(<number>, <packet>, <value>);
      -------------------------------------

    That means that "<value>" of "<packet>" is stored in the <number> buffer.
    The first <number> is 0.

	$GPGGA,125109.272,5014.7262,N,01123.9966,E,2,07,1.2,624.7,M,47.7,M,1.9,0000*77
	$GPRMC,125109.272,A,5014.7262,N,01123.9966,E,33.439922,47.98,230711,,*09
    Here are the packet names and the associated value names:

    Position packet (beginning with "GGA"): "PACK_GGA"
    value names: "TIM", "LAT", "NOS", "LON", "EOW", "FIX", "SAT", "DIL", "ALT", "MTR", "GEO", "MET", "AGE", "DIF",

    Required minimum packet (beginning with "RMC"): "PACK_RMC"
       value names: "TIM", "NRW", "LT1", "NSO", "LN1", "EWE", "SOG", "COG", "DAT", "MAG", "EAW"

    The buffers are accessed using the macro "VALSTR(<n>)", where "<n>" is "0"
    for the first buffer, and "1" for the second buffer.

    sbuf is a single character buffer and contains the last value of a field ????
    rbuf[x][y] contains the full field

    When a value is missing, it is replaced by the contents of val_unknown ("?").
*/

    title ('1');
    my_lcd_puts        (   2*FW,   1*FH, PSTR("UTC-Time      Sat"));

    if (ggareceived) {
	  ggareceived=0;
	  passes=0;
	  initval (SHORT_BUF(1), PACK_GGA, FIX);				// -> sbuf[1]
	  fixed=(sbuf[1]>0x30) ? ATTRIB : 0 ;
    }

    if (rmcreceived) {
	  rmcreceived=0;
	  initval (LONG_BUF(1), PACK_RMC, DAT);					// sets rbuf[1][.]
	  gpstime=bintime(rbuf[0]);
    }

    if (rbuf[0][0]) {						// show always if RMC data have been received
	  initval (LONG_BUF(4), PACK_GGA, SAT);				// -> rbuf[4]			
	  lcd_putsnAtt  (  19*FW,   1*FH, &rbuf[4][0], 2, 16+fixed);	// satellites in view, invers if Fixed
	
     	  lcd_putsnAtt  (   2*FW,   2*FH, &rbuf[0][0], 2, APSIZE);		// hours
        lcd_putcAtt   (   6*FW,   2*FH, ':', DBLSIZE);			// ":"
     	  lcd_putsnAtt  (   8*FW,   2*FH, &rbuf[0][2], 2, APSIZE);		// minutes
        lcd_putcAtt   (  12*FW,   2*FH, ':', DBLSIZE);			// ":"
     	  lcd_putsnAtt  (  14*FW,   2*FH, &rbuf[0][4], 2, APSIZE);		// seconds
    }
    else
     	  lcd_putsAtt   (   2*FW,   2*FH, val_unknown, APSIZE);		// "?"


    if (show_timer)  {							// show the Timer when data have been received

        my_lcd_puts    (   2*FW,   4*FH, PSTR("Timer"));			// display "Timer"
     	  putsTime      (   5*FW,   5*FH, (gpstime-gpstimer), DBLSIZE, DBLSIZE);	// display difference as mm:ss
    }
    else
    {
     	  my_lcd_puts      ( 2*FW,   4*FH, PSTR("Date"));			// show the UTC Date	

        if (rbuf[1][0])	{
     	      lcd_putsnAtt( 2*FW,   5*FH, &rbuf[1][0], 2, APSIZE);		// year
           	lcd_putcAtt ( 6*FW,   5*FH, '/', DBLSIZE);			// "/" 
            lcd_putsnAtt( 8*FW,   5*FH, &rbuf[1][2], 2, APSIZE);		// month
     	      lcd_putcAtt (12*FW,   5*FH, '/', DBLSIZE);			// "/"
           	lcd_putsnAtt(14*FW,   5*FH, &rbuf[1][4], 2, APSIZE);		// day
        }
    } 
     question(9,3);		// large blinking Questionmark in case of timeout

}