1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

allow to hide config items from the ui and allow to change config values in the init function

This commit is contained in:
wellenvogel
2022-01-14 23:16:43 +01:00
parent e70591eb4f
commit 966ef0c4fb
6 changed files with 49 additions and 10 deletions

View File

@@ -10,6 +10,13 @@
*/
void exampleInit(GwApi *api){
api->getLogger()->logDebug(GwLog::LOG,"example init running");
//this example is a more or less useless example how you could set some
//config value to a fixed value
//you can only set config values within the init function
//you could also compute this value from some own configuration
//for this example it would make a lot of sense to declare a capability
//to hide this config item from the UI - see header file
api->getConfig()->setValue(api->getConfig()->minXdrInterval,"50");
}
#define INVALID_COORD -99999
class GetBoatDataRequest: public GwMessage{
@@ -84,6 +91,7 @@ void exampleTask(GwApi *api){
bool hasPosition=false;
bool hasPosition2=false;
LOG_DEBUG(GwLog::DEBUG,"example switch ist %s",exampleSwitch?"true":"false");
LOG_DEBUG(GwLog::DEBUG,"minXdrInterval=%d",api->getConfig()->getInt(api->getConfig()->minXdrInterval));
GwApi::BoatValue *longitude=new GwApi::BoatValue(F("Longitude"));
GwApi::BoatValue *latitude=new GwApi::BoatValue(F("Latitude"));
GwApi::BoatValue *testValue=new GwApi::BoatValue(boatItemName);

View File

@@ -43,4 +43,7 @@ DECLARE_INITFUNCTION(exampleInit);
//elements when this capability is set correctly
DECLARE_CAPABILITY(testboard,true);
DECLARE_CAPABILITY(testboard2,true);
//hide some config value
//just set HIDE + the name of the config item to true
DECLARE_CAPABILITY(HIDEminXdrInterval,true);
#endif