[dasher] Fixes to dynamic mode states / auto speed control, e.g.,
- From: Patrick Welche <pwelche src gnome org>
- To: svn-commits-list gnome org
- Subject: [dasher] Fixes to dynamic mode states / auto speed control, e.g.,
- Date: Wed, 17 Jun 2009 14:29:10 -0400 (EDT)
commit 2db5b48797ebf79c187c2e9bd6b933e7757e0b32
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Wed Jun 17 19:12:34 2009 +0100
Fixes to dynamic mode states / auto speed control, e.g.,
make speed control time unsigned.
ChangeLog | 1 +
Src/DasherCore/DynamicFilter.cpp | 11 ++++++-----
Src/DasherCore/DynamicFilter.h | 2 +-
3 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 92f45d2..bf8a90b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
(Controlled by new settings for time period, increase
and decrease, added to both existing dynamic modes:
LP_DYNAMIC_SPEED_{FREQ, INC, DEC} respectively).
+ * DynamicFilter: Fixes to dynamic mode states / auto speed control
2009-06-17 Alan Lawrence <acl33 inf phy cam ac uk>
diff --git a/Src/DasherCore/DynamicFilter.cpp b/Src/DasherCore/DynamicFilter.cpp
index 6b05d90..8821244 100644
--- a/Src/DasherCore/DynamicFilter.cpp
+++ b/Src/DasherCore/DynamicFilter.cpp
@@ -38,11 +38,12 @@ bool CDynamicFilter::Timer(int iTime, CDasherView *m_pDasherView, CDasherModel *
if (isPaused()) return false;
if (isReversing()) return m_pDasherModel->OneStepTowards(41943,2048, iTime, pAdded, pNumDeleted);
//moving forwards. Check auto speed control...
- if (GetLongParameter(BP_AUTO_SPEEDCONTROL) && m_iSpeedControlTime < iTime)
+ unsigned int uTime = static_cast<unsigned int>(iTime);
+ if (GetBoolParameter(BP_AUTO_SPEEDCONTROL) && m_uSpeedControlTime < uTime)
{
- if (m_iSpeedControlTime > 0) //has actually been set?
+ if (m_uSpeedControlTime > 0) //has actually been set?
SetLongParameter(LP_MAX_BITRATE, GetLongParameter(LP_MAX_BITRATE) * (1.0 + GetLongParameter(LP_DYNAMIC_SPEED_INC)/100.0));
- m_iSpeedControlTime = iTime + 1000*GetLongParameter(LP_DYNAMIC_SPEED_FREQ);
+ m_uSpeedControlTime = uTime + 1000*GetLongParameter(LP_DYNAMIC_SPEED_FREQ);
}
return TimerImpl(iTime, m_pDasherView, m_pDasherModel, pAdded, pNumDeleted);
}
@@ -81,7 +82,7 @@ void CDynamicFilter::Event(int iTime, int iButton, int iType, CDasherModel *pMod
// First sanity check - if Dasher is paused then jump to the
// appropriate state
- if(GetBoolParameter(BP_DASHER_PAUSED))
+ if(GetBoolParameter(BP_DASHER_PAUSED) && !isPaused())
pause();
// TODO: Check that state diagram implemented here is what we
@@ -154,7 +155,7 @@ void CDynamicFilter::run(int iSubclassState)
{
DASHER_ASSERT(iSubclassState>=0);
if (m_iState<2) //wasn't running previously
- m_iSpeedControlTime = 0; //will be set in Timer()
+ m_uSpeedControlTime = 0; //will be set in Timer()
m_iState = iSubclassState+2;
}
diff --git a/Src/DasherCore/DynamicFilter.h b/Src/DasherCore/DynamicFilter.h
index b960e13..e9a4646 100644
--- a/Src/DasherCore/DynamicFilter.h
+++ b/Src/DasherCore/DynamicFilter.h
@@ -59,7 +59,7 @@ class CDynamicFilter : public CInputFilter {
int m_iState; // 0 = paused, 1 = reversing, >=2 = running (extensible by subclasses)
int m_iHeldId;
int m_iKeyDownTime;
- int m_iSpeedControlTime;
+ unsigned int m_uSpeedControlTime;
CUserLogBase *m_pUserLog;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]