- 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
Currently testing with breakoutboard and larger
1.3'' display (OFFSETX needed)
- display.cpp:
- change structure (outsource in page functions)
- add git and compile info to startup screen
- add armchair mode and motor current to status screen
- control.hpp: Add methods to get current armchair control mode (string)
- motorctl.hpp: Add method to get motor current
Now you can switch to mode ADJUST_CHAIR via 1x short, 1x long button
press and control the armchair rests with the joystick.
Untested, due to hardware (relays) not installed yet
- complete rework of chairAdjust.cpp/.hpp
created a class cControlledRest which is more readable
and saves a lot of duplicate code
- joystick.cpp: move chair control via joystick to
chairAdjust.cpp (prevents dependency loop)
- button.cpp: fix bug instant idle when changing to ADJUST_CHAIR
Note: briefly tested this state on a breakout board:
Mode change and call of new class methods works.
- add mutex around mutex send instruction
- add minimum delay between sent messages
- detect situation where both motors are off and send special both motor
stop command. This might fix issue "right motor stay always on"
- move speedsensor files from motorctl pcb to common
- single pcb create and configure global speedsensor objects
- display: create fast slow veryslow loop
- clear display every 30s
- show speed in rpm and km/h
NOTE: speedsensor needs fix, direction unreliable
slightly rework hacked display test
- new code structure
- split code in several functions
- add task for display instead of running it in main()
- functions to convert voltage to battery percent charged
- show percentage and voltage on display
Successfull test drive with new driver
- set max duty from 90 to 100
- config adjust fading, calibrate joystick, disable deadtime
- disable 1x button cmd
- 8x sport mode: toggle accel not decel
- make motorctl compatible with different drivers
- pass set function instead of specific motor object
- add lambda function in config.cpp
- update config to use one new sabertooth driver instead of two single100a
- main test controlled motor
Same reason as before commit
Note: some changes to http were necessary due to global object
- untested!
Also remove unneded duplicate components folder
since board_single uses mostly the same code as board_control and
board_motorctl several files are outsorced to common folder to prevent
dupliate code and different versions
New controller will be run with single controller at first...
get single board version from V2.0 and create new folder
(two boards version is kept)
-> copied firmware from e6e586e5855d81ee726bb9a0fbe8ab12def5eeef
successfully read rotational speed and direction using encoder disk and
optical sensor
custom implementation of incremental encoder using gpio edge interrupt
brake-mode support
in BRAKE state relays are powered that connects a brake resistor
(not tested with actual motors)
Also brake mode is currently not used at all
[untested]
Turn on brake relays in BRAKE state
Also wait certain time for relays to switch before shorting the driver
Add config option for brake relay pin
Initialize pin in constructor