Skip to content

Commit 451c6e3

Browse files
authored
Merge pull request #153 from MatzElectronics/Community
Fixes obstacle detection
2 parents 4e21d1d + e70c51a commit 451c6e3

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed
Binary file not shown.

Learn/Simple Libraries/Robotics/S3/libs3/libs3.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,15 @@ the Test Utility, cycle the Scribbler//s power switch.
7474
7575
*/
7676

77-
int main() {
77+
// ------ Libraries and Definitions ------
78+
#include "simpletools.h"
79+
#include "s3.h"
80+
81+
82+
83+
// ------ Main Program ------
84+
int main()
85+
{
7886

7987
}
8088

Learn/Simple Libraries/Robotics/S3/libs3/s3.c

+12-4
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,19 @@ int32_t s3_readMic()
118118
static void s3_obstacler()
119119
{
120120
int32_t side, ObstacleThld;
121-
if (scribbler_get_obstacle_threshold() != SCRIBBLER_DEFAULT_OBSTACLE_THLD) {
122-
ObstacleThld = scribbler_get_obstacle_threshold();
121+
if (scribbler_get_model_s3()) {
122+
if (scribbler_get_obstacle_threshold() != S3_OBSTACLE_THLD) {
123+
ObstacleThld = scribbler_get_obstacle_threshold();
124+
} else {
125+
ObstacleThld = S3_OBSTACLE_THLD;
126+
}
123127
} else {
124-
ObstacleThld = S3_OBSTACLE_THLD;
125-
}
128+
if (scribbler_get_obstacle_threshold() != SCRIBBLER_DEFAULT_OBSTACLE_THLD) {
129+
ObstacleThld = scribbler_get_obstacle_threshold();
130+
} else {
131+
ObstacleThld = SCRIBBLER_DEFAULT_OBSTACLE_THLD;
132+
}
133+
}
126134
while (1) {
127135
for(side = SCRIBBLER_OBS_TX_LEFT; side <= SCRIBBLER_OBS_TX_RIGHT; side = side + 9) {
128136
FRQA = (14000 * ObstacleThld) + (20607 * (100 - ObstacleThld));

0 commit comments

Comments
 (0)