4 Commits

Author SHA1 Message Date
jonny_ji7
d573cc5b24 Revert "Add hysteresis to joystick position X-Axis"
While testing this feature briefly that approach did not appear to be a good idea.
- noticed that the driving with joystick was a little unintuitive/unexpected (maybe just not used to it?)
- BUG that the state does not reset to center when previous state was
  X-AXIS? Resulting in the armchair to slightly shake randomly at
  joystick center
  -> this has to be fixed if this approach is tested again.

This reverts commit b2b12fe5de1e16ea2f25dfa4b0c3ac6845024c71.
2022-07-14 18:50:36 +02:00
jonny_ji7
b2b12fe5de Add hysteresis to joystick position X-Axis [WIP]
modified function
joystickPos_t joystick_evaluatePosition(float x, float y, joystickPos_t* prevPos)

because prevPos has to be stored http.cpp/hpp and joystick.cpp/hpp had
to be updated as well

TODO: add function without hysteresis again?
WIP this has to be tested
2022-07-08 19:38:29 +02:00
jonny_ji7
06d0fda8ee Create httpJoystick class
create new class for http mode -> move code for http mode from control.cpp to http.cpp
this makes control.cpp and config.cpp more clear
2022-06-22 12:29:08 +02:00
jonny_ji7
3cb5bc410b Create http server, Add HTTP mode
- 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
2022-06-17 18:24:11 +02:00