summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2012-09-19 19:38:36 +0200
committerDavid Lamparter <equinox@diac24.net>2012-09-19 19:38:36 +0200
commit32182fe8b0e7af37f0cab0b5233e40414f7b629e (patch)
tree3de580874a23c8a9d66f83f6ffba1b3560e7e22e
parent354e4cc46c19751b932f534e74e87988143c2b14 (diff)
dali: pretty up bus scan
-rw-r--r--dali_ctl.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/dali_ctl.c b/dali_ctl.c
index 797f58f..ed23ce1 100644
--- a/dali_ctl.c
+++ b/dali_ctl.c
@@ -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);