LOGGER  Logger
Data Logging using ESP8266
Macros | Functions | Variables
parameters.cpp File Reference
#include <EEPROM.h>
#include <arduino.h>
#include "parameters.h"
#include "parameterincludes.h"
#include "error.h"
#include "webpages.h"
#include "parametertable.h"

Macros

#define parametersEdit   1
 version of this module
 
#define PERMANENTS_VERSION   1
 

Functions

EXTERNDEF void parametersInit ()
 
EXTERNDEF void parametersSaveValue (void *pVariable, uint8_t numBytes)
 
EXTERNDEF void parametersSetValue (String name, String value)
 
EXTERNDEF void parametersSaveAll ()
 Save all variables that are stored in permanent memory.
 
EXTERNDEF String parametersDumpWebRow (void *pVariable)
 

Variables

EXTERNVAR uint8_t permanentsVersion
 < version of this include file More...
 
EXTERNVAR uint16_t permanentsSize = sizeof(permanentsVersion) + sizeof(permanentsSize)
 

Detailed Description

Services to store and recover permanent parameters.

Author
Michael Newman
Date
2February2016

Macro Definition Documentation

#define PERMANENTS_VERSION   1

Version of what is stored in permanent memory.

If this version does not match then variables are not recovered and the EEPROM is updated to match the values loaded with the code.

Function Documentation

EXTERNDEF String parametersDumpWebRow ( void *  pVariable)

Build a row that displays a variable and allows the user to set the value of the variable. The name of the value is permanentname and the name of the value is permanentvalue.

Parameters
pVariablepointer to the variable to display
Returns
a row for a table that displays the variable
EXTERNDEF void parametersInit ( )

Call once at system startup to recover parameters from memory that survives reboots and store the recovered values in memory.

EXTERNDEF void parametersSaveValue ( void *  pVariable,
uint8_t  numBytes 
)

Call to update a variable in permanent memory. Copys the in memory value to permanent memory. The permanent memory copy will be recovered at system boot. Call this routine any time the in memory variable changes.

The variable in memory is read from pVariable and stored in EEPROM. This value will be recovered at boot and be the initial value of the variable.

Parameters
pVariablepointer to memory storage
numBytesnumber of bytes of data to copy
EXTERNDEF void parametersSetValue ( String  name,
String  value 
)

Update a variable in permanent memory by first finding the variable by its permanent name and setting the local value and then setting the value in permanent storage.

Variable Documentation

EXTERNVAR uint16_t permanentsSize = sizeof(permanentsVersion) + sizeof(permanentsSize)

Place to store how many bytes are saved in permanent memory. Initialized to make sure we will always read the first two items

EXTERNVAR uint8_t permanentsVersion

< version of this include file

Place to store the permanents version number which is recovered from EEPROM