From a6d4863c86a84771dc153f8c6e2bfd38e42c0340 Mon Sep 17 00:00:00 2001 From: Thammi Date: Sat, 13 Sep 2014 11:22:58 +0200 Subject: [PATCH] Adjust thresholds --- firmware/apps/buggy.c | 10 ++++++---- firmware/lib/photons.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/apps/buggy.c b/firmware/apps/buggy.c index 008d2b4..54c728b 100644 --- a/firmware/apps/buggy.c +++ b/firmware/apps/buggy.c @@ -7,6 +7,8 @@ #include #include +#define BASELINE 0xa0 + inline uint16_t biased_random(uint8_t value) { return value / 2 * (rand() & 15); } @@ -79,12 +81,12 @@ static void run(void) { pentatonic_all_led_set(light >> 3); - motor_set(biased_random(light) > 0x70); + motor_set(biased_random(light) > BASELINE + 0x40); - led_set(RIGHT, biased_random(light) > 0x30); - led_set(LEFT, biased_random(light) > 0x30); + led_set(RIGHT, biased_random(light) > BASELINE + 0x00); + led_set(LEFT, biased_random(light) > BASELINE + 0x00); - if(biased_random(light) > 0x60) { + if(biased_random(light) > BASELINE + 0x20) { uint16_t tone = (biased_random(light) * 2) + 500; set_note(tone, 0); } else { diff --git a/firmware/lib/photons.c b/firmware/lib/photons.c index c001415..f050543 100644 --- a/firmware/lib/photons.c +++ b/firmware/lib/photons.c @@ -31,7 +31,7 @@ uint8_t photons_measure(void) { // wait for discharge - wait_ms(1); + wait_ms(5); // set direction to input for measurement