|
|
@ -996,13 +996,19 @@ uint16_t read_voltage(byte pin) { |
|
|
|
} |
|
|
|
|
|
|
|
void read_all_voltage() { |
|
|
|
throttle_raw = read_voltage(THROTTLE_PIN); |
|
|
|
yaw_raw = read_voltage(YAW_PIN); |
|
|
|
// yaw_raw = readYaw();
|
|
|
|
pitch_raw = read_voltage(PITCH_PIN); |
|
|
|
// roll_raw = analogRead(ROLL_PIN);
|
|
|
|
// Hardcode to increase the value a bit...
|
|
|
|
roll_raw = read_voltage(ROLL_PIN) + 150; |
|
|
|
// Somehow when BLE enables, pow formula hangs it.
|
|
|
|
if(ble_begin) { |
|
|
|
throttle_raw = analogRead(THROTTLE_PIN); |
|
|
|
yaw_raw = analogRead(YAW_PIN); |
|
|
|
pitch_raw = analogRead(PITCH_PIN); |
|
|
|
roll_raw = analogRead(ROLL_PIN); |
|
|
|
} else { |
|
|
|
throttle_raw = read_voltage(THROTTLE_PIN); |
|
|
|
yaw_raw = read_voltage(YAW_PIN); |
|
|
|
pitch_raw = read_voltage(PITCH_PIN); |
|
|
|
// Hardcode to increase the value a bit...
|
|
|
|
roll_raw = analogRead(ROLL_PIN) + 150; |
|
|
|
} |
|
|
|
vbat_raw = analogRead(VBAT_PIN); |
|
|
|
|
|
|
|
// Serial.print("T:");Serial.print(throttle_raw);Serial.print(" Y:");Serial.print(yaw_raw);Serial.print(" P:");Serial.print(pitch_raw);Serial.print("R:");Serial.println(roll_raw);
|
|
|
@ -1334,12 +1340,15 @@ void loop() { |
|
|
|
last_seconds = millis() + 1000; |
|
|
|
} |
|
|
|
|
|
|
|
// Serial.println("Debug: read_all_voltage()");
|
|
|
|
read_all_voltage(); |
|
|
|
|
|
|
|
/* Sending Signal */ |
|
|
|
// Serial.println("Debug: tx_data()");
|
|
|
|
tx_data(); |
|
|
|
|
|
|
|
// Update display
|
|
|
|
// Serial.println("Debug: update_display()");
|
|
|
|
update_display(); |
|
|
|
|
|
|
|
// Serial.println(throttle_raw + " : " + yaw_raw);
|
|
|
@ -1484,6 +1493,8 @@ void update_display(void) { |
|
|
|
} |
|
|
|
} else { |
|
|
|
menu_entry_alpha_selected = false; |
|
|
|
if(ble_begin) |
|
|
|
ble_begin = false; |
|
|
|
// u8g2_right.clearBuffer();
|
|
|
|
// u8g2_right.sendBuffer();
|
|
|
|
} |
|
|
@ -2635,6 +2646,7 @@ void bluetooth_gamepad() { |
|
|
|
u8g2_left.nextPage(); |
|
|
|
|
|
|
|
if(!ble_begin) { |
|
|
|
Serial.println("bleGamepad begin()"); |
|
|
|
bleGamepad.begin(); |
|
|
|
ble_begin = true; |
|
|
|
} |
|
|
@ -2645,6 +2657,8 @@ void bluetooth_gamepad() { |
|
|
|
// [YAW, THROTTLE, ROLL, PITCH]
|
|
|
|
bleGamepad.setAxes(yaw, throttle, roll, pitch, 0, 0, DPAD_CENTERED); |
|
|
|
} |
|
|
|
|
|
|
|
// Serial.println("Debug: BleGamepad()");
|
|
|
|
} |
|
|
|
|
|
|
|
void rf_settings(void) { |
|
|
|