Gbox 4.20
Grow box automation and monitoring - <a href='https://sites.google.com/site/growboxguy/'>https://sites.google.com/site/growboxguy/</a>
 
Loading...
Searching...
No Matches
Settings.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Settings
 
struct  Settings::HempyModuleSettings
 < Hempy default settings More...
 
struct  Settings::HempyBucketSettings
 < HempyBucket default settings More...
 
struct  Settings::SoundSettings
 < Sound default settings More...
 
struct  Settings::WaterPumpSettings
 < WaterPump default settings More...
 
struct  Settings::WeightSensorSettings
 < WeightSensor default settings More...
 

Functions

void saveSettings (Settings *ToSave)
 Store settings in EEPROM - Only updates changed bits.
 
SettingsloadSettings (bool ResetEEPROM=false)
 Load settings from EEPROM.
 
void restoreDefaults ()
 Load sketch default settings into EEPROM.
 

Variables

constexpr uint8_t Version = 16
 Default Settings for each component within the module. Loaded when the Arduino starts.
 
constexpr uint8_t MaxWordLength = 32
 Default char * buffer length for storing a word + null terminator. Memory intense!
 
constexpr uint8_t MaxShotTextLength = 64
 Default char * buffer length for storing mutiple words. Memory intense!
 
constexpr uint16_t MaxLongTextLength = 168
 Default char * buffer length for storing a long text. Memory intense!
 
constexpr uint8_t QueueDepth = 6
 Limits the maximum number of active modules. Memory intense!
 
char LongMessage [MaxLongTextLength]
 Temp storage for assembling long messages (REST API, MQTT reporting)
 
char ShortMessage [MaxShotTextLength]
 Temp storage for assembling short text messages (Log entries, Error messages,etc)
 
char CurrentTime [MaxWordLength]
 Buffer for storing current time in text format.
 
constexpr uint8_t WirelessCSNPin = 9
 < nRF24L01+ wireless receiver
 
constexpr uint8_t WirelessCEPin = 10
 nRF24l01+ wireless transmitter CE pin - Pre-connected on RF-Nano
 
constexpr uint8_t WirelessChannel [6] = {"Hemp1"}
 This needs to be unique and match with the Name of the HempyModule_Web object in the MainModule_Web.cpp.
 
constexpr uint8_t WirelessPayloadSize = 32
 Size of the wireless packages exchanged with the Main module. Max 32 bytes are supported on nRF24L01+.
 
constexpr uint16_t WirelessMessageTimeout = 500
 (ms) One package should be exchanged within this timeout (Including retries and delays)
 
constexpr uint16_t WirelessReceiveTimeout = 60000
 (ms) If no packages are received from the Main module over this limit, try reseting the nRF24L01+ wireless receiver
 

Function Documentation

◆ loadSettings()

Settings * loadSettings ( bool  ResetEEPROM)

Load settings from EEPROM.

Parameters
ResetEEPROM- Force loading the defaults from the sketch and overwriting the EEPROM with it
Returns
Reference to Settings object
Parameters
ResetEEPROMif the function contains arguments with default values, they must be declared strictly before they are called, otherwise there is a compilation error: '<function name> was not declared in this scope. https://forum.arduino.cc/index.php?topic=606678.0

Definition at line 20 of file Settings.cpp.

◆ restoreDefaults()

void restoreDefaults ( )

Load sketch default settings into EEPROM.

Attention
Restarts the Arduino sketch!

Definition at line 45 of file Settings.cpp.

◆ saveSettings()

void saveSettings ( Settings ToSave)

Store settings in EEPROM - Only updates changed bits.

Attention
Use cautiously, EEPROM has a write limit of 100.000 cycles

Definition at line 10 of file Settings.cpp.

Variable Documentation

◆ CurrentTime

char CurrentTime[MaxWordLength]
extern

Buffer for storing current time in text format.

Definition at line 30 of file Gbox420_Mega_Main.ino.

◆ LongMessage

char LongMessage[MaxLongTextLength]
extern

Temp storage for assembling long messages (REST API, MQTT reporting)

Definition at line 28 of file Gbox420_Mega_Main.ino.

◆ MaxLongTextLength

constexpr uint16_t MaxLongTextLength = 168
constexpr

Default char * buffer length for storing a long text. Memory intense!

Definition at line 19 of file Settings.h.

◆ MaxShotTextLength

constexpr uint8_t MaxShotTextLength = 64
constexpr

Default char * buffer length for storing mutiple words. Memory intense!

Definition at line 18 of file Settings.h.

◆ MaxWordLength

constexpr uint8_t MaxWordLength = 32
constexpr

Default char * buffer length for storing a word + null terminator. Memory intense!

Definition at line 17 of file Settings.h.

◆ QueueDepth

constexpr uint8_t QueueDepth = 6
constexpr

Limits the maximum number of active modules. Memory intense!

Global variables

Definition at line 20 of file Settings.h.

◆ ShortMessage

char ShortMessage[MaxShotTextLength]
extern

Temp storage for assembling short text messages (Log entries, Error messages,etc)

Definition at line 29 of file Gbox420_Mega_Main.ino.

◆ Version

constexpr uint8_t Version = 16
constexpr

Default Settings for each component within the module. Loaded when the Arduino starts.

Settings are stored in EEPROM and kept between reboots. Stored values are updated by the website controls on user interaction.

Warning
EEPROM has a write limit of 100.000 cycles, constantly updating the variables inside a loop would wear out the EEPROM memory!
Attention
Update the Version number when you change the structure of the settings. This will overwrite the EEPROM stored settings with the sketch defaults from this file.
Author
GrowBoxGuy
Version
4.20 Increment this after changing the stucture of the SAVED TO EEPROM section to force overwriting the stored settings in the Arduino's EEPROM. NOT SAVED TO EEPROM Global constants

Definition at line 12 of file Settings.h.

◆ WirelessCEPin

constexpr uint8_t WirelessCEPin = 10
constexpr

nRF24l01+ wireless transmitter CE pin - Pre-connected on RF-Nano

Definition at line 29 of file Settings.h.

◆ WirelessChannel

constexpr uint8_t WirelessChannel[6] = {"Hemp1"}
constexpr

This needs to be unique and match with the Name of the HempyModule_Web object in the MainModule_Web.cpp.

Definition at line 30 of file Settings.h.

◆ WirelessCSNPin

constexpr uint8_t WirelessCSNPin = 9
constexpr

< nRF24L01+ wireless receiver

nRF24l01+ wireless transmitter CSN pin - Pre-connected on RF-Nano

Definition at line 28 of file Settings.h.

◆ WirelessMessageTimeout

constexpr uint16_t WirelessMessageTimeout = 500
constexpr

(ms) One package should be exchanged within this timeout (Including retries and delays)

Definition at line 32 of file Settings.h.

◆ WirelessPayloadSize

constexpr uint8_t WirelessPayloadSize = 32
constexpr

Size of the wireless packages exchanged with the Main module. Max 32 bytes are supported on nRF24L01+.

Definition at line 31 of file Settings.h.

◆ WirelessReceiveTimeout

constexpr uint16_t WirelessReceiveTimeout = 60000
constexpr

(ms) If no packages are received from the Main module over this limit, try reseting the nRF24L01+ wireless receiver

SAVED TO EEPROM - Settings struct If you change things here, increase the Version variable in line 12

Definition at line 33 of file Settings.h.