@@ -41,15 +41,15 @@ auto rain = RainSensor(RAIN_SENSOR_PIN);
4141// cin and cout for ArduinoSTL
4242namespace std
4343{
44- ohserialstream cout (host);
45- ihserialstream cin (host);
44+ ohserialstream cout (host);
45+ ihserialstream cin (host);
4646} // namespace std
4747
48- void DispatchCommand (const Command& command)
49- {
48+ void DispatchCommand (const Command & command)
49+ {
5050 // std::cout << command.RawCommand << "V=" << command.Verb << ", T=" << command.TargetDevice << ", P=" << command.StepPosition << std::endl;
5151 commandProcessor.HandleCommand (command);
52- }
52+ }
5353
5454/*
5555 * Handles receive data from the host serial interface.
@@ -71,7 +71,7 @@ void HandleSerialCommunications()
7171 case ' \n ' : // newline - dispatch the command
7272 case ' \r ' : // carriage return - dispatch the command
7373 if (hostReceiveBuffer.length () > 1 )
74- {
74+ {
7575 const auto command = Command (hostReceiveBuffer);
7676 DispatchCommand (command);
7777 hostReceiveBuffer.clear ();
@@ -81,7 +81,7 @@ void HandleSerialCommunications()
8181 << ResponseBuilder::Message
8282 << ResponseBuilder::terminator
8383 << std::endl; // send response, if there is one.
84- }
84+ }
8585 break ;
8686 case ' @' : // Start of new command
8787 hostReceiveBuffer.clear ();
@@ -171,7 +171,10 @@ void loop()
171171 rain.loop ();
172172 // Release stepper holding torque if there has been no serial communication for "a long time".
173173 if (serialInactivityTimer.Expired ())
174+ {
174175 stepper.releaseMotor ();
176+ serialInactivityTimer.Stop ();
177+ }
175178 }
176179}
177180
0 commit comments