Skip to content

Commit

Permalink
sensor_hx71x: query at higher rate when data is not pending
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin O'Connor <[email protected]>
  • Loading branch information
KevinOConnor committed Jun 12, 2024
1 parent 0c0bcde commit 3b673b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion klippy/extras/hx71x.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _convert_samples(self, samples):
# Start, stop, and process message batches
def _start_measurements(self):
# Start bulk reading
rest_ticks = self.mcu.seconds_to_clock(0.5 / self.sps)
rest_ticks = self.mcu.seconds_to_clock(1. / (11. * self.sps))
self.query_hx71x_cmd.send([self.oid, rest_ticks])
logging.info("HX71x starting '%s' measurements", self.name)
# Initialize clock tracking
Expand Down
4 changes: 3 additions & 1 deletion src/sensor_hx71x.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ hx71x_event(struct timer *timer)
if (hx71x_is_data_ready(hx71x)) {
hx71x->pending_flag = 1;
sched_wake_task(&wake_hx71x);
hx71x->timer.waketime += hx71x->rest_ticks * 8;
} else {
hx71x->timer.waketime += hx71x->rest_ticks;
}
hx71x->timer.waketime += hx71x->rest_ticks;
return SF_RESCHEDULE;
}

Expand Down

0 comments on commit 3b673b6

Please sign in to comment.