Added ability to change line speeds

This commit is contained in:
Mike C 2013-03-10 21:56:36 -04:00
parent c807b2f384
commit 68f5b7b101
2 changed files with 12 additions and 3 deletions

View file

@ -67,12 +67,13 @@ enum linespeed {
thirtyeightFourK, thirtyeightFourK,
fiftysevenFiveK, fiftysevenFiveK,
oneNineteenTwoK, oneNineteenTwoK,
maxlinespeed,
zero=-1 zero=-1
}; };
// Description / speed scruct to use in lookup table // Description / speed scruct to use in lookup table
struct linespeedinfo { struct linespeedinfo {
char description[8]; char* description;
int linespeed; int linespeed;
}; };

View file

@ -90,9 +90,14 @@ void setDefaults() {
} }
void setLineSpeed(linespeed aLineSpeed) { void setLineSpeed(linespeed aLineSpeed) {
if (aLineSpeed >= maxlinespeed) {
currentLineSpeed = (linespeed)0;
}
else {
currentLineSpeed = aLineSpeed; currentLineSpeed = aLineSpeed;
}
bool sel = selectedMode == modelinespeed ? true : false; bool sel = selectedMode == modelinespeed ? true : false;
printLineSpeed(aLineSpeed, sel); printLineSpeed(currentLineSpeed, sel);
} }
void setMode(serialmode aMode) { void setMode(serialmode aMode) {
@ -103,6 +108,9 @@ void setMode(serialmode aMode) {
lcd.setStr(" ", xLoc(previousMode), yLoc(0), TEXT, BACKGROUND); lcd.setStr(" ", xLoc(previousMode), yLoc(0), TEXT, BACKGROUND);
lcd.setStr("*", xLoc(currentMode), yLoc(0), TEXT, BACKGROUND); lcd.setStr("*", xLoc(currentMode), yLoc(0), TEXT, BACKGROUND);
} }
else {
setLineSpeed((linespeed)(currentLineSpeed + 1));
}
} }
void setSelection(serialmode aMode) { void setSelection(serialmode aMode) {