Make sure we stop motors on exit (#199)

This commit is contained in:
Michał Moskal 2018-01-07 15:54:40 +00:00 committed by Peli de Halleux
parent 7fe8580de8
commit b3f9a4c92f

View File

@ -483,7 +483,15 @@ void runLMS() {
*/ */
} }
void stopMotors() {
uint8_t cmd[2] = { 0xA3, 0x0F };
int fd = open("/dev/lms_pwm", O_RDWR);
write(fd, cmd, 2);
close(fd);
}
extern "C" void target_reset() { extern "C" void target_reset() {
stopMotors();
if (lmsPid) if (lmsPid)
runLMS(); runLMS();
else else