From 840f44b488395e701e55c5d39b87fa7b90a5df4a Mon Sep 17 00:00:00 2001 From: Mike C Date: Sun, 10 Mar 2013 14:48:32 -0400 Subject: [PATCH] Fixup highlight and improve responsiveness --- Universal_Serial_Adapter/Universal_Serial_Adapter.ino | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino index fe4cc0b..86175a7 100644 --- a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino +++ b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino @@ -89,10 +89,16 @@ void setMode(serialmode aMode) { void setSelection(serialmode aMode) { serialmode previousSelection = selectedMode; selectedMode = aMode; + + int yLocOne = yLoc(1); + int xSelected = xLoc(selectedMode) + CHAR_HEIGHT; + int xPrevious = xLoc(previousSelection) + CHAR_HEIGHT; + int previousLength = strlen(modeToText[previousSelection]) * CHAR_WIDTH; int selectedLength = strlen(modeToText[selectedMode]) * CHAR_WIDTH; - lcd.setLine(xLoc(selectedMode) + CHAR_HEIGHT, yLoc(1), xLoc(selectedMode) + CHAR_HEIGHT, yLoc(1) + selectedLength, HILIGHT); - lcd.setLine(xLoc(previousSelection) + CHAR_HEIGHT, yLoc(1), xLoc(previousSelection) + CHAR_HEIGHT, yLoc(1) + previousLength, BACKGROUND); + + lcd.setLine(xSelected, yLocOne, xSelected, yLocOne + selectedLength, HILIGHT); + lcd.setLine(xPrevious, yLocOne, xPrevious, yLocOne + previousLength, BACKGROUND); } void printMode(serialmode aMode) {