static void u8g_init_data(u8g_t *u8g) { u8g->font = NULL; u8g->cursor_font = NULL; u8g->cursor_bg_color = 0; u8g->cursor_fg_color = 1; u8g->cursor_encoding = 34; u8g->cursor_fn = (u8g_draw_cursor_fn)0; #if defined(U8G_WITH_PINLIST) { uint8_t i; for( i = 0; i < U8G_PIN_LIST_LEN; i++ ) u8g->pin_list[i] = U8G_PIN_NONE; } #endif u8g_SetColorIndex(u8g, 1); u8g_SetFontPosBaseline(u8g); u8g->font_height_mode = U8G_FONT_HEIGHT_MODE_XTEXT; u8g->font_ref_ascent = 0; u8g->font_ref_descent = 0; u8g->font_line_spacing_factor = 64; /* 64 = 1.0, 77 = 1.2 line spacing factor */ u8g->line_spacing = 0; u8g->state_cb = u8g_state_dummy_cb; }
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; y++; /* 13 Jan 2013: Issue 95 */ 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); } }
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; }
/* x1 must be lower or equal to x2 */ void dog_SetHLine(uint8_t x1, uint8_t x2, uint8_t y) { //printf("SetHLine x1:%d x2:%d y:%d\n", x1, x2, y); y = dog_height_minus_one - y; u8g_SetColorIndex(&u8g_dogm128_obj, 1); u8g_DrawHLine(&u8g_dogm128_obj, x1, y, x2-x1+1); //printf("SetHLine x:%d y:%d w:%d \n", x1, y, x2-x1+1); }
void dog_SetVLine(uint8_t x, uint8_t y1, uint8_t y2) { y1 = dog_height_minus_one - y1; y2 = dog_height_minus_one - y2; u8g_SetColorIndex(&u8g_dogm128_obj, 1); u8g_DrawVLine(&u8g_dogm128_obj, x, y2, y1-y2+1); }
void m2_u8g_draw_bitmap_icon(uint8_t x, uint8_t y, uint8_t font, uint8_t icon) { const u8g_pgm_uint8_t *ptr = m2_u8g_icon0; if ( icon == M2_ICON_TOGGLE_ACTIVE || icon == M2_ICON_RADIO_ACTIVE ) ptr = m2_u8g_icon1; //dog_SetBitmapP(x,y+7,ptr,8,8); u8g_SetColorIndex(m2_u8g, m2_u8g_current_text_color); u8g_DrawBitmapP(m2_u8g, x, m2_u8g_height_minus_one - (y+8), 1, 8, ptr); }
// Lua: u8g.setColorIndex( self, color ) static int lu8g_setColorIndex( lua_State *L ) { lu8g_userdata_t *lud; if ((lud = get_lud( L )) == NULL) return 0; u8g_SetColorIndex( LU8G, luaL_checkinteger( L, 2 ) ); return 0; }
/* origin is low left */ void m2_u8g_draw_box(uint8_t x0, uint8_t y0, uint8_t w, uint8_t h) { u8g_uint_t y; /* transform y to upper left */ y = m2_u8g_dev_variables.m2_u8g_height_minus_one; y -= y0; y -= h; y++; /* 13 Jan 2013: Issue 95 */ u8g_SetColorIndex(m2_u8g_dev_variables.m2_u8g, m2_u8g_dev_variables.m2_u8g_draw_color); u8g_DrawBox(m2_u8g_dev_variables.m2_u8g, x0, y, w, h); }
void m2_u8g_draw_frame(uint8_t x0, uint8_t y0, uint8_t w, uint8_t h) { u8g_uint_t y; y = m2_u8g_dev_variables.m2_u8g_height_minus_one; y -= y0; y -= h; y++; /* 13 Jan 2013: Issue 95 */ u8g_SetColorIndex(m2_u8g_dev_variables.m2_u8g, m2_u8g_dev_variables.m2_u8g_draw_color); u8g_DrawFrame(m2_u8g_dev_variables.m2_u8g, x0, y, w, h); /* printf("draw_frame: x=%d y=%d w=%d h=%d\n", x0, y, w, h); */ }
void m2_u8g_draw_frame_shadow(uint8_t x0, uint8_t y0, uint8_t w, uint8_t h) { u8g_uint_t y; y = m2_u8g_dev_variables.m2_u8g_height_minus_one; y -= y0; y -= h; y++; /* 13 Jan 2013: Issue 95 */ w--; h--; u8g_SetColorIndex(m2_u8g_dev_variables.m2_u8g, m2_u8g_dev_variables.m2_u8g_draw_color); u8g_DrawFrame(m2_u8g_dev_variables.m2_u8g, x0, y, w, h); u8g_DrawVLine(m2_u8g_dev_variables.m2_u8g, x0+w, y+1, h); u8g_DrawHLine(m2_u8g_dev_variables.m2_u8g, x0+1, y+h, w); }
void m2_u8g_draw_box_icon(uint8_t x, uint8_t y, uint8_t font, uint8_t icon) { uint8_t h; h = m2_u8g_get_box_icon_size(font); y = m2_u8g_height_minus_one - y; u8g_SetColorIndex(m2_u8g, m2_u8g_current_text_color); u8g_DrawFrame(m2_u8g, x, y - h, h, h); if ( icon == M2_ICON_TOGGLE_ACTIVE || icon == M2_ICON_RADIO_ACTIVE ) { h -= 4; u8g_DrawBox(m2_u8g, x + 2, y - h - 2, h, h); } }
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); */ }
void display_init(void) { /* select minimal prescaler (max system speed) */ CLKPR = 0xFF; // SCK MOSI CS D/C u8g_InitSPI(&u8g, &u8g_dev_ssd1325_nhd27oled_2x_gr_sw_spi, PN(5, 6), PN(5, 5), PN(4, 7),PN(5,7), PN(4,6)); u8g_SetRot180(&u8g); /* assign default color value */ u8g_SetColorIndex(&u8g, 3); /* max intensity */ // u8g_SetColorIndex(&u8g, 1); /* pixel on */ u8g_SetFont(&u8g, u8g_font_profont11); u8g_SetFontRefHeightExtendedText(&u8g); u8g_SetDefaultForegroundColor(&u8g); u8g_SetFontPosTop(&u8g); }
int main(void) { u8g_t u8g; u8g_Init(&u8g, &u8g_dev_sdl_1bit_h); u8g_FirstPage(&u8g); do { u8g_SetColorIndex(&u8g, 1); u8g_DrawPixel(&u8g,0,0); u8g_DrawPixel(&u8g,0,1); u8g_SetFont(&u8g, u8g_font_unifont); //u8g_SetFont(&u8g, u8g_font_10x20); //u8g_SetFont(&u8g, u8g_font_gdb17); u8g_SetFontRefHeightText(&u8g); //u8g_SetRefHeightAll(&u8g); //u8g_SetFontPosBaseline(&u8g); //u8g_SetFontPosCenter(&u8g); u8g_SetFontPosTop(&u8g); glyph(&u8g, 5,25, 'g'); u8g_SetFontPosCenter(&u8g); glyph(&u8g, 5+25,25, 'g'); u8g_SetFontPosBaseline(&u8g); glyph(&u8g, 5+2*25,25, 'g'); u8g_SetFontPosBottom(&u8g); glyph(&u8g, 5+3*25,25, 'g'); }while( u8g_NextPage(&u8g) ); while( u8g_sdl_get_key() < 0 ) ; return 0; }
void u8g_SetDefaultForegroundColor(u8g_t *u8g) { u8g_SetColorIndex(u8g, u8g_GetDefaultForegroundColor(u8g)); }
uint8_t m2_gh_u8g_cffs(m2_gfx_arg_p arg) { switch(arg->msg) { case M2_GFX_MSG_DRAW_NORMAL_NO_FOCUS: if ( (arg->font & 4) != 0 ) { /* highlight flag is set, draw frame with shadow */ m2_u8g_draw_color_box(arg->x+1, arg->y+1, arg->w-2, arg->h-2, m2_u8g_highlight_bg_color); m2_u8g_draw_color_frame_shadow(arg->x+m2_u8g_dev_variables.m2_gh_u8g_invisible_frame_border_x_size, arg->y, arg->w-2*m2_u8g_dev_variables.m2_gh_u8g_invisible_frame_border_x_size, arg->h, m2_u8g_highlight_frame_color, m2_u8g_highlight_shadow_color); } m2_u8g_dev_variables.m2_u8g_current_text_color = m2_u8g_dev_variables.m2_u8g_fg_text_color; // if ( m2_gh_u8g_invert_at_depth < m2_gh_u8g_current_depth ) // { // m2_u8g_current_text_color = m2_u8g_bg_text_color; // } break; case M2_GFX_MSG_DRAW_NORMAL_PARENT_FOCUS: break; case M2_GFX_MSG_DRAW_NORMAL_FOCUS: if ( (arg->font & 4) != 0 ) { /* highlight version draw frame with shadow together with a filled box */ //m2_u8g_current_text_color = m2_u8g_bg_text_color; m2_u8g_dev_variables.m2_u8g_current_text_color = m2_u8g_dev_variables.m2_u8g_fg_text_color; m2_u8g_draw_color_box(arg->x+1, arg->y+1, arg->w-2, arg->h-2, m2_u8g_highlight_focus_bg_color); m2_u8g_draw_color_frame_shadow(arg->x+m2_u8g_dev_variables.m2_gh_u8g_invisible_frame_border_x_size, arg->y, arg->w-2*m2_u8g_dev_variables.m2_gh_u8g_invisible_frame_border_x_size, arg->h, m2_u8g_highlight_focus_frame_color, m2_u8g_highlight_focus_shadow_color); // m2_gh_u8g_invert_at_depth = m2_gh_u8g_current_depth; } else { /* normal version draw only the frame with shadow */ m2_u8g_dev_variables.m2_u8g_current_text_color = m2_u8g_dev_variables.m2_u8g_fg_text_color; m2_u8g_draw_color_box(arg->x+1, arg->y+1, arg->w-2, arg->h-2, m2_u8g_normal_focus_bg_color); m2_u8g_draw_color_frame_shadow(arg->x+m2_u8g_dev_variables.m2_gh_u8g_invisible_frame_border_x_size, arg->y, arg->w-2*m2_u8g_dev_variables.m2_gh_u8g_invisible_frame_border_x_size, arg->h, m2_u8g_normal_focus_frame_color, m2_u8g_normal_focus_shadow_color); } // printf("invert %d, width %d x:%d y:%d\n", m2_gh_u8g_invert_at_depth, arg->w, arg->x, arg->y); break; case M2_GFX_MSG_DRAW_SMALL_FOCUS: /* m2_u8g_current_text_color = m2_u8g_bg_text_color; m2_u8g_draw_color_box(arg->x, arg->y, arg->w, arg->h, m2_u8g_fg_text_color); */ m2_u8g_dev_variables.m2_u8g_current_text_color = m2_u8g_dev_variables.m2_u8g_fg_text_color; m2_u8g_draw_color_box(arg->x, arg->y, arg->w, arg->h, m2_u8g_small_focus_bg_color); break; case M2_GFX_MSG_DRAW_GO_UP: /* does not work because of missing xor... also: can not be fixed with FRAME_DRAW_AT_END m2_u8g_current_text_color = m2_u8g_bg_text_color; */ m2_u8g_draw_color_box(arg->x, arg->y, arg->w, arg->h/2, m2_u8g_exit_data_entry_color); break; case M2_GFX_MSG_GET_NORMAL_BORDER_HEIGHT: return 3; case M2_GFX_MSG_GET_NORMAL_BORDER_WIDTH: return 3+2*m2_u8g_dev_variables.m2_gh_u8g_invisible_frame_border_x_size+2*m2_u8g_dev_variables.m2_gh_u8g_additional_text_border_x_size; case M2_GFX_MSG_GET_NORMAL_BORDER_X_OFFSET: return 1+m2_u8g_dev_variables.m2_gh_u8g_invisible_frame_border_x_size+m2_u8g_dev_variables.m2_gh_u8g_additional_text_border_x_size; case M2_GFX_MSG_GET_NORMAL_BORDER_Y_OFFSET: return 2; case M2_GFX_MSG_GET_LIST_OVERLAP_HEIGHT: return 0; case M2_GFX_MSG_GET_LIST_OVERLAP_WIDTH: return 0; case M2_GFX_MSG_IS_FRAME_DRAW_AT_END: return 0; /* focus (highlight) is drawn first, then the text string */ case M2_GFX_MSG_START: u8g_SetColorIndex(m2_u8g_dev_variables.m2_u8g, m2_u8g_background_color); u8g_DrawBox(m2_u8g_dev_variables.m2_u8g, 0, 0, u8g_GetWidth(m2_u8g_dev_variables.m2_u8g), u8g_GetHeight(m2_u8g_dev_variables.m2_u8g)); break; } return m2_gh_u8g_base(arg); }
void dog_ClrPixel(uint8_t x, uint8_t y) { y = dog_height_minus_one - y; u8g_SetColorIndex(&u8g_dogm128_obj, 0); u8g_DrawPixel(&u8g_dogm128_obj, x, y); }
uint8_t m2_gh_u8g_base(m2_gfx_arg_p arg) { /* Do a safety check here: Abort if m2_SetU8g has not been called */ if ( m2_u8g_dev_variables.m2_u8g == NULL ) return 0; /* Proceed with normal message processing */ switch(arg->msg) { case M2_GFX_MSG_INIT: break; case M2_GFX_MSG_START: /* check for proper setup */ break; case M2_GFX_MSG_END: break; case M2_GFX_MSG_DRAW_HLINE: u8g_DrawHLine(m2_u8g_dev_variables.m2_u8g, arg->x, m2_u8g_dev_variables.m2_u8g_height_minus_one - arg->y, arg->w); break; case M2_GFX_MSG_DRAW_VLINE: u8g_DrawVLine(m2_u8g_dev_variables.m2_u8g, arg->x, m2_u8g_dev_variables.m2_u8g_height_minus_one - arg->y, arg->h); break; case M2_GFX_MSG_DRAW_BOX: m2_u8g_draw_box(arg->x, arg->y, arg->w, arg->h); break; case M2_GFX_MSG_DRAW_TEXT: { u8g_uint_t x = arg->x; u8g_uint_t y; u8g_SetColorIndex(m2_u8g_dev_variables.m2_u8g, m2_u8g_dev_variables.m2_u8g_current_text_color); u8g_SetFont(m2_u8g_dev_variables.m2_u8g, m2_u8g_get_font(arg->font)); u8g_SetFontPosBottom(m2_u8g_dev_variables.m2_u8g); if ( (arg->font & 8) != 0 ) { if ( arg->w != 0 ) { x = arg->w; x -= u8g_GetStrWidth(m2_u8g_dev_variables.m2_u8g, arg->s); x >>= 1; x += arg->x; } } y = m2_u8g_dev_variables.m2_u8g_height_minus_one; y -= arg->y; y++; /* 13 Jan 2013: Issue 95, problem 2 */ x -= u8g_GetStrX(m2_u8g_dev_variables.m2_u8g, arg->s); //x += m2_gh_u8g_additional_text_border_x_size; u8g_DrawStr(m2_u8g_dev_variables.m2_u8g, x, y, arg->s); // printf("DRAW_TEXT: x=%d y=%d s=%s\n", x, y, arg->s); } break; case M2_GFX_MSG_DRAW_TEXT_P: { u8g_uint_t x = arg->x; u8g_uint_t y; u8g_SetColorIndex(m2_u8g_dev_variables.m2_u8g, m2_u8g_dev_variables.m2_u8g_current_text_color); u8g_SetFont(m2_u8g_dev_variables.m2_u8g, m2_u8g_get_font(arg->font)); u8g_SetFontPosBottom(m2_u8g_dev_variables.m2_u8g); if ( (arg->font & 8) != 0 ) { if ( arg->w != 0 ) { x = arg->w; x -= u8g_GetStrWidthP(m2_u8g_dev_variables.m2_u8g, (const u8g_pgm_uint8_t *)arg->s); x >>= 1; x += arg->x; } } y = m2_u8g_dev_variables.m2_u8g_height_minus_one; y -= arg->y; x -= u8g_GetStrXP(m2_u8g_dev_variables.m2_u8g, (const u8g_pgm_uint8_t *)arg->s); //x += m2_gh_u8g_additional_text_border_x_size; y++; /* 13 Jan 2013: Issue 95, problem 2 */ u8g_DrawStrP(m2_u8g_dev_variables.m2_u8g, x, y, (const u8g_pgm_uint8_t *)arg->s); }
void dog_ClrHLine(uint8_t x1, uint8_t x2, uint8_t y) { y = dog_height_minus_one - y; u8g_SetColorIndex(&u8g_dogm128_obj, 0); u8g_DrawHLine(&u8g_dogm128_obj, x1, y, x2-x1+1); }
void u8g_SetDefaultBackgroundColor(u8g_t *u8g) { u8g_SetColorIndex(u8g, u8g_GetDefaultBackgroundColor(u8g)); /* pixel on / black */ }
void u8g_SetDefaultMidColor(u8g_t *u8g) { u8g_SetColorIndex(u8g, u8g_GetDefaultMidColor(u8g)); }
ICACHE_FLASH_ATTR static void draw_normal(DrawingState *state) { uint8_t buf[50]; u8g_SetColorIndex(&(state->u8g), 1); drawingRefreshIcons(state); uint8_t iconWidth = 40; //current measured temperature u8g_SetFont(&(state->u8g), u8g_font_helvB18); u8g_SetFontPosTop(&(state->u8g)); os_sprintf(buf, "%d", state->currentTemp / 100); uint8_t currentTempWidth = u8g_GetStrWidth(&(state->u8g), buf); uint8_t cWidth = u8g_GetStrWidth(&(state->u8g), "C"); uint8_t strHeight = u8g_GetFontAscent(&(state->u8g)); u8g_SetFont(&(state->u8g), u8g_font_helvR08); u8g_SetFontPosBaseline(&(state->u8g)); os_sprintf(buf, "%02d", abs(state->currentTemp % 100)); uint8_t webTempWidth = u8g_GetStrWidth(&(state->u8g), buf); u8g_DrawStr(&(state->u8g), iconWidth + (128 - iconWidth) / 2 - (currentTempWidth + cWidth + webTempWidth) / 2 + currentTempWidth, 16 + strHeight, buf); u8g_SetFont(&(state->u8g), u8g_font_helvB18); u8g_SetFontPosTop(&(state->u8g)); os_sprintf(buf, "%d", state->currentTemp / 100); u8g_DrawStr(&(state->u8g), iconWidth + (128 - iconWidth) / 2 - (currentTempWidth + cWidth + webTempWidth) / 2, 16, buf); u8g_DrawStr(&(state->u8g), iconWidth + (128 - iconWidth) / 2 - (currentTempWidth + cWidth + webTempWidth) / 2 + currentTempWidth + webTempWidth, 16, "C"); //web text if (state->weather.code != 255) { u8g_SetFont(&(state->u8g), u8g_font_6x10); u8g_SetFontPosBottom(&(state->u8g)); os_sprintf(buf, "%s", state->weather.text); currentTempWidth = u8g_GetStrWidth(&(state->u8g), buf); strHeight = u8g_GetFontBBXHeight(&(state->u8g)); u8g_DrawStr(&(state->u8g), iconWidth + (128 - iconWidth) / 2 - currentTempWidth / 2, 64, buf); } //web temperature u8g_SetFont(&(state->u8g), u8g_font_6x10); u8g_SetFontPosBottom(&(state->u8g)); os_sprintf(buf, "%dC", state->weather.temp); uint8_t outsideTempWidth = u8g_GetStrWidth(&(state->u8g), buf); u8g_DrawStr(&(state->u8g), iconWidth + (128 - iconWidth) / 2 - outsideTempWidth / 2, 64 - strHeight, buf); u8g_SetFont(&(state->u8g), u8g_font_6x10); u8g_SetFontPosCenter(&(state->u8g)); if (state->temperatureMode == MANUAL) { os_sprintf(buf, "Manual: %d.%02dC", state->manualTemp / 100, abs(state->manualTemp % 100)); } else if (state->temperatureMode == AUTOMATIC) { if (state->automaticTempCurrentState == NULL) { os_sprintf(buf, "Auto"); } else { os_sprintf(buf, "A:%d.%02dC, %d:%02d", state->automaticTempCurrentState->temp / 100, abs(state->automaticTempCurrentState->temp % 100), state->automaticTempCurrentState->time / 60, state->automaticTempCurrentState->time % 60); } } u8g_DrawStr(&(state->u8g), 0, 8, buf); }