Unterminated function-like macro invocation - competition tmrw!

Hi all,
I’m getting the following errors with my code in a function to set up the Axis 3 on the joystick and the main loop, respectively:
Unterminated function-like macro invocation (58, 3)
Expected “{” (191, 2)

My code is attached below. Unfortunately, other methods weren’t working, so I had to export it to Drive. Please excuse some of the sillier comments by my teammate!
https://drive.google.com/drive/folders/1tRiVGPmndrNT3minvXLq1sqsisyuKezd?usp=sharing

what is the intent of this (which is incorrect, but I’m not sure what you are trying to do)

  waitUntil(!Controller1.Axis3.position(percent, 100%);

and do you really want to register a callback when axis3 is changed ? (which will be called very often)

  Controller1.Axis3.changed(whenAxis3Pressed);
3 Likes

Ah, yes, I see. It’s intended to wait until the Axis 3 position = 0 to stop the drivetrain; that 100% should be a 0, my bad there. I see now that it’s also missing parentheses; just edited that.

As for the second line, I’m honestly not sure. I just followed the template in the V5 reference for programming the controller; if that’s redundant and there’s a better way to do it, any advice would be much appreciated.

Update: I updated the callback to the correct function name (second quoted line) and removed the second argument about the percentage (first quoted line)…going to test it now and see how things go.

yea, you probably don’t want to be using callbacks on a controller axis. Also, you are registering them inside the while loop, don’t do that, you end up creating multiple callbacks all trying to do the same thing.

You would be better off just polling the controller axis position and sending the value to the drive motors.

8 Likes

Okay, we will try that - unfortunately, I won’t be able to test it until tomorrow morning, but I’ll get back to this ASAP and let you know how it goes. Thank you so much for your time and assistance!

Also, I should note, when I saw that you replied to my post I was in momentary shock - I also have to thank you for being a general legend on the forums for so many years! I initially came across your post about torque-speed curves in 2017 and it changed my team’s approach for the better. We appreciate your work beyond words. :smile:

2 Likes