Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
DIOT WIC Gateware
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
DIOT WIC Gateware
Commits
d1d874a3
Commit
d1d874a3
authored
Aug 13, 2018
by
Projects
Committed by
Grzegorz Daniluk
Aug 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code comments and debug messages
parent
a113b8f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
3 deletions
+62
-3
controller.cpp
sw/diot-sw/gui_demo/controller.cpp
+6
-3
controller.h
sw/diot-sw/gui_demo/controller.h
+56
-0
No files found.
sw/diot-sw/gui_demo/controller.cpp
View file @
d1d874a3
...
...
@@ -129,7 +129,7 @@ void DiotIOCard::SetOutput(unsigned int state) {
void
DiotIOCard
::
action_click
(
int
slot
,
int
io
)
{
qDebug
()
<<
"
B
utton test clicked - slot("
<<
slot
<<
") io("
<<
io
<<
")"
;
qDebug
()
<<
"
b
utton test clicked - slot("
<<
slot
<<
") io("
<<
io
<<
")"
;
outputs
[
io
]
=
!
outputs
[
io
];
emit
OutputChanged
(
slot_nr
,
GetOutput
());
}
...
...
@@ -263,13 +263,16 @@ void DiotDiag::UpdateVoltage(unsigned int volt, bool state)
{
QLabel
*
label
=
volt_lbl
[
volt
];
auto
volt_enum
=
DIOT_Crate
::
GetVoltEnum
(
volt
);
qDebug
()
<<
"voltage "
<<
DIOT_Crate
::
GetVoltName
(
volt_enum
).
c_str
()
<<
" state: "
<<
state
;
if
(
state
)
{
label
->
setStyleSheet
(
"color: green"
);
label
->
setText
(
QString
(
"%1 OK"
).
arg
(
QString
::
fromStdString
(
DIOT_Crate
::
GetVoltName
(
volt_enum
))));
label
->
setText
(
QString
(
"%1 OK"
).
arg
(
QString
::
fromStdString
(
DIOT_Crate
::
GetVoltName
(
volt_enum
))));
}
else
{
label
->
setStyleSheet
(
"color: red"
);
label
->
setText
(
QString
(
"%1 ERR"
).
arg
(
QString
::
fromStdString
(
DIOT_Crate
::
GetVoltName
(
volt_enum
))));
label
->
setText
(
QString
(
"%1 ERR"
).
arg
(
QString
::
fromStdString
(
DIOT_Crate
::
GetVoltName
(
volt_enum
))));
}
}
...
...
sw/diot-sw/gui_demo/controller.h
View file @
d1d874a3
...
...
@@ -32,11 +32,24 @@ class QDialog;
class
QLabel
;
class
QPushButton
;
/**
* Class representing the DIOT crate hardware in the Qt world.
* It initalizes the hardware and provides signals and slots to other classes.
*/
class
DiotHardware
:
public
QObject
{
Q_OBJECT
public
:
/**
* Constructor.
* @param address is the FIP agent address of the crate.
* @param slots_nr is the number of I/O cards in the crate.
*/
DiotHardware
(
int
address
,
int
slots_nr
);
/**
* Start the WorldFIP cycle.
*/
void
Start
();
DIOT_Crate
*
GetCrate
()
const
...
...
@@ -45,12 +58,43 @@ public:
}
public
slots
:
/**
* Change the output state for a card in a particular slot.
* @param slot is the card number (indexing from 0).
* @param state is the new output state.
*/
void
SetOutput
(
int
slot
,
unsigned
int
state
);
signals
:
/**
* Signal emitted on every macrocycle, provides information about inputs state.
* @param slot is the card number (indexing from 0).
* @param state is the inputs state.
*/
void
InputChanged
(
int
slot
,
unsigned
int
state
);
/**
* Signal emitted on every macrocycle, provides information about fan state.
* @param fan is the fan number (indexing from 0).
* @param state is the fan state (true == operational, false == failure).
* @param rpm is the fan speed (expressed in RPM).
*/
void
FanChanged
(
unsigned
int
fan
,
bool
state
,
int
rpm
);
/**
* Signal emitted on every macrocycle, provides information about temperature.
* @param sensor is the sensor number (indexing from 0).
* @param state is the fan state (true == operational, false == failure).
* @param temp is the temperature (Celsius degrees).
*/
void
TemperatureChanged
(
unsigned
int
sensor
,
bool
state
,
int
temp
);
/**
* Signal emitted on every macrocycle, provides information about voltage.
* @param volt is the voltage number (indexing from 0).
* @param state is the voltage state (true == operational, false == failure).
* @see DIOT_Crate::GetVoltages()
*/
void
VoltageChanged
(
unsigned
int
volt
,
bool
state
);
private
:
...
...
@@ -62,6 +106,9 @@ private:
};
/**
* Widget representing a single I/O card in the crate.
*/
class
DiotIOCard
:
public
QFrame
{
Q_OBJECT
...
...
@@ -100,6 +147,9 @@ protected:
};
/**
* Widget grouping the I/O cards.
*/
class
DiotIOController
:
public
QFrame
{
Q_OBJECT
...
...
@@ -115,6 +165,9 @@ private:
};
/**
* Widget displaying diagnostic data obtained from the crate.
*/
class
DiotDiag
:
public
QFrame
{
Q_OBJECT
...
...
@@ -125,17 +178,20 @@ public:
public
slots
:
void
UpdateFan
(
unsigned
int
fan
,
bool
state
,
int
rpm
)
{
qDebug
()
<<
"fan "
<<
fan
<<
" state: "
<<
state
<<
" RPM: "
<<
rpm
;
updateLabel
(
fan_lbl
,
fan
,
state
,
"Fan"
,
rpm
);
}
void
UpdateTemperature
(
unsigned
int
sensor
,
bool
state
,
int
temp
)
{
qDebug
()
<<
"temperature "
<<
sensor
<<
" state: "
<<
state
<<
" value: "
<<
temp
;
updateLabel
(
temp_lbl
,
sensor
,
state
,
"Temperature"
,
temp
);
}
void
UpdateVoltage
(
unsigned
int
volt
,
bool
state
);
private
:
// Helper function to update labels
void
updateLabel
(
std
::
vector
<
QLabel
*>
labels
,
unsigned
int
idx
,
bool
state
,
const
QString
&
desc
,
int
val
);
...
...
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