10 Commits

Author SHA1 Message Date
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
jonny_ji7
57de7e3e59 Create wifi.c/h: create AP or connect to Wifi
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);
2022-06-16 11:00:16 +02:00
jonny_ji7
ad2dbb0ce0 Create class controlledFan, Add getStatus to motorctl
- 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
2022-06-11 16:47:13 +02:00
jonny_ji7
adb517c7ed Create 'control.hpp/cpp', Create 'button.hpp/cpp'
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).
2022-06-10 23:09:23 +02:00
jonny_ji7
06451b47d0 Add 'buzzer.hpp, buzzer.cpp' Add instance 'button'
- 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
2022-06-10 08:40:46 +02:00
jonny_ji7
4eb1c5d43a Create class 'evaluatedJoystick'
- 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
2022-06-08 19:50:17 +02:00
jonny_ji7
84bfe211ac Create class 'controlledMotor', Create config
- 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.
2022-06-05 16:36:57 +02:00
jonny_ji7
b0d0b568a3 Create driver for 'single100a h-bridge'
- 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
2022-06-04 18:17:44 +02:00
jonny_ji7
37e9048daa Changes for C++ support, Add gitigore
- extern C around libraries and main function
- Include common libraries
- Create gitignore
2022-06-04 18:17:44 +02:00
jonny_ji7
ffb415fb11 init (esp-idf sample_project)
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
2022-06-04 18:17:15 +02:00