Commit c352e1674e41b08193835f522705864382cf55a3
1 parent
d53ffdcd
--no commit message
Showing
3 changed files
with
7 additions
and
15 deletions
Project/applications/smartcities/buffer.c
... | ... | @@ -69,9 +69,10 @@ int send(char** buf, uint32_t *index, uint32_t *size_buf, char *provider_ID, cha |
69 | 69 | chHeapFree(buf[i]); |
70 | 70 | } |
71 | 71 | if(buf!=NULL) |
72 | + { | |
72 | 73 | chHeapFree(buf); |
73 | - | |
74 | - printf(" posant la mida i l'index a 0\r\n"); | |
74 | + } | |
75 | + printf("posant la mida i l'index a 0\r\n"); | |
75 | 76 | *index=0; |
76 | 77 | *size_buf=0; |
77 | 78 | } | ... | ... |
Project/applications/smartcities/flash.bat
Project/applications/smartcities/ntp.c
... | ... | @@ -98,17 +98,11 @@ unsigned long getSecsSince1900 (void) |
98 | 98 | // Set recv timeout. |
99 | 99 | sendUDPNetConn->recv_timeout = SNTP_RECV_TIMEOUT; |
100 | 100 | // Receive SNTP server response. |
101 | - //receiveUDPNetBuf = netconn_recv(sendUDPNetConn); | |
102 | 101 | errLWIP=netconn_recv(sendUDPNetConn, &receiveUDPNetBuf); |
103 | - | |
104 | - | |
105 | - //if (NULL != receiveUDPNetBuf) | |
106 | 102 | if(errLWIP==ERR_OK) |
107 | 103 | { |
108 | 104 | // Get pointer to response data. |
109 | 105 | netbuf_data(receiveUDPNetBuf, (void **) &sntp_response, (u16_t *) &dataLen); |
110 | - | |
111 | - | |
112 | 106 | // If the response size is good. |
113 | 107 | if (dataLen == SNTP_MAX_DATA_LEN) |
114 | 108 | { |
... | ... | @@ -117,7 +111,6 @@ unsigned long getSecsSince1900 (void) |
117 | 111 | { |
118 | 112 | /* extract GMT time from response */ |
119 | 113 | memcpy(×tamp, (sntp_response + SNTP_RCV_TIME_OFS), sizeof(timestamp)); |
120 | - //timestamp = (ntohl(timestamp) - DIFF_SEC_1900_1970); | |
121 | 114 | timestamp=(ntohl(timestamp)); |
122 | 115 | |
123 | 116 | printf("Received timestamp %u\r\n", timestamp); |
... | ... | @@ -136,25 +129,23 @@ unsigned long getSecsSince1900 (void) |
136 | 129 | } |
137 | 130 | else |
138 | 131 | { |
139 | - //printf("Netconn receive failed with %d\r\n", netconn_err(sendUDPNetConn)); | |
140 | 132 | printf("Netconn receive failed with %d\r\n", netconn_err(sendUDPNetConn)); |
141 | 133 | } |
142 | - } // netconn_send(sendUDPNetConn, sendUDPNetBuf); | |
134 | + } | |
143 | 135 | else |
144 | 136 | { |
145 | 137 | printf("Netconn sendto failed with %d\r\n", errLWIP); |
146 | 138 | } |
147 | - } //netconn_connect(sendUDPNetConn, &sntp_server_address, SNTP_PORT); | |
139 | + } | |
148 | 140 | else |
149 | 141 | { |
150 | 142 | printf("Netconn connect to server %X, port %u failed with %d\r\n", sntp_server_address.addr, SNTP_PORT, errLWIP); |
151 | 143 | } |
152 | - } // if ((NULL != sendUDPNetConn) && (NULL != sendUDPNetBuf) && (NULL != sntp_request)) | |
144 | + } | |
153 | 145 | else |
154 | 146 | { |
155 | 147 | printf("Netconn or netbuf or data allocation failed.\r\n"); |
156 | 148 | } |
157 | - | |
158 | 149 | // Deallocate space hold for netconn and netbuf structure. |
159 | 150 | netbuf_delete(sendUDPNetBuf); |
160 | 151 | netconn_delete(sendUDPNetConn); | ... | ... |