Tested new control modes on actual hardware.
Adjust new code so the modes kind of work now, as proof of concept.
Still needs major optimization and fixes though.
motorctl:
- add config option to disable logging for particular instance
- add some definitions to finetune control modes
- rework current and speed mode, so they actually kind of work
- fix TCS to not cause deadlock motors off
menu:
- add item set motorControlMode (select DUTY, CURRENT, SPEED)
- fix missing item maxDuty
speedsensor: fix return type
very experimental needs testing/debugging,
other control modes can currently be selected by editing the class definition in motorctl.hpp
menu/config
- add menu item to enable/disable traction control system
main: pass ptr to other motor to motor object
speedsensor: add method to get last update time
motorctl: handle loop:
- re-arrange some code sections
- add several methods to get current status (needed from other motor for tcs)
- add sketchy code for different control modes DUTY, CURRENT, SPEED (very basic implementation)
- add experimental code for traction control
Add new status screens that can be selected in menu
(status screen = display content while not in MENU mode)
- display:
- Motors screen: shows Power usage, duty, speed
- Joystick screen: shows all stick data and current control mode (similar to 'debug joystick' menu option
- menu:
- disable example menu items
- add new status screens
- config, chairAdjust:
- disable reset-pin of display (not connected, random pin was assigned)
same pin was used for chair adjust resulting in on state after startup
- fix chairAdjust not stopping in OFF state
- display
- add functionality to show different status screens (content when not in MENU)
- add status screen 'Speed' (to show speed and debug speedsensors)
- menu
- fix item joystick define center not working
- add item to select status screen
- menu:
- Add item joystick calibration wizzard
- Add item RESET (clear nvs and restart)
- Add configuration option to not show/change value. Instead only show confirm message
apply this to all items only running action
- Optimize formatting and comments
- main:
- pass nvsHandle to display task and joystick class
- joystick:
- Add methods to write and load calibration values (axis min/max adc value) from nvs
- Add method to get raw adc value
menu:
- optimize set-value page: send static content only once
so only update value -> significant performance boost
- formatting
- reset control timeout to prevent unintended exit and bugged display
- menu item: add option to show a default value (function ptr)
- add default value to adjust fading
- add beeping
motorctl:
- dont write to nvs when value is unchanged
- All files:
Modify almost all files to adjust functions and classes to
work with pointers to objects passed at task creation
instead of global variables from config.hpp
- Remove/clear config.hpp to get rid of all global variables
- main.cpp
- Create pointer to all shared (used in multiple tasks) objects in main
- remove evaluatedSwitch button object,
since joystick library is used to get switch events
- changes HTTP-mode
- always init http-server (do not enable/disable at mode change)
- pass url-handle function to init-htpp function
- add lambda function to pass method of instance for thatMajor Rework all files - Remove global variables, pass pointers to tasks
- All files:
Modify almost all files to adjust functions and classes to
work with pointers to objects passed at task creation
instead of global variables from config.hpp
- Remove/clear config.hpp to get rid of all global variables
- main.cpp
- Create pointer to all shared (used in multiple tasks) objects in main
- remove evaluatedSwitch button object,
since joystick library is used to get switch events
- changes HTTP-mode
- always init http-server (do not enable/disable at mode change)
- pass url-handle function to init-htpp function
- add lambda function to pass method of instance for that
NOTES: - tested on breakoutboard only
- known issue that slow encoder events are not recognized
(especially in menu) - slowing down motorctl helps
Simple functions for printing a line normal, large or centered
using format string directly instead of having to use both
snprintf first and then display function all the time
This makes the code more readable and compact
Applied this optimization where applicable in manu.cpp and display.cpp
Armchair functions as before (all tasks enabled).
Note: probably wrong encoder pin set in encoder.hpp
Old button menu works as usual (opimized code).
You can switch to new MENU state with 1x long press
and exit the menu with 1x long press
button.cpp: - use encoder queue instead of evaluated switch
- simplify code, rework actions
control.cpp: Add MENU state/mode
-> control task: turns motors off and idles
-> button task idles (button menu disabled)
-> display task switches state to handle menu
control.cpp: Optimize structure:
Add methods to freeze stick and toggle stick mapping
display.cpp: show status screen or handle menu depending on mode, simpilfy task
main.cpp: re-enable button task, disable buzzer logging
menu.cpp: Change events, Add menu exit condition
Added functional menu using display and encoder:
- a menu item is defined in one struct
- scroll in a list of defined items
- select option
- modify value
- save value, return to list
Currently only menu is run (button and status display disabled)
- Add menu.cpp/hpp
- Add encoder.cpp/hpp mostly from previous test in board-control
- display.cpp: only run new handleMenu() function
- main.cpp: initialize encoder at startup, disable button task for testing