Commit ac6a3343032c469423154bbb574bef0b8cc676e5
1 parent
f98a930c
--no commit message
Showing
7 changed files
with
52 additions
and
64 deletions
Project/applications/smartcities/buffer.c
@@ -7,13 +7,10 @@ char** put_message(char* info, char** buf,uint32_t *index, uint32_t *buf_len) | @@ -7,13 +7,10 @@ char** put_message(char* info, char** buf,uint32_t *index, uint32_t *buf_len) | ||
7 | len=*buf_len; | 7 | len=*buf_len; |
8 | if(len==*index) | 8 | if(len==*index) |
9 | { | 9 | { |
10 | - DBG_BUFFER("Joining buffer...\r\n"); | ||
11 | char** buffer = join_buf(buf, buf_len); | 10 | char** buffer = join_buf(buf, buf_len); |
12 | - DBG_BUFFER("Joined buffer...\r\n"); | ||
13 | buffer[*index] = chHeapAlloc(NULL,strlen(info)+1); | 11 | buffer[*index] = chHeapAlloc(NULL,strlen(info)+1); |
14 | - DBG_BUFFER("Memory allocated...\r\n"); | ||
15 | strcpy(buffer[*index],info); | 12 | strcpy(buffer[*index],info); |
16 | - DBG_BUFFER("Data copied...\r\n"); | 13 | + DBG_BUFFER("Data copied\r\n"); |
17 | i = *index+1; | 14 | i = *index+1; |
18 | *index = i; | 15 | *index = i; |
19 | return buffer; | 16 | return buffer; |
@@ -31,9 +28,10 @@ char** put_message(char* info, char** buf,uint32_t *index, uint32_t *buf_len) | @@ -31,9 +28,10 @@ char** put_message(char* info, char** buf,uint32_t *index, uint32_t *buf_len) | ||
31 | 28 | ||
32 | int check_memory() | 29 | int check_memory() |
33 | { | 30 | { |
31 | + wismart_mem_stat_ram_t status = libwismart_GetMemFree_Ram(); | ||
34 | DBG_BUFFER("Checking available memory...\r\n"); | 32 | DBG_BUFFER("Checking available memory...\r\n"); |
35 | - DBG_BUFFER("%c[1;36mAvailable memory: %d B%c[1;00m\r\n",0x1B,libwismart_GetMemFree_Ram().free,0x1B); | ||
36 | - int mem = MAX_RAM - libwismart_GetMemFree_Ram().free; | 33 | + DBG_BUFFER("%c[1;36mAvailable memory: %d B%c[1;00m\r\n",0x1B,status.free,0x1B); |
34 | + int mem = MAX_RAM - status.free; | ||
37 | DBG_BUFFER("%c[1;36mUsed memory: %d B%c[1;00m\r\n",0x1B,mem,0x1B); | 35 | DBG_BUFFER("%c[1;36mUsed memory: %d B%c[1;00m\r\n",0x1B,mem,0x1B); |
38 | if(mem >= HARD_LIMIT) | 36 | if(mem >= HARD_LIMIT) |
39 | { | 37 | { |
@@ -78,30 +76,23 @@ int send(char** buf, uint32_t *index, uint32_t *size_buf, char *provider_ID, cha | @@ -78,30 +76,23 @@ int send(char** buf, uint32_t *index, uint32_t *size_buf, char *provider_ID, cha | ||
78 | return res; | 76 | return res; |
79 | } | 77 | } |
80 | 78 | ||
81 | -//realloc | ||
82 | char** join_buf(char** buf, uint32_t *buf_len) | 79 | char** join_buf(char** buf, uint32_t *buf_len) |
83 | { | 80 | { |
81 | + DBG_BUFFER("Joining buffer...\r\n"); | ||
84 | char** n_buf; | 82 | char** n_buf; |
85 | int len = *buf_len; | 83 | int len = *buf_len; |
86 | n_buf = chHeapAlloc (NULL,sizeof (char *) * (len+1)); | 84 | n_buf = chHeapAlloc (NULL,sizeof (char *) * (len+1)); |
87 | int i; | 85 | int i; |
88 | - DBG_BUFFER("Start buffer join...\r\n"); | ||
89 | for(i=0; i<len;i++) | 86 | for(i=0; i<len;i++) |
90 | { | 87 | { |
91 | - DBG_BUFFER("in join_buf for, Asking for %d bytes...\r\n",strlen(buf[i]+1)); | ||
92 | n_buf[i] = chHeapAlloc(NULL,strlen(buf[i])+1); | 88 | n_buf[i] = chHeapAlloc(NULL,strlen(buf[i])+1); |
93 | - DBG_BUFFER("in join_buf for, Memory allocated...\r\n"); | ||
94 | strcpy(n_buf[i],buf[i]); | 89 | strcpy(n_buf[i],buf[i]); |
95 | - DBG_BUFFER("in join_buf for, Message copied...\r\n"); | ||
96 | chHeapFree(buf[i]); | 90 | chHeapFree(buf[i]); |
97 | - DBG_BUFFER("in join_buf for, Memory cleared...\r\n"); | ||
98 | } | 91 | } |
99 | - DBG_BUFFER("All data transferred\r\n"); | ||
100 | if(len != 0) | 92 | if(len != 0) |
101 | { | 93 | { |
102 | chHeapFree(buf); | 94 | chHeapFree(buf); |
103 | } | 95 | } |
104 | - DBG_BUFFER("Old buffer cleared\r\n"); | ||
105 | len++; | 96 | len++; |
106 | *buf_len=len; | 97 | *buf_len=len; |
107 | return n_buf; | 98 | return n_buf; |
Project/applications/smartcities/buglist.txt
Project/applications/smartcities/include/sensors.h
@@ -56,7 +56,8 @@ char* distance_value(uint16_t distance); | @@ -56,7 +56,8 @@ char* distance_value(uint16_t distance); | ||
56 | 56 | ||
57 | 57 | ||
58 | //PRESSURE SENSOR | 58 | //PRESSURE SENSOR |
59 | -typedef struct { | 59 | +typedef struct bmp085_callibration bmp085_callibration_t; |
60 | +struct bmp085_callibration { | ||
60 | uint16_t AC1; | 61 | uint16_t AC1; |
61 | uint16_t AC2; | 62 | uint16_t AC2; |
62 | uint16_t AC3; | 63 | uint16_t AC3; |
@@ -68,14 +69,14 @@ typedef struct { | @@ -68,14 +69,14 @@ typedef struct { | ||
68 | uint16_t MB; | 69 | uint16_t MB; |
69 | uint16_t MC; | 70 | uint16_t MC; |
70 | uint16_t MD; | 71 | uint16_t MD; |
71 | -} bmp085_callibration; | 72 | +}; |
72 | 73 | ||
73 | void init_pressure(void); | 74 | void init_pressure(void); |
74 | void init_pressure_temperature(void); | 75 | void init_pressure_temperature(void); |
75 | uint16_t get_pressure_data(void); | 76 | uint16_t get_pressure_data(void); |
76 | uint16_t get_pressure_temperature_data(void); | 77 | uint16_t get_pressure_temperature_data(void); |
77 | -bmp085_callibration get_pressure_callibration_data(void); | ||
78 | -char* callibration_pressure_data_csv(bmp085_callibration parameters); | 78 | +void get_pressure_callibration_data(bmp085_callibration_t *calib_data); |
79 | +char* callibration_pressure_data_csv(bmp085_callibration_t *parameters); | ||
79 | char* pressure_value(uint16_t pressure,uint16_t temperature); | 80 | char* pressure_value(uint16_t pressure,uint16_t temperature); |
80 | 81 | ||
81 | //HUMIDITY AND TEMPERATURE SENSOR | 82 | //HUMIDITY AND TEMPERATURE SENSOR |
Project/applications/smartcities/json.c
@@ -8,7 +8,10 @@ uint8_t register_sensor(sensor sens) | @@ -8,7 +8,10 @@ uint8_t register_sensor(sensor sens) | ||
8 | if(sens.ID == PRESSURE_ADDR) | 8 | if(sens.ID == PRESSURE_ADDR) |
9 | { | 9 | { |
10 | DBG_JSON("Putting additional info for pressure sensor...\r\n"); | 10 | DBG_JSON("Putting additional info for pressure sensor...\r\n"); |
11 | - char *callibration_data = callibration_pressure_data_csv(get_pressure_callibration_data()); | 11 | + bmp085_callibration_t calib_data; |
12 | + get_pressure_callibration_data(&calib_data); | ||
13 | + DBG_JSON("Got callibration data\r\n"); | ||
14 | + char *callibration_data = callibration_pressure_data_csv(&calib_data); | ||
12 | DBG_JSON("callibration_data is: %s\r\n",callibration_data); | 15 | DBG_JSON("callibration_data is: %s\r\n",callibration_data); |
13 | statement = prepare_json_register_statement(mod,sens,callibration_data); | 16 | statement = prepare_json_register_statement(mod,sens,callibration_data); |
14 | chHeapFree(callibration_data); | 17 | chHeapFree(callibration_data); |
Project/applications/smartcities/main.c
@@ -132,7 +132,6 @@ void put_buffers(char** buffers[],uint32_t ind[],uint32_t sizes[],char** cooked, | @@ -132,7 +132,6 @@ void put_buffers(char** buffers[],uint32_t ind[],uint32_t sizes[],char** cooked, | ||
132 | DBG("Message put: %s\r\n",buffers[i][ind[i]-1]); | 132 | DBG("Message put: %s\r\n",buffers[i][ind[i]-1]); |
133 | chHeapFree(cooked[i]); | 133 | chHeapFree(cooked[i]); |
134 | DBG("Memory freed\n\r"); | 134 | DBG("Memory freed\n\r"); |
135 | - DBG("[ASSERTION] Message put: %s with length %d\r\n",buffers[i][ind[i]-1] ,strlen(buffers[i][ind[i]-1])); | ||
136 | } | 135 | } |
137 | DBG("Data is now in buffer\n\r"); | 136 | DBG("Data is now in buffer\n\r"); |
138 | } | 137 | } |
@@ -196,7 +195,6 @@ void wifi_disconnect(void) | @@ -196,7 +195,6 @@ void wifi_disconnect(void) | ||
196 | connected |= CONNECTED_PAST; | 195 | connected |= CONNECTED_PAST; |
197 | } | 196 | } |
198 | connected = connected & CONNECTED_PAST ; | 197 | connected = connected & CONNECTED_PAST ; |
199 | - DBG("Connnected: %d\r\n",connected); | ||
200 | timeout = 0; | 198 | timeout = 0; |
201 | uint8_t res=libwismart_WiFiDisconnect(); | 199 | uint8_t res=libwismart_WiFiDisconnect(); |
202 | if(res) | 200 | if(res) |
@@ -212,7 +210,7 @@ int main(void) | @@ -212,7 +210,7 @@ int main(void) | ||
212 | libwismart_PowerSave_HigherProfile(TRUE); | 210 | libwismart_PowerSave_HigherProfile(TRUE); |
213 | libwismart_RegisterDhcpCB(dhcp_connect_result_cb); | 211 | libwismart_RegisterDhcpCB(dhcp_connect_result_cb); |
214 | libwismart_WiFiInit(); | 212 | libwismart_WiFiInit(); |
215 | - libwismart_SetScanRunsForConnTimeout(4); //Edit a 4 | 213 | + libwismart_SetScanRunsForConnTimeout(4); |
216 | libwismart_EnableBsdSocketAPI(); | 214 | libwismart_EnableBsdSocketAPI(); |
217 | 215 | ||
218 | int i; | 216 | int i; |
Project/applications/smartcities/ntp.c
@@ -168,9 +168,7 @@ char* timestamp_data(char* value,Date time) | @@ -168,9 +168,7 @@ char* timestamp_data(char* value,Date time) | ||
168 | DBG_NTP("Writing timestamp...\r\n"); | 168 | DBG_NTP("Writing timestamp...\r\n"); |
169 | uint8_t length = strlen(value) + strlen(",00/00/0000T00:00:00") + 1; | 169 | uint8_t length = strlen(value) + strlen(",00/00/0000T00:00:00") + 1; |
170 | char str_day[3],str_month[3],str_year[5],str_hour[3],str_minute[3],str_second[3]; | 170 | char str_day[3],str_month[3],str_year[5],str_hour[3],str_minute[3],str_second[3]; |
171 | - DBG_NTP("Asking for %d bytes in timestamp_data\r\n", length); | ||
172 | char* data = chHeapAlloc(NULL,length*sizeof(char)); | 171 | char* data = chHeapAlloc(NULL,length*sizeof(char)); |
173 | - DBG_NTP("Data allocated in timestamp_data\r\n", length); | ||
174 | sprintf(str_day,"%d",time.day); | 172 | sprintf(str_day,"%d",time.day); |
175 | sprintf(str_month,"%d",time.month); | 173 | sprintf(str_month,"%d",time.month); |
176 | sprintf(str_year,"%d",time.year); | 174 | sprintf(str_year,"%d",time.year); |
Project/applications/smartcities/sensors.c
@@ -219,107 +219,105 @@ void init_pressure_temperature(void) | @@ -219,107 +219,105 @@ void init_pressure_temperature(void) | ||
219 | chThdSleepMilliseconds(5); | 219 | chThdSleepMilliseconds(5); |
220 | } | 220 | } |
221 | 221 | ||
222 | -bmp085_callibration get_pressure_callibration_data(void) | 222 | +void get_pressure_callibration_data(bmp085_callibration_t *calib_data) |
223 | { | 223 | { |
224 | DBG_SENSORS("[PRESSURE] Fetching callibration data\r\n"); | 224 | DBG_SENSORS("[PRESSURE] Fetching callibration data\r\n"); |
225 | - bmp085_callibration calib_data; | ||
226 | 225 | ||
227 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 226 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
228 | I2C_write(I2C1, 0xAA); | 227 | I2C_write(I2C1, 0xAA); |
229 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 228 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
230 | - calib_data.AC1 = (I2C_read_ack(I2C1) << 8); | ||
231 | - calib_data.AC1 |= I2C_read_nack(I2C1); | 229 | + calib_data->AC1 = (I2C_read_ack(I2C1) << 8); |
230 | + calib_data->AC1 |= I2C_read_nack(I2C1); | ||
232 | I2C_stop(I2C1); | 231 | I2C_stop(I2C1); |
233 | 232 | ||
234 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 233 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
235 | I2C_write(I2C1, 0xAC); | 234 | I2C_write(I2C1, 0xAC); |
236 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 235 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
237 | - calib_data.AC2 = (I2C_read_ack(I2C1) << 8); | ||
238 | - calib_data.AC2 |= I2C_read_nack(I2C1); | 236 | + calib_data->AC2 = (I2C_read_ack(I2C1) << 8); |
237 | + calib_data->AC2 |= I2C_read_nack(I2C1); | ||
239 | I2C_stop(I2C1); | 238 | I2C_stop(I2C1); |
240 | 239 | ||
241 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 240 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
242 | I2C_write(I2C1, 0xAE); | 241 | I2C_write(I2C1, 0xAE); |
243 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 242 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
244 | - calib_data.AC3 = (I2C_read_ack(I2C1) << 8); | ||
245 | - calib_data.AC3 |= I2C_read_nack(I2C1); | 243 | + calib_data->AC3 = (I2C_read_ack(I2C1) << 8); |
244 | + calib_data->AC3 |= I2C_read_nack(I2C1); | ||
246 | I2C_stop(I2C1); | 245 | I2C_stop(I2C1); |
247 | 246 | ||
248 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 247 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
249 | I2C_write(I2C1, 0xB0); | 248 | I2C_write(I2C1, 0xB0); |
250 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 249 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
251 | - calib_data.AC4 = (I2C_read_ack(I2C1) << 8); | ||
252 | - calib_data.AC4 |= I2C_read_nack(I2C1); | 250 | + calib_data->AC4 = (I2C_read_ack(I2C1) << 8); |
251 | + calib_data->AC4 |= I2C_read_nack(I2C1); | ||
253 | I2C_stop(I2C1); | 252 | I2C_stop(I2C1); |
254 | 253 | ||
255 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 254 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
256 | I2C_write(I2C1, 0xB2); | 255 | I2C_write(I2C1, 0xB2); |
257 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 256 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
258 | - calib_data.AC5 = (I2C_read_ack(I2C1) << 8); | ||
259 | - calib_data.AC5 |= I2C_read_nack(I2C1); | 257 | + calib_data->AC5 = (I2C_read_ack(I2C1) << 8); |
258 | + calib_data->AC5 |= I2C_read_nack(I2C1); | ||
260 | I2C_stop(I2C1); | 259 | I2C_stop(I2C1); |
261 | 260 | ||
262 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 261 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
263 | I2C_write(I2C1, 0xB4); | 262 | I2C_write(I2C1, 0xB4); |
264 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 263 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
265 | - calib_data.AC6 = (I2C_read_ack(I2C1) << 8); | ||
266 | - calib_data.AC6 |= I2C_read_nack(I2C1); | 264 | + calib_data->AC6 = (I2C_read_ack(I2C1) << 8); |
265 | + calib_data->AC6 |= I2C_read_nack(I2C1); | ||
267 | I2C_stop(I2C1); | 266 | I2C_stop(I2C1); |
268 | 267 | ||
269 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 268 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
270 | I2C_write(I2C1, 0xB6); | 269 | I2C_write(I2C1, 0xB6); |
271 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 270 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
272 | - calib_data.B1 = (I2C_read_ack(I2C1) << 8); | ||
273 | - calib_data.B1 |= I2C_read_nack(I2C1); | 271 | + calib_data->B1 = (I2C_read_ack(I2C1) << 8); |
272 | + calib_data->B1 |= I2C_read_nack(I2C1); | ||
274 | I2C_stop(I2C1); | 273 | I2C_stop(I2C1); |
275 | 274 | ||
276 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 275 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
277 | I2C_write(I2C1, 0xB8); | 276 | I2C_write(I2C1, 0xB8); |
278 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 277 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
279 | - calib_data.B2 = (I2C_read_ack(I2C1) << 8); | ||
280 | - calib_data.B2 |= I2C_read_nack(I2C1); | 278 | + calib_data->B2 = (I2C_read_ack(I2C1) << 8); |
279 | + calib_data->B2 |= I2C_read_nack(I2C1); | ||
281 | I2C_stop(I2C1); | 280 | I2C_stop(I2C1); |
282 | 281 | ||
283 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 282 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
284 | I2C_write(I2C1, 0xBA); | 283 | I2C_write(I2C1, 0xBA); |
285 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 284 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
286 | - calib_data.MB = (I2C_read_ack(I2C1) << 8); | ||
287 | - calib_data.MB |= I2C_read_nack(I2C1); | 285 | + calib_data->MB = (I2C_read_ack(I2C1) << 8); |
286 | + calib_data->MB |= I2C_read_nack(I2C1); | ||
288 | I2C_stop(I2C1); | 287 | I2C_stop(I2C1); |
289 | 288 | ||
290 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 289 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
291 | I2C_write(I2C1, 0xBC); | 290 | I2C_write(I2C1, 0xBC); |
292 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 291 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
293 | - calib_data.MC = (I2C_read_ack(I2C1) << 8); | ||
294 | - calib_data.MC |= I2C_read_nack(I2C1); | 292 | + calib_data->MC = (I2C_read_ack(I2C1) << 8); |
293 | + calib_data->MC |= I2C_read_nack(I2C1); | ||
295 | I2C_stop(I2C1); | 294 | I2C_stop(I2C1); |
296 | 295 | ||
297 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); | 296 | I2C_start(I2C1,PRESSURE_ADDR << 1, I2C_Direction_Transmitter); |
298 | I2C_write(I2C1, 0xBE); | 297 | I2C_write(I2C1, 0xBE); |
299 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); | 298 | I2C_restart(I2C1, PRESSURE_ADDR << 1, I2C_Direction_Receiver); |
300 | - calib_data.MD = (I2C_read_ack(I2C1) << 8); | ||
301 | - calib_data.MD |= I2C_read_nack(I2C1); | 299 | + calib_data->MD = (I2C_read_ack(I2C1) << 8); |
300 | + calib_data->MD |= I2C_read_nack(I2C1); | ||
302 | I2C_stop(I2C1); | 301 | I2C_stop(I2C1); |
303 | 302 | ||
304 | DBG_SENSORS("[PRESSURE] Got callibration data\r\n"); | 303 | DBG_SENSORS("[PRESSURE] Got callibration data\r\n"); |
305 | - return calib_data; | ||
306 | } | 304 | } |
307 | 305 | ||
308 | -char* callibration_pressure_data_csv(bmp085_callibration parameters) | 306 | +char* callibration_pressure_data_csv(bmp085_callibration_t *parameters) |
309 | { | 307 | { |
310 | - char *str = chHeapAlloc(NULL,sizeof(char)*(11*11-1)); | ||
311 | - memset(str,0x00,sizeof(char)*(11*11)); | ||
312 | - sprintf(str + strlen(str),"%u,",parameters.AC1); | ||
313 | - sprintf(str + strlen(str),"%u,",parameters.AC2); | ||
314 | - sprintf(str + strlen(str),"%u,",parameters.AC3); | ||
315 | - sprintf(str + strlen(str),"%u,",parameters.AC4); | ||
316 | - sprintf(str + strlen(str),"%u,",parameters.AC5); | ||
317 | - sprintf(str + strlen(str),"%u,",parameters.AC6); | ||
318 | - sprintf(str + strlen(str),"%u,",parameters.B1); | ||
319 | - sprintf(str + strlen(str),"%u,",parameters.B2); | ||
320 | - sprintf(str + strlen(str),"%u,",parameters.MB); | ||
321 | - sprintf(str + strlen(str),"%u,",parameters.MC); | ||
322 | - sprintf(str + strlen(str),"%u",parameters.MD); | 308 | + char *str = chHeapAlloc(NULL,(11*11-1)); |
309 | + memset(str,0x00,(11*11-1)); | ||
310 | + sprintf(str + strlen(str),"%u,",parameters->AC1); | ||
311 | + sprintf(str + strlen(str),"%u,",parameters->AC2); | ||
312 | + sprintf(str + strlen(str),"%u,",parameters->AC3); | ||
313 | + sprintf(str + strlen(str),"%u,",parameters->AC4); | ||
314 | + sprintf(str + strlen(str),"%u,",parameters->AC5); | ||
315 | + sprintf(str + strlen(str),"%u,",parameters->AC6); | ||
316 | + sprintf(str + strlen(str),"%u,",parameters->B1); | ||
317 | + sprintf(str + strlen(str),"%u,",parameters->B2); | ||
318 | + sprintf(str + strlen(str),"%u,",parameters->MB); | ||
319 | + sprintf(str + strlen(str),"%u,",parameters->MC); | ||
320 | + sprintf(str + strlen(str),"%u",parameters->MD); | ||
323 | return str; | 321 | return str; |
324 | } | 322 | } |
325 | 323 |