Electronic Load  1.0
Programmable Constant Current Sink
Macros | Functions | Variables
screen.c File Reference

Screen handling. More...

Include dependency graph for screen.c:

Macros

#define isEditable(control)   ((control)!=CONTROL_TEXTLA && (control)!=CONTROL_REFRESH)
 

Functions

uint8_t doScreenDischgTest (void)
 
uint8_t doScreenManualTest (void)
 
void DrawASCallback (uint8_t param)
 
void DrawControl (control_t *control, drawMode_t mode)
 (Re-) draws a control More...
 
void DrawPRcallback (uint8_t param)
 Draws voltage, power and resistance for one sink. More...
 
void drawResetCause (uint8_t param)
 Prints the Flags set in MCUSR. More...
 
void DrawTempCallback (uint8_t param)
 
void DrawVIcallback (uint8_t param)
 Draws the measured current for one sink. More...
 
void EnterSink (CONTROL_RET action, ctlEnterNumber_t *en, uint8_t param)
 Sets a sink to the Value of an enterNumber-control. More...
 
void formatPrefixValue (prefixValue_t *val, double newVal)
 Formats a value using SI-Prefix Letters. More...
 
static void RefreshAutoItems (screen_t *screen)
 Redraws all Auto-Refresh items. More...
 
uint8_t Screen (screen_t *screen)
 Handles a screen. More...
 

Variables

ctlButton_t buttonBack ={CONTROL_BUTTON,LCD_LINE4,TXT_BACK}
 
screenItem_t buttonBack_s ={(control_t*)&buttonBack,BACK}
 Definition of the Back Button as a Replacement for the Cancel Button. More...
 
ctlButton_t buttonBacks ={CONTROL_BUTTON,LCD_LINE4+18,TXT_BACKs}
 
screenItem_t buttonBacks_s ={(control_t*)&buttonBacks,BACK}
 Definition of the Back Button as a Replacement for the Cancel Button. More...
 
ctlButton_t buttonCancel ={CONTROL_BUTTON,LCD_LINE4,TXT_CANCEL}
 
screenItem_t buttonCancel_s ={(control_t*)&buttonCancel,CANCEL}
 Definition of the standard Cancel Button, last Line, left. More...
 
ctlButton_t buttonEnter ={CONTROL_BUTTON,LCD_LINE4+10,TXT_ENTER}
 
screenItem_t buttonEnter_s ={(control_t*)&buttonEnter,ENTER}
 Definition of the standard Enter Button, last line, right. More...
 
ctlButton_t buttonStart ={CONTROL_BUTTON,LCD_LINE3+14,TXT_START}
 
screenItem_t buttonStart_s ={(control_t*)&buttonStart,START}
 Definition of the standard Cancel Button, last Line, left. More...
 
ctlEnterNumber_t inSink1 ={CONTROL_ENTERNUMBER,LCD_LINE1+11,EnterSink,0,&inSink1ev}
 
screenItem_t inSink1_s ={(control_t*)&inSink1,0}
 
enterNumberVariable_t inSink1ev ={"0.0000","A"}
 
static const char TXT_CANCEL [] PROGMEM = "Cancel"
 The Cancel-Button usually appears in the last line on the left. More...
 
ctlRefresh_t resetCause ={CONTROL_REFRESH,LCD_LINE3,drawResetCause,0}
 
screen_t screenDischgTest
 
screen_t screenManualTest
 
screen_t screenVersion
 The Version Screen. More...
 
volatile uint8_t sFlags
 Flags used for Screen Control. More...
 
sinkPrefixValues_t sinkPVal
 
ctlRefresh_t temp ={CONTROL_REFRESH,LCD_LINE4,DrawTempCallback,0}
 
screenItem_t temp_s ={(control_t*)&temp,0}
 
ctlText_t terminator ={CONTROL_TERMINATOR}
 
screenItem_t terminator_s ={(control_t*)&terminator,0}
 Definition of the Terminator. This Screen Item has to be the very last Control in a Screen Struct. More...
 
ctlText_t txtCurrent ={CONTROL_TEXTLA,LCD_LINE1,txtCurrent_t}
 
screenItem_t txtCurrent_s ={(control_t*)&txtCurrent,0}
 
ctlText_t txtSetPoint ={CONTROL_TEXTLA,LCD_LINE1,txtSetPoint_t}
 
screenItem_t txtSetPoint_s ={(control_t*)&txtSetPoint,0}
 
ctlRefresh_t valueAS ={CONTROL_REFRESH,LCD_LINE3,DrawASCallback,0}
 
screenItem_t valueAS_s ={(control_t*)&valueAS,0}
 
ctlRefresh_t valueI1 ={CONTROL_REFRESH,LCD_LINE2,DrawVIcallback,0}
 
screenItem_t valueI1_s ={(control_t*)&valueI1,0}
 
