From bf5c5d2292f71cd5f6fa449dd9174585098eacc0 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Tue, 17 Apr 2012 22:24:07 +0200 Subject: digital/beacon: display network status in the debug task --- digital/beacon/src/debug.c | 2 ++ digital/beacon/src/network.c | 7 ++++++- digital/beacon/src/network.h | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/digital/beacon/src/debug.c b/digital/beacon/src/debug.c index 11af35a8..c21d0dca 100644 --- a/digital/beacon/src/debug.c +++ b/digital/beacon/src/debug.c @@ -28,6 +28,7 @@ #include "configuration.h" #include "debug.h" #include "servo.h" +#include "network.h" HAL_UsartDescriptor_t appUsartDescriptor; // USART descriptor (required by stack) HAL_AppTimer_t debugTimer; // TIMER descripor used by the DEBUG task @@ -164,4 +165,5 @@ void debug_start_stop_task(void) void debug_task(void) { uprintf("------------------------- debug TASK -------------------------\r\n"); + uprintf("NWK : status = 0x%x\r\n",network_get_status()); } diff --git a/digital/beacon/src/network.c b/digital/beacon/src/network.c index 4247304f..14ee78ca 100644 --- a/digital/beacon/src/network.c +++ b/digital/beacon/src/network.c @@ -90,6 +90,11 @@ void network_start(void) ZDO_StartNetworkReq(&networkParams); } +/* This function returns the network status */ +uint16_t network_get_status(void) +{ + return appState; +} /* ZDO_StartNetwork primitive confirmation callback */ void ZDO_StartNetworkConf(ZDO_StartNetworkConf_t* confirmInfo) @@ -128,7 +133,7 @@ void ZDO_StartNetworkConf(ZDO_StartNetworkConf_t* confirmInfo) } else { - uprintf("CONNECTION FAILED. confirmInfo->status = %x\n\r",confirmInfo->status); +// uprintf("CONNECTION FAILED. confirmInfo->status = %x\n\r",confirmInfo->status); } SYS_PostTask(APL_TASK_ID); } diff --git a/digital/beacon/src/network.h b/digital/beacon/src/network.h index aec22c03..004434f0 100644 --- a/digital/beacon/src/network.h +++ b/digital/beacon/src/network.h @@ -64,6 +64,10 @@ void ZDO_WakeUpInd(void); void network_init(void); void network_start(void); + +/* This function returns the network status */ +uint16_t network_get_status(void); + void send_data(uint8_t type, uint8_t data); void send_angle(int angle_degree); void network_leave(void); -- cgit v1.2.3