Skip to content

Commit c7a0019

Browse files
committed
Minor changes to the Sweep library
Added motor speed code for 0 Hz Changed 2 boolean functions (_writeCommand & _writeCommandWithArgument) which each had no return statement to void functions Fixed Sweep::getMotorReady() which had no return statement for the case where _readResponseInfoSetting() returns false
1 parent be7d0bc commit c7a0019

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Sweep/Sweep.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ bool Sweep::getMotorReady()
8181
// readyCode == 0 indicates device is ready
8282
return _ascii_bytes_to_integer(readyCode) == 0;
8383
}
84+
return false;
8485
}
8586

8687
bool Sweep::waitUntilMotorReady()
@@ -177,14 +178,14 @@ void Sweep::reset()
177178
_writeCommand(_RESET_DEVICE);
178179
}
179180

180-
bool Sweep::_writeCommand(const uint8_t cmd[2])
181+
void Sweep::_writeCommand(const uint8_t cmd[2])
181182
{
182183
const uint8_t command[3] = {cmd[0], cmd[1], _COMMAND_TERMINATION};
183184

184185
_serial.write(command, 3);
185186
}
186187

187-
bool Sweep::_writeCommandWithArgument(const uint8_t cmd[2], const uint8_t arg[2])
188+
void Sweep::_writeCommandWithArgument(const uint8_t cmd[2], const uint8_t arg[2])
188189
{
189190
const uint8_t command[5] = {cmd[0], cmd[1], arg[0], arg[1], _COMMAND_TERMINATION};
190191

@@ -287,4 +288,4 @@ void Sweep::_flushInputBuffer()
287288
{
288289
_serial.read();
289290
}
290-
}
291+
}

Sweep/Sweep.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define sweepArrLen(x) (sizeof(x) / sizeof(*x))
1313

1414
// Available Motor Speed Codes for the setMotorSpeed method
15+
const uint8_t MOTOR_SPEED_CODE_0_HZ[2] = {'0', '0'};
1516
const uint8_t MOTOR_SPEED_CODE_1_HZ[2] = {'0', '1'};
1617
const uint8_t MOTOR_SPEED_CODE_2_HZ[2] = {'0', '2'};
1718
const uint8_t MOTOR_SPEED_CODE_3_HZ[2] = {'0', '3'};
@@ -161,9 +162,9 @@ class Sweep
161162
uint8_t _responseInfoSetting[5];
162163

163164
// Write command without any argument
164-
bool _writeCommand(const uint8_t cmd[2]);
165+
void _writeCommand(const uint8_t cmd[2]);
165166
// Write command with a 2 character argument code
166-
bool _writeCommandWithArgument(const uint8_t cmd[2], const uint8_t arg[2]);
167+
void _writeCommandWithArgument(const uint8_t cmd[2], const uint8_t arg[2]);
167168

168169
// Read various types of responses
169170
bool _readResponseHeader();
@@ -196,4 +197,4 @@ class Sweep
196197
}
197198
};
198199

199-
#endif
200+
#endif

0 commit comments

Comments
 (0)