aboutsummaryrefslogtreecommitdiff
path: root/src/survive_sensor_activations.c
diff options
context:
space:
mode:
authorJustin Berger <j.david.berger@gmail.com>2018-04-20 22:31:18 -0600
committerJustin Berger <j.david.berger@gmail.com>2018-04-20 22:50:20 -0600
commita1027bceebb36afc4fa9d082277478abd8101eda (patch)
treef9692cad198f8e39e4fa0fe6cdd4cf1d5abcef5c /src/survive_sensor_activations.c
parent3c007f47a30b70f00fd642b14ef8f4127c46ffc3 (diff)
downloadlibsurvive-a1027bceebb36afc4fa9d082277478abd8101eda.tar.gz
libsurvive-a1027bceebb36afc4fa9d082277478abd8101eda.tar.bz2
Enabled and then cleaned up warnings
Diffstat (limited to 'src/survive_sensor_activations.c')
-rw-r--r--src/survive_sensor_activations.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/survive_sensor_activations.c b/src/survive_sensor_activations.c
index dc5c0d4..e83b2fc 100644
--- a/src/survive_sensor_activations.c
+++ b/src/survive_sensor_activations.c
@@ -4,6 +4,9 @@
bool SurviveSensorActivations_isPairValid(const SurviveSensorActivations *self, uint32_t tolerance,
uint32_t timecode_now, uint32_t idx, int lh) {
const uint32_t *data_timecode = self->timecode[idx][lh];
+ if (self->lengths[idx][lh][0] == 0 || self->lengths[idx][lh][1] == 0)
+ return false;
+
return !(timecode_now - data_timecode[0] > tolerance || timecode_now - data_timecode[1] > tolerance);
}
@@ -26,7 +29,7 @@ void SurviveSensorActivations_add(SurviveSensorActivations *self, struct PoserDa
*angle = lightData->angle;
*data_timecode = lightData->timecode;
- *length = lightData->length * 48000000;
+ *length = (uint32_t)(lightData->length * 48000000);
}
uint32_t SurviveSensorActivations_default_tolerance = (uint32_t)(48000000 /*mhz*/ * (16.7 * 2 /*ms*/) / 1000) + 5000;