From 40aa61ba9880414bcd49a84ce9b266dd63f7cfdc Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Mon, 7 Apr 2025 17:54:47 -0400 Subject: [PATCH] constrain traces to the screen --- main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 6aca37e..6e2eb27 100644 --- a/main.c +++ b/main.c @@ -238,9 +238,12 @@ int main(void) { float fVoltsPerDiv = gVoltageScale[voltage_scale]; float fScale = (VIN_RANGE * PIXELS_PER_DIV)/((1 << ADC_BITS) * fVoltsPerDiv); - GrContextForegroundSet(&sContext, ClrPink); + GrContextForegroundSet(&sContext, ClrYellow); for(j=0; j(b))?(a):(b)) + #define CONSTRAIN(x) MAX(MIN(HEIGHT - 1, x), 0) + #define TRANSPOSE(x) CONSTRAIN((HEIGHT/2) - (int)roundf(fScale * ((int)x - ADC_OFFSET))) uint32_t upper,lower, current, last; if (j==0) { @@ -250,10 +253,6 @@ int main(void) { } else { current = TRANSPOSE(local_adc_buffer[j]); - // couldn't find these anywhere - #define MIN(a,b) (((a)<(b))?(a):(b)) - #define MAX(a,b) (((a)>(b))?(a):(b)) - upper = MAX(current, last); lower = MIN(current, last);