With this commit the webserver of the controller can serve a folder (/react-app/build/), when the ip is accessed in a web-browser.
Currently the react app is successfully served and the armchair can be controlled when in HTTP mode and connected via AP.
- CMakeLists: Add command that creates and flashes the spiffs partition when running
idf.py flash
- main.cpp: Add function to initialize spiffs
- http.cpp: uncomment handler for default URL (accesses spiffs)
- Add partitions.csv: needed for the creation of spiffs.bin during
compilation
- Add sdkconfig: It was necessary to change the FLASH_SIZE from 2MB to
4MB. To avoid having the same trouble on other devices the sdkconfig
is now added to the repository
- Create http.cpp and http.hpp
- functions for initializing a http server
- function for URL api/joystick
- receive joystick data from http post request
- parse json, define joystick position (function from joystick.hpp)
- send data to control task via queue
- control.hpp/cpp:
- add HTTP mode to handle loop
- receive joystick commands from queue, generate commands, send to
motorctl
- upgrade changeMode function with ability to run functions at switch
FROM and TO certain modes
- add code to start/stop wifi and webserver when switching to/from
HTTP mode
- change toggleModes and toggleIdle to use the changeMode function
- main.cpp:
- add several sections with code for testing new functions (commented
out)
- add http loglevel
- buzzer.cpp:
- add command (press 4 times) to toggle between HTTP and JOYSTICK mode
FIXME: moved initialization of wifi to main.cpp at startup because of an
error -> resolve this and place wifi start and stop functions into
mode-change as intended
currently works best in accesspoint mode with laptop connected using the
react-webapp
Create functions in wifi.c and wifi.h:
- an wifi accesspoint can be created
- connect to an existing wifi anf disconnect
Add code for testing to main.cpp:
repeatedly connects, disconnects and switches between AP and connecting
to BKA-network every run
New functions
//init components (run in main function once)
void wifi_initNvs_initNetif();
//function to start an access point
void wifi_init_ap(void);
//function to disable/deinit access point
void wifi_deinit_ap(void);
//function to connect to existing wifi network
void wifi_init_client(void);
//function to disable/deinit client
void wifi_deinit_client(void);
- Add class for controlling fans for cooling the motor drivers
- Add configuration for left and right fan to config.cpp
- Create fan task in main.cpp
- Add getStatus function to controlledMotor class
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).
- Copy buzzer function from gate project
this makes it possible to easily trigger and queue up buzzing events
without having to worry about delaying the program
- Add instance buzzer to config
- Add code for testing the buzzer to main.cpp
- Create class 'evaluatedJoystick'
- evaluates a joystick with 2 analog signals
- scales the adc input to coordinates with detailed tolerances
- calculates angle and radius
- defines an enum with position information
- Add joystick configuration and class instance to config.cpp
- Add code for testing the new class to main.cpp
- Add joystick.cpp to cmakelists
now function `joystick.getData` can be used globally to obtain a struct with
current position data of the joystick
- Create class 'controlledMotor':
- handles 'fading / ramp' of the pwm duty
- handles current limit **not implemented yet**
- has .handle function that is intended to be run very fast in another task
commands are sent via queue
- Create config.hpp
- Globally available instance motorLeft of controlledMotor class
- Create config.cpp
- Configuration of motordriver and control parameters for motorLeft
- Add config.cpp and motorctl.cpp to cmakelists
- main.cpp:
- create 'task_motorctl' which repeatedly runs motorLeft.handle()
- modify testing code for testing the new class
- comments
The fading/ramp capability of the new class was tested successfully
using a breakoutboard with an led.
- create class 'single100a' in motordrivers.hpp and motordrivers.cpp
- add code for testing the driver in main.cpp (test with led was successful)
- update cmakelists, to also compile the new .cpp file
Rewrite of firmware controlling an electric armchair (previous firmware
developed 2019-2021)
- Init esp-idf project: with esp-idf version v4.4.1 installed ran command `idf.py create-project
armchair`
- Add connection plan from old repo