tmp
authoryu.dongliang <18588496441@163.com>
Wed, 1 Nov 2023 02:58:07 +0000 (10:58 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 1 Nov 2023 02:58:07 +0000 (10:58 +0800)
ses_step_simplify.c

index f65440ef0081cda8030c63c9f9e71f98940b9dcd..faff6f17036d9502c5d7696fc235a1475911ba86 100644 (file)
@@ -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);
        }