Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mattdr
supermileage_2018
Commits
21cf5d8b
Commit
21cf5d8b
authored
Feb 19, 2019
by
thcl
Browse files
Added a few comments
parent
5d9674bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
source_code/Teensy32/src/main.cpp
View file @
21cf5d8b
...
...
@@ -34,6 +34,7 @@ S TO START BUTT CONTROL (OPTIMIZED)\n");
}
if
(
incomingByte
==
' '
)
//space bar
{
//skips to start calibration
break
;
}
else
if
(
incomingByte
==
'z'
)
//'z'
...
...
source_code/Teensy32/src/motor_ctrl.cpp
View file @
21cf5d8b
...
...
@@ -65,6 +65,7 @@ void motor_setup(void) {
turn_all_off
();
}
// Turns all the mosfets to LOW
void
turn_all_off
()
{
digitalWrite
(
L1
,
LOW
);
digitalWrite
(
L2
,
LOW
);
...
...
@@ -81,7 +82,7 @@ int one_to_scaleFactor(int x)
{
if
(
x
==
1
)
{
// NOTE: The scale factor
of
is the max value we want out of
// NOTE: The scale factor is the max value we want out of
// the potentiometer
return
get_pot_0_scaled
(
SCALE_FACTOR
,
PERIOD_OVER_255
);
}
...
...
@@ -145,6 +146,8 @@ void set_phase(int high1, int high2, int high3, int low1, int low2, int low3)
if
(
!
high3
)
analogWrite
(
H3
,
high3
);
//turn the stuff that should be on, on
/*this is so multiple mosfets don't go high at the
same time when they shouldn't*/
if
(
low1
)
digitalWrite
(
L1
,
low1
);
if
(
low2
)
digitalWrite
(
L2
,
low2
);
...
...
@@ -242,7 +245,7 @@ void open_loop_control(void)
for
(
int
p
=
1
;
p
<=
6
;
p
++
)
{
set_block_phase
(
p
);
//What's going on with this math, expl
i
nation:
//What's going on with this math, expl
a
nation:
// The get_pot_1_inv will return an int 0-100
// We want the minimum speed to be 1 sec per phase
// we want the maximum speed to be 2800 us per phase
...
...
@@ -258,7 +261,7 @@ void open_loop_control(void)
}
}
// This just charges up the small boostrap capacitors
// This just charges up the small boo
t
strap capacitors
// this should allways be called right before powering the motor
void
charge_bootstrap_capacitors
(
void
)
{
...
...
@@ -270,6 +273,8 @@ void charge_bootstrap_capacitors(void)
}
//using hardcoded located state positions
/* If we're in a position, start powering the voltage
to get us to the next position */
void
direct_position_control
(
void
)
{
calibrate_encoder
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment