add documentation

This commit is contained in:
elmo128 2023-09-21 17:22:57 +02:00
parent 7c5ec51abb
commit 45dacd4f78
2 changed files with 17 additions and 4 deletions

View File

@ -32,6 +32,9 @@ SDCard::~SDCard()
unmount();
}
/// @brief Transfer settings from config file on a SD card to the device.
/// @param nvMemory* where to save
/// @param TSettings* passing a struct is required, to save memory
void SDCard::SD2nvMemory(nvMemory* nvMem, TSettings* Settings)
{
if (loadConfigFile(Settings))
@ -43,6 +46,9 @@ void SDCard::SD2nvMemory(nvMemory* nvMem, TSettings* Settings)
}
}
/// @brief Retreives settings from a config file on a SD card.
/// @param TSettings* Struct to update with new Settings
/// @return true on success
bool SDCard::loadConfigFile(TSettings* Settings)
{
// Load existing configuration file

View File

@ -9,10 +9,7 @@
#include "..\devices\device.h"
#include "storage.h"
nvMemory::nvMemory()
{
Initialized_ = false;
}
nvMemory::nvMemory() : Initialized_(false){};
nvMemory::~nvMemory()
{
@ -20,6 +17,9 @@ nvMemory::~nvMemory()
SPIFFS.end();
};
/// @brief Save settings to config file on SPIFFS
/// @param TSettings* Settings to be saved.
/// @return true on success
bool nvMemory::saveConfig(TSettings* Settings)
{
if (init())
@ -60,6 +60,9 @@ bool nvMemory::saveConfig(TSettings* Settings)
return false;
}
/// @brief Load settings from config file located in SPIFFS.
/// @param TSettings* Struct to update with new settings.
/// @return true on success
bool nvMemory::loadConfig(TSettings* Settings)
{
// Uncomment if we need to format filesystem
@ -113,12 +116,16 @@ bool nvMemory::loadConfig(TSettings* Settings)
return false;
}
/// @brief Delete config file from SPIFFS
/// @return true on successs
bool nvMemory::deleteConfig()
{
Serial.println("SPIFS: Erasing config file..");
return SPIFFS.remove(JSON_CONFIG_FILE); //Borramos fichero
}
/// @brief Prepare and mount SPIFFS
/// @return true on success
bool nvMemory::init()
{
if (!Initialized_)