|
|
|
@ -144,8 +144,11 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
@@ -144,8 +144,11 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
|
|
|
|
|
static int16_t mode; |
|
|
|
|
static int16_t camTilt = 1500; |
|
|
|
|
static int16_t lights = 1100; |
|
|
|
|
static uint32_t lastLights; |
|
|
|
|
static bool lightsBrighter = true; |
|
|
|
|
static uint32_t buttonDebounce; |
|
|
|
|
|
|
|
|
|
// Debouncing timer
|
|
|
|
|
if ( tnow_ms - buttonDebounce > 50 ) { |
|
|
|
|
buttonDebounce = tnow_ms; |
|
|
|
|
|
|
|
|
|
// Button logic to arm/disarm motors (Start and back buttons)
|
|
|
|
|
if ( buttons & (1 << 4) ) { |
|
|
|
@ -156,9 +159,9 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
@@ -156,9 +159,9 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
|
|
|
|
|
|
|
|
|
|
// Button logic to change camera tilt (D-pad up and down + left joystick click to center)
|
|
|
|
|
if ( buttons & (1 << 0) ) { |
|
|
|
|
camTilt = constrain_float(camTilt+20,800,2200); |
|
|
|
|
camTilt = constrain_float(camTilt-30,800,2200); |
|
|
|
|
} else if ( buttons & (1 << 1) ) { |
|
|
|
|
camTilt = constrain_float(camTilt-20,800,2200); |
|
|
|
|
camTilt = constrain_float(camTilt+30,800,2200); |
|
|
|
|
} else if ( buttons & (1 << 6) ) { |
|
|
|
|
camTilt = 1500; // Reset camera tilt
|
|
|
|
|
} |
|
|
|
@ -177,20 +180,11 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
@@ -177,20 +180,11 @@ void Sub::transform_manual_control_to_rc_override(int16_t x, int16_t y, int16_t
|
|
|
|
|
mode = 1000; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Button logic for lights with cyclical dimming (right joystick click)
|
|
|
|
|
if ( (buttons & (1 << 7)) && (tnow_ms - lastLights > 100) ) { |
|
|
|
|
lastLights = tnow_ms; |
|
|
|
|
|
|
|
|
|
if ( lightsBrighter ) { |
|
|
|
|
lights += 200; |
|
|
|
|
} else { |
|
|
|
|
lights -= 200; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( lights >= 1900 ) { |
|
|
|
|
lightsBrighter = false; |
|
|
|
|
} else if ( lights <= 1100 ) { |
|
|
|
|
lightsBrighter = true; |
|
|
|
|
// Button logic for lights with dimming (right bumper brighter, left bumper dimmer)
|
|
|
|
|
if ( buttons & (1 << 8) ) { |
|
|
|
|
lights = constrain_float(lights-100,1100,1900); |
|
|
|
|
} else if ( buttons & (1 << 9) ) { |
|
|
|
|
lights = constrain_float(lights+100,1100,1900); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|