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
- control.cpp: Add feature to HTTP mode, that turns motors off when at least one motor is still on
but no data was received for more than 3 seconds (e.g. wifi connection
lost)
- change queue size from 20 to 1 - no need to store multiple joystick
data since only the latest one is relevant
- add "preset command" to control.hpp to set both motors to IDLE
- 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