Skip to content

Commit

Permalink
Show ble connected in gui
Browse files Browse the repository at this point in the history
  • Loading branch information
dlktdr committed Jun 12, 2023
1 parent 7a1ea2f commit 22611c1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion firmware/src/src/basetrackersettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ class BaseTrackerSettings {
inline const bool& getCh5Arm() {return ch5arm;}
void setCh5Arm(bool val=false) { ch5arm = val; }

// Bluetooth Mode (0-Off, 1- Head, 2-Receive, 3-Scanner, BT_HID_Joystick)
// Bluetooth Mode (0-Off, 1- Head, 2-Receive, 3-Scanner, 4- BT HID Joystick)
inline const uint8_t& getBtMode() {return btmode;}
bool setBtMode(uint8_t val=0) {
if(val >= 0 && val <= 4) {
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/src/include/ble.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern struct bt_uuid_16 htoverridech;
extern struct bt_uuid_16 btbutton;
extern struct bt_uuid_16 jsonuuid;

/* TODO: Work me in, instead of using the switch statements
/* TODO: Work me in?, instead of using the switch statements
typedef struct {
void (*start)();
void (*stop)();
Expand Down
1 change: 1 addition & 0 deletions firmware/src/src/include/btpararmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ void BTRmtSetChannel(int channel, const uint16_t value);
uint16_t BTRmtGetChannel(int channel);
const char* BTRmtGetAddress();
void BTRmtSendButtonPress(bool longpress = false);
bool BTRmtGetConnected();
int8_t BTRmtGetRSSI();
2 changes: 2 additions & 0 deletions firmware/src/src/targets/nrf52/ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ const char *BTGetAddress()
case BTPARARMT:
case BTSCANONLY:
return BTRmtGetAddress();
case BTJOYSTICK:
return BTJoystickGetAddress();
default:
break;
}
Expand Down
15 changes: 13 additions & 2 deletions firmware/src/src/targets/nrf52/btjoystick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,19 @@ void BTJoystickStart()

void BTJoystickExecute()
{
buildJoystickHIDReport(report, bthidchans);
if (simulate_input) bt_gatt_notify(NULL, &bthid_svc.attrs[6], (void *)&report, sizeof(report));
if (bleconnected) {
clearLEDFlag(LED_BTSCANNING);
setLEDFlag(LED_BTCONNECTED);

buildJoystickHIDReport(report, bthidchans);
if (simulate_input)
bt_gatt_notify(NULL, &bthid_svc.attrs[6], (void *)&report, sizeof(report));

} else {
// Scanning
setLEDFlag(LED_BTSCANNING);
clearLEDFlag(LED_BTCONNECTED);
}
}

void BTJoystickSetChannel(int channel, const uint16_t value) { bthidchans[channel] = value; }
Expand Down
4 changes: 2 additions & 2 deletions gui/src/basetrackersettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class BaseTrackerSettings : public QObject
descriptions["sboutinv"] = "SBUS Transmit Inverted";
descriptions["crsftxinv"] = "Invert CRSF output";
descriptions["ch5arm"] = "Channel 5 ";
descriptions["btmode"] = "Bluetooth Mode (0-Off, 1- Head, 2-Receive, 3-Scanner)";
descriptions["btmode"] = "Bluetooth Mode (0-Off, 1- Head, 2-Receive, 3-Scanner, 4- BT HID Joystick)";
descriptions["rstonwave"] = "Reset on Proximity Sense";
descriptions["butlngps"] = "Long Press on the Button to Enable/Disable Tilt Roll and Pan";
descriptions["rstontlt"] = "Reset Center on a Head Tilt";
Expand Down Expand Up @@ -1174,7 +1174,7 @@ class BaseTrackerSettings : public QObject
bool getCh5Arm() {return _setting["ch5arm"].toBool();}
void setCh5Arm(bool val=false) { _setting["ch5arm"] = val; }

// Bluetooth Mode (0-Off, 1- Head, 2-Receive, 3-Scanner, BT_HID_Joystick)
// Bluetooth Mode (0-Off, 1- Head, 2-Receive, 3-Scanner, 4- BT HID Joystick)
uint8_t getBtMode() {
return _setting["btmode"].toUInt();
}
Expand Down

0 comments on commit 22611c1

Please sign in to comment.