Commit 5931f4ee authored by Pavel Vaynerman's avatar Pavel Vaynerman

fixed bug in SandClock interface

parent a4123390
......@@ -3,7 +3,7 @@
Name: libuniset
Version: 0.97
Release: eter59
Release: eter60
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
......@@ -184,6 +184,12 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Thu Mar 18 2010 Pavel Vainerman <pv@etersoft.ru> 0.97-eter60
- new build
* Thu Mar 18 2010 Pavel Vainerman <pv@etersoft.ru> 0.97-eter59
- fixed bug in ModbuRTU::autedetect slave adress function
* Sun Mar 14 2010 Pavel Vainerman <pv@altlinux.ru> 0.97-eter58
- minor fixes in MTR setup API
......
......@@ -29,26 +29,26 @@
class SandClock
{
public:
SandClock(): state(false),sand(0),size(0){}
SandClock(): _state(false),_sand(0),_size(0){}
~SandClock(){}
// ÚÁÐÕÓÔÉÔØ ÞÁÓÙ (ÚÁÎÏ×Ï)
inline void run( int msec )
{
t.setTiming(msec);
state = true;
sand = msec;
size = msec;
_state = true;
_sand = msec;
_size = msec;
}
inline void reset ()
{
run(size);
run(_size);
}
inline int duration()
{
return size;
return _size;
}
// ÐÅÒÅ×ÅÒÎÕÔØ ÞÁÓÙ
// true - ÚÁÓÅÞØ ×ÒÅÍÑ
......@@ -56,17 +56,17 @@ class SandClock
// ×ÏÚ×ÒÁÝÁÅÔ ÁÒÇÕÍÅÎÔ (Ô.Å. ÉÄ£Ô ÌÉ ÏÔÓÞ£Ô ×ÒÅÍÅÎÉ)
inline bool rotate( bool st )
{
if( st == state )
if( st == _state )
return st;
state = st;
if( !state )
_state = st;
if( !_state )
{
int cur = t.getCurrent();
sand -= cur;
_sand -= cur;
if( sand < 0 )
sand = 0;
if( _sand < 0 )
_sand = 0;
// std::cout << "ÐÅÒÅ×ÅÒÎÕÌÉ: ÐÒÏÛÌÏ " << cur
// << " ÏÓÔÁÌÏÓØ " << sand
......@@ -76,15 +76,15 @@ class SandClock
}
else
{
sand += t.getCurrent();
if( sand > size )
sand = size;
_sand += t.getCurrent();
if( _sand > _size )
_sand = _size;
// std::cout << "×ÅÒÎÕÌÉ: ÐÒÏÛÌÏ " << t.getCurrent()
// << " ÏÓÔÁÌÏÓØ " << sand
// << " ÚÁÓÅËÁÍ " << sand << endl;
t.setTiming(sand);
t.setTiming(_sand);
}
return st;
}
......@@ -108,19 +108,19 @@ class SandClock
{
// ÐÏËÁ ÞÁÓÙ ÎÅ "ÓÔÏÑÔ"
// ×ÓÅÇÄÁ false
if( !state )
if( !_state )
return false;
return t.checkTime();
}
inline bool state(){ return state; }
inline bool state(){ return _state; }
protected:
PassiveTimer t;
bool state;
int sand;
int size;
bool _state;
int _sand;
int _size;
};
// --------------------------------------------------------------------------
#endif
......
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