Skip to content

Commit

Permalink
Merge pull request #2 from esp-cpp/bugfix/start-stop
Browse files Browse the repository at this point in the history
bugfix(haptics): enable repeated start/stop
  • Loading branch information
finger563 authored Jun 23, 2023
2 parents c7687da + eba4a03 commit 3887f07
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ See the Getting Started Guide for full steps to configure and use ESP-IDF to bui
The haptics (detent configuration, click/buzz) can be configured dynamically at
run-time using the provided CLI, see screenshot below:

![CleanShot 2023-06-23 at 08 45 26](https://github.com/esp-cpp/bldc_test_stand/assets/213467/912aae32-a434-4969-8309-af42a4f5f4c7)
![CleanShot 2023-06-23 at 13 23 44](https://github.com/esp-cpp/bldc_test_stand/assets/213467/eb2a2f37-01d0-46e3-992a-48820401c0ab)

As you can see, the cli also allows you to start and stop the haptic engine
(default is off when the program starts) and allows you to query the position of
Expand Down
2 changes: 1 addition & 1 deletion components/espp
Submodule espp updated 86 files
+13 −28 components/bldc_driver/include/bldc_driver.hpp
+33 −2 components/bldc_haptics/include/bldc_haptics.hpp
+16 −6 components/bldc_motor/include/bldc_motor.hpp
+9 −10 components/cli/include/cli.hpp
+172 −1 components/rtsp/example/main/jpeg_image.hpp
+11 −9 components/rtsp/example/main/rtsp_example.cpp
+114 −128 components/rtsp/include/jpeg_frame.hpp
+725 −321 components/rtsp/include/jpeg_header.hpp
+15 −17 components/rtsp/include/rtcp_packet.hpp
+201 −214 components/rtsp/include/rtp_jpeg_packet.hpp
+140 −147 components/rtsp/include/rtp_packet.hpp
+425 −416 components/rtsp/include/rtsp_client.hpp
+271 −274 components/rtsp/include/rtsp_server.hpp
+8 −0 components/task/include/task.hpp
+2 −2 docs/adc/adc_types.html
+2 −2 docs/adc/ads1x15.html
+2 −2 docs/adc/ads7138.html
+2 −2 docs/adc/continuous_adc.html
+1 −1 docs/adc/index.html
+2 −2 docs/adc/oneshot_adc.html
+2 −2 docs/bldc/bldc_driver.html
+15 −4 docs/bldc/bldc_motor.html
+1 −1 docs/bldc/index.html
+2 −2 docs/button.html
+3 −3 docs/cli.html
+2 −2 docs/color.html
+2 −2 docs/controller.html
+3 −3 docs/csv.html
+2 −2 docs/display/display.html
+3 −3 docs/display/display_drivers.html
+1 −1 docs/display/index.html
+2 −2 docs/encoder/abi_encoder.html
+2 −2 docs/encoder/as5600.html
+2 −2 docs/encoder/encoder_types.html
+1 −1 docs/encoder/index.html
+2 −2 docs/encoder/mt6701.html
+2 −2 docs/event_manager.html
+2 −2 docs/file_system.html
+2 −2 docs/filters/biquad.html
+2 −2 docs/filters/butterworth.html
+1 −1 docs/filters/index.html
+2 −2 docs/filters/lowpass.html
+2 −2 docs/filters/sos.html
+2 −2 docs/filters/transfer_function.html
+4 −4 docs/ftp/ftp_server.html
+1 −1 docs/ftp/index.html
+11 −3 docs/genindex.html
+25 −4 docs/haptics/bldc_haptics.html
+2 −2 docs/haptics/drv2605.html
+1 −1 docs/haptics/index.html
+1 −1 docs/index.html
+1 −1 docs/input/index.html
+2 −2 docs/input/touchpad_input.html
+2 −2 docs/io_expander/aw9523.html
+1 −1 docs/io_expander/index.html
+2 −2 docs/io_expander/mcp23x17.html
+2 −2 docs/joystick.html
+2 −2 docs/led.html
+2 −2 docs/led_strip.html
+2 −2 docs/logger.html
+2 −2 docs/math/bezier.html
+2 −2 docs/math/fast_math.html
+2 −2 docs/math/gaussian.html
+1 −1 docs/math/index.html
+2 −2 docs/math/range_mapper.html
+2 −2 docs/math/vector2d.html
+2 −2 docs/monitor.html
+1 −1 docs/network/index.html
+2 −2 docs/network/socket.html
+2 −2 docs/network/tcp_socket.html
+2 −2 docs/network/udp_socket.html
+1 −1 docs/nfc/index.html
+2 −2 docs/nfc/ndef.html
+2 −2 docs/nfc/st25dv.html
+ docs/objects.inv
+2 −2 docs/pid.html
+3 −3 docs/rmt.html
+20 −18 docs/rtsp.html
+1 −1 docs/searchindex.js
+3 −3 docs/serialization.html
+5 −5 docs/state_machine.html
+13 −2 docs/task.html
+2 −2 docs/thermistor.html
+1 −1 docs/wifi/index.html
+2 −2 docs/wifi/wifi_ap.html
+2 −2 docs/wifi/wifi_sta.html
28 changes: 24 additions & 4 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,23 @@ extern "C" void app_main(void) {
root_menu->Insert(
"start",
[&](std::ostream &out) {
out << "Starting motor!\n";
haptic_motor.start();
if (!haptic_motor.is_running()) {
out << "Starting motor!\n";
haptic_motor.start();
} else {
out << "Motor already running!\n";
}
},
"Start the motor");
root_menu->Insert(
"stop",
[&](std::ostream &out) {
out << "Stopping motor!\n";
haptic_motor.stop();
if (haptic_motor.is_running()) {
out << "Stopping motor!\n";
haptic_motor.stop();
} else {
out << "Motor already stopped!\n";
}
},
"Stop the motor");
root_menu->Insert(
Expand All @@ -171,6 +179,18 @@ extern "C" void app_main(void) {
out << "Current position: " << haptic_motor.get_position() << "\n";
},
"Print the current position of the haptic motor");
root_menu->Insert(
"shaft_angle",
[&](std::ostream &out) {
out << "Current shaft angle: " << motor.get_shaft_angle() << " radians\n";
},
"Print the current position of the haptic motor");
root_menu->Insert(
"electrical_angle",
[&](std::ostream &out) {
out << "Current electrical angle: " << motor.get_electrical_angle() << " radians\n";
},
"Print the current position of the haptic motor");
root_menu->Insert(
"unbounded_no_detents",
[&](std::ostream &out) {
Expand Down

0 comments on commit 3887f07

Please sign in to comment.