diff options
author | Keith Packard <keithp@keithp.com> | 2017-05-15 08:59:52 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2017-05-15 08:59:52 -0700 |
commit | ab50a1467bac0234062bc8c0a17783f1730aa981 (patch) | |
tree | 51d982bc8626648122355f52063374a4a095abe1 /src/drivers | |
parent | f132a22995235f3002e4a2bb8771c9b5738efb30 (diff) |
altos/ao_rn4678: Send '$$$' for new devices. Fix name setting code.
New devices won't respond to the cmd pin we have configured, so get
them to command mode by sending the $$$ string. Somehow I'd botched
the name setting code and hadn't caught it as I hadn't tried a new
device...
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/ao_rn4678.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/drivers/ao_rn4678.c b/src/drivers/ao_rn4678.c index f5b50459..4e3d12cb 100644 --- a/src/drivers/ao_rn4678.c +++ b/src/drivers/ao_rn4678.c @@ -315,19 +315,15 @@ ao_rn_set_name(void) { char sn[8]; char *s = sn + 8; - char c; int n; ao_rn_dbg("set name...\n"); - ao_rn_send_cmd(AO_RN_SET_NAME_CMD, "TeleBT-"); *--s = '\0'; - *--s = '\r'; n = ao_serial_number; do { *--s = '0' + n % 10; } while (n /= 10); - while ((c = *s++)) - ao_rn_putchar(c); + ao_rn_send_cmd(AO_RN_SET_NAME_CMD "TeleBT-", s); return ao_rn_wait_status(); } @@ -408,6 +404,8 @@ ao_rn(void) continue; } + ao_rn_puts("$$$"); + /* After it reboots, it can take a moment before it responds * to commands */ @@ -422,7 +420,7 @@ ao_rn(void) continue; } - if (strncmp(name, "TeleBT", 6) == 0) { + if (strncmp(name, "TeleBT-", 7) == 0) { ao_rn_dbg("name is set\n"); status = AO_RN_OK; break; |