- slightly decrease msFadeDecel by 100ms
- different approach in button.cpp for case last button press was long
e.g. reworked commands:
- 1x long press = restart
- 1x short press = center stick, freeze
- 1x short 1x long = run new auto commands
- 2x short = toggle idle
- change default minOnMs / minOffMs for evaulated switch class -> fix
button presses sometimes not recognized
the joystick object is now available in the button class/task
thus can be used to trigger commands with certain combinations of
joystick and button
- not used yet -
- automaticArmchair:
- add method addCommands for adding an array of
commands to queue
- add keys to simpleCommand struct
- fadeDecel (not used yet)
- fadeAcel (not used yet)
- instructions (new enum for running other commands in control task
, not used yet)
- button.cpp
- add example command to 1x button press (comment out previous cmd
temporarily)
- control.cpp
- update changeMode function: dont do anything when current mode is
already target mode
- add 3 functions to controlledMotor class in motorctl.cpp/hpp
- setFade: set specific msFade duration for acceleration or
deceleration
- setFade: disable or set to default ramp for acceleration or
deceleration
- toggleFade: toggle between fading enabled or disables for
acceleration or deceleration
- button.cpp
- add controlledMotor objects to constructor
- add new command 8x press which now toggles fade-deceleration of both
motors
- config.cpp
- slightly decrease fading durations
- Move all separately declared functions in control.hpp to a new class
'controlledArmchair'
- now passing other objects only one time with constructor instead
of accessing them globally
- Create control instance in config.hpp, and passing objects in
config.cpp
- Add functions to new control class
- toggleIdle(): toggle between last mode and idle
- toggleModes(mode1, mode2): toggle between two modes
- Add commands to button.cpp
- 2x button press: call toggleIdle()
- 6x button press: toggleModes MASSAGE -> JOYSTICK
- Define control task in main.cpp
- Adjust button files and main.cpp to use the new command object instead
of the previus functions
Add control.hpp and control.cpp
- task that repeatedly generates motor commands depending on the current mode
- function to change to a specified control mode
Add button.hpp and button.cpp
- class which runs commands depending on the count a button was pressed
Update main.cpp
- create button task
- create control task
- comment out previous testing code
- remove unnecessary includes (already included in config.hpp)
Add control.cpp and button.cpp to CMakeLists
Notes: Tested this state on the armchair: All currently implemented features
work. You can switch between IDLE and JOYSTICK by pressing the button 2
or 3 times. Also driving works well (limited to 60% duty, with no fans
yet).