From 314c5c01f122cf0b81de976c638682a82693c38b Mon Sep 17 00:00:00 2001 From: schneider <schneider@blinkenlichts.net> Date: Thu, 22 Aug 2019 22:58:04 +0200 Subject: [PATCH] Revert "Merge branch 'fix-off-by-one' into 'master'" This reverts commit 44c48cc932e83c6cc7813d590fbad5163020cee6, reversing changes made to f2b53a9c679dd60f139278ae7711a9bbb6499411. --- pycardium/modules/sys_display.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pycardium/modules/sys_display.c b/pycardium/modules/sys_display.c index 835f059f..cc550be6 100644 --- a/pycardium/modules/sys_display.c +++ b/pycardium/modules/sys_display.c @@ -61,12 +61,12 @@ static mp_obj_t mp_display_pixel(size_t n_args, const mp_obj_t *args) uint16_t col = get_color(args[2]); //TODO: Move sanity checks to epicardium - if (x >= 160 || x < 0) { - mp_raise_ValueError("X-Coords have to be 0 <= x < 160"); + if (x > 160 || x < 0) { + mp_raise_ValueError("X-Coords have to be 0 < x < 160"); } - if (y >= 80 || y < 0) { - mp_raise_ValueError("Y-Coords have to be 0 <= y < 80"); + if (y > 80 || y < 0) { + mp_raise_ValueError("Y-Coords have to be 0 < y < 80"); } int res = epic_disp_pixel(x, y, col); @@ -91,12 +91,12 @@ static mp_obj_t mp_display_line(size_t n_args, const mp_obj_t *args) uint16_t ps = mp_obj_get_int(args[6]); //TODO: Move sanity checks to epicardium - if (xs >= 160 || xs < 0 || xe >= 160 || xe < 0) { - mp_raise_ValueError("X-Coords have to be 0 <= x < 160"); + if (xs > 160 || xs < 0 || xe > 160 || xe < 0) { + mp_raise_ValueError("X-Coords have to be 0 < x < 160"); } - if (ys >= 80 || ys < 0 || ye >= 80 || ye < 0) { - mp_raise_ValueError("Y-Coords have to be 0 <= x < 80"); + if (ys > 80 || ys < 0 || ye > 80 || ye < 0) { + mp_raise_ValueError("Y-Coords have to be 0 < x < 80"); } if (ls > 1 || ls < 0) { @@ -125,12 +125,12 @@ static mp_obj_t mp_display_rect(size_t n_args, const mp_obj_t *args) uint16_t ps = mp_obj_get_int(args[6]); //TODO: Move sanity checks to epicardium - if (xs >= 160 || xs < 0 || xe >= 160 || xe < 0) { - mp_raise_ValueError("X-Coords have to be 0 <= x < 160"); + if (xs > 160 || xs < 0 || xe > 160 || xe < 0) { + mp_raise_ValueError("X-Coords have to be 0 < x < 160"); } - if (ys >= 80 || ys < 0 || ye >= 80 || ye < 0) { - mp_raise_ValueError("Y-Coords have to be 0 <= x < 80"); + if (ys > 80 || ys < 0 || ye > 80 || ye < 0) { + mp_raise_ValueError("Y-Coords have to be 0 < x < 80"); } if (fs > 1 || fs < 0) { -- GitLab