1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-16 07:23:07 +01:00

intermediate: prepare for multiple grove configs

This commit is contained in:
andreas
2024-03-18 20:20:38 +01:00
parent 8641f0efd9
commit 59a80fcc9a
7 changed files with 107 additions and 70 deletions

View File

@@ -6,15 +6,9 @@
#include <MD5Builder.h>
using CfgInit=std::function<void(GwConfigHandler *)>;
static std::vector<CfgInit> cfgInits;
class CfgInitializer{
public:
CfgInitializer(CfgInit f){
cfgInits.push_back(f);
}
};
#define CFG_INIT(name,value,mode) \
__MSG("config set " #name " " #value " " #mode); \
static CfgInitializer _ ## name ## _init([](GwConfigHandler *cfg){ \
static GwInitializer<CfgInit> _ ## name ## _init(cfgInits,[](GwConfigHandler *cfg){ \
cfg->setValue(GwConfigDefinitions::name,value,GwConfigInterface::mode); \
});
#include "GwHardware.h"