ctlRefresh_t valueUPR1 ={CONTROL_REFRESH,LCD_LINE3,DrawPRcallback,0}
 
screenItem_t valueUPR1_s ={(control_t*)&valueUPR1,0}
 
ctlText_t versionL1 ={CONTROL_TEXTLA,LCD_LINE1,TXT_VERSIONL1}
 
screenItem_t versionL1_s ={(control_t*)&versionL1,0}
 
ctlText_t versionL2 ={CONTROL_TEXTLA,LCD_LINE2,TXT_BUILD}
 
screenItem_t versionL2_s ={(control_t*)&versionL2,0}
 
screenItem_t versionL3_s ={(control_t*)&resetCause,0}
 
ctlText_t versionL4 ={CONTROL_TEXTLA,LCD_LINE4,TXT_WWW}
 
screenItem_t versionL4_s ={(control_t*)&versionL4,0}
 

Detailed Description

Screen handling.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Macro Definition Documentation

◆ isEditable

#define isEditable (   control)    ((control)!=CONTROL_TEXTLA && (control)!=CONTROL_REFRESH)

Function Documentation

◆ drawResetCause()

void drawResetCause ( uint8_t  param)

Prints the Flags set in MCUSR.

Parameters
paramNot used
Here is the call graph for this function:

◆ DrawVIcallback()

void DrawVIcallback ( uint8_t  param)

Draws the measured current for one sink.

Parameters
paramThe parameter given for the callback function (unused)
Here is the call graph for this function:

◆ DrawPRcallback()

void DrawPRcallback ( uint8_t  param)

Draws voltage, power and resistance for one sink.

Parameters
paramThe parameter given for the callback function (unused)
Here is the call graph for this function:

◆ DrawTempCallback()

void DrawTempCallback ( uint8_t  param)
Here is the call graph for this function:

◆ EnterSink()

void EnterSink ( CONTROL_RET  action,
ctlEnterNumber_t en,
uint8_t  param 
)

Sets a sink to the Value of an enterNumber-control.

Parameters
actionThe return value of the enterNumber (not used)
enA pointer to the enterNumber-control
param(unused)
Here is the call graph for this function:

◆ doScreenManualTest()

uint8_t doScreenManualTest ( void  )
Here is the call graph for this function:

◆ DrawASCallback()

void DrawASCallback ( uint8_t  param)
Here is the call graph for this function:

◆ doScreenDischgTest()

uint8_t doScreenDischgTest ( void  )
Here is the call graph for this function:

◆ DrawControl()

void DrawControl ( control_t control,
drawMode_t  mode 
)

(Re-) draws a control

Parameters
controla pointer to the control
modethe drawing mode
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RefreshAutoItems()

static void RefreshAutoItems ( screen_t screen)
static

Redraws all Auto-Refresh items.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Screen()

uint8_t Screen ( screen_t screen)

Handles a screen.

Parameters
screenA pointer to the screen.
Returns
The value of the retval of the control clicked.

A screen may have static, editable and autorefresh-objects. If the retval of an editable item is !=0 (normally used only with buttons) the screen is terminated when the user presses enter whenever the item is selected. If a screen has no editable items at all, the screen is terminated when the user presses enter, too.

Here is the call graph for this function:

◆ formatPrefixValue()

void formatPrefixValue ( prefixValue_t val,
double  newVal 
)

Formats a value using SI-Prefix Letters.

Parameters
vala pointer to the prefixValue_t
newValthe (new) value to be formatted The newVal is formatted to fit into the value-string of the struct. The function uses prefixes like 'kilo' or 'micro' to get easily readable values. To avoid flickering when the value changes between 999 and 1000 (999 and 1.00k) a threshold has been implemented to keep the same prefix until the value goes too far beyond.

Variable Documentation

◆ sinkPVal

◆ sFlags

volatile uint8_t sFlags

Flags used for Screen Control.

◆ PROGMEM

const char txtCurrent_t [] PROGMEM = "Cancel"
static

The Cancel-Button usually appears in the last line on the left.

The Text for Set Point.

The Program Version as to be displayed in the Greeting Screen.

The Start-Button usually appears in the 3rd line on the right.

The small Back-Button is a space-saving alternative.

The Back-Button is a Replacement for the Cancel Button.

The Enter-Button usually appears in the last line on the right.

◆ buttonCancel

ctlButton_t buttonCancel ={CONTROL_BUTTON,LCD_LINE4,TXT_CANCEL}

◆ buttonCancel_s

screenItem_t buttonCancel_s ={(control_t*)&buttonCancel,CANCEL}

Definition of the standard Cancel Button, last Line, left.

◆ buttonEnter

ctlButton_t buttonEnter ={CONTROL_BUTTON,LCD_LINE4+10,TXT_ENTER}

◆ buttonEnter_s

screenItem_t buttonEnter_s ={(control_t*)&buttonEnter,ENTER}

Definition of the standard Enter Button, last line, right.

◆ buttonBack

