From 39c49d8002c754f7e497d201ce2a962e64fb0999 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Sun, 19 Jul 2015 22:00:51 -0400 Subject: [PATCH] Fixed graphing window to properly graph things that are signed but don't exist on clean byte boundaries, updated version num. --- config.h | 2 +- graphingwindow.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/config.h b/config.h index e4a193d..7835eaa 100644 --- a/config.h +++ b/config.h @@ -1,7 +1,7 @@ #ifndef CONFIG #define CONFIG -#define VERSION 124 +#define VERSION 125 //try to keep this in sync. //SavvyCAN will complain if you connect a GVRET board with a revision diff --git a/graphingwindow.cpp b/graphingwindow.cpp index e1ea762..2a84161 100644 --- a/graphingwindow.cpp +++ b/graphingwindow.cpp @@ -554,9 +554,11 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam) tempValInt &= params.mask; - if (params.isSigned && tempValInt > ((shiftRef / 2) - 1)) + long long twocompPoint = params.mask; + if (shiftRef < twocompPoint) twocompPoint = shiftRef; + if (params.isSigned && tempValInt > ((twocompPoint / 2) - 1)) { - tempValInt = tempValInt - shiftRef; + tempValInt = tempValInt - twocompPoint; } tempValue = (float)tempValInt; @@ -600,9 +602,11 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam) } tempValInt &= params.mask; - if (params.isSigned && tempValInt > ((shiftRef / 2) - 1)) + long long twocompPoint = params.mask; + if (shiftRef < twocompPoint) twocompPoint = shiftRef; + if (params.isSigned && tempValInt > ((twocompPoint / 2) - 1)) { - tempValInt = tempValInt - shiftRef; + tempValInt = tempValInt - twocompPoint; } tempValue = (float)tempValInt;