Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
dbe1f291
You need to sign in or sign up before continuing.
Commit
dbe1f291
authored
Mar 23, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(IOBase): дореализовал вспомогательные различные вспомогательные функуции.
parent
548db385
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
17 deletions
+94
-17
Calibration.h
extensions/include/Calibration.h
+2
-0
IOBase.h
extensions/include/IOBase.h
+3
-1
IOBase.cc
extensions/lib/IOBase.cc
+55
-1
test_iobase_with_sm.cc
extensions/tests/test_iobase_with_sm.cc
+1
-2
UniSetTypes.h
include/UniSetTypes.h
+7
-6
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+26
-7
No files found.
extensions/include/Calibration.h
View file @
dbe1f291
...
@@ -197,6 +197,8 @@ class Calibration
...
@@ -197,6 +197,8 @@ class Calibration
// список надо отсортировать по x!
// список надо отсортировать по x!
typedef
std
::
vector
<
Part
>
PartsVec
;
typedef
std
::
vector
<
Part
>
PartsVec
;
inline
std
::
string
getName
(){
return
myname
;
}
protected
:
protected
:
long
minRaw
,
maxRaw
,
minVal
,
maxVal
,
rightVal
,
leftVal
,
rightRaw
,
leftRaw
;
long
minRaw
,
maxRaw
,
minVal
,
maxVal
,
rightVal
,
leftVal
,
rightRaw
,
leftRaw
;
...
...
extensions/include/IOBase.h
View file @
dbe1f291
...
@@ -132,6 +132,8 @@ struct IOBase
...
@@ -132,6 +132,8 @@ struct IOBase
ft10
// срабатывание на переход "1-->0"
ft10
// срабатывание на переход "1-->0"
};
};
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
FrontType
&
f
);
bool
front
;
// флаг работы по фронту
bool
front
;
// флаг работы по фронту
FrontType
front_type
;
FrontType
front_type
;
bool
front_prev_state
;
bool
front_prev_state
;
...
@@ -142,7 +144,7 @@ struct IOBase
...
@@ -142,7 +144,7 @@ struct IOBase
IOController
::
IOStateList
::
iterator
ioit
;
IOController
::
IOStateList
::
iterator
ioit
;
UniSetTypes
::
uniset_rwmutex
val_lock
;
/*!< блокировка на время "работы" со значением */
UniSetTypes
::
uniset_rwmutex
val_lock
;
/*!< блокировка на время "работы" со значением */
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
IOBase
&
inf
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
IOBase
&
inf
);
static
void
processingFasAI
(
IOBase
*
it
,
float
new_val
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
static
void
processingFasAI
(
IOBase
*
it
,
float
new_val
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
static
void
processingAsAI
(
IOBase
*
it
,
long
new_val
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
static
void
processingAsAI
(
IOBase
*
it
,
long
new_val
,
const
std
::
shared_ptr
<
SMInterface
>&
shm
,
bool
force
);
...
...
extensions/lib/IOBase.cc
View file @
dbe1f291
#include "Configuration.h"
#include "Configuration.h"
#include "Extensions.h"
#include "Extensions.h"
#include "UniSetTypes.h"
#include "IOBase.h"
#include "IOBase.h"
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
using
namespace
std
;
using
namespace
std
;
...
@@ -9,7 +10,38 @@ using namespace UniSetTypes;
...
@@ -9,7 +10,38 @@ using namespace UniSetTypes;
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
IOBase
&
inf
)
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
IOBase
&
inf
)
{
{
return
os
<<
"("
<<
inf
.
si
.
id
<<
")"
<<
uniset_conf
()
->
oind
->
getMapName
(
inf
.
si
.
id
)
return
os
<<
"("
<<
inf
.
si
.
id
<<
")"
<<
uniset_conf
()
->
oind
->
getMapName
(
inf
.
si
.
id
)
<<
" default="
<<
inf
.
defval
<<
" safety="
<<
inf
.
safety
;
<<
" default="
<<
inf
.
defval
<<
" safety="
<<
inf
.
safety
<<
" stype="
<<
inf
.
stype
<<
" calibration="
<<
inf
.
cal
<<
" cdiagram="
<<
(
inf
.
cdiagram
?
inf
.
cdiagram
->
getName
()
:
"null"
)
<<
" breaklim="
<<
inf
.
breaklim
<<
" value="
<<
inf
.
value
<<
" craw="
<<
inf
.
craw
<<
" cprev"
<<
inf
.
cprev
<<
" nofilter="
<<
inf
.
nofilter
<<
" f_median="
<<
inf
.
f_median
<<
" f_ls="
<<
inf
.
f_ls
<<
" f_filter_iir="
<<
inf
.
f_filter_iir
<<
" ignore="
<<
inf
.
ignore
<<
" invert="
<<
inf
.
invert
<<
" noprecision="
<<
inf
.
noprecision
<<
" calcrop="
<<
inf
.
calcrop
<<
" debounce_pause="
<<
inf
.
debounce_pause
<<
" debounce_state="
<<
inf
.
debounce_state
<<
" ondelay_state="
<<
inf
.
ondelay_state
<<
" offdelay_state="
<<
inf
.
offdelay_state
<<
" d_id="
<<
uniset_conf
()
->
oind
->
getMapName
(
inf
.
d_id
)
<<
" d_value="
<<
inf
.
d_value
<<
" d_off_value="
<<
inf
.
d_off_value
<<
" d_iotype="
<<
inf
.
d_iotype
<<
" t_ai="
<<
inf
.
t_ai
<<
" ti="
<<
inf
.
ti
<<
" front="
<<
inf
.
front
<<
" front_type="
<<
inf
.
front_type
<<
" front_prev_state="
<<
inf
.
front_prev_state
<<
" front_state="
<<
inf
.
front_state
<<
" rawdata="
<<
inf
.
rawdata
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
IOBase
::~
IOBase
()
IOBase
::~
IOBase
()
...
@@ -667,3 +699,25 @@ bool IOBase::initItem( IOBase* b, UniXML::iterator& it, const std::shared_ptr<SM
...
@@ -667,3 +699,25 @@ bool IOBase::initItem( IOBase* b, UniXML::iterator& it, const std::shared_ptr<SM
return
true
;
return
true
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
IOBase
::
FrontType
&
f
)
{
switch
(
f
)
{
case
IOBase
:
:
ft01
:
os
<<
"(ft01)[0-->1]"
;
break
;
case
IOBase
:
:
ft10
:
os
<<
"(ft10)[1-->0]"
;
break
;
case
IOBase
:
:
ftUnknown
:
default
:
os
<<
"ftUnknown"
;
break
;
}
return
os
;
}
// -----------------------------------------------------------------------------
extensions/tests/test_iobase_with_sm.cc
View file @
dbe1f291
...
@@ -488,10 +488,9 @@ TEST_CASE("IOBase with SM","[iobase][extensions]")
...
@@ -488,10 +488,9 @@ TEST_CASE("IOBase with SM","[iobase][extensions]")
WARN
(
"IOBase with SM: Not all tests implemented!"
);
WARN
(
"IOBase with SM: Not all tests implemented!"
);
// ignore
// ignore
// ioinvert
// ioinvert
// asDO (!)
// asDI (!)
// iofront
// iofront
// UndefinedState
// UndefinedState
// threshold_ai
// threshold_ai
// processingThreshold
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
include/UniSetTypes.h
View file @
dbe1f291
...
@@ -82,6 +82,7 @@ namespace UniSetTypes
...
@@ -82,6 +82,7 @@ namespace UniSetTypes
UniversalIO
::
IOType
getIOType
(
const
std
::
string
&
s
);
UniversalIO
::
IOType
getIOType
(
const
std
::
string
&
s
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
UniversalIO
::
IOType
t
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
UniversalIO
::
IOType
t
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
IONotifyController_i
::
ThresholdInfo
&
ti
);
/*! Команды для управления лампочками */
/*! Команды для управления лампочками */
enum
LampCommand
enum
LampCommand
...
@@ -224,14 +225,14 @@ namespace UniSetTypes
...
@@ -224,14 +225,14 @@ namespace UniSetTypes
// ---------------------------------------------------------------
// ---------------------------------------------------------------
// Калибровка
// Калибровка
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
IOController_i
::
CalibrateInfo
c
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
IOController_i
::
CalibrateInfo
&
c
);
// Функции калибровки значений
// Функции калибровки значений
// raw
- преобразуемое значение
// raw - преобразуемое значение
// rawMin
- минимальная граница исходного диапазона
// rawMin - минимальная граница исходного диапазона
// rawMax
- максимальная граница исходного диапазона
// rawMax - максимальная граница исходного диапазона
// calMin
- минимальная граница калиброванного диапазона
// calMin - минимальная граница калиброванного диапазона
// calMin
- минимальная граница калиброванного диапазона
// calMin - минимальная граница калиброванного диапазона
// limit - обрезать итоговое значение по границам
// limit - обрезать итоговое значение по границам
float
fcalibrate
(
float
raw
,
float
rawMin
,
float
rawMax
,
float
calMin
,
float
calMax
,
bool
limit
=
true
);
float
fcalibrate
(
float
raw
,
float
rawMin
,
float
rawMax
,
float
calMin
,
float
calMax
,
bool
limit
=
true
);
long
lcalibrate
(
long
raw
,
long
rawMin
,
long
rawMax
,
long
calMin
,
long
calMax
,
bool
limit
=
true
);
long
lcalibrate
(
long
raw
,
long
rawMin
,
long
rawMax
,
long
calMin
,
long
calMax
,
bool
limit
=
true
);
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
dbe1f291
...
@@ -331,13 +331,6 @@ std::ostream& UniSetTypes::operator<<( std::ostream& os, const UniversalIO::IOTy
...
@@ -331,13 +331,6 @@ std::ostream& UniSetTypes::operator<<( std::ostream& os, const UniversalIO::IOTy
return
os
<<
"UnknownIOType"
;
return
os
<<
"UnknownIOType"
;
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
std
::
ostream
&
UniSetTypes
::
operator
<<
(
std
::
ostream
&
os
,
const
IOController_i
::
CalibrateInfo
c
)
{
return
os
<<
" rmin="
<<
c
.
minRaw
<<
" rmax="
<<
c
.
maxRaw
<<
" cmin="
<<
c
.
minCal
<<
" cmax="
<<
c
.
maxCal
<<
" precision="
<<
c
.
precision
;
}
// ------------------------------------------------------------------------------------------
bool
UniSetTypes
::
check_filter
(
UniXML
::
iterator
&
it
,
const
std
::
string
&
f_prop
,
const
std
::
string
&
f_val
)
bool
UniSetTypes
::
check_filter
(
UniXML
::
iterator
&
it
,
const
std
::
string
&
f_prop
,
const
std
::
string
&
f_val
)
{
{
if
(
f_prop
.
empty
()
)
if
(
f_prop
.
empty
()
)
...
@@ -410,3 +403,29 @@ char* UniSetTypes::uni_strdup( const string& src )
...
@@ -410,3 +403,29 @@ char* UniSetTypes::uni_strdup( const string& src )
return
d
;
return
d
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
std
::
ostream
&
UniSetTypes
::
operator
<<
(
std
::
ostream
&
os
,
const
IOController_i
::
CalibrateInfo
&
c
)
{
os
<<
"[ rmin="
<<
c
.
minRaw
<<
" rmax="
<<
c
.
maxRaw
<<
" cmin="
<<
c
.
minCal
<<
" cmax="
<<
c
.
maxCal
<<
" prec="
<<
c
.
precision
<<
" ]"
;
return
os
;
}
// -------------------------------------------------------------------------
std
::
ostream
&
UniSetTypes
::
operator
<<
(
std
::
ostream
&
os
,
const
IONotifyController_i
::
ThresholdInfo
&
ti
)
{
os
<<
"[ id="
<<
ti
.
id
<<
" hilim="
<<
ti
.
hilimit
<<
" lowlim="
<<
ti
.
lowlimit
<<
" state="
<<
ti
.
state
<<
" tv_sec="
<<
ti
.
tv_sec
<<
" tv_usec="
<<
ti
.
tv_usec
<<
" invert="
<<
ti
.
invert
<<
" ]"
;
return
os
;
}
// -------------------------------------------------------------------------
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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