From ec9431bf6cf8b7ba9aec46267d89481945e58ddb Mon Sep 17 00:00:00 2001 From: Cole Deck Date: Sat, 23 Sep 2023 21:07:07 -0500 Subject: [PATCH] Update serialctl packet to include right stick --- src/main.cpp | 12 ++++++++++-- src/packet.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index dced0df..214f7a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -101,6 +101,7 @@ int left_cooldown = 0; int right_cooldown = 0; int olddisplay = 99999; // guarantee a change when first value comes in +// motor indeces for set_motor() function #define FLSTEER 1 #define FRSTEER 2 #define BLSTEER 3 @@ -844,7 +845,14 @@ void loop() { } else fb = appjoystick->getFeedback();*/ - int zeroed_power = -1 * ((int)(astate->stickX) - 127); + int zeroed_lx = -1 * ((int)(astate->stickX) - 127); + int zeroed_ly = ((int)(astate->stickY) - 127); + int zeroed_rx = -1 * ((int)(astate->stickRX) - 127); + int zeroed_ry = ((int)(astate->stickRY) - 127); + + + // Goliath / 2 side arcade tank drive code below + /*int zeroed_power = -1 * ((int)(astate->stickX) - 127); int zeroed_turn = ((int)(astate->stickY) - 127); @@ -922,7 +930,7 @@ void loop() { //drive_right(right_enabled, right_power); //drive_left(left_enabled, -left_power); SerComm.println(" L: " + String(left_power) + " LT: " + String(target_left_power) + " R: " + String(right_power) + " RT: " + String(target_right_power) + " MEM FREE: "+ String(rp2040.getFreeHeap())); - + */ //if(left_power != target_left_power || right_power != target_right_power) diff --git a/src/packet.h b/src/packet.h index 0932e26..becb448 100644 --- a/src/packet.h +++ b/src/packet.h @@ -15,4 +15,6 @@ uint8_t stickY; uint8_t btnhi; uint8_t btnlo; uint16_t cksum; +uint8_t stickRX; // add right stick, without changieng existing var names or ordering +uint8_t stickRY; } packet_t;