From 3ef3ac7793dcb837e8cdba0c265236f1ad7ec1c4 Mon Sep 17 00:00:00 2001 From: Jacob Walser Date: Wed, 20 Dec 2023 17:53:06 -0500 Subject: [PATCH] ping360: set baudrate before turning motor off --- src/sensor/ping360.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sensor/ping360.cpp b/src/sensor/ping360.cpp index cd7162e4e..18a0c93a2 100644 --- a/src/sensor/ping360.cpp +++ b/src/sensor/ping360.cpp @@ -853,6 +853,12 @@ Ping360::~Ping360() ping360_motor_off message; message.updateChecksum(); + // set the baudrate for two reasons: + // 1: if doing an auto scan, this will break the sensor out of + // automatic transmission mode + // 2: use a low baudrate to decrease chances of corruption in transmission + setBaudRate(9600); + // Stop scanning and turn off the stepper motor for (int i {0}; i < 10; i++) { writeMessage(message);