42 lines
739 B
C++
42 lines
739 B
C++
#include "config.h"
|
|
#include <vector>
|
|
#include "FS.h"
|
|
#include "LITTLEFS.h"
|
|
#include "ArduinoJson.h"
|
|
|
|
const char *tagConfigfile = "/tagconfig.json";
|
|
|
|
struct tagConfig {
|
|
char filename[64];
|
|
char tagID[64];
|
|
};
|
|
|
|
std::vector<tagConfig> tags;
|
|
|
|
void loadConfig(const char *fname)
|
|
{
|
|
Serial.println("config: load");
|
|
File file = LITTLEFS.open(fname);
|
|
StaticJsonDocument<512> doc;
|
|
DeserializationError error = deserializeJson(doc, file);
|
|
if (error)
|
|
Serial.println(F("Failed to read file"));
|
|
|
|
serializeJsonPretty(doc, Serial);
|
|
Serial.println("config: load done");
|
|
|
|
}
|
|
|
|
void initConfig(void)
|
|
{
|
|
Serial.println("config: init");
|
|
|
|
loadConfig(tagConfigfile);
|
|
Serial.println("config: init done");
|
|
|
|
}
|
|
|
|
void handleConfig(void)
|
|
{
|
|
|
|
} |