From 68f5b7b101d0c0f0643f8ec3197226a0fcaebd5f Mon Sep 17 00:00:00 2001 From: Mike C Date: Sun, 10 Mar 2013 21:56:36 -0400 Subject: [PATCH] Added ability to change line speeds --- Universal_Serial_Adapter/Project.h | 3 ++- .../Universal_Serial_Adapter.ino | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Universal_Serial_Adapter/Project.h b/Universal_Serial_Adapter/Project.h index 5212e80..d4fb82f 100644 --- a/Universal_Serial_Adapter/Project.h +++ b/Universal_Serial_Adapter/Project.h @@ -67,12 +67,13 @@ enum linespeed { thirtyeightFourK, fiftysevenFiveK, oneNineteenTwoK, + maxlinespeed, zero=-1 }; // Description / speed scruct to use in lookup table struct linespeedinfo { - char description[8]; + char* description; int linespeed; }; diff --git a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino index d307326..4ab9641 100644 --- a/Universal_Serial_Adapter/Universal_Serial_Adapter.ino +++ b/Universal_Serial_Adapter/Universal_Serial_Adapter.ino @@ -90,9 +90,14 @@ void setDefaults() { } void setLineSpeed(linespeed aLineSpeed) { - currentLineSpeed = aLineSpeed; + if (aLineSpeed >= maxlinespeed) { + currentLineSpeed = (linespeed)0; + } + else { + currentLineSpeed = aLineSpeed; + } bool sel = selectedMode == modelinespeed ? true : false; - printLineSpeed(aLineSpeed, sel); + printLineSpeed(currentLineSpeed, sel); } void setMode(serialmode aMode) { @@ -103,6 +108,9 @@ void setMode(serialmode aMode) { lcd.setStr(" ", xLoc(previousMode), yLoc(0), TEXT, BACKGROUND); lcd.setStr("*", xLoc(currentMode), yLoc(0), TEXT, BACKGROUND); } + else { + setLineSpeed((linespeed)(currentLineSpeed + 1)); + } } void setSelection(serialmode aMode) {