Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Software Defined Radio
r0tor
Commits
d1ee2561
Commit
d1ee2561
authored
Mar 14, 2019
by
Markus
Browse files
Rename CRotor->Rotor
parent
4692f36e
Changes
5
Hide whitespace changes
Inline
Side-by-side
shackremote_arduino/hamlib.cpp
View file @
d1ee2561
...
...
@@ -20,7 +20,7 @@ CHamlib::CHamlib()
/// @brief Initialize Hamlib
///
void
CHamlib
::
initHamlib
(
EthernetUDP
*
udp
,
C
Rotor
*
rotor
)
void
CHamlib
::
initHamlib
(
EthernetUDP
*
udp
,
Rotor
*
rotor
)
{
udp_
=
udp
;
rotor_
=
rotor
;
...
...
shackremote_arduino/hamlib.h
View file @
d1ee2561
...
...
@@ -20,7 +20,7 @@ public:
enum
hamlibError
{
HAMLIB_OK
,
HAMLIB_NOK
};
CHamlib
();
void
initHamlib
(
EthernetUDP
*
udp
,
C
Rotor
*
rotor
);
void
initHamlib
(
EthernetUDP
*
udp
,
Rotor
*
rotor
);
void
receiveHamlibPacket
();
void
sendHamlibPacket
();
hamlibError
parseHamlibPacket
();
...
...
@@ -28,7 +28,7 @@ public:
private:
EthernetUDP
*
udp_
;
C
Rotor
*
rotor_
;
Rotor
*
rotor_
;
char
received_packet_
[
UDP_TX_PACKET_MAX_SIZE
];
char
tx_packet_
[
UDP_TX_PACKET_MAX_SIZE
];
bool
packet_received_
=
false
;
...
...
shackremote_arduino/rotor.cpp
View file @
d1ee2561
...
...
@@ -11,7 +11,7 @@
/// @brief Constructor
///
C
Rotor
::
C
Rotor
()
Rotor
::
Rotor
()
{
initRotor
();
}
...
...
@@ -20,7 +20,7 @@ CRotor::CRotor()
/// @brief Initialize all ADC Values and set Arduino Pins to a defined value.
///
void
C
Rotor
::
initRotor
()
void
Rotor
::
initRotor
()
{
if
(
AZIM
)
{
...
...
@@ -58,7 +58,7 @@ void CRotor::initRotor()
/// @brief Does all the rotor movement stuff
///
void
C
Rotor
::
doRotor
()
void
Rotor
::
doRotor
()
{
int
diff_elev
,
diff_azim
;
readRotSensors
();
...
...
@@ -115,31 +115,31 @@ void CRotor::doRotor()
}
}
void
C
Rotor
::
releaseBreakAzimuth
()
void
Rotor
::
releaseBreakAzimuth
()
{
m_bAzimuthBreakReleased
=
1
;
digitalWrite
(
AZIM_RE_BREAK
,
LOW
);
}
void
C
Rotor
::
releaseBreakElevation
()
void
Rotor
::
releaseBreakElevation
()
{
m_bElevationBreakReleased
=
1
;
digitalWrite
(
ELEV_RE_BREAK
,
LOW
);
}
void
C
Rotor
::
tightenBreakAzimuth
()
void
Rotor
::
tightenBreakAzimuth
()
{
m_bAzimuthBreakReleased
=
0
;
digitalWrite
(
AZIM_RE_BREAK
,
HIGH
);
}
void
C
Rotor
::
tightenBreakElevation
()
void
Rotor
::
tightenBreakElevation
()
{
m_bElevationBreakReleased
=
0
;
digitalWrite
(
ELEV_RE_BREAK
,
HIGH
);
}
void
C
Rotor
::
stopAzimuth
()
void
Rotor
::
stopAzimuth
()
{
digitalWrite
(
AZIM_RE_CW
,
HIGH
);
digitalWrite
(
AZIM_RE_CCW
,
HIGH
);
...
...
@@ -147,7 +147,7 @@ void CRotor::stopAzimuth()
m_bAzimuthShouldRotate
=
0
;
}
void
C
Rotor
::
stopElevation
()
void
Rotor
::
stopElevation
()
{
digitalWrite
(
ELEV_RE_UP
,
HIGH
);
digitalWrite
(
ELEV_RE_DWN
,
HIGH
);
...
...
@@ -155,44 +155,44 @@ void CRotor::stopElevation()
m_bElevationShouldRotate
=
0
;
}
C
Rotor
::
rotorError
C
Rotor
::
rotateCW
()
Rotor
::
rotorError
Rotor
::
rotateCW
()
{
if
(
m_bAzimuthBreakReleased
==
0
)
return
C
Rotor
::
ROT_BREAK_NOT_RELEASED
;
return
Rotor
::
ROT_BREAK_NOT_RELEASED
;
digitalWrite
(
AZIM_RE_CW
,
LOW
);
digitalWrite
(
AZIM_RE_CCW
,
HIGH
);
m_bAzimuthCurrentlyRotating
=
1
;
return
C
Rotor
::
ROT_OK
;
return
Rotor
::
ROT_OK
;
}
C
Rotor
::
rotorError
C
Rotor
::
rotateCCW
()
Rotor
::
rotorError
Rotor
::
rotateCCW
()
{
if
(
m_bAzimuthBreakReleased
==
0
)
return
C
Rotor
::
ROT_BREAK_NOT_RELEASED
;
return
Rotor
::
ROT_BREAK_NOT_RELEASED
;
digitalWrite
(
AZIM_RE_CW
,
HIGH
);
digitalWrite
(
AZIM_RE_CCW
,
LOW
);
m_bAzimuthCurrentlyRotating
=
1
;
return
C
Rotor
::
ROT_OK
;
return
Rotor
::
ROT_OK
;
}
C
Rotor
::
rotorError
C
Rotor
::
rotateUp
()
Rotor
::
rotorError
Rotor
::
rotateUp
()
{
if
(
m_bElevationBreakReleased
==
0
)
return
C
Rotor
::
ROT_BREAK_NOT_RELEASED
;
return
Rotor
::
ROT_BREAK_NOT_RELEASED
;
digitalWrite
(
ELEV_RE_UP
,
LOW
);
digitalWrite
(
ELEV_RE_DWN
,
HIGH
);
m_bElevationCurrentlyRotating
=
1
;
return
C
Rotor
::
ROT_OK
;
return
Rotor
::
ROT_OK
;
}
C
Rotor
::
rotorError
C
Rotor
::
rotateDown
()
Rotor
::
rotorError
Rotor
::
rotateDown
()
{
if
(
m_bElevationBreakReleased
==
0
)
return
C
Rotor
::
ROT_BREAK_NOT_RELEASED
;
return
Rotor
::
ROT_BREAK_NOT_RELEASED
;
digitalWrite
(
ELEV_RE_UP
,
HIGH
);
digitalWrite
(
ELEV_RE_DWN
,
LOW
);
m_bElevationCurrentlyRotating
=
1
;
return
C
Rotor
::
ROT_OK
;
return
Rotor
::
ROT_OK
;
}
...
...
@@ -200,7 +200,7 @@ CRotor::rotorError CRotor::rotateDown()
/// @brief Serial Debug output Function
///
void
C
Rotor
::
debugOut
()
void
Rotor
::
debugOut
()
{
//debug Out
readRotSensors
();
...
...
@@ -217,7 +217,7 @@ void CRotor::debugOut()
/// @return uint16 actual Azimuth value in degree
///
uint16
C
Rotor
::
getActualAzimuth
()
const
uint16
Rotor
::
getActualAzimuth
()
const
{
return
m_uActualAzimuth
;
}
...
...
@@ -228,7 +228,7 @@ uint16 CRotor::getActualAzimuth() const
/// @return actual Elevation value in degree
///
uint16
C
Rotor
::
getActualElevation
()
const
uint16
Rotor
::
getActualElevation
()
const
{
return
m_uActualElevation
;
}
...
...
@@ -241,17 +241,17 @@ uint16 CRotor::getActualElevation() const
/// @return Error Code
///
C
Rotor
::
rotorError
C
Rotor
::
setAzimuth
(
uint16
pAzimuth
)
Rotor
::
rotorError
Rotor
::
setAzimuth
(
uint16
pAzimuth
)
{
if
(
pAzimuth
>=
AZIM_MIN
&&
pAzimuth
<=
AZIM_MAX
)
{
m_uSetAzimuth
=
pAzimuth
;
m_bAzimuthShouldRotate
=
1
;
return
C
Rotor
::
ROT_OK
;
return
Rotor
::
ROT_OK
;
}
else
{
return
C
Rotor
::
ROT_VAL_OUT_OF_RANGE
;
return
Rotor
::
ROT_VAL_OUT_OF_RANGE
;
}
}
...
...
@@ -263,17 +263,17 @@ CRotor::rotorError CRotor::setAzimuth(uint16 pAzimuth)
/// @return Error Code
///
C
Rotor
::
rotorError
C
Rotor
::
setElevation
(
uint16
pElevation
)
Rotor
::
rotorError
Rotor
::
setElevation
(
uint16
pElevation
)
{
if
(
pElevation
>=
ELEV_MIN
&&
pElevation
<=
ELEV_MAX
)
{
m_uSetElevation
=
pElevation
;
m_bElevationShouldRotate
=
1
;
return
C
Rotor
::
ROT_OK
;
return
Rotor
::
ROT_OK
;
}
else
{
return
C
Rotor
::
ROT_VAL_OUT_OF_RANGE
;
return
Rotor
::
ROT_VAL_OUT_OF_RANGE
;
}
}
...
...
@@ -283,14 +283,14 @@ CRotor::rotorError CRotor::setElevation(uint16 pElevation)
/// @return Error Code
///
C
Rotor
::
rotorError
C
Rotor
::
readRotSensors
()
Rotor
::
rotorError
Rotor
::
readRotSensors
()
{
if
(
AZIM
)
m_uActualAzimuth
=
(
uint16
)(
readADC
(
AZIM_POT
)
/
AZIM_DEG
);
if
(
ELEV
)
m_uActualElevation
=
(
uint16
)(
readADC
(
ELEV_POT
)
/
ELEV_DEG
);
return
C
Rotor
::
ROT_OK
;
return
Rotor
::
ROT_OK
;
}
///
...
...
@@ -301,7 +301,7 @@ CRotor::rotorError CRotor::readRotSensors()
/// @return average ADC value
///
uint16
C
Rotor
::
readADC
(
int
AdcPin
)
uint16
Rotor
::
readADC
(
int
AdcPin
)
{
//Read ADC 4 times and calculate average
uint32_t
adcValue
=
0
;
...
...
shackremote_arduino/rotor.h
View file @
d1ee2561
...
...
@@ -11,14 +11,14 @@
#include "settings.h"
#include "Arduino.h"
class
C
Rotor
class
Rotor
{
public:
enum
rotorError
{
ROT_OK
,
ROT_NOK
,
ROT_VAL_OUT_OF_RANGE
,
ROT_BREAK_NOT_RELEASED
};
C
Rotor
();
Rotor
();
void
initRotor
();
void
doRotor
();
void
debugOut
();
...
...
shackremote_arduino/shackremote_arduino.ino
View file @
d1ee2561
...
...
@@ -20,7 +20,7 @@ byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x13, 0x37 };
IPAddress
ip
(
83
,
133
,
178
,
126
);
unsigned
int
localPort
=
51337
;
C
Rotor
rotor
;
Rotor
rotor
;
CHamlib
hamlib
;
EthernetUDP
udp
;
int
debugTime
;
...
...
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