[Bluetooth] CLEAR command added
This commit is contained in:
@@ -450,6 +450,11 @@ void Bluetooth::wakeup()
|
|||||||
/* else if (state == BLUETOOTH_STATE_DISCOVER_START && !strcmp(line, "OK+DISCE")) {
|
/* else if (state == BLUETOOTH_STATE_DISCOVER_START && !strcmp(line, "OK+DISCE")) {
|
||||||
state = BLUETOOTH_STATE_DISCOVER_END;
|
state = BLUETOOTH_STATE_DISCOVER_END;
|
||||||
} */
|
} */
|
||||||
|
else if (state == BLUETOOTH_STATE_CLEAR_REQUESTED) {
|
||||||
|
char command[] = "AT+CLEAR";
|
||||||
|
writeString(command);
|
||||||
|
state = BLUETOOTH_STATE_IDLE;
|
||||||
|
}
|
||||||
else if (state == BLUETOOTH_STATE_BIND_REQUESTED) {
|
else if (state == BLUETOOTH_STATE_BIND_REQUESTED) {
|
||||||
char command[32];
|
char command[32];
|
||||||
strAppend(strAppend(command, "AT+CON"), distantAddr);
|
strAppend(strAppend(command, "AT+CON"), distantAddr);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ enum BluetoothStates {
|
|||||||
BLUETOOTH_STATE_CONNECT_SENT,
|
BLUETOOTH_STATE_CONNECT_SENT,
|
||||||
BLUETOOTH_STATE_CONNECTED,
|
BLUETOOTH_STATE_CONNECTED,
|
||||||
BLUETOOTH_STATE_DISCONNECTED,
|
BLUETOOTH_STATE_DISCONNECTED,
|
||||||
|
BLUETOOTH_STATE_CLEAR_REQUESTED,
|
||||||
BLUETOOTH_STATE_FLASH_FIRMWARE
|
BLUETOOTH_STATE_FLASH_FIRMWARE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1192,7 +1192,7 @@ void menuModelSetup(event_t event)
|
|||||||
lcdDrawText(INDENT_WIDTH, y+1, bluetooth.distantAddr, TINSIZE);
|
lcdDrawText(INDENT_WIDTH, y+1, bluetooth.distantAddr, TINSIZE);
|
||||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, BUTTON(TR_CLEAR), attr);
|
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, BUTTON(TR_CLEAR), attr);
|
||||||
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||||
bluetooth.state = BLUETOOTH_STATE_OFF;
|
bluetooth.state = BLUETOOTH_STATE_CLEAR_REQUESTED;
|
||||||
memclear(bluetooth.distantAddr, sizeof(bluetooth.distantAddr));
|
memclear(bluetooth.distantAddr, sizeof(bluetooth.distantAddr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1203,6 +1203,7 @@ void menuModelSetup(event_t event)
|
|||||||
else
|
else
|
||||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_BUTTON_DISCOVER, attr);
|
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_BUTTON_DISCOVER, attr);
|
||||||
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||||
|
killEvents(KEY_ENTER);
|
||||||
if (bluetooth.state < BLUETOOTH_STATE_IDLE) {
|
if (bluetooth.state < BLUETOOTH_STATE_IDLE) {
|
||||||
bluetooth.state = BLUETOOTH_STATE_OFF;
|
bluetooth.state = BLUETOOTH_STATE_OFF;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user