From c352e1674e41b08193835f522705864382cf55a3 Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Sat, 31 May 2014 19:48:46 +0000 Subject: [PATCH] --- Project/applications/smartcities/buffer.c | 5 +++-- Project/applications/smartcities/flash.bat | 2 +- Project/applications/smartcities/ntp.c | 15 +++------------ 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Project/applications/smartcities/buffer.c b/Project/applications/smartcities/buffer.c index 935e885..626d8b6 100644 --- a/Project/applications/smartcities/buffer.c +++ b/Project/applications/smartcities/buffer.c @@ -69,9 +69,10 @@ int send(char** buf, uint32_t *index, uint32_t *size_buf, char *provider_ID, cha chHeapFree(buf[i]); } if(buf!=NULL) + { chHeapFree(buf); - - printf(" posant la mida i l'index a 0\r\n"); + } + printf("posant la mida i l'index a 0\r\n"); *index=0; *size_buf=0; } diff --git a/Project/applications/smartcities/flash.bat b/Project/applications/smartcities/flash.bat index 8146deb..a1a5ba4 100644 --- a/Project/applications/smartcities/flash.bat +++ b/Project/applications/smartcities/flash.bat @@ -4,4 +4,4 @@ :: -HardRst ECHO flash -C:\ST-LINK_Utility\ST-LINK_CLI.exe -c SWD -p build/buttonExample.bin 0x08000000 -Run +"C:\Program Files\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility\ST-LINK_CLI.exe" -c SWD -p build/smartcities.bin 0x08000000 -Run diff --git a/Project/applications/smartcities/ntp.c b/Project/applications/smartcities/ntp.c index 6b733db..737684f 100644 --- a/Project/applications/smartcities/ntp.c +++ b/Project/applications/smartcities/ntp.c @@ -98,17 +98,11 @@ unsigned long getSecsSince1900 (void) // Set recv timeout. sendUDPNetConn->recv_timeout = SNTP_RECV_TIMEOUT; // Receive SNTP server response. - //receiveUDPNetBuf = netconn_recv(sendUDPNetConn); errLWIP=netconn_recv(sendUDPNetConn, &receiveUDPNetBuf); - - - //if (NULL != receiveUDPNetBuf) if(errLWIP==ERR_OK) { // Get pointer to response data. netbuf_data(receiveUDPNetBuf, (void **) &sntp_response, (u16_t *) &dataLen); - - // If the response size is good. if (dataLen == SNTP_MAX_DATA_LEN) { @@ -117,7 +111,6 @@ unsigned long getSecsSince1900 (void) { /* extract GMT time from response */ memcpy(×tamp, (sntp_response + SNTP_RCV_TIME_OFS), sizeof(timestamp)); - //timestamp = (ntohl(timestamp) - DIFF_SEC_1900_1970); timestamp=(ntohl(timestamp)); printf("Received timestamp %u\r\n", timestamp); @@ -136,25 +129,23 @@ unsigned long getSecsSince1900 (void) } else { - //printf("Netconn receive failed with %d\r\n", netconn_err(sendUDPNetConn)); printf("Netconn receive failed with %d\r\n", netconn_err(sendUDPNetConn)); } - } // netconn_send(sendUDPNetConn, sendUDPNetBuf); + } else { printf("Netconn sendto failed with %d\r\n", errLWIP); } - } //netconn_connect(sendUDPNetConn, &sntp_server_address, SNTP_PORT); + } else { printf("Netconn connect to server %X, port %u failed with %d\r\n", sntp_server_address.addr, SNTP_PORT, errLWIP); } - } // if ((NULL != sendUDPNetConn) && (NULL != sendUDPNetBuf) && (NULL != sntp_request)) + } else { printf("Netconn or netbuf or data allocation failed.\r\n"); } - // Deallocate space hold for netconn and netbuf structure. netbuf_delete(sendUDPNetBuf); netconn_delete(sendUDPNetConn); -- libgit2 0.22.2