diff options
author | David Phillips <david@yeah.nah.nz> | 2021-02-27 22:26:22 +1300 |
---|---|---|
committer | David Phillips <david@yeah.nah.nz> | 2021-02-27 22:26:22 +1300 |
commit | eaba2a7b0658f648bf32219aec0ce827c94333a0 (patch) | |
tree | 42f50d2f3c87abfb7af0149430a67afb778fd4f1 /data_manager.c | |
parent | 450829bab633da3bce84a9a0f6857e68e46c7eb4 (diff) | |
download | altimeter-eaba2a7b0658f648bf32219aec0ce827c94333a0.tar.xz |
Make timer mandatory for data manager
The NULL check was a bit of a hack to get the test building. Probably a bad
idea to leave it around, since there's no time it's sane to leave the
timestamps on data manager contexts unset.
Diffstat (limited to 'data_manager.c')
-rw-r--r-- | data_manager.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/data_manager.c b/data_manager.c index b77ba81..8202216 100644 --- a/data_manager.c +++ b/data_manager.c @@ -15,7 +15,7 @@ static float pressure_to_metres_asl(float real, float setting) void data_manager_init(struct data_ctx *ctx, struct timer *timer, struct barometer *barometer) { - ctx->setting = 1013.25; + ctx->setting = 1013.25; /* FIXME don't hardcode, at least not here */ ctx->timer = timer; ctx->barometer = barometer; data_manager_tick(ctx); @@ -24,9 +24,7 @@ void data_manager_init(struct data_ctx *ctx, struct timer *timer, struct baromet void data_manager_tick(struct data_ctx *ctx) { /* FIXME altitude rate */ -// struct data_ctx previous_ctx = *ctx; - if (ctx->timer) - ctx->timestamp = ctx->timer->get_time(); + ctx->timestamp = ctx->timer->get_time(); ctx->pressure = ctx->barometer->read_pressure(); ctx->altitude = pressure_to_metres_asl(ctx->pressure, ctx->setting); } |