CrossTheRoadElec / Phoenix-Releases

Release repository for Phoenix-Framework and Phoenix-Tuner
79 stars 6 forks source link

Feature Request: TalonFX {Get/Set}SlotConfiguration(int slotid) #27

Closed dawonn closed 2 years ago

dawonn commented 2 years ago

Would be handy to be able to Get/Set a SlotConfiguration for a a motor with one command without resorting to the 'allconfigs' version that pulls in much more data.

struct ctre::phoenix::motorcontrol::can::SlotConfiguration to be precise.

ozrien commented 2 years ago

Have you tried these? configureSlot getSlotConfigs

dawonn commented 2 years ago

ConfigureSlot() is private in cpp it seems. If it were made public, some documentation about what enableOptimizations option does would be neat. I'm hoping that will send all the data once and then block once rather than after each element :shrug:

getSlotConfigs :heavy_check_mark:

/home/dereck/projects/FRC2022/src/main/cpp/subsystems/Shooter.cpp:201:43: error: 'ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigureSlot(const ctre::phoenix::motorcontrol::can::SlotConfiguration&, int, int, bool)' is private within this context
     motor.ConfigureSlot(config, 0, 0, true);
                                           ^
In file included from /home/dereck/.gradle/caches/transforms-3/679754deb7ba07bb38d86bda6549ee08/transformed/api-cpp-5.21.1-headers/ctre/phoenix/motorcontrol/can/BaseTalon.h:7:0,
                 from /home/dereck/.gradle/caches/transforms-3/679754deb7ba07bb38d86bda6549ee08/transformed/api-cpp-5.21.1-headers/ctre/phoenix/motorcontrol/can/TalonFX.h:7,
                 from /home/dereck/.gradle/caches/transforms-3/679754deb7ba07bb38d86bda6549ee08/transformed/api-cpp-5.21.1-headers/ctre/Phoenix.h:21,
                 from /home/dereck/projects/FRC2022/src/main/include/subsystems/Shooter.hpp:17,
                 from /home/dereck/projects/FRC2022/src/main/cpp/subsystems/Shooter.cpp:1:
/home/dereck/.gradle/caches/transforms-3/679754deb7ba07bb38d86bda6549ee08/transformed/api-cpp-5.21.1-headers/ctre/phoenix/motorcontrol/can/BaseMotorController.h:585:31: note: declared private here
      ctre::phoenix::ErrorCode ConfigureSlot(const SlotConfiguration& slot, int slotIdx, int timeoutMs, bool enableOptimizations);
JCaporuscio commented 2 years ago

Yep, so those functions were originally only used internally (and the java ones that were public were marked deprecated for removal).

But since there's interest and it would be useful we can make them public (and un-deprecate the java ones). The enableOptimizations param will be hidden, it's only used internally.

JCaporuscio commented 2 years ago

This has been implemented in the latest release: https://github.com/CrossTheRoadElec/Phoenix-Releases/releases/tag/v5.21.2.0