Added print of hilight for line speed

This commit is contained in:
Mike C 2013-03-10 16:56:25 -04:00
parent d0e436d7b7
commit 4fade5c3fe
2 changed files with 23 additions and 10 deletions

View file

@ -46,6 +46,7 @@ enum serialmode {
db9_norm, db9_norm,
db9_null, db9_null,
cisco, cisco,
modelinespeed,
none=-1 none=-1
}; };
@ -164,14 +165,6 @@ void printTx(bool show) {
lcd.setLine(rtXPosStart, rtYPosStart, rtXPosEnd, rtYPosEnd, color); lcd.setLine(rtXPosStart, rtYPosStart, rtXPosEnd, rtYPosEnd, color);
} }
void printLineSpeed(linespeed aLineSpeed) {
int xPos = xLoc(6);
int yPos = yLoc(5);
lcd.setStr(" ", xPos, yPos, BACKGROUND, BACKGROUND);
lcd.setStr(linespeeds[aLineSpeed].description, xPos, yPos, TEXT, BACKGROUND);
}
void printMode(serialmode aMode) { void printMode(serialmode aMode) {
lcd.setStr(modeToText[aMode], xLoc(aMode), yLoc(1), TEXT, BACKGROUND); lcd.setStr(modeToText[aMode], xLoc(aMode), yLoc(1), TEXT, BACKGROUND);
} }

View file

@ -42,7 +42,7 @@ void setup() {
// Print the modes // Print the modes
// Uses enum trickery -- don't assign values to serialmode enum values // Uses enum trickery -- don't assign values to serialmode enum values
for (int i=0; i<=cisco; i++) { for (int i=0; i<modelinespeed; i++) {
printMode((serialmode)i); printMode((serialmode)i);
} }
@ -84,7 +84,8 @@ void loop() {
void setLineSpeed(linespeed aLineSpeed) { void setLineSpeed(linespeed aLineSpeed) {
currentLineSpeed = aLineSpeed; currentLineSpeed = aLineSpeed;
printLineSpeed(aLineSpeed); bool sel = selectedMode == modelinespeed ? true : false;
printLineSpeed(aLineSpeed, sel);
} }
void setMode(serialmode aMode) { void setMode(serialmode aMode) {
@ -108,3 +109,22 @@ void setSelection(serialmode aMode) {
lcd.setLine(xSelected, yLocOne, xSelected, yLocOne + selectedLength, HILIGHT); lcd.setLine(xSelected, yLocOne, xSelected, yLocOne + selectedLength, HILIGHT);
lcd.setLine(xPrevious, yLocOne, xPrevious, yLocOne + previousLength, BACKGROUND); lcd.setLine(xPrevious, yLocOne, xPrevious, yLocOne + previousLength, BACKGROUND);
} }
void printLineSpeed(linespeed aLineSpeed, bool selected) {
int xPosText = xLoc(6);
int yPosText = yLoc(5);
int xPosLine = xLoc(7);
int yPosLine = yLoc(5);
char* toPrint = linespeeds[aLineSpeed].description;
int length = strlen(toPrint);
lcd.setStr(" ", xPosText, yPosText, BACKGROUND, BACKGROUND);
lcd.setLine(xPosLine, yPosLine, xPosLine, yPosLine + 7 * CHAR_WIDTH, BACKGROUND);
lcd.setStr(toPrint, xPosText, yPosText, TEXT, BACKGROUND);
if (selected) {
lcd.setLine(xPosLine, yPosLine, xPosLine, yPosLine + length * CHAR_WIDTH, HILIGHT);
}
}