Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
55b29141
Commit
55b29141
authored
May 12, 2014
by
Lorenz Meier
Browse files
Merge pull request #654 from treymarc/time_displayHours
correction : display duration in hours,minutes,sec
parents
f5ef31df
971cf487
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ui/uas/UASView.cc
View file @
55b29141
...
@@ -634,16 +634,26 @@ void UASView::refresh()
...
@@ -634,16 +634,26 @@ void UASView::refresh()
// Thrust
// Thrust
m_ui
->
thrustBar
->
setValue
(
thrust
*
100
);
m_ui
->
thrustBar
->
setValue
(
thrust
*
100
);
// Time Elapsed
//QDateTime time = MG::TIME::msecToQDateTime(uas->getUptime());
quint64
filterTime
=
uas
->
getUptime
()
/
1000
;
int
hours
=
static_cast
<
int
>
(
filterTime
/
3600
);
int
min
=
static_cast
<
int
>
((
filterTime
-
3600
*
hours
)
/
60
);
int
sec
=
static_cast
<
int
>
(
filterTime
-
60
*
min
-
3600
*
hours
);
QString
timeText
;
timeText
=
timeText
.
sprintf
(
"%02d:%02d:%02d"
,
hours
,
min
,
sec
);
m_ui
->
timeElapsedLabel
->
setText
(
timeText
);
if
(
this
->
timeRemaining
>
1
&&
this
->
timeRemaining
<
QGC
::
MAX_FLIGHT_TIME
)
if
(
this
->
timeRemaining
>
1
&&
this
->
timeRemaining
<
QGC
::
MAX_FLIGHT_TIME
)
{
{
// Filter output to get a higher stability
// Filter output to get a higher stability
filterTime
=
static_cast
<
int
>
(
this
->
timeRemaining
);
filterTime
=
static_cast
<
int
>
(
this
->
timeRemaining
);
filterTime
=
0.8
*
filterTime
+
0.2
*
static_cast
<
int
>
(
this
->
timeRemaining
);
//
filterTime = 0.8 * filterTime + 0.2 * static_cast<int>(this->timeRemaining);
int
sec
=
static_cast
<
int
>
(
filterTime
-
static_cast
<
int
>
(
filterTime
/
60
.0
f
)
*
6
0
);
hours
=
static_cast
<
int
>
(
filterTime
/
3
600
);
int
min
=
static_cast
<
int
>
(
filterTime
/
60
);
min
=
static_cast
<
int
>
(
(
filterTime
-
3600
*
hours
)
/
60
);
int
hours
=
static_cast
<
int
>
(
filterTime
-
min
*
60
-
sec
);
sec
=
static_cast
<
int
>
(
filterTime
-
60
*
min
-
3600
*
hours
);
QString
timeText
;
timeText
=
timeText
.
sprintf
(
"%02d:%02d:%02d"
,
hours
,
min
,
sec
);
timeText
=
timeText
.
sprintf
(
"%02d:%02d:%02d"
,
hours
,
min
,
sec
);
m_ui
->
timeRemainingLabel
->
setText
(
timeText
);
m_ui
->
timeRemainingLabel
->
setText
(
timeText
);
}
}
...
@@ -652,16 +662,7 @@ void UASView::refresh()
...
@@ -652,16 +662,7 @@ void UASView::refresh()
m_ui
->
timeRemainingLabel
->
setText
(
tr
(
"Calc.."
));
m_ui
->
timeRemainingLabel
->
setText
(
tr
(
"Calc.."
));
}
}
// Time Elapsed
//QDateTime time = MG::TIME::msecToQDateTime(uas->getUptime());
quint64
filterTime
=
uas
->
getUptime
()
/
1000
;
int
sec
=
static_cast
<
int
>
(
filterTime
-
static_cast
<
int
>
(
filterTime
/
60
)
*
60
);
int
min
=
static_cast
<
int
>
(
filterTime
/
60
);
int
hours
=
static_cast
<
int
>
(
filterTime
-
min
*
60
-
sec
);
QString
timeText
;
timeText
=
timeText
.
sprintf
(
"%02d:%02d:%02d"
,
hours
,
min
,
sec
);
m_ui
->
timeElapsedLabel
->
setText
(
timeText
);
}
}
generalUpdateCount
++
;
generalUpdateCount
++
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment