diff --git a/README.md b/README.md index c7de0fa..28de7e9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/components/espp b/components/espp index 22f0b58..7f51727 160000 --- a/components/espp +++ b/components/espp @@ -1 +1 @@ -Subproject commit 22f0b587124445e3dfe5ce1454aadd055490a84d +Subproject commit 7f51727cec9de6c88e4d3120cd4b60b61f4b74dd diff --git a/main/main.cpp b/main/main.cpp index 0497e1e..06eca9f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -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( @@ -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) {