From: yu.dongliang <18588496441@163.com> Date: Wed, 1 Nov 2023 03:19:27 +0000 (+0800) Subject: _simplify_draw() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=d724b18e3ce7e6ba95b6a6de34588b6969f2dc17;p=ses.git _simplify_draw() --- diff --git a/ses_step_simplify.c b/ses_step_simplify.c index faff6f1..dbab7d1 100644 --- a/ses_step_simplify.c +++ b/ses_step_simplify.c @@ -76,15 +76,25 @@ static int _simplify_draw(ScfEfunction* f, uint32_t bx, uint32_t by, uint32_t bw 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_stroke(cr); 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 if (el->v > 1e-3 || el->v < -1e-3) + snprintf(text, sizeof(text) - 1, "%lgv", (int)(el->v * 1000) / 1000.0); + + else if (el->v > 1e-6 || el->v < -1e-6) + snprintf(text, sizeof(text) - 1, "%lgmV", (int)(el->v * 1000000) / 1000.0); else - snprintf(text, sizeof(text) - 1, "%lg", el->v); + snprintf(text, sizeof(text) - 1, "%lguV", (int)(el->v * 1000000) / 1000000.0); + + cairo_set_font_size(cr, 20); cairo_move_to (cr, l->x0 - 24, l->y0 + 24); cairo_show_text(cr, text);