forked from mavlink/qgroundcontrol
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from dimazdoks/termit-dev
Termit dev
- Loading branch information
Showing
23 changed files
with
490 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
add_library(ServoControl | ||
ServoControl.cc | ||
ServoControl.h | ||
${EXTRA_SRC} | ||
) | ||
|
||
target_link_libraries(ServoControl | ||
PUBLIC | ||
qgc | ||
) | ||
|
||
target_include_directories(ServoControl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/**************************************************************************** | ||
* | ||
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> | ||
* | ||
* QGroundControl is licensed according to the terms in the file | ||
* COPYING.md in the root of the source code directory. | ||
* | ||
****************************************************************************/ | ||
|
||
|
||
#include<iostream> | ||
#include "Vehicle.h" | ||
#include "ServoControl.h" | ||
|
||
#define SERVO_PWM_ON 2000 | ||
#define SERVO_PWM_OFF 1000 | ||
|
||
#define DAY_LIGHT_SERVO 11 | ||
#define NIGHT_LIGHT_SERVO 3 | ||
|
||
|
||
ServoControl::ServoControl(QObject *parent, Vehicle *vehicle) | ||
: QObject(parent), _vehicle(vehicle) | ||
{ | ||
} | ||
|
||
void ServoControl::setDayLightEnabled(bool enabled, int _defaultComponentId) { | ||
if (!enabled) { | ||
dayLightDisable(_defaultComponentId); | ||
} else { | ||
dayLightEnable(_defaultComponentId); | ||
} | ||
}; | ||
|
||
void ServoControl::setNightLightEnabled(bool enabled, int _defaultComponentId) { | ||
if (!enabled) { | ||
nightLightDisable(_defaultComponentId); | ||
} else { | ||
nightLightEnable(_defaultComponentId); | ||
} | ||
}; | ||
|
||
// ---------------------------------------------------------------------------- | ||
void ServoControl::dayLightEnable(int _defaultComponentId) { | ||
// _defaultComponentId | ||
_vehicle->sendCommand( | ||
_defaultComponentId, | ||
MAV_CMD_DO_SET_SERVO, | ||
true, | ||
DAY_LIGHT_SERVO, | ||
SERVO_PWM_ON | ||
); | ||
}; | ||
|
||
// ---------------------------------------------------------------------------- | ||
void ServoControl::dayLightDisable(int _defaultComponentId) { | ||
// _defaultComponentId | ||
_vehicle->sendCommand( | ||
_defaultComponentId, | ||
MAV_CMD_DO_SET_SERVO, | ||
true, | ||
DAY_LIGHT_SERVO, | ||
SERVO_PWM_OFF | ||
); | ||
}; | ||
|
||
// ---------------------------------------------------------------------------- | ||
void ServoControl::nightLightEnable(int _defaultComponentId) { | ||
// _defaultComponentId | ||
_vehicle->sendCommand( | ||
_defaultComponentId, | ||
MAV_CMD_DO_SET_SERVO, | ||
true, | ||
NIGHT_LIGHT_SERVO, | ||
SERVO_PWM_ON | ||
); | ||
}; | ||
|
||
// ---------------------------------------------------------------------------- | ||
void ServoControl::nightLightDisable(int _defaultComponentId) { | ||
// _defaultComponentId | ||
_vehicle->sendCommand( | ||
_defaultComponentId, | ||
MAV_CMD_DO_SET_SERVO, | ||
true, | ||
NIGHT_LIGHT_SERVO, | ||
SERVO_PWM_OFF | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/**************************************************************************** | ||
* | ||
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> | ||
* | ||
* QGroundControl is licensed according to the terms in the file | ||
* COPYING.md in the root of the source code directory. | ||
* | ||
****************************************************************************/ | ||
|
||
|
||
#pragma once | ||
|
||
#include "QGCLoggingCategory.h" | ||
#include "QGCMAVLink.h" | ||
#include <QString> | ||
#include <QMap> | ||
|
||
class Vehicle; | ||
|
||
class ServoControl : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
ServoControl(QObject* parent, Vehicle* vehicle); | ||
|
||
Q_INVOKABLE void setDayLightEnabled(bool, int); | ||
Q_INVOKABLE void setNightLightEnabled(bool, int); | ||
|
||
void dayLightEnable(int); | ||
void dayLightDisable(int); | ||
void nightLightEnable(int); | ||
void nightLightDisable(int); | ||
private: | ||
Vehicle* _vehicle; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"version": 1, | ||
"fileType": "FactMetaData", | ||
"QGC.MetaData.Facts": | ||
[ | ||
{ | ||
"name": "dayLight", | ||
"shortDesc": "Status of day light", | ||
"type": "bool", | ||
"default": false | ||
}, | ||
{ | ||
"name": "nightLight", | ||
"shortDesc": "Status of night light", | ||
"type": "bool", | ||
"default": false | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.