From 5f48b6ef4af3158e39beaf0152bc39a85363926e Mon Sep 17 00:00:00 2001 From: Fisch Date: Sat, 9 Aug 2025 14:24:47 +0200 Subject: [PATCH] add rc yaw channel --- controller_teensy/include/rc.h | 14 ++++++++++++++ controller_teensy/src/main.cpp | 17 ++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/controller_teensy/include/rc.h b/controller_teensy/include/rc.h index 1c3ee20..8c2daad 100644 --- a/controller_teensy/include/rc.h +++ b/controller_teensy/include/rc.h @@ -21,6 +21,7 @@ static int count=0; #define PPM_DEADBAND 5 #define PPM_CHANNEL_THROTTLE 1 #define PPM_CHANNEL_STEER 2 +#define PPM_CHANNEL_YAW 3 #define PPM_CHANNEL_MODE 5 float ppm[PPM_CHANNELS]; @@ -33,6 +34,7 @@ void printPPM(); int16_t getRCThrottle(); int16_t getRCSteer(); +int16_t getRCYaw(); uint8_t getRCMode(uint8_t modes); bool rc_fullcontrol_enabled=false; //full remote control. can be cancelled by button press @@ -98,6 +100,18 @@ int16_t getRCSteer() { } +//Return value -1000 - 1000 +int16_t getRCYaw() { //tank steering + if (ppm[PPM_CHANNEL_YAW-1]>PPM_MID+PPM_DEADBAND){ + return constrain(map(ppm[PPM_CHANNEL_YAW-1],PPM_MID+PPM_DEADBAND,PPM_MAX,0,1000), 0,1000); + }else if (ppm[PPM_CHANNEL_YAW-1]