From eaba2a7b0658f648bf32219aec0ce827c94333a0 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sat, 27 Feb 2021 22:26:22 +1300 Subject: 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. --- data_manager.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'data_manager.c') 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); } -- cgit v1.1