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;