diff options
| author | Keith Packard <keithp@keithp.com> | 2012-10-13 13:37:29 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2012-10-13 13:37:29 -0700 | 
| commit | 0ec77f5c90e0b930488ae2ab75efcbba8a3bd1d8 (patch) | |
| tree | c8465c00ba707a9ece138773c0191620335c0108 /src/test/ao_flight_test.c | |
| parent | 2733d1b71bbac2c5ef4a2c3a1992ba448e981267 (diff) | |
altos: Eliminate implicit 1 byte offset in uint16/int16 functions
Make callers explicitly compute the full offset
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/test/ao_flight_test.c')
| -rw-r--r-- | src/test/ao_flight_test.c | 25 | 
1 files changed, 12 insertions, 13 deletions
diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c index b9e291ce..3231194d 100644 --- a/src/test/ao_flight_test.c +++ b/src/test/ao_flight_test.c @@ -469,7 +469,6 @@ union ao_telemetry_all {  uint16_t  uint16(uint8_t *bytes, int off)  { -	off++;  	return (uint16_t) bytes[off] | (((uint16_t) bytes[off+1]) << 8);  } @@ -608,22 +607,22 @@ ao_sleep(void *wchan)  					}  				} else if (len == 99) {  					ao_flight_started = 1; -					tick = uint16(bytes, 21); -					ao_flight_ground_accel = int16(bytes, 7); -					ao_config.accel_plus_g = int16(bytes, 17); -					ao_config.accel_minus_g = int16(bytes, 19); +					tick = uint16(bytes+1, 21); +					ao_flight_ground_accel = int16(bytes+1, 7); +					ao_config.accel_plus_g = int16(bytes+1, 17); +					ao_config.accel_minus_g = int16(bytes+1, 19);  					type = 'A'; -					a = int16(bytes, 23); -					b = int16(bytes, 25); +					a = int16(bytes+1, 23); +					b = int16(bytes+1, 25);  				} else if (len == 98) {  					ao_flight_started = 1; -					tick = uint16(bytes, 20); -					ao_flight_ground_accel = int16(bytes, 6); -					ao_config.accel_plus_g = int16(bytes, 16); -					ao_config.accel_minus_g = int16(bytes, 18); +					tick = uint16(bytes+1, 20); +					ao_flight_ground_accel = int16(bytes+1, 6); +					ao_config.accel_plus_g = int16(bytes+1, 16); +					ao_config.accel_minus_g = int16(bytes+1, 18);  					type = 'A'; -					a = int16(bytes, 22); -					b = int16(bytes, 24); +					a = int16(bytes+1, 22); +					b = int16(bytes+1, 24);  				} else {  					printf("unknown len %d\n", len);  					continue;  | 
