Skip to content

Commit 00b3ff7

Browse files
committed
bugfix(haptics): enable repeated start/stop
* Update espp submodule for bldc control bugfix - enabling repeated enable/disable * Added commands for getting the shaft angle and electical angle of the motor
1 parent c7687da commit 00b3ff7

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

components/espp

Submodule espp updated 86 files

main/main.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,23 @@ extern "C" void app_main(void) {
154154
root_menu->Insert(
155155
"start",
156156
[&](std::ostream &out) {
157-
out << "Starting motor!\n";
158-
haptic_motor.start();
157+
if (!haptic_motor.is_running()) {
158+
out << "Starting motor!\n";
159+
haptic_motor.start();
160+
} else {
161+
out << "Motor already running!\n";
162+
}
159163
},
160164
"Start the motor");
161165
root_menu->Insert(
162166
"stop",
163167
[&](std::ostream &out) {
164-
out << "Stopping motor!\n";
165-
haptic_motor.stop();
168+
if (haptic_motor.is_running()) {
169+
out << "Stopping motor!\n";
170+
haptic_motor.stop();
171+
} else {
172+
out << "Motor already stopped!\n";
173+
}
166174
},
167175
"Stop the motor");
168176
root_menu->Insert(
@@ -171,6 +179,18 @@ extern "C" void app_main(void) {
171179
out << "Current position: " << haptic_motor.get_position() << "\n";
172180
},
173181
"Print the current position of the haptic motor");
182+
root_menu->Insert(
183+
"shaft_angle",
184+
[&](std::ostream &out) {
185+
out << "Current shaft angle: " << motor.get_shaft_angle() << " radians\n";
186+
},
187+
"Print the current position of the haptic motor");
188+
root_menu->Insert(
189+
"electrical_angle",
190+
[&](std::ostream &out) {
191+
out << "Current electrical angle: " << motor.get_electrical_angle() << " radians\n";
192+
},
193+
"Print the current position of the haptic motor");
174194
root_menu->Insert(
175195
"unbounded_no_detents",
176196
[&](std::ostream &out) {

0 commit comments

Comments
 (0)