Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Satnogs Arduino
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Android-smartphones
interesting_things
bkerler
Satnogs Arduino
Commits
3e40c290
Commit
3e40c290
authored
10 years ago
by
Agis Zisimatos
Browse files
Options
Downloads
Patches
Plain Diff
Add new homing function.
parent
57511af0
Branches
master
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Arduino/SatNOGS.ino
+21
-12
21 additions, 12 deletions
Arduino/SatNOGS.ino
with
21 additions
and
12 deletions
Arduino/SatNOGS.ino
+
21
−
12
View file @
3e40c290
...
...
@@ -13,7 +13,7 @@
#define SPR 200 //Step Per Revolution
#define RATIO 60 //Gear ratio
#define T_DELAY
2
0000 //Time to disable the motors in millisecond
#define T_DELAY
6
0000 //Time to disable the motors in millisecond
#define HOME_AZ 4 //Homing switch for Azimuth
#define HOME_EL 5 //Homing switch for Elevation
...
...
@@ -53,9 +53,10 @@ void setup()
/*Serial Communication*/
Serial
.
begin
(
19200
);
/*Initial Homing*/
Initial_Homing
(
);
Homing
(
deg2step
(
-
ANGLE_SCANNING_MULT
),
deg2step
(
-
ANGLE_SCANNING_MULT
)
);
}
/*Homing Function*/
void
loop
()
{
/*Define the steps*/
...
...
@@ -68,7 +69,9 @@ void loop()
/*Disable Motors*/
if
(
AZstep
==
AZstepper
.
currentPosition
()
&&
ELstep
==
ELstepper
.
currentPosition
()
&&
millis
()
-
t_DIS
>
T_DELAY
)
{
digitalWrite
(
EN
,
HIGH
);
}
/*Enable Motors*/
else
digitalWrite
(
EN
,
LOW
);
...
...
@@ -79,14 +82,12 @@ void loop()
stepper_move
(
AZstep
,
ELstep
);
}
void
Initial_Homing
(
)
void
Homing
(
int
AZsteps
,
int
ELsteps
)
{
int
value_Home_AZ
=
HIGH
;
int
value_Home_EL
=
HIGH
;
int
n_AZ
=
1
;
//Times that AZ angle has changed
int
n_EL
=
1
;
//Times that EL angle has changed
int
AZsteps
=
deg2step
(
-
n_AZ
*
ANGLE_SCANNING_MULT
);
//Initial scanning steps for AZ
int
ELsteps
=
deg2step
(
-
n_EL
*
ANGLE_SCANNING_MULT
);
//Initial scanning steps for EL
boolean
isHome_AZ
=
false
;
boolean
isHome_EL
=
false
;
...
...
@@ -187,6 +188,14 @@ void cmd_proc(int &stepAz, int &stepEl)
{
stepEl
=
ELstepper
.
currentPosition
();;
}
else
if
(
buffer
[
0
]
==
'H'
&&
buffer
[
1
]
==
'M'
)
{
/*Move the steppers to initial position*/
Homing
(
0
,
0
);
/*Zero the steps*/
stepAz
=
0
;
stepEl
=
0
;
}
counter
=
0
;
/*Reset the disable motor time*/
t_DIS
=
0
;
...
...
@@ -208,20 +217,20 @@ void error(int num_error)
case
(
0
):
while
(
1
)
{
Serial
.
println
(
"
Error[0]: Azimuth Homing
"
);
Serial
.
println
(
"
AL001
"
);
delay
(
100
);
}
/*Elevation error*/
case
(
1
):
while
(
1
)
{
Serial
.
println
(
"
Error[1]: Elevation Homing
"
);
Serial
.
println
(
"
AL002
"
);
delay
(
100
);
}
default
:
while
(
1
)
{
Serial
.
println
(
"
Error[?]: Unknown error
"
);
Serial
.
println
(
"
AL000
"
);
delay
(
100
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment