Пример #1
0
void m2_u8g_draw_font_icon(uint8_t x, uint8_t y, uint8_t font, uint8_t icon)
{
  y = m2_u8g_height_minus_one - y;
  
  u8g_SetColorIndex(m2_u8g, m2_u8g_current_text_color);
  
  if ( icon == M2_ICON_TOGGLE_ACTIVE || icon == M2_ICON_TOGGLE_INACTIVE )
  {
    if ( m2_u8g_toggle_icon_font == NULL )
      return;
    u8g_SetFont(m2_u8g, m2_u8g_toggle_icon_font);
    if ( icon == M2_ICON_TOGGLE_ACTIVE )
      u8g_DrawGlyph(m2_u8g, x, y, m2_u8g_toggle_active);
    else
      u8g_DrawGlyph(m2_u8g, x, y, m2_u8g_toggle_inactive);      
  }
  
  if ( icon == M2_ICON_RADIO_ACTIVE || icon == M2_ICON_RADIO_INACTIVE )
  {
    if ( m2_u8g_radio_icon_font == NULL )
      return;
    u8g_SetFont(m2_u8g, m2_u8g_radio_icon_font);
    if ( icon == M2_ICON_RADIO_ACTIVE )
      u8g_DrawGlyph(m2_u8g, x, y, m2_u8g_radio_active);
    else
      u8g_DrawGlyph(m2_u8g, x, y, m2_u8g_radio_inactive);      
  }
  
}
Пример #2
0
/* drawing callback for menu */
int gui_menu_draw_cb(u8g_t *u8g, struct GuiWindow *win,
                struct GuiPoint abspos)
{
    struct GuiMenu *menu = (struct GuiMenu *)win;

    int y0 = menu->selected*10;

    u8g_SetDefaultBackgroundColor(u8g);
    u8g_DrawBox(u8g, abspos.x, y0, abspos.x+10, abspos.y+70);

    // u8g_SetDefaultMidColor(u8g);
    u8g_SetDefaultForegroundColor(u8g);
    u8g_DrawTriangle(u8g, abspos.x, y0,
            abspos.x+10, y0+5,
            abspos.x, y0+10);

    u8g_SetDefaultForegroundColor(u8g);

    for (int i = 0; i < 7; ++i) {
        y0 = (i+1)*10;
        const char *s = menutext[i];

        if (i == menu->selected) {
            u8g_SetFont(u8g, u8g_font_helvB08);
        } else {
            u8g_SetFont(u8g, u8g_font_helvR08);
        }
        u8g_DrawStr(u8g,  abspos.x+12, y0, s);
    }

    return 0;
}
Пример #3
0
void about(mtk_t * mtk) {
	u8g_SetFont(mtk->u8g, u8g_font_helvR24);
	u8g_DrawRFrame(mtk->u8g, 0, 20, 240, 140, 5);
	u8g_DrawRFrame(mtk->u8g, 5, 25, 230, 130, 5);
	u8g_DrawStr(mtk->u8g, 54, 63, "El   Paulo");
	u8g_DrawXBM(mtk->u8g, 86, 24, 24, 63, u8g_logo_bits);
	u8g_DrawRFrame(mtk->u8g, 10, 130, 220, 20, 5);
	u8g_SetFont(mtk->u8g, u8g_font_ncenR10);
	u8g_DrawStr(mtk->u8g, 95, 145, "v.0.1.5");
	u8g_DrawStr(mtk->u8g, 50, 110, "*****@*****.**");
}
Пример #4
0
void draw_logo(uint8_t d)
{
  u8g_SetFont(&u8g, u8g_font_gdr25r);
  u8g_DrawStr(&u8g, 0+d, 30+d, "U");
  u8g_SetFont(&u8g, u8g_font_gdr30n);
  u8g_DrawStr90(&u8g, 23+d,10+d,"8");
  u8g_SetFont(&u8g, u8g_font_gdr25r);
  u8g_DrawStr(&u8g, 53+d,30+d,"g");
  
  u8g_DrawHLine(&u8g, 2+d, 35+d, 47);
  u8g_DrawVLine(&u8g, 45+d, 32+d, 12);
}
Пример #5
0
void draw(void) {
  // graphic commands to redraw the complete screen should be placed here  
  u8g_SetFont(&u8g, u8g_font_helvR08);
  u8g_SetFontPosTop(&u8g);
  
  u8g_DrawStr( &u8g, 0, 0, "Hello World!");

  // Try with/ without below lines

  u8g_SetFont(&u8g, u8g_font_profont11);
  u8g_SetFontPosTop(&u8g);
  u8g_DrawStr( &u8g, 32, 25, "see yah!");
  u8g_DrawPixel(&u8g, 32, 25);
}
Пример #6
0
int main(void)
{
  u8g_uint_t w,h;
  u8g_uint_t r, g, b, x, y;
  u8g_t u8g;
  
  u8g_Init(&u8g, &u8g_dev_sdl_8bit);
  u8g_FirstPage(&u8g);
  do
  {
    u8g_SetFont(&u8g, u8g_font_10x20);
    u8g_SetFont(&u8g, u8g_font_fur25);

    /*
  for ( x = 0; x < 128; x++ )
    for ( y = 0; y < 64; y++ )
    {
      u8g_SetColorIndex(&u8g, ((x&3)+y*4) & 255);
      u8g_DrawPixel(&u8g, x, y);
    }
    */
  w = 4;
  h = 4;
  for( b = 0; b < 4; b++ )
    for( g = 0; g < 8; g++ )
      for( r = 0; r < 8; r++ )
      {
        u8g_SetColorIndex(&u8g, (r<<5) |  (g<<2) | b );
        u8g_DrawBox(&u8g, g*w + b*w*8, r*h, w, h);
        u8g_DrawBox(&u8g, g*w + b*w*8, r*h+32, w, h);
      }

    
    w = u8g_GetFontBBXWidth(&u8g);
    h = u8g_GetFontBBXHeight(&u8g);
    u8g_SetColorIndex(&u8g, 1);
    u8g_DrawStr(&u8g, 20, 40, "U8glib");
    u8g_SetColorIndex(&u8g, 2);
    u8g_DrawStr(&u8g, 20+1, 40+1, "U8glib");
    u8g_SetColorIndex(&u8g, 3);
    u8g_DrawStr(&u8g, 20+2, 40+2, "U8glib");
    
  }while( u8g_NextPage(&u8g) );
  
  while( u8g_sdl_get_key() < 0 )
    ;
  
  return 0;
}
Пример #7
0
uint8_t dog_DrawStrP(uint8_t x, uint8_t y, DOG_PGM_P font, const u8g_pgm_uint8_t  *s)
{
  y = dog_height_minus_one - y;
  u8g_SetFont(&u8g_dogm128_obj, font);
  u8g_SetColorIndex(&u8g_dogm128_obj, 1);
  return u8g_DrawStrP(&u8g_dogm128_obj, x, y, s);
}
Пример #8
0
ICACHE_FLASH_ATTR
static void draw_upgrade(DrawingState *state) {
    u8g_SetFont(&(state->u8g), u8g_font_6x10);
    u8g_SetFontPosCenter(&(state->u8g));
    u8g_DrawStr(&(state->u8g), 0, 8, "upgrading fw...");
    icon_draw_center(&(state->u8g), 128 / 2, 16 + (48 / 2), icon_update);
}
Пример #9
0
void drawMainMenu(uint8_t menuPosition){
	char *mainMenuStrings[MAIN_MENU_ITEMS] = {"Last swim", "New Swim"};
	uint8_t i, h;
	u8g_uint_t w, d;
	u8g_SetFont(&u8g, u8g_font_6x13);
	u8g_SetFontRefHeightText(&u8g);
	u8g_SetFontPosTop(&u8g);
	h = u8g_GetFontAscent(&u8g) - u8g_GetFontDescent(&u8g);
	w = u8g_GetWidth(&u8g);
	
	char vccChar[10];
	my_itoa(vcc, vccChar, 10);

	// Doing the actual drawing
	u8g_FirstPage(&u8g);
	do{
		
		for (i = 0; i < MAIN_MENU_ITEMS; i++){
			d = (w - u8g_GetStrWidth(&u8g, mainMenuStrings[i])) / 2;
			u8g_SetDefaultForegroundColor(&u8g);
			if (i == menuPosition){
				u8g_DrawBox(&u8g, 0, i*h+1, w, h);
				u8g_SetDefaultBackgroundColor(&u8g);
			}
			u8g_DrawStr(&u8g, d, i*h, mainMenuStrings[i]);
		}
		u8g_SetDefaultForegroundColor(&u8g);
		u8g_DrawFrame(&u8g, 0, 0, 128, 64);
		
		u8g_DrawStr(&u8g, 5, 50, vccChar);
	} while (u8g_NextPage(&u8g));
}
Пример #10
0
uint8_t m2_u8g_get_font_icon_height(uint8_t font, uint8_t icon)
{
  if ( icon == M2_ICON_TOGGLE_ACTIVE || icon == M2_ICON_TOGGLE_INACTIVE )
  {
    u8g_SetFont(m2_u8g, m2_u8g_toggle_icon_font);
  }
  else if ( icon == M2_ICON_RADIO_ACTIVE || icon == M2_ICON_RADIO_INACTIVE )
  {
    u8g_SetFont(m2_u8g, m2_u8g_radio_icon_font);
  }
  else
  {
    return 0;
  }
  return u8g_GetFontAscent(m2_u8g)-u8g_GetFontDescent(m2_u8g);
}
Пример #11
0
int main(void)
{
  u8g_uint_t w,h;
  u8g_t u8g;
  
  u8g_Init(&u8g, &u8g_dev_stdout);
  u8g_FirstPage(&u8g);
  do
  {
    u8g_SetColorIndex(&u8g, 1);
    u8g_SetFont(&u8g, u8g_font_10x20);
    w = u8g_GetFontBBXWidth(&u8g);
    h = u8g_GetFontBBXHeight(&u8g);
    u8g_DrawStr(&u8g, 0, h, 0, "ABCgdef");
    //u8g_DrawStr(&u8g, 0, 5, 0, "g");
    //u8g_DrawStr(&u8g, 10, 7, 0, "g");
    //u8g_DrawStr(&u8g, 20, 9, 0, "g");
    //u8g_DrawFrame(&u8g, 2, 2, 9, 3);
    //u8g_DrawFrame(&u8g, 0, 0, 13, 7);
    //u8g_DrawHLine( &u8g, 0, 16, 50 );   
    
    u8g_SetColorIndex(&u8g, 0);
    
    //u8g_DrawHLine( &u8g, 0, 17, 50 );   
    
    
  }while( u8g_NextPage(&u8g) );
  return 0;
}
Пример #12
0
// Showing the record screen
void showRecordScreen(void){
	char lengthStr[4], totLenTimeStr[9], curLenTimeStr[9];
	itoa(currentLength, lengthStr, 10);
	timeToString(totLenTime, totLenTimeStr);
	timeToString(curLenTime, curLenTimeStr);

	u8g_FirstPage(&u8g);
	u8g_SetDefaultForegroundColor(&u8g);
	u8g_SetFont(&u8g, u8g_font_6x13);
	do{
		// Draw boxes
		u8g_DrawLine(&u8g, 64, 0, 64, 64);
		u8g_DrawLine(&u8g, 64, 32, 128, 32);
		
		// Draw text
		u8g_DrawFrame(&u8g, 0, 0, 128, 64);
		u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, "Length"))/2, 5, "Length");		
		u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, lengthStr))/2, 32+5, lengthStr);
		
		u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, "Total"))/2, 5, "Total");
		u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, totLenTimeStr))/2, 5+15, totLenTimeStr);
		
		u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, "Last len"))/2, 5+32, "Last len");
		//u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, timeToString(lastLengthTime, rS)))/2, 5+32+15, timeToString(lastLengthTime, rS));

	} while (u8g_NextPage(&u8g));
}
Пример #13
0
void draw_Intro(void){ //Show various info about device
  u8g_SetFont(&u8g, NORMALFONT);

  u8g_DrawStr (&u8g, 14, 12, "ALTIMETER!");
  u8g_DrawStr (&u8g, 20, 30, "V34, 2016");
  u8g_DrawStr (&u8g, 10, 45, "GNU GPL V3");
  u8g_DrawStr (&u8g, 15, 64, "Ahmet Onat");
}
Пример #14
0
int main(void)
{
  u8g_uint_t w,h;
  u8g_t u8g;
  
  u8g_Init(&u8g, &u8g_dev_sdl_1bit);
  u8g_SetCursorFont(&u8g, u8g_font_cursor);
  u8g_SetCursorStyle(&u8g, 34);
  u8g_SetCursorColor(&u8g, 1, 0);
  u8g_EnableCursor(&u8g);
  
  for(;;)
  {
    
    u8g_FirstPage(&u8g);
    do
    {
      u8g_SetColorIndex(&u8g, 1);
      u8g_SetFont(&u8g, u8g_font_10x20);
      //u8g_SetFont(&u8g, u8g_font_fur17);
      w = u8g_GetFontBBXWidth(&u8g);
      h = u8g_GetFontBBXHeight(&u8g);
      //u8g_DrawStr(&u8g, 0, 2*h, 0, "ABCgdef");
      u8g_DrawStrDir(&u8g, 0, 5, 0, "g");
      u8g_DrawStrDir(&u8g, 10, 7, 0, "g");
      u8g_DrawStrDir(&u8g, 20, 9, 0, "g");
      u8g_DrawStrDir(&u8g, 20, 9, 0, "ga");

      //u8g_DrawStr(&u8g, 40, 9, 0, "g");
      u8g_DrawStr(&u8g, 70+3, 25, "gabc");
      u8g_DrawStr90(&u8g, 70, 25+3, "gabc");
      u8g_DrawStr180(&u8g, 70-3, 25, "gabc");
      u8g_DrawStr270(&u8g, 70, 25-3, "gabc");

      
      //u8g_DrawFrame(&u8g, 2, 2, 9, 3);
      //u8g_DrawFrame(&u8g, 0, 0, 13, 7);
      //u8g_DrawHLine( &u8g, 0, 16, 50 );   
      
      u8g_SetColorIndex(&u8g, 1);
      
      u8g_DrawHLine( &u8g, 0, 3, 127 );   
      
      u8g_SetColorIndex(&u8g, 0);
      u8g_DrawHLine( &u8g, 0, 4, 127 );   

    }while( u8g_NextPage(&u8g) );

    while( uiStep(&u8g) == 0 )
      ;
    printf("%d %d\n", cursor_x, cursor_y);
    u8g_SetCursorPos(&u8g, cursor_x, cursor_y);
  }
  
  
  return 0;
}
Пример #15
0
static void calculate_dimensions() {

    // When we query font dimensions, base them on the largest extent of all
    // the glyphs in the font:
    u8g_SetFontRefHeightAll( u8g );

    u8g_SetFont( u8g, num_selector_num_font );
    num_font_height = u8g_GetFontAscent( u8g );
    num_font_vsize = num_font_height - u8g_GetFontDescent( u8g );

    u8g_SetFont( u8g, menu_title_font );
    menu_title_font_height = u8g_GetFontAscent( u8g );
    menu_title_font_vsize = menu_title_font_height - u8g_GetFontDescent( u8g );

    u8g_SetFont( u8g, menu_list_font );
    menu_list_font_height = u8g_GetFontAscent( u8g );
    menu_list_font_vsize = menu_list_font_height - u8g_GetFontDescent( u8g );

}
Пример #16
0
uint8_t m2_u8g_get_font_icon_width(uint8_t font, uint8_t icon)
{
  char s[2];
  s[1] = '\0';
  if ( icon == M2_ICON_TOGGLE_ACTIVE || icon == M2_ICON_TOGGLE_INACTIVE )
  {
    s[0] = m2_u8g_toggle_active;
    u8g_SetFont(m2_u8g, m2_u8g_toggle_icon_font);
    return u8g_GetStrWidth(m2_u8g, s);
  }
  
  if ( icon == M2_ICON_RADIO_ACTIVE || icon == M2_ICON_RADIO_INACTIVE )
  {
    s[0] = m2_u8g_radio_active;
    u8g_SetFont(m2_u8g, m2_u8g_radio_icon_font);
    return u8g_GetStrWidth(m2_u8g, s);
  }
  return 0;
}
Пример #17
0
void u8g_DrawLogo(void) //,,Verschönerung" zum Zeit ,,schinden" am Anfang für UM6
{
    u8g_FirstPage(&u8g);
    do
    {
        u8g_DrawXBMP(&u8g, 1, 0, 126, 46, logo);
        u8g_SetFont(&u8g, u8g_font_6x10); //Schriftart
        u8g_DrawStr(&u8g, 20, 	60, "Kalibriere UM6...");
    } while(u8g_NextPage(&u8g));
}
Пример #18
0
void Display::DrawMainScreen()
{
	DrawFrostIcon();
	DrawWaterIcon();
	u8g_SetFont(&u8g, u8g_font_5x8);
	u8g_DrawStr(&u8g, 0, 36, "set");

	u8g_SetFont(&u8g, u8g_font_7x13);
	for (int i = 0; i < 3; i++)
	{
		u8g_DrawStr(&u8g, 20, ((i+1)*12), temp[i]);
	}

	if (strlen(errorText) > 0)
	{
		u8g_DrawStr(&u8g, 0, 48, errorText);
	}
	else if (heatingState)
		u8g_DrawStr(&u8g, 0, 48, "Heating");

	u8g_DrawStr(&u8g, 0, 64, statusBar);

	u8g_DrawVLine(&u8g,64,0 ,52);
	u8g_DrawHLine(&u8g,0 ,51,64);

	if (radioState)
	{
		if (radioStereo)
		{
			u8g_SetFont(&u8g, u8g_font_5x8);
			u8g_DrawStr(&u8g, 108, 8, "st");
			u8g_SetFont(&u8g, u8g_font_7x13);
		}
		u8g_DrawStr(&u8g, 73, 26, radioChannel);
		DrawSignalStrength();
	}
	if (audioState)
	{
		u8g_DrawStr(&u8g, 81, 38, "Source:");
		u8g_DrawStr(&u8g, 66, 50, audioSource);
	}
}
Пример #19
0
void draw(uint8_t pos)
{
  //u8g_SetFont(&u8g, u8g_font_unifont);
  //char tokenstr[256]; 
  //u8g_DrawBox(&u8g, 1,1+pos,100,100);
  u8g_DrawXBM(&u8g, pos-64,0, threatbutt_width, threatbutt_height, threatbutt_bits);
  if(line_valid == 1){
      u8g_SetFont(&u8g, u8g_font_profont22r);
      u8g_DrawStr(&u8g, pos, 20, ip_addr);
      u8g_SetFont(&u8g, u8g_font_gdr11r);
      u8g_DrawStr(&u8g, pos, 40, attacker);
      //token = strtok(NULL, ';'); 
       
      u8g_DrawStr(&u8g, pos, 60, vector);
      //while(tokstr != NULL) {
      //  tokstr = strtok(NULL,";");
      //  u8g_DrawStr(&u8g, pos, 40, tokstr);
      //  } 
  }
}
Пример #20
0
uint8_t m2_u8g_get_box_icon_size(uint8_t font)
{
    int8_t x;
    u8g_SetFont(m2_u8g, m2_u8g_get_font(font));
    x = u8g_GetFontAscent(m2_u8g)-u8g_GetFontDescent(m2_u8g);
    x*=5;
    x >>=3;
    if ( x < 6 )
      x = 6;
    return x;
}
Пример #21
0
//It is unfortunate that QNH as argument here is different from global ONH...
// TODO: Fix it sometime...
void draw_alt(int pressure, int temperature, int altitude_m, int altitude_ft, int QNH)
{
  //Display locations:
  const int BARO_x=2, BARO_y=13;
  //const int TEMP_x=4, TEMP_y=20;
  const int ALTM_x=4, ALTM_y=30;
  const int ALTFT_x=30, ALTFT_y=47;
  const int QNH_x=2, QNH_y=62;
  char array[BUFSIZE];
  u8g_SetFont(&u8g, NORMALFONT);

  if(pressure>0){
    xsprintf(array, "P:%uhpa T:%uC", pressure,temperature);  
  }else{
  xsprintf(array, "P:-%uhpa T:%uC", -pressure,temperature);  
  }
  u8g_DrawStr(&u8g, BARO_x, BARO_y, array);
  //  xsprintf(array, "Temp : %u", temperature);
  //  u8g_DrawStr(&u8g, TEMP_x, TEMP_y, array);

  u8g_DrawStr (&u8g, 0, ALTFT_y-8, "Alt:");
  u8g_DrawStr (&u8g, ALTFT_x+76, ALTFT_y-8, "ft");
  
  xsprintf(array, "QNH: %uhpa", QNH);
  u8g_DrawStr(&u8g, QNH_x, QNH_y, array);


  u8g_SetFont(&u8g, u8g_font_fub25n);  //This also works...
  if (altitude_ft>=0){  //Workaround with %u in displaying negative values.
    xsprintf(array, "%u",altitude_ft);
  }else{
    xsprintf(array, "-%u",-altitude_ft);
  }
  u8g_DrawStr(&u8g, ALTFT_x, ALTFT_y, array);
  //  xsprintf(array, "Alt  : %u m",altitude_m);
  //u8g_DrawStr(&u8g, ALTM_x, ALTM_y, array);

  
  //u8g_DrawRFrame(&u8g, 8,6,96,38,8);// (x,y,h,l,radius)

}
Пример #22
0
void draw_url(void)
{
  u8g_SetFont(&u8g, u8g_font_4x6);
  if ( u8g_GetHeight(&u8g) < 59 )
  {
    u8g_DrawStr(&u8g, 53,9,"code.google.com");
    u8g_DrawStr(&u8g, 77,18,"/p/u8glib");
  }
  else
  {
    u8g_DrawStr(&u8g, 1,54,"code.google.com/p/u8glib");
  }
}
Пример #23
0
void menu_draw(menu_t *menu, u8g_t *u8g)
{
	uint8_t i, h;
	static char ramstr[32];
	menu_buttons_t *b;
	u8g_uint_t w, d;
	
	if(!menu)
		return;
	
	// Calculate text size
	u8g_SetFont(u8g, u8g_font_5x7);
	u8g_SetFontRefHeightText(u8g);
	u8g_SetFontPosTop(u8g);
	h = u8g_GetFontAscent(u8g)-u8g_GetFontDescent(u8g);
	w = u8g_GetWidth(u8g);
	for( i = 0;; i++ ) {        // draw all menu items
		// Copy string from program memory to a work string in RAM
		strncpy_P(ramstr, (PGM_P)pgm_read_word(&(menu->strings[i])), sizeof(ramstr));
		ramstr[31] = 0;
		// Zero length string marks end of string list. 
		if(!ramstr[0])
			break;
		// Get its length in pixels
		d = (w-u8g_GetStrWidth(u8g, ramstr))/2;
		// Set foreground color
		u8g_SetDefaultForegroundColor(u8g);
		// If item selected
		if ( i == menu->selected ) {            // current selected menu item
			u8g_DrawBox(u8g, 0, i*h+1, w, h);   // draw cursor bar
			u8g_SetDefaultBackgroundColor(u8g);
		}
		// Display the string
		u8g_DrawStr(u8g, d, i*h, ramstr);
	}
	
	// Remember menu item count
	menu->item_count = i;
	
	// Ensure text and background are set back to normal
	u8g_SetDefaultForegroundColor(u8g);
	
	// If there are soft buttons, draw them here
	if(menu->buttons){	
		for(b = menu->buttons; b; b = b->next){
			strncpy_P(ramstr, b->label, sizeof(ramstr));
			ramstr[31] = 0;
			u8g_DrawStr(u8g, b->col, b->row, ramstr);
		}
	}
}
Пример #24
0
void draw_qnh(int pressure, int temperature, int altitude_m, int altitude_ft, int QNH)
{
  //Display locations:
  const int BARO_x=2, BARO_y=13;
  //  const int TEMP_x=2, TEMP_y=20;
  //  const int ALTM_x=2, ALTM_y=30;
  const int ALTFT_x=2, ALTFT_y=22; //was 28
  const int QNH_x=45, QNH_y=62;
  char array[BUFSIZE];

  u8g_SetFont(&u8g, NORMALFONT);

  //  xsprintf(array, "P:%uhpa, T:%uC", pressure,temperature);  
  //  u8g_DrawStr(&u8g, BARO_x, BARO_y, array);
  //  xsprintf(array, "Temp : %u", temperature);
  //  u8g_DrawStr(&u8g, TEMP_x, TEMP_y, array);

  if (altitude_ft>0){
    xsprintf(array, "Alt: %uft, %um",altitude_ft, altitude_m);
  }else{
    xsprintf(array, "Alt: -%uft, -%um",-altitude_ft, -altitude_m);
  }
  u8g_DrawStr(&u8g, ALTFT_x, ALTFT_y, array);
  //  xsprintf(array, "Alt  : %u m",altitude_m);
  //u8g_DrawStr(&u8g, ALTM_x, ALTM_y, array);

  u8g_DrawStr (&u8g, QNH_x-45, QNH_y-15, "QNH");
  u8g_DrawStr (&u8g, QNH_x-45, QNH_y-2, "hpa");
  u8g_SetFont(&u8g, u8g_font_fub25n);  //This also works...

  xsprintf(array, "%u", QNH);
  u8g_DrawStr(&u8g, QNH_x, QNH_y, array);
  
  //u8g_DrawRFrame(&u8g, 8,6,96,38,8);// (x,y,h,l,radius)

}
Пример #25
0
void draw(void)
{
  u8g_SetFont(&u8g, u8g_font_fixed_v0r);
  //u8g_SetFont(&u8g, u8g_font_7x13r);
  u8g_DrawStr(&u8g, 0, 10, "Analog Values");
  u8g_DrawStr(&u8g, 0, 20, u8g_u16toa(adc_val1, 4));
  u8g_DrawStr(&u8g, 40, 20, u8g_u16toa(adc_val2, 4));
  u8g_DrawStr(&u8g, 80, 20, sign == 0 ? "+" : "-");
  u8g_DrawStr(&u8g, 80+8, 20, u8g_u16toa(val, 3));
  
  draw_signed(0, 30, sval);
  draw_signed(40, 30, min);
  draw_signed(80, 30, max);
  
}
Пример #26
0
// Lua: u8g.setFont( self, font )
static int lu8g_setFont( lua_State *L )
{
    lu8g_userdata_t *lud;

    if ((lud = get_lud( L )) == NULL)
        return 0;

    u8g_fntpgm_uint8_t *font = (u8g_fntpgm_uint8_t *)lua_touserdata( L, 2 );
    if (font != NULL)
        u8g_SetFont( LU8G, font );
    else
        luaL_argerror(L, 2, "font data expected");

    return 0;
}
Пример #27
0
int xmain(void)
{
  u8g_uint_t w,h;
  u8g_t u8g;
  
  u8g_Init(&u8g, &u8g_dev_sdl_1bit);
  u8g_FirstPage(&u8g);
  u8g_SetCursorFont(&u8g, u8g_font_cursor);
  do
  {
    u8g_SetColorIndex(&u8g, 1);
    u8g_SetFont(&u8g, u8g_font_9x18);
    //u8g_SetFont(&u8g, u8g_font_fur17);
    w = u8g_GetFontBBXWidth(&u8g);
    h = u8g_GetFontBBXHeight(&u8g);
    //u8g_DrawStr(&u8g, 0, 2*h, 0, "ABCgdef");
    u8g_DrawStrDir(&u8g, 0, 5, 0, "g");
    u8g_DrawStrDir(&u8g, 10, 7, 0, "g");
    u8g_DrawStrDir(&u8g, 20, 9, 0, "g");
    u8g_DrawStrDir(&u8g, 20, 9, 0, "ga");

    //u8g_DrawStr(&u8g, 40, 9, 0, "g");
    u8g_DrawStr(&u8g, 70+3, 25, "gabc");
    u8g_DrawStr90(&u8g, 70, 25+3, "gabc");
    u8g_DrawStr180(&u8g, 70-3, 25, "gabc");
    u8g_DrawStr270(&u8g, 70, 25-3, "gabc");

    
    //u8g_DrawFrame(&u8g, 2, 2, 9, 3);
    //u8g_DrawFrame(&u8g, 0, 0, 13, 7);
    //u8g_DrawHLine( &u8g, 0, 16, 50 );   
    
    u8g_SetColorIndex(&u8g, 1);
    
    u8g_DrawHLine( &u8g, 0, 3, 127 );   
    
    u8g_SetColorIndex(&u8g, 0);
    u8g_DrawHLine( &u8g, 0, 4, 127 );   
    
    
  }while( u8g_NextPage(&u8g) );
  
  while( u8g_sdl_get_key() < 0 )
    ;
  
  return 0;
}
Пример #28
0
void draw_clip_test(void) {
  u8g_uint_t i, j, k;
  char buf[3] = "AB";
  k = 0;
  u8g_SetColorIndex(&u8g, 1);
  u8g_SetFont(&u8g, u8g_font_6x10);
  
  /*
  u8g_DrawHLine(&u8g, 0-3, 5, 5);
  
  for( i = 0; i  < 6; i++ ) {
    for( j = 1; j  < 8; j++ ) {
      u8g_DrawHLine(&u8g, i-3, k, j);
      u8g_DrawHLine(&u8g, i-3+10, k, j);
      
      u8g_DrawVLine(&u8g, k+20, i-3, j);
      u8g_DrawVLine(&u8g, k+20, i-3+10, j);
      
      k++;
    }
  }
  */
  /*
  u8g_DrawStr(&u8g, 0-3, 50, buf);
  u8g_DrawStr180(&u8g, 0+3, 50, buf);
  
  u8g_DrawStr(&u8g, u8g_GetWidth(&u8g)-3, 40, buf);
  u8g_DrawStr180(&u8g, u8g_GetWidth(&u8g)+3, 40, buf);

  u8g_DrawStr90(&u8g, u8g_GetWidth(&u8g)-10, 0-3, buf);
  u8g_DrawStr270(&u8g, u8g_GetWidth(&u8g)-10, 3, buf);

  u8g_DrawStr90(&u8g, u8g_GetWidth(&u8g)-20, u8g_GetHeight(&u8g)-3, buf);
  u8g_DrawStr270(&u8g, u8g_GetWidth(&u8g)-20, u8g_GetHeight(&u8g)+3, buf);  
  */
  
  u8g_DrawStr(&u8g, 1, 20, "H");


/*  
  u8g_DrawBox(&u8g, 0, 0, 10, 10);
  u8g_DrawBox(&u8g, u8g_GetWidth(&u8g)-10-1, 0, 10, 10);
  u8g_DrawBox(&u8g, u8g_GetWidth(&u8g)-10-1, u8g_GetHeight(&u8g)-10-1, 10, 10);
  u8g_DrawBox(&u8g, 0, u8g_GetHeight(&u8g)-10-1, 10, 10);
*/  
}
Пример #29
0
static void draw_menu( ui_menu_t * menu ) {

    // Render title bar and background:
    draw_page( menu->title );

    // Draw list:
    u8g_SetFont( u8g, menu_list_font );
    int y = page_body_start + menu_list_vpad + menu_list_font_height + 1;
    int step = menu_list_font_vsize + ( menu_list_vpad << 1 ) + 1;
    int indent = menu_list_hpad + u8g_GetStrWidth( u8g, "2. " );
    ui_menu_item_t * items = menu->items;
    for ( int i = 0; i < menu->num_items; i++ ) {

        // Check if y descends beyond bottom of display:
        if ( y > 127 ) {
            break;
        }

        // Set item color:
        ui_menu_item_t * item = &items[ i ];
        switch ( item->type ) {

            case UI_DUMMY:
                display_set_draw_color( &menu_list_disabled_color_fg );
                break;

            case UI_FLAG:
                if ( ! get_flag_state( item->number, item->bit ) ) {
                    display_set_draw_color( &menu_list_disabled_color_fg );
                    break;
                }

            default:
                display_set_draw_color( &menu_list_color_fg );
        }

        // Draw item number:
        char number[] = "n. ";
        number[ 0 ] = 0x31 + i;
        u8g_DrawStr( u8g, menu_list_hpad, y, number );

        // Draw item label:
        u8g_DrawStr( u8g, indent, y, item->label );
        y += step;
    }
}
Пример #30
0
int display_putc( char c)
{
	char buf[2];
	buf[1]=0x00;
	buf[0]=c;
	if(c=='\r') {
		cur_x++;
	}
	if(c=='\n') {
		cur_y=0;
	}
    u8g_SetFont(&u8g, u8g_font_6x10);
	u8g_DrawStr(&u8g, cur_x, cur_y, buf);
	cur_y++;

	return 1;
}