Browse Source

Fixed BLE Issues

master
Englebert 4 years ago
parent
commit
c7caedbcc9
  1. 25
      OpenFlightTX.ino

25
OpenFlightTX.ino

@ -385,7 +385,7 @@ input[type=button] {
/*** Index Page ***/
const char* index_html PROGMEM = R"rawliteral(<pre><strong>OpenFlightTX v1.2</strong>
const char* index_html PROGMEM = R"rawliteral(<pre><strong>OpenFlightTX v1.2.4</strong>
)rawliteral";
// WebPages ----- END
@ -613,6 +613,7 @@ uint32_t nrf_profiling = 0;
uint32_t nrf_profiling_raw = 0;
uint32_t last_seconds = 0;
uint32_t last_nrf_scanned = 0;
uint32_t last_ble_sent = 0;
//define the pins used by the transceiver module
#define SS 5
@ -1458,7 +1459,7 @@ void update_display(void) {
// u8g2_left.setFont(u8g2_font_micro_tr);
u8g2_left.setFont(u8g2_font_5x7_tf);
u8g2_left.setCursor(0,62);
u8g2_left.print(F("OpenFlightTX - 1.2"));
u8g2_left.print(F("OpenFlightTX - 1.2.4"));
// Battery
show_battery_level(115, 56);
@ -1640,7 +1641,23 @@ void tx_data(void) {
nrf_profiling_raw++;
// } else {
// delay(1);
} // End of if(nrf_scanner)
} else if(ble_begin) { // End of if(nrf_scanner)
if(bleGamepad.isConnected()) {
if(millis() > last_ble_sent) {
int throttle = map(throttle_value, 0, 4096, 127, -127); // Throttle
int yaw = map(yaw_value, 0, 4096, -127, 127); // Yaw
int pitch = map(pitch_value, 0, 4096, 127, -127); // Pitch
int roll = map(roll_value, 0, 4096, -127, 127); // Roll
ble_profiling_raw++;
// [YAW, THROTTLE, ROLL, PITCH]
bleGamepad.setAxes(yaw, throttle, roll, pitch, 0, 0, DPAD_CENTERED);
// Serial.println("Debug: BleGamepad()");
last_ble_sent = millis() + 30;
}
}
}
}
void rx_checker(void) {
@ -2651,12 +2668,14 @@ void bluetooth_gamepad() {
ble_begin = true;
}
/*
if(bleGamepad.isConnected()) {
ble_profiling_raw++;
// [YAW, THROTTLE, ROLL, PITCH]
bleGamepad.setAxes(yaw, throttle, roll, pitch, 0, 0, DPAD_CENTERED);
}
*/
// Serial.println("Debug: BleGamepad()");
}

Loading…
Cancel
Save