From 1b6e0ae14c74b7763e6e7d6320212985ec86c77b Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 20 Jun 2012 20:47:17 +0200 Subject: dali: clean up search --- dali_ctl.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'dali_ctl.c') diff --git a/dali_ctl.c b/dali_ctl.c index 50dc77c..b1502d4 100644 --- a/dali_ctl.c +++ b/dali_ctl.c @@ -28,19 +28,11 @@ static void dali_search_byte(uint16_t cmd) dali_s_byte = 0xff; uint8_t bit = 0x80; - uart_puthex(cmd >> 8); - uart_puts("dali byte\n"); while (bit) { - uart_puts("dali sb "); - uart_puthex(dali_s_byte & ~bit); - uart_puts("\n"); - dali_twice(cmd | (dali_s_byte & ~bit)); if (dali_compare()) { - uart_puts("cx1\n"); dali_s_byte &= ~bit; } else if (dali_compare()) { - uart_puts("cx2\n"); dali_s_byte &= ~bit; } bit >>= 1; @@ -85,8 +77,13 @@ static void dali_search(void) uart_puthex(dali_sh); uart_puthex(dali_sm); uart_puthex(dali_sl); - uart_puts("\n"); dali_send(DALI_C_QURYSHORT); + if (dali_rx_avail) { + uart_puts(" short: "); + uart_puthex(dali_rx); + uart_puts("\n"); + } else + uart_puts(" noshort\n"); dali_send(DALI_C_WITHDRAW); } } while (!dali_s_notfound); -- cgit v1.2.1