diff --git a/part12-wgt/lib/bt.c b/part12-wgt/lib/bt.c index 9e987ce..912dd47 100644 --- a/part12-wgt/lib/bt.c +++ b/part12-wgt/lib/bt.c @@ -232,7 +232,7 @@ void sendACLsubscribe(unsigned int handle) bt_writeByte(lo(channel)); bt_writeByte(hi(channel)); - volatile unsigned char command[5] = { 0x12, 0x2b, 0x00, 0x01, 0x00 }; + volatile unsigned char command[5] = { 0x12, 0x3d, 0x00, 0x01, 0x00 }; unsigned int c=0; while (c++= 2 && buf[0] == LE_CONNECT_CODE) { connected = !*(buf+1); - connection_handle = *(buf+2) | (*(buf+3) << 8); + connection_handle = *(buf+2) | (*(buf+3) << 8); - if (connection_handle == 0) delay(1); + if (connected == 0) wait_msec(0x186A); } } }