Commit a7f58c5b authored by Max Shvetsov's avatar Max Shvetsov
Browse files

[leash_app] Pairing fix, service scr play/pause enabled, RLT/Land fix

fixed pairing mode, now going back to pairing from service screen
mavlink check interval increased not to confuse user with slow connection
Pausing RTL and Landing now appearing on the screen
Play/Pause added to service screen
parent 6b0015c8
......@@ -21,12 +21,15 @@
namespace modes
{
ModeConnect::ModeConnect(State Current)
: currentState(Current)
ModeConnect::ModeConnect(State Current) :
forcing_pairing(false),
currentState(Current)
{
if (Current == State::PAIRING)
{
forcing_pairing = true;
BTPairing();
DisplayHelper::showInfo(INFO_PAIRING);
}
else
{
......@@ -65,36 +68,40 @@ int ModeConnect::getTimeout()
Base* ModeConnect::doEvent(int orbId)
{
Base *nextMode = nullptr;
getConState();
if (forcing_pairing)
{
if (currentState == State::PAIRING)
forcing_pairing = false;
}
else
getConState();
if (orbId == FD_BLRHandler)
if (currentState == State::CONNECTING)
{
if (currentState == State::CONNECTING)
{
DisplayHelper::showInfo(INFO_CONNECTING_TO_AIRDOG);
}
else if (currentState == State::CONNECTED)
{
currentState = State::CHECK_MAVLINK;
time(&startTime);
}
else if (currentState == State::DISCONNECTED)
{
DisplayHelper::showInfo(INFO_CONNECTION_LOST);
}
else if (currentState == State::NOT_PAIRED)
{
DisplayHelper::showInfo(INFO_NOT_PAIRED);
}
else if (currentState == State::PAIRING)
{
DisplayHelper::showInfo(INFO_PAIRING);
}
else {
DisplayHelper::showInfo(INFO_FAILED);
}
DisplayHelper::showInfo(INFO_CONNECTING_TO_AIRDOG);
}
else if (currentState == State::CONNECTED)
{
currentState = State::CHECK_MAVLINK;
time(&startTime);
}
else if (currentState == State::DISCONNECTED)
{
DisplayHelper::showInfo(INFO_CONNECTION_LOST);
}
else if (orbId == FD_KbdHandler)
else if (currentState == State::NOT_PAIRED)
{
DisplayHelper::showInfo(INFO_NOT_PAIRED);
}
else if (currentState == State::PAIRING)
{
DisplayHelper::showInfo(INFO_PAIRING);
}
else {
DisplayHelper::showInfo(INFO_FAILED);
}
if (orbId == FD_KbdHandler)
{
if (key_pressed(BTN_OK))
{
......
......@@ -26,7 +26,9 @@ public:
virtual Base* doEvent(int orbId);
private:
const static int MAVLINK_CHECK_INTERVAL = 5; // in seconds
const static int MAVLINK_CHECK_INTERVAL = 10; // in seconds
bool forcing_pairing;
State currentState;
......
......@@ -256,6 +256,7 @@ Base* Main::makeAction()
Base *nextMode = nullptr;
DataManager *dm = DataManager::instance();
// On ground
if (baseCondition.main == GROUNDED && !isErrorShowed)
{
switch (baseCondition.sub)
......@@ -292,6 +293,7 @@ Base* Main::makeAction()
break;
}
}
// In flight
else if (!isErrorShowed)
{
switch (baseCondition.sub)
......@@ -411,6 +413,11 @@ Base* Main::processLandRTL(int orbId)
displayInfo.airdog_mode = AIRDOGMODE_PAUSE;
baseCondition.sub = RTL;
}
else if (dm->airdog_status.state_aird == AIRD_STATE_IN_AIR)
{
displayInfo.airdog_mode = AIRDOGMODE_PAUSE;
baseCondition.sub = PAUSE;
}
}
else if (orbId == FD_KbdHandler)
{
......
#include <stdio.h>
#include <stdlib.h>
#include <uORB/topics/vehicle_status.h>
#include "../uorb_functions.h"
#include "connect.h"
#include "main.h"
#include "service.h"
......@@ -66,6 +69,10 @@ Base* Service::doEvent(int orbId)
{
if (key_LongPressed(BTN_FUTURE))
nextMode = new ModeConnect();
else if (key_ShortPressed(BTN_PLAY))
{
sendAirDogCommnad(VEHICLE_CMD_NAV_REMOTE_CMD, REMOTE_CMD_PLAY_PAUSE);
}
}
return nextMode;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment