Minor optimizations & code harmonization (#708)
This commit is contained in:
+13
-5
@@ -39,7 +39,9 @@ char _convBuf[MAX_PAYLOAD*2+1];
|
||||
void _callbackTransportReady(void)
|
||||
{
|
||||
if (!_coreConfig.presentationSent) {
|
||||
#if !defined(MY_GATEWAY_FEATURE) // GW calls presentNode() when client connected
|
||||
presentNode();
|
||||
#endif
|
||||
_registerNode();
|
||||
_coreConfig.presentationSent = true;
|
||||
}
|
||||
@@ -94,7 +96,7 @@ void _begin(void)
|
||||
// set defaults
|
||||
_coreConfig.presentationSent = false;
|
||||
|
||||
// Call before() in sketch (if it exists)
|
||||
// Call sketch before() (if defined)
|
||||
if (before) {
|
||||
CORE_DEBUG(PSTR("MCO:BGN:BFR\n")); // before callback
|
||||
before();
|
||||
@@ -143,7 +145,7 @@ void _begin(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Call sketch setup
|
||||
// Call sketch setup() (if defined)
|
||||
if (setup) {
|
||||
CORE_DEBUG(PSTR("MCO:BGN:STP\n")); // setup callback
|
||||
setup();
|
||||
@@ -223,33 +225,39 @@ void presentNode(void)
|
||||
|
||||
uint8_t getNodeId(void)
|
||||
{
|
||||
uint8_t result = VALUE_NOT_DEFINED;
|
||||
uint8_t result;
|
||||
#if defined(MY_GATEWAY_FEATURE)
|
||||
result = GATEWAY_ADDRESS;
|
||||
#elif defined(MY_SENSOR_NETWORK)
|
||||
result = transportGetNodeId();
|
||||
#else
|
||||
result = VALUE_NOT_DEFINED;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
uint8_t getParentNodeId(void)
|
||||
{
|
||||
uint8_t result = VALUE_NOT_DEFINED;
|
||||
uint8_t result;
|
||||
#if defined(MY_GATEWAY_FEATURE)
|
||||
result = VALUE_NOT_DEFINED; // GW doesn't have a parent
|
||||
#elif defined(MY_SENSOR_NETWORK)
|
||||
result = transportGetParentNodeId();
|
||||
#else
|
||||
result = VALUE_NOT_DEFINED;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
uint8_t getDistanceGW(void)
|
||||
{
|
||||
uint8_t result = VALUE_NOT_DEFINED;
|
||||
uint8_t result;
|
||||
#if defined(MY_GATEWAY_FEATURE)
|
||||
result = 0;
|
||||
#elif defined(MY_SENSOR_NETWORK)
|
||||
result = transportGetDistanceGW();
|
||||
#else
|
||||
result = VALUE_NOT_DEFINED;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user