diff options
author | Josh Allen <axlecrusher@gmail.com> | 2017-02-13 21:22:00 -0500 |
---|---|---|
committer | Josh Allen <axlecrusher@gmail.com> | 2017-02-13 21:22:00 -0500 |
commit | f0e743ccc98397ee011ea10a6068263b5f3dbae7 (patch) | |
tree | 619008b4f39e272a97b31ee88d2d0f4eb42d449c /tools/ootx_decode/ootx_decoder.c | |
parent | c67f528d10f55e34d0d254fb59494778bcb04e90 (diff) | |
download | libsurvive-f0e743ccc98397ee011ea10a6068263b5f3dbae7.tar.gz libsurvive-f0e743ccc98397ee011ea10a6068263b5f3dbae7.tar.bz2 |
rename function for half float to float
Diffstat (limited to 'tools/ootx_decode/ootx_decoder.c')
-rw-r--r-- | tools/ootx_decode/ootx_decoder.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/ootx_decode/ootx_decoder.c b/tools/ootx_decode/ootx_decoder.c index 5c64898..b5a7b54 100644 --- a/tools/ootx_decode/ootx_decoder.c +++ b/tools/ootx_decode/ootx_decoder.c @@ -153,7 +153,7 @@ uint8_t* get_ptr(uint8_t* data, uint8_t bytes, uint16_t* idx) { return x; } -float _to_float(uint8_t* data) { +float _half_to_float(uint8_t* data) { //this will not handle infinity, NaN, or denormalized floats uint16_t x = *(uint16_t*)data; @@ -198,21 +198,21 @@ void init_lighthouse_info_v6(lighthouse_info_v6* lhi, uint8_t* data) { lhi->fw_version = *(uint16_t*)get_ptr(data,sizeof(uint16_t),&idx); lhi->id = *(uint32_t*)get_ptr(data,sizeof(uint32_t),&idx); - lhi->fcal_0_phase = _to_float( get_ptr(data,sizeof(uint16_t),&idx) ); - lhi->fcal_1_phase = _to_float( get_ptr(data,sizeof(uint16_t),&idx) ); - lhi->fcal_0_tilt = _to_float( get_ptr(data,sizeof(uint16_t),&idx) ); - lhi->fcal_1_tilt = _to_float( get_ptr(data,sizeof(uint16_t),&idx) ); + lhi->fcal_0_phase = _half_to_float( get_ptr(data,sizeof(uint16_t),&idx) ); + lhi->fcal_1_phase = _half_to_float( get_ptr(data,sizeof(uint16_t),&idx) ); + lhi->fcal_0_tilt = _half_to_float( get_ptr(data,sizeof(uint16_t),&idx) ); + lhi->fcal_1_tilt = _half_to_float( get_ptr(data,sizeof(uint16_t),&idx) ); lhi->sys_unlock_count = *get_ptr(data,sizeof(uint8_t),&idx); lhi->hw_version = *get_ptr(data,sizeof(uint8_t),&idx); - lhi->fcal_0_curve = _to_float( get_ptr(data,sizeof(uint16_t),&idx) ); - lhi->fcal_1_curve = _to_float( get_ptr(data,sizeof(uint16_t),&idx) ); + lhi->fcal_0_curve = _half_to_float( get_ptr(data,sizeof(uint16_t),&idx) ); + lhi->fcal_1_curve = _half_to_float( get_ptr(data,sizeof(uint16_t),&idx) ); lhi->accel_dir_x = *(int8_t*)get_ptr(data,sizeof(uint8_t),&idx); lhi->accel_dir_y = *(int8_t*)get_ptr(data,sizeof(uint8_t),&idx); lhi->accel_dir_z = *(int8_t*)get_ptr(data,sizeof(uint8_t),&idx); - lhi->fcal_0_gibphase = _to_float( get_ptr(data,sizeof(uint16_t),&idx) ); - lhi->fcal_1_gibphase = _to_float( get_ptr(data,sizeof(uint16_t),&idx) ); - lhi->fcal_0_gibmag = _to_float( get_ptr(data,sizeof(uint16_t),&idx) ); - lhi->fcal_1_gibmag = _to_float( get_ptr(data,sizeof(uint16_t),&idx) ); + lhi->fcal_0_gibphase = _half_to_float( get_ptr(data,sizeof(uint16_t),&idx) ); + lhi->fcal_1_gibphase = _half_to_float( get_ptr(data,sizeof(uint16_t),&idx) ); + lhi->fcal_0_gibmag = _half_to_float( get_ptr(data,sizeof(uint16_t),&idx) ); + lhi->fcal_1_gibmag = _half_to_float( get_ptr(data,sizeof(uint16_t),&idx) ); lhi->mode_current = *get_ptr(data,sizeof(uint8_t),&idx); lhi->sys_faults = *get_ptr(data,sizeof(uint8_t),&idx); |