i'm an idiot

master
Felix Pankratz 2 years ago
parent 3a70dcc28a
commit 3b1262ddb4

@ -72,13 +72,13 @@ static float queue_avg(queue *q) {
} else { } else {
node *tmp; node *tmp;
float sum = 0.0; float sum = 0.0;
tmp = q->front; tmp = q->front;
while (tmp != NULL) { while (tmp != NULL) {
sum = sum + tmp->interval; sum = sum + tmp->interval;
tmp = tmp->next; tmp = tmp->next;
} }
avg = sum / q->size; avg = sum / q->size;
FURI_LOG_D("BPM-Tapper", "Sum: %.2f Avg: %.2f", (double)sum, (double)avg);
return avg; return avg;
} }
} }
@ -166,7 +166,7 @@ static void render_callback(Canvas* const canvas, void* ctx) {
static void bpm_state_init(BPMTapper* const plugin_state) { static void bpm_state_init(BPMTapper* const plugin_state) {
plugin_state->taps = 0; plugin_state->taps = 0;
plugin_state->bpm = 120.0; plugin_state->bpm = 120.0;
plugin_state->last_stamp = 0; plugin_state->last_stamp = furi_get_tick();
plugin_state->interval = 500; plugin_state->interval = 500;
queue *q; queue *q;
q = malloc(sizeof(queue)); q = malloc(sizeof(queue));

Loading…
Cancel
Save