From 2ca6847b4069400eff8670b954fef8b77bda709a Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 1 Nov 2023 10:58:07 +0800 Subject: [PATCH] tmp --- ses_step_simplify.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ses_step_simplify.c b/ses_step_simplify.c index f65440e..faff6f1 100644 --- a/ses_step_simplify.c +++ b/ses_step_simplify.c @@ -71,14 +71,23 @@ static int _simplify_draw(ScfEfunction* f, uint32_t bx, uint32_t by, uint32_t bw cairo_line_to(cr, l->x1, l->y1); } + cairo_select_font_face(cr, "Georgia", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); + cairo_set_font_size (cr, 24); + uint8_t text[64]; snprintf(text, sizeof(text) - 1, "%ld", el->id); + cairo_move_to (cr, l->x0 - 20, l->y0 + 5); + cairo_show_text(cr, text); - cairo_select_font_face(cr, "Georgia", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_set_font_size (cr, 24); - cairo_move_to (cr, l->x0 - 20, l->y0 + 5); - cairo_show_text (cr, text); + if (el->v < SCF_EDA_V_MIN) + snprintf(text, sizeof(text) - 1, "%lg", B->pins[SCF_EDA_Battery_NEG]->v); + else if (el->v > SCF_EDA_V_MAX) + snprintf(text, sizeof(text) - 1, "%lg", B->pins[SCF_EDA_Battery_POS]->v); + else + snprintf(text, sizeof(text) - 1, "%lg", el->v); + cairo_move_to (cr, l->x0 - 24, l->y0 + 24); + cairo_show_text(cr, text); cairo_stroke(cr); } -- 2.25.1