rims-arduino-library  v3.1.1
Recirculation infusion mash system library for Arduino
Public Member Functions | Protected Member Functions | List of all members
UIRims Class Reference

Library to manage LCD and keypad for Rims library. More...

#include <UIRims.h>

Public Member Functions

 UIRims (LiquidCrystal *lcd, byte pinKeysAnalog, byte pinLight=LED_BUILTIN, char pinSpeaker=-1)
 Constructor. More...
 
void showSerialWarning ()
 Show warning about Arduino IDE Serial Monitor.
 
void showPumpWarning (float flow=0.0)
 Show the pump switching warning. More...
 
void showHeaterWarning (bool state=false)
 Show the heater switching warning. More...
 
void showTempScreen ()
 Show temperature (set point and process value) screen on _lcd.
 
void showTimeFlowScreen ()
 Show remaining time and flow screen on _lcd.
 
void switchScreen ()
 Toggle between SCREENTEMP and SCREENTIMEFLOW on _lcd.
 
void showIdentScreen ()
 Show system identification screen on _lcd.
 
void showPIDTuningScreen (float Kp, float Ki, float Kd, float tauFilter)
 Show PID coefficients screen on _lcd.
 
void showMemAccessScreen ()
 Show the memory access mode screen.
 
void setTempSP (float tempCelcius)
 Set a new set point temperature. More...
 
void setTempPV (float tempCelcius, bool buzz=true)
 Set a new process value temperature. More...
 
void setCV (float controlValue)
 Set ident CV on identScreen. More...
 
void setTime (unsigned int timeSec)
 Set a new remaining time. More...
 
void setFlow (float flow, bool buzz=true)
 Set a new flow value. More...
 
void setFlowBounds (float lowBound, float upBound)
 Set bounds for accepted flow rate. More...
 
void setHeaterVoltState (bool state, bool buzz=true)
 Set voltage detection on heater under the heater warning. More...
 
byte readKeysADC (bool waitNone=true)
 Read keys without software debouce. More...
 
void timerRunningChar (bool state)
 Show blinking char next to remaining time. More...
 
void ring (bool state=true)
 Ring with given speaker setted with the Constructor. More...
 
void lcdLight (bool state=true)
 Turn on/off the LCD backlighting. More...
 
float askSetPoint (float defaultVal)
 Ask set point temperature with the UI. More...
 
unsigned int askTime (unsigned int defaultVal)
 Ask timer time on the UI. More...
 
byte askMashWater (int mashWaterValues[], byte defaultVal)
 Ask mash water quantity (4 choices max). More...
 

Protected Member Functions

byte _waitForKeyChange ()
 Read keys with software debounce. More...
 
void _waitTime (unsigned long timeInMilliSec)
 Pause the Arduino for the given timeInMilliSec. More...
 
void _printStrLCD (String mess, byte col, byte row)
 Show mess at column col and row row on _lcd. More...
 
void _printFloatLCD (float val, int width, int prec, byte col, byte row)
 Show a floating number at column col and row row on _lcd. More...
 
void _setCursorPosition (byte col, byte row)
 Set _lcd cursor at given column col and given row row. More...
 
float _celciusToFahrenheit (float celcius)
 Convert celcius temp to fahrenheit temp. More...
 
void _moveCursorLR (byte begin, byte end, byte dotPosition, byte row, bool left)
 Move the cursor left or right on _lcd. More...
 
float _incDecValue (float value, byte dotPosition, bool increase, float lowerBound, float upperBound, bool timeFormat)
 Increse or decrease a floating point value on _lcd-> dotPosition give the position (column) of the point mark. More...
 
float _askValue (byte begin, byte end, byte dotPosition, byte row, float defaultVal, float lowerBound, float upperBound, bool timeFormat)
 Ask a value on _lcd. More...
 

Detailed Description

Library to manage LCD and keypad for Rims library.

Made for : DFRobot LCD Keypad Shield For Arduino http://tinyurl.com/zqk5wmg

If anything else is used, lcd must be 16 cols 2 rows and keypad must be associated to a analog ADC pin with a volage divider for each keys. Needed keys : UP, DOWN, LEFT, RIGHT, SELECT/OK

Author
Francis Gagnon
Examples:
rimsBasic.ino, rimsFlow.ino, rimsIdentBasic.ino, rimsMem.ino, and rimsTunerBasic.ino.

Constructor & Destructor Documentation

◆ UIRims()

UIRims::UIRims ( LiquidCrystal *  lcd,
byte  pinKeysAnalog,
byte  pinLight = LED_BUILTIN,
char  pinSpeaker = -1 
)

Constructor.

Parameters
lcd: LiquidCrystal* (16x2 characters) that will be used during identification.
pinKeysAnalog: byte. Analog input pin for keypad reading
pinLight: byte. Pin used for lcd backlight control
pinSpeaker: byte. Pin used for outputing alarm to buzzer

Member Function Documentation

◆ _askValue()

float UIRims::_askValue ( byte  begin,
byte  end,
byte  dotPosition,
byte  row,
float  defaultVal,
float  lowerBound,
float  upperBound,
bool  timeFormat 
)
protected

Ask a value on _lcd.

Parameters
begin: byte. cursor bounds (columns) for the value.
end: byte. cursor bounds (columns) for the value.
dotPosition: byte. point mark position
row: byte. row on _lcd
defaultVal: float. starting value
lowerBound: float. value's limits
upperBound: float. value's limits
timeFormat: boolean. treats the value (in sec) as a time with minutes and secondes.
Returns
float : selected value

◆ _celciusToFahrenheit()

float UIRims::_celciusToFahrenheit ( float  celcius)
protected

Convert celcius temp to fahrenheit temp.

Parameters
celcius: float.
Returns
float : celcius param converted in fahrenheit.

◆ _incDecValue()

float UIRims::_incDecValue ( float  value,
byte  dotPosition,
bool  increase,
float  lowerBound,
float  upperBound,
bool  timeFormat 
)
protected

Increse or decrease a floating point value on _lcd-> dotPosition give the position (column) of the point mark.

Parameters
value: float.
dotPosition: byte. position (column) of the point mark
increase: boolean. If true, increment else, decrement.
lowerBound: float. decreasing limit of the value
upperBound: float. increasing limit of the value
timeFormat: boolean. treats the value (in sec) as a time with minutes and secondes.
Returns
float : result of increment/decrement

◆ _moveCursorLR()

void UIRims::_moveCursorLR ( byte  begin,
byte  end,
byte  dotPosition,
byte  row,
bool  left 
)
protected

Move the cursor left or right on _lcd.

Parameters
begin: byte. indicate the position (column) of the beginning of the cursor bounds.
end: byte. indicate the position (column) of the ending of the cursor bounds.
dotPosition: byte. position (column) of the dot to skip it.
row: byte. row indicate the row of the cursor on _lcd
left: boolean. If true, left movement else, right.

◆ _printFloatLCD()

void UIRims::_printFloatLCD ( float  val,
int  width,
int  prec,
byte  col,
byte  row 
)
protected

Show a floating number at column col and row row on _lcd.

Parameters
val: float.
width: int. minumum width
prec: int. digit after point
col: byte. starting column on _lcd
row: byte. starting row on _lcd

◆ _printStrLCD()

void UIRims::_printStrLCD ( String  mess,
byte  col,
byte  row 
)
protected

Show mess at column col and row row on _lcd.

Parameters
mess: String. Message to print
col: byte. starting column on _lcd
row: byte. starting row on _lcd

◆ _setCursorPosition()

void UIRims::_setCursorPosition ( byte  col,
byte  row 
)
protected

Set _lcd cursor at given column col and given row row.

Parameters
col: byte. starting column on _lcd
row: byte. starting row on _lcd

◆ _waitForKeyChange()

byte UIRims::_waitForKeyChange ( )
protected

Read keys with software debounce.

Returns
byte : KEYNONE, KEYUP, KEYDOWN, KEYLEFT, KEYRIGHT or KEYSELECT

◆ _waitTime()

void UIRims::_waitTime ( unsigned long  timeInMilliSec)
protected

Pause the Arduino for the given timeInMilliSec.

Parameters
timeInMilliSec: unsigned long. Time that the Arduino will be pause
Returns
byte : KEYNONE, KEYUP, KEYDOWN, KEYLEFT, KEYRIGHT or KEYSELECT

◆ askMashWater()

byte UIRims::askMashWater ( int  mashWaterValues[],
byte  defaultVal 
)

Ask mash water quantity (4 choices max).

Parameters
mashWaterValues: int[4]. Array that contain different choices for mash water quantity. If less than 4 is needed, the rest should be setted to -1. All values should be between 0 L and 99 L.
defaultVal: byte. Cursor starting position index.
Returns
byte : 0 to 4. Index of the selected mash water quantity.

◆ askSetPoint()

float UIRims::askSetPoint ( float  defaultVal)

Ask set point temperature with the UI.

Parameters
defaultVal: float.
Returns
float : selected value

◆ askTime()

unsigned int UIRims::askTime ( unsigned int  defaultVal)

Ask timer time on the UI.

Parameters
defaultVal: unsigned int. in sec
Returns
unsigned int : selected value in sec

◆ lcdLight()

void UIRims::lcdLight ( bool  state = true)

Turn on/off the LCD backlighting.

Parameters
state: boolean. If true, light on, else, light off.

◆ readKeysADC()

byte UIRims::readKeysADC ( bool  waitNone = true)

Read keys without software debouce.

Parameters
waitNone: boolean. If true, KEYNONE must be detected to return anything else than KEYNONE.
Returns
byte : KEYNONE, KEYUP, KEYDOWN, KEYLEFT, KEYRIGHT or KEYSELECT

◆ ring()

void UIRims::ring ( bool  state = true)

Ring with given speaker setted with the Constructor.

Parameters
state: boolean. If true, start buzz, if false stop buzz.

◆ setCV()

void UIRims::setCV ( float  controlValue)

Set ident CV on identScreen.

Parameters
controlValue: float. current CV between 0 to 100 %

◆ setFlow()

void UIRims::setFlow ( float  flow,
bool  buzz = true 
)

Set a new flow value.

Set a new flow value. If timeFlowScreen is shown, it will be updated on the lcd _lcd else it will be memorized for when it will be shown.

Parameters
flow: float. If flow is NAN , flow measurement is not used in the UI.
buzz: boolean. Emit an alarm on speaker if flow is incorrect.

◆ setFlowBounds()

void UIRims::setFlowBounds ( float  lowBound,
float  upBound 
)

Set bounds for accepted flow rate.

Parameters
lowBound: float. Lower bound of flow rate [L/min]
upBound: float. Upper bound of flow rate [L/min]

◆ setHeaterVoltState()

void UIRims::setHeaterVoltState ( bool  state,
bool  buzz = true 
)

Set voltage detection on heater under the heater warning.

Parameters
state: boolean. If true, show on, else, off.
buzz: boolean. If true, speaker alarm is trigerred if no voltage. If false, state is shown on LCD.

◆ setTempPV()

void UIRims::setTempPV ( float  tempCelcius,
bool  buzz = true 
)

Set a new process value temperature.

Set a new process value temperature. If tempScreen is shown, it will be updated on the lcd _lcd else it will be memorized for when it will be shown.

Parameters
tempCelcius: float. If tempCelcius is NAN , temperature probe is considered unconnected.
buzz: boolean. Emit an alarm on speaker if temperture probe is disconnected.

◆ setTempSP()

void UIRims::setTempSP ( float  tempCelcius)

Set a new set point temperature.

Set a new set point temperature. If tempScreen is shown, it will be updated on the lcd _lcd else it will be memorized for when it will be shown.

Parameters
tempCelcius: float.

◆ setTime()

void UIRims::setTime ( unsigned int  timeSec)

Set a new remaining time.

Set a new remaining time. If timeFlowScreen is shown, it will be updated on the lcd _lcd else it will be memorized for when it will be shown.

Parameters
timeSec: unsigned int. remaining time in sec

◆ showHeaterWarning()

void UIRims::showHeaterWarning ( bool  state = false)

Show the heater switching warning.

Parameters
state: boolean. shown state value.

◆ showPumpWarning()

void UIRims::showPumpWarning ( float  flow = 0.0)

Show the pump switching warning.

Parameters
flow: float. shown flow value.

◆ timerRunningChar()

void UIRims::timerRunningChar ( bool  state)

Show blinking char next to remaining time.

Parameters
state: boolean. If true, char is shown.

The documentation for this class was generated from the following files: