@@ -337,6 +337,27 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
337
337
GraphMeterMode_drawGraph (this , x + captionLen , y , w , this -> h , -1 );
338
338
}
339
339
340
+ static void IOMeterMode_draw (Meter * this , int x , int y , int w ) {
341
+ assert (x >= 0 );
342
+ assert (w <= INT_MAX - x );
343
+
344
+ // Draw the caption
345
+ const int captionLen = 3 ;
346
+ const char * caption = Meter_getCaption (this );
347
+ if (w >= captionLen ) {
348
+ attrset (CRT_colors [METER_TEXT ]);
349
+ mvaddnstr (y , x , caption , captionLen );
350
+ }
351
+ w -= captionLen ;
352
+
353
+ // Draw the top graph, half height
354
+ GraphMeterMode_drawGraph (this , x + captionLen , y , w , GRAPH_HEIGHT / 2 , 0 );
355
+
356
+ // Draw the bottom graph, half height
357
+ y += GRAPH_HEIGHT / 2 ;
358
+ GraphMeterMode_drawGraph (this , x + captionLen , y , w , GRAPH_HEIGHT / 2 , 1 );
359
+ }
360
+
340
361
/* ---------- LEDMeterMode ---------- */
341
362
342
363
static const char * const LEDMeterMode_digitsAscii [] = {
@@ -442,6 +463,11 @@ static const MeterMode Meter_modes[] = {
442
463
.h = DEFAULT_GRAPH_HEIGHT ,
443
464
.draw = GraphMeterMode_draw ,
444
465
},
466
+ [IO_METERMODE ] = {
467
+ .uiName = "In/Out" ,
468
+ .h = GRAPH_HEIGHT ,
469
+ .draw = IOMeterMode_draw ,
470
+ },
445
471
[LED_METERMODE ] = {
446
472
.uiName = "LED" ,
447
473
.h = 3 ,
0 commit comments