Revision 350
increased precision
proj/include/proj_structures.h | ||
---|---|---|
67 | 67 |
/// @brief Host player Y-postition |
68 | 68 |
int16_t host_y; |
69 | 69 |
/// @brief Host player angle |
70 |
int16_t host_angle;
|
|
70 |
float host_angle;
|
|
71 | 71 |
/// @brief Host player health |
72 | 72 |
int16_t host_health; |
73 | 73 |
/// @brief Host player current health |
... | ... | |
79 | 79 |
/// @brief Remote player Y-postition |
80 | 80 |
int16_t remote_y; |
81 | 81 |
/// @brief Remote player angle |
82 |
int16_t remote_angle;
|
|
82 |
float remote_angle;
|
|
83 | 83 |
/// @brief Remote player health |
84 | 84 |
int16_t remote_health; |
85 | 85 |
/// @brief Remote player current health |
proj/libs/uart/src/hltp.c | ||
---|---|---|
55 | 55 |
} |
56 | 56 |
int hltp_send_host_info(const host_info_t *p) { printf("%s, %d\n",__func__, rand()); |
57 | 57 |
|
58 |
printf(" sending angle: 0x%04X\n", p->host_angle); |
|
58 |
//printf(" sending angle: 0x%04X\n", p->host_angle);
|
|
59 | 59 |
|
60 | 60 |
uint8_t type = hltp_type_host; |
61 | 61 |
const uint8_t* ptr[11]; size_t sz[11]; |
62 | 62 |
ptr[0] = (uint8_t*)& type ; sz[0] = 1; |
63 | 63 |
ptr[1] = (uint8_t*)&p->host_x ; sz[1] = sizeof(int16_t); |
64 | 64 |
ptr[2] = (uint8_t*)&p->host_y ; sz[2] = sizeof(int16_t); |
65 |
ptr[3] = (uint8_t*)&p->host_angle ; sz[3] = sizeof(int16_t);
|
|
65 |
ptr[3] = (uint8_t*)&p->host_angle ; sz[3] = sizeof(float);
|
|
66 | 66 |
ptr[4] = (uint8_t*)&p->host_health ; sz[4] = sizeof(int16_t); |
67 | 67 |
ptr[5] = (uint8_t*)&p->host_current_health ; sz[5] = sizeof(int16_t); |
68 | 68 |
ptr[6] = (uint8_t*)&p->remote_x ; sz[6] = sizeof(int16_t); |
69 | 69 |
ptr[7] = (uint8_t*)&p->remote_y ; sz[7] = sizeof(int16_t); |
70 |
ptr[8] = (uint8_t*)&p->remote_angle ; sz[8] = sizeof(int16_t);
|
|
70 |
ptr[8] = (uint8_t*)&p->remote_angle ; sz[8] = sizeof(float);
|
|
71 | 71 |
ptr[9] = (uint8_t*)&p->remote_health ; sz[9] = sizeof(int16_t); |
72 | 72 |
ptr[10] = (uint8_t*)&p->remote_current_health ; sz[10] = sizeof(int16_t); |
73 | 73 |
/* |
proj/src/proj_func.c | ||
---|---|---|
275 | 275 |
|
276 | 276 |
ret->host_x = (int16_t)gunner_get_x (host); |
277 | 277 |
ret->host_y = (int16_t)gunner_get_y (host); |
278 |
ret->host_angle = (int16_t)gunner_get_angle (host);
|
|
278 |
ret->host_angle = (float) gunner_get_angle (host);
|
|
279 | 279 |
ret->host_health = (int16_t)gunner_get_health (host); |
280 | 280 |
ret->host_current_health = (int16_t)gunner_get_curr_health(host); |
281 | 281 |
|
282 | 282 |
// remote |
283 | 283 |
ret->remote_x = (int16_t)gunner_get_x (remote); |
284 | 284 |
ret->remote_y = (int16_t)gunner_get_y (remote); |
285 |
ret->remote_angle = (int16_t)gunner_get_angle (remote);
|
|
285 |
ret->remote_angle = (float) gunner_get_angle (remote);
|
|
286 | 286 |
ret->remote_health = (int16_t)gunner_get_health (remote); |
287 | 287 |
ret->remote_current_health = (int16_t)gunner_get_curr_health(remote); |
288 | 288 |
|
... | ... | |
338 | 338 |
// host |
339 | 339 |
p->host_x = (int16_t)gunner_get_x (host); |
340 | 340 |
p->host_y = (int16_t)gunner_get_y (host); |
341 |
p->host_angle = (int16_t)gunner_get_angle (host);
|
|
341 |
p->host_angle = (float) gunner_get_angle (host);
|
|
342 | 342 |
p->host_health = (int16_t)gunner_get_health (host); |
343 | 343 |
p->host_current_health = (int16_t)gunner_get_curr_health(host); |
344 | 344 |
|
345 | 345 |
// remote |
346 | 346 |
p->remote_x = (int16_t)gunner_get_x (remote); |
347 | 347 |
p->remote_y = (int16_t)gunner_get_y (remote); |
348 |
p->remote_angle = (int16_t)gunner_get_angle (remote);
|
|
348 |
p->remote_angle = (float) gunner_get_angle (remote);
|
|
349 | 349 |
p->remote_health = (int16_t)gunner_get_health (remote); |
350 | 350 |
p->remote_current_health = (int16_t)gunner_get_curr_health(remote); |
351 | 351 |
/* |
Also available in: Unified diff