◆ buttonBack_s

screenItem_t buttonBack_s ={(control_t*)&buttonBack,BACK}

Definition of the Back Button as a Replacement for the Cancel Button.

◆ buttonBacks

ctlButton_t buttonBacks ={CONTROL_BUTTON,LCD_LINE4+18,TXT_BACKs}

◆ buttonBacks_s

screenItem_t buttonBacks_s ={(control_t*)&buttonBacks,BACK}

Definition of the Back Button as a Replacement for the Cancel Button.

◆ buttonStart

ctlButton_t buttonStart ={CONTROL_BUTTON,LCD_LINE3+14,TXT_START}

◆ buttonStart_s

screenItem_t buttonStart_s ={(control_t*)&buttonStart,START}

Definition of the standard Cancel Button, last Line, left.

◆ terminator

◆ terminator_s

screenItem_t terminator_s ={(control_t*)&terminator,0}

Definition of the Terminator. This Screen Item has to be the very last Control in a Screen Struct.

◆ versionL1

ctlText_t versionL1 ={CONTROL_TEXTLA,LCD_LINE1,TXT_VERSIONL1}

◆ versionL1_s

screenItem_t versionL1_s ={(control_t*)&versionL1,0}

◆ versionL2

ctlText_t versionL2 ={CONTROL_TEXTLA,LCD_LINE2,TXT_BUILD}

◆ versionL2_s

screenItem_t versionL2_s ={(control_t*)&versionL2,0}

◆ resetCause

◆ versionL3_s

screenItem_t versionL3_s ={(control_t*)&resetCause,0}

◆ versionL4

ctlText_t versionL4 ={CONTROL_TEXTLA,LCD_LINE4,TXT_WWW}

◆ versionL4_s

screenItem_t versionL4_s ={(control_t*)&versionL4,0}

◆ screenVersion

screen_t screenVersion
Initial value:
=
{
0,15,
{
}
}
screenItem_t versionL1_s
Definition: screen.c:124
screenItem_t versionL4_s
Definition: screen.c:130
screenItem_t versionL2_s
Definition: screen.c:126
screenItem_t versionL3_s
Definition: screen.c:128
screenItem_t terminator_s
Definition of the Terminator. This Screen Item has to be the very last Control in a Screen Struct.
Definition: screen.c:70

The Version Screen.

◆ valueI1

◆ valueI1_s

screenItem_t valueI1_s ={(control_t*)&valueI1,0}

◆ valueUPR1

◆ valueUPR1_s

screenItem_t valueUPR1_s ={(control_t*)&valueUPR1,0}

◆ temp

◆ temp_s

screenItem_t temp_s ={(control_t*)&temp,0}

◆ inSink1ev

enterNumberVariable_t inSink1ev ={"0.0000","A"}

◆ inSink1

◆ inSink1_s

screenItem_t inSink1_s ={(control_t*)&inSink1,0}

◆ txtSetPoint

◆ txtSetPoint_s

screenItem_t txtSetPoint_s ={(control_t*)&txtSetPoint,0}

◆ screenManualTest

screen_t screenManualTest
Initial value:
=
{
0,0,
{
}
}
screenItem_t temp_s
Definition: screen.c:183
screenItem_t txtSetPoint_s
Definition: screen.c:202
screenItem_t buttonBacks_s
Definition of the Back Button as a Replacement for the Cancel Button.
Definition: screen.c:63
screenItem_t valueUPR1_s
Definition: screen.c:181
screenItem_t inSink1_s
Definition: screen.c:188
screenItem_t valueI1_s
Definition: screen.c:179
screenItem_t terminator_s
Definition of the Terminator. This Screen Item has to be the very last Control in a Screen Struct.
Definition: screen.c:70

◆ txtCurrent

ctlText_t txtCurrent ={CONTROL_TEXTLA,LCD_LINE1,txtCurrent_t}

◆ txtCurrent_s

screenItem_t txtCurrent_s ={(control_t*)&txtCurrent,0}

◆ valueAS

◆ valueAS_s

screenItem_t valueAS_s ={(control_t*)&valueAS,0}

◆ screenDischgTest

screen_t screenDischgTest
Initial value:
=
{
0,0,
{
}
}
screenItem_t temp_s
Definition: screen.c:183
screenItem_t txtCurrent_s
Definition: screen.c:244
screenItem_t buttonStart_s
Definition of the standard Cancel Button, last Line, left.
Definition: screen.c:67
screenItem_t buttonBacks_s
Definition of the Back Button as a Replacement for the Cancel Button.
Definition: screen.c:63
screenItem_t valueAS_s
Definition: screen.c:246
screenItem_t inSink1_s
Definition: screen.c:188
screenItem_t valueI1_s
Definition: screen.c:179
screenItem_t terminator_s
Definition of the Terminator. This Screen Item has to be the very last Control in a Screen Struct.
Definition: screen.c:70