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

fixed bug in SandClock interface

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