diff --git a/nanovna.h b/nanovna.h index 5caee68..9753285 100644 --- a/nanovna.h +++ b/nanovna.h @@ -459,8 +459,8 @@ extern uint16_t graph_bottom; // Num Input height at bottom #define NUM_INPUT_HEIGHT 32 -extern int16_t area_width; -extern int16_t area_height; +extern uint16_t area_width; +extern uint16_t area_height; // Define marker size (can be 0 or 1) #ifdef TINYSA3 diff --git a/plot.c b/plot.c index b666168..7fa3d03 100644 --- a/plot.c +++ b/plot.c @@ -46,8 +46,8 @@ static int16_t grid_offset; static int16_t grid_width; static freq_t grid_span; -int16_t area_width = AREA_WIDTH_NORMAL; -int16_t area_height; // initialized in main() = AREA_HEIGHT_NORMAL; +uint16_t area_width = AREA_WIDTH_NORMAL; +uint16_t area_height; // initialized in main() = AREA_HEIGHT_NORMAL; // Cell render use spi buffer typedef uint16_t pixel_t; @@ -1532,9 +1532,9 @@ draw_cell(int m, int n) int t; uint16_t c; // Clip cell by area - if (x0 + w > area_width) + if (w > area_width - x0) w = area_width - x0; - if (y0 + h > area_height) + if (h > area_height - y0) h = area_height - y0; if (w <= 0 || h <= 0) return;