From 725f50dd0d7b486fa88c24463150c2ce5eeceb57 Mon Sep 17 00:00:00 2001 From: twobit Date: Fri, 12 Oct 2012 00:21:11 +0200 Subject: [PATCH 1/2] coz shorter is always better --- firmware/apps/crazy_synth.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/firmware/apps/crazy_synth.c b/firmware/apps/crazy_synth.c index e66941d..2733fc3 100644 --- a/firmware/apps/crazy_synth.c +++ b/firmware/apps/crazy_synth.c @@ -105,21 +105,14 @@ ISR(TIMER0_COMPA_vect,ISR_NOBLOCK) osc1 += pgm_read_word(&freq_table[ pgm_read_byte(&music_data[1][row])]); if (++sample == speedtime ) { sample = 0; - if (speedtime > 600) speedtime -= 4; if (++row == SONG_LENGTH) { row = 0; if (speedtime <= 600) speedtime = 3000; } - if (row&4){ - led_on(LED_R); - led_off(LED_L); - }else{ - led_on(LED_L); - led_off(LED_R); - } + led_on(row&4 ? LED_R : LED_L); + led_off(row&4 ? LED_L : LED_R); } - if (osc0 >= 0x8000) PORTB |= (1 << PORTB2); else PORTB &= ~(1<< PORTB2); if (osc1 >= 0xc000) PORTC |= (1 << PORTC5); From a0da1143000687a68012941333585cf724e6e59a Mon Sep 17 00:00:00 2001 From: bigalex Date: Fri, 12 Oct 2012 01:04:26 +0200 Subject: [PATCH 2/2] turn off the motor before power down --- firmware/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/firmware/main.c b/firmware/main.c index c1954c8..b8278b3 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -59,6 +59,7 @@ void do_powerDown(void) mode_uninitialized = false; pwdn_state = 0; timer_set(&mytimer, 5); + set_motor(MOTOR_OFF); ledRon = true; }; if (timer_expired(&mytimer)) {