diff options
| author | David Lamparter <equinox@diac24.net> | 2012-09-19 19:38:36 +0200 | 
|---|---|---|
| committer | David Lamparter <equinox@diac24.net> | 2012-09-19 19:38:36 +0200 | 
| commit | 32182fe8b0e7af37f0cab0b5233e40414f7b629e (patch) | |
| tree | 3de580874a23c8a9d66f83f6ffba1b3560e7e22e | |
| parent | 354e4cc46c19751b932f534e74e87988143c2b14 (diff) | |
dali: pretty up bus scan
| -rw-r--r-- | dali_ctl.c | 23 | 
1 files changed, 16 insertions, 7 deletions
@@ -80,7 +80,12 @@ static void dali_search_single(void)  static void dali_search(void)  {  	dali_twice(DALI_C_INITIALISE); -	// dali_twice(DALI_C_RANDOMISE); + +	/* _some_ EVGs keep the long address in nonvolatile memory, +	 * among them the OSRAM one we have lying around.  however, +	 * this doesn't seem to work with Tridonic EVGs. +	 */ +	dali_twice(DALI_C_RANDOMISE);  	dali_assign = eeprom_read_byte(&dali_nextaddr); @@ -98,24 +103,28 @@ static void dali_search(void)  				if ((dali_rx & 0x81) == 0x01) {  					addr = dali_rx >> 1; -					uart_puts(" short: "); +					uart_puts(" current: ");  					uart_puthex(addr); -					uart_puts("\n"); -				} else { -					uart_puts(" noshort "); +				} + +				if (addr == 0x00 || (dali_map[addr >> 3] & (1 << (addr & 0x07)))) { +					uart_puts(" reprog"); +					addr = 0xff; +				} +				if (addr == 0xff) {  					dali_send(DALI_C_PROGSHORT | (dali_assign << 1));  					dali_send(DALI_C_VRFYSHORT | (dali_assign << 1));  					if (dali_rx_avail) {  						uart_puts("prog ");  						uart_puthex(dali_assign); -						uart_puts("\n");  					} else -						uart_puts("progfail\n"); +						uart_puts("progfail");  					addr = dali_assign;  					dali_assign++;  				} +				uart_puts("\n");  				if (addr < 64)  					dali_map[addr >> 3] |= 1 << (addr & 0x7);  | 
