加入对新RTK状态支持,

加入RGB灯控制第一版
This commit is contained in:
pxzleo 2017-08-04 22:32:12 +08:00
parent 2ae769b5d4
commit 6a18c8ac4e
6 changed files with 65 additions and 2 deletions

View File

@ -6,7 +6,8 @@
Fix2D = 2, Fix2D = 2,
Fix3D = 3, Fix3D = 3,
DGPS3D=4, DGPS3D=4,
RTK3D= 5 RTKFLOAT= 5,
RTKFIXED = 6
} }

View File

@ -113,7 +113,7 @@ namespace Plane.Copters
Task SetShowLEDAsync(bool Ledon); Task SetShowLEDAsync(bool Ledon);
Task SetShowLEDFlashAsync(int Flashtype, int millisecondsTime); Task SetShowLEDFlashAsync(int Flashtype, int millisecondsTime);
Task SetShowRGBLEDAsync(int RedValue, int GreenValue, int BlueValue);
/// <summary> /// <summary>
/// 开始对频。 /// 开始对频。

View File

@ -886,6 +886,41 @@ namespace Plane.Copters
public async Task TakeOffAsync() public async Task TakeOffAsync()
{ {
/* await SetChannelsAsync(
ch1: 1500,
ch2: 1500,
ch3: 1500,
ch4: 1500
).ConfigureAwait(false);
_forcedState = CopterState.TakingOff;
State = CopterState.TakingOff;
await DoCommandAsync(MAVLink.MAV_CMD.TAKEOFF, 0, 0, 0, 0, 0, 0, alt).ConfigureAwait(false);
var temp = Task.Run(async () =>
{
var startTime = DateTime.Now;
var secondsTimeout = alt / 0.7;
while (currentTakeOffCount == _takeOffCount)
{
if (alt - Altitude < 0.2 || startTime.AddSeconds(secondsTimeout) <= DateTime.Now)
{
_forcedState = null;
await HoverAsync().ConfigureAwait(false);
break;
}
await Task.Delay(50).ConfigureAwait(false);
}
});
*/
if (await SetModeAsync(FlightMode.AUTO).ConfigureAwait(false)) if (await SetModeAsync(FlightMode.AUTO).ConfigureAwait(false))
{ {
await SetChannelsAsync( await SetChannelsAsync(
@ -895,6 +930,7 @@ namespace Plane.Copters
ch4: 1500 ch4: 1500
).ConfigureAwait(false); ).ConfigureAwait(false);
} }
} }
/// <summary> /// <summary>

View File

@ -72,6 +72,13 @@ namespace Plane.Copters
return TaskUtils.CompletedTask; return TaskUtils.CompletedTask;
} }
public Task SetShowRGBLEDAsync(int RedValue, int GreenValue, int BlueValue)
{
return TaskUtils.CompletedTask;
}
public Task StartPairingAsync() public Task StartPairingAsync()
{ {
return TaskUtils.CompletedTask; return TaskUtils.CompletedTask;

View File

@ -275,6 +275,14 @@ namespace Plane.Copters
RaiseLocationChanged(); RaiseLocationChanged();
return TaskUtils.CompletedTask; return TaskUtils.CompletedTask;
} }
public Task SetShowRGBLEDAsync(int RedValue, int GreenValue, int BlueValue)
{
return TaskUtils.CompletedTask;
}
public Task SetShowLEDFlashAsync(int Flashtype, int millisecondsTime) public Task SetShowLEDFlashAsync(int Flashtype, int millisecondsTime)
{ {
bool Ledison; bool Ledison;

View File

@ -149,6 +149,17 @@ namespace Plane.Copters
_showLed = Ledon; _showLed = Ledon;
} }
public async Task SetShowRGBLEDAsync(int RedValue,int GreenValue,int BlueValue)
{
float rgbvalue = (RedValue & 255) << 16 + (GreenValue & 255) << 8 + (BlueValue & 255);
await SetParamNoCheckAsync("NTF_SHOWRGBLED", rgbvalue);
}
/// <summary> /// <summary>
/// 闪烁SHOWLED如果当前没亮那就亮一下如果本来就是亮的那就暗一下 /// 闪烁SHOWLED如果当前没亮那就亮一下如果本来就是亮的那就暗一下
/// </summary> /// </summary>