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
13032120
Commit
13032120
authored
Apr 04, 2019
by
mattdr
Browse files
more updates at the tracki
parent
0a98c606
Changes
8
Hide whitespace changes
Inline
Side-by-side
source_code/Teensy35/.vscode/ipch/14cbe486409a6b76/ENCODER.ipch
View file @
13032120
No preview for this file type
source_code/Teensy35/.vscode/ipch/1cb69e9f519845bb/UTILS.ipch
View file @
13032120
No preview for this file type
source_code/Teensy35/.vscode/ipch/50a0a87be72c2092/mmap_address.bin
0 → 100644
View file @
13032120
File added
source_code/Teensy35/.vscode/ipch/8c5111ec85d5935b/MOTOR_CTRL.ipch
View file @
13032120
No preview for this file type
source_code/Teensy35/.vscode/ipch/c7b2d5234dd9a51/MAIN.ipch
View file @
13032120
No preview for this file type
source_code/Teensy35/src/encoder.cpp
View file @
13032120
...
...
@@ -31,7 +31,7 @@ int opposite_direction_offset = 341;
// hand calibration (done by buttons)
int
button_offset
=
6
0
;
int
button_offset
=
7
0
;
//how much of an effect the button press has
int
button_offset_increment
=
5
;
...
...
@@ -45,7 +45,7 @@ IntervalTimer speed_timer;
// buttons (for hand tuneing)
int
ButtonA
=
0
;
int
ButtonB
=
1
;
int
ButtonB
=
2
;
//forward declarations
void
isr_index
(
void
);
...
...
@@ -284,6 +284,13 @@ bool is_calibration_complete()
return
calibration_complete
;
}
void
set_calibration_complete
()
{
cli
();
calibration_complete
=
true
;
sei
();
}
//This will provide debug prints with info that could be usefull
void
debug_encoder
(
void
)
{
...
...
source_code/Teensy35/src/encoder.h
View file @
13032120
...
...
@@ -13,6 +13,8 @@ int get_elec_rev_position_ticks(int mechanical_position);
int
get_phase_number
(
int
elec_position
);
int
get_Zoffset
(
void
);
bool
is_calibration_complete
();
void
set_calibration_complete
();
...
...
source_code/Teensy35/src/utils.cpp
View file @
13032120
...
...
@@ -3,7 +3,7 @@
#include "motor_ctrl.h"
#include "encoder.h"
float
CALIBRATION_MAX_PWM
=
53
.0
;
float
CALIBRATION_MAX_PWM
=
100
.0
;
const
float
UPWARD_ROC_LIMITER
=
20.0
;
float
UPWARD_ROC_PREV_VALUE
=
0
;
...
...
@@ -71,6 +71,13 @@ int get_pot_0_scaled(int scaleFactor, float period_over_255)
potval
=
UPWARD_ROC_PREV_VALUE
-
UPWARD_ROC_LIMITER
;
}
//This code creates a limit on the amount of power durring calibration
if
(
!
is_calibration_complete
()){
if
(
potval
>
CALIBRATION_MAX_PWM
){
potval
=
CALIBRATION_MAX_PWM
;
}
}
UPWARD_ROC_PREV_VALUE
=
potval
;
potval
=
potval
/
1024
;
...
...
@@ -84,19 +91,19 @@ int get_pot_0_scaled(int scaleFactor, float period_over_255)
return
(
int
)
0
;
}
//This code creates a limit on the amount of power durring calibration
if
(
!
is_calibration_complete
()){
if
(
potval
>
CALIBRATION_MAX_PWM
){
return
CALIBRATION_MAX_PWM
;
}
if
(
potval
>
255
)
//limit the top
{
potval
=
255
;
}
return
(
int
)
potval
;
}
//this just prints the output of get_pot_0_scaled
int
debug_pot_0_scaled
()
{
set_calibration_complete
();
//spoof complete calibration to get proper values
while
(
1
){
Serial
.
println
(
"value from get_pot_0_scaled"
);
Serial
.
println
(
get_pot_0_scaled
(
240
,
0.0000000817
));
...
...
Write
Preview
Markdown
is supported
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