![]() |
rims-arduino-library
v3.1.1
Recirculation infusion mash system library for Arduino
|
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... | |
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
UIRims::UIRims | ( | LiquidCrystal * | lcd, |
byte | pinKeysAnalog, | ||
byte | pinLight = LED_BUILTIN , |
||
char | pinSpeaker = -1 |
||
) |
Constructor.
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 |
|
protected |
Ask a value on _lcd.
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. |
|
protected |
Convert celcius temp to fahrenheit temp.
celcius | : float. |
|
protected |
Increse or decrease a floating point value on _lcd-> dotPosition give the position (column) of the point mark.
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. |
|
protected |
Move the cursor left or right on _lcd.
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. |
|
protected |
Show a floating number at column col and row row on _lcd.
val | : float. |
width | : int. minumum width |
prec | : int. digit after point |
col | : byte. starting column on _lcd |
row | : byte. starting row on _lcd |
|
protected |
Show mess at column col and row row on _lcd.
mess | : String. Message to print |
col | : byte. starting column on _lcd |
row | : byte. starting row on _lcd |
|
protected |
Set _lcd cursor at given column col and given row row.
col | : byte. starting column on _lcd |
row | : byte. starting row on _lcd |
|
protected |
|
protected |
byte UIRims::askMashWater | ( | int | mashWaterValues[], |
byte | defaultVal | ||
) |
Ask mash water quantity (4 choices max).
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. |
float UIRims::askSetPoint | ( | float | defaultVal | ) |
Ask set point temperature with the UI.
defaultVal | : float. |
unsigned int UIRims::askTime | ( | unsigned int | defaultVal | ) |
Ask timer time on the UI.
defaultVal | : unsigned int. in sec |
void UIRims::lcdLight | ( | bool | state = true | ) |
Turn on/off the LCD backlighting.
state | : boolean. If true, light on, else, light off. |
byte UIRims::readKeysADC | ( | bool | waitNone = true | ) |
void UIRims::ring | ( | bool | state = true | ) |
Ring with given speaker setted with the Constructor.
state | : boolean. If true, start buzz, if false stop buzz. |
void UIRims::setCV | ( | float | controlValue | ) |
Set ident CV on identScreen.
controlValue | : float. current CV between 0 to 100 % |
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.
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. |
void UIRims::setFlowBounds | ( | float | lowBound, |
float | upBound | ||
) |
Set bounds for accepted flow rate.
lowBound | : float. Lower bound of flow rate [L/min] |
upBound | : float. Upper bound of flow rate [L/min] |
void UIRims::setHeaterVoltState | ( | bool | state, |
bool | buzz = true |
||
) |
Set voltage detection on heater under the heater warning.
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. |
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.
tempCelcius | : float. If tempCelcius is NAN , temperature probe is considered unconnected. |
buzz | : boolean. Emit an alarm on speaker if temperture probe is disconnected. |
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.
tempCelcius | : float. |
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.
timeSec | : unsigned int. remaining time in sec |
void UIRims::showHeaterWarning | ( | bool | state = false | ) |
Show the heater switching warning.
state | : boolean. shown state value. |
void UIRims::showPumpWarning | ( | float | flow = 0.0 | ) |
Show the pump switching warning.
flow | : float. shown flow value. |
void UIRims::timerRunningChar | ( | bool | state | ) |
Show blinking char next to remaining time.
state | : boolean. If true, char is shown. |