Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
picsimlab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
picsimlab
Commits
c42b5089
Commit
c42b5089
authored
Apr 14, 2024
by
lcgamboa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Fix Spareparts Prop window position on windows !minor
parent
bbdb4cf0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
17 deletions
+26
-17
src/parts/other_logic_block.cc
src/parts/other_logic_block.cc
+22
-14
src/parts/other_logic_block.h
src/parts/other_logic_block.h
+1
-0
src/picsimlab5.cc
src/picsimlab5.cc
+3
-3
No files found.
src/parts/other_logic_block.cc
View file @
c42b5089
...
@@ -90,6 +90,7 @@ cpart_lblock::cpart_lblock(const unsigned x, const unsigned y, const char* name,
...
@@ -90,6 +90,7 @@ cpart_lblock::cpart_lblock(const unsigned x, const unsigned y, const char* name,
input_pins
[
7
]
=
0
;
input_pins
[
7
]
=
0
;
output_value
=
0
;
output_value
=
0
;
output_value_prev
=
!
output_value
;
output_pins
[
0
]
=
0
;
output_pins
[
0
]
=
0
;
output_pins
[
1
]
=
SpareParts
.
RegisterIOpin
(
"LB0"
);
output_pins
[
1
]
=
SpareParts
.
RegisterIOpin
(
"LB0"
);
...
@@ -192,6 +193,14 @@ void cpart_lblock::PreProcess(void) {
...
@@ -192,6 +193,14 @@ void cpart_lblock::PreProcess(void) {
void
cpart_lblock
::
Process
(
void
)
{
void
cpart_lblock
::
Process
(
void
)
{
const
picpin
*
ppins
=
SpareParts
.
GetPinsValues
();
const
picpin
*
ppins
=
SpareParts
.
GetPinsValues
();
// Add one clock pulse delay to output
if
(
output_value_prev
!=
output_value
)
{
SpareParts
.
SetPin
(
output_pins
[
0
],
output_value
);
SpareParts
.
WritePin
(
output_pins
[
1
],
output_value
);
output_value_prev
=
output_value
;
ioupdated
=
1
;
}
if
(
ioupdated
)
{
if
(
ioupdated
)
{
switch
(
gatetype
)
{
switch
(
gatetype
)
{
case
LG_NOT
:
case
LG_NOT
:
...
@@ -239,10 +248,7 @@ void cpart_lblock::Process(void) {
...
@@ -239,10 +248,7 @@ void cpart_lblock::Process(void) {
}
}
output_value
=
!
output_value
;
output_value
=
!
output_value
;
break
;
break
;
break
;
}
}
SpareParts
.
SetPin
(
output_pins
[
0
],
output_value
);
SpareParts
.
WritePin
(
output_pins
[
1
],
output_value
);
}
}
mcount
++
;
mcount
++
;
...
@@ -256,21 +262,21 @@ void cpart_lblock::Process(void) {
...
@@ -256,21 +262,21 @@ void cpart_lblock::Process(void) {
void
cpart_lblock
::
PostProcess
(
void
)
{
void
cpart_lblock
::
PostProcess
(
void
)
{
const
long
int
NSTEPJ
=
PICSimLab
.
GetNSTEPJ
();
const
long
int
NSTEPJ
=
PICSimLab
.
GetNSTEPJ
();
// const picpin* ppins = SpareParts.GetPinsValues();
const
picpin
*
ppins
=
SpareParts
.
GetPinsValues
();
/*
SpareParts
.
WritePinOA
(
output_pins
[
1
],
((
output_pins_alm
*
200.0
)
/
NSTEPJ
)
+
55
);
for
(
unsigned
int
i
=
0
;
i
<
Size
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
Size
;
i
++
)
{
if (input_pins[i] && (output_ids[O_
L
1 + i]->value != ppins[input_pins[i] - 1].oavalue)) {
if
(
input_pins
[
i
]
&&
(
output_ids
[
O_
IN
1
+
i
]
->
value
!=
ppins
[
input_pins
[
i
]
-
1
].
oavalue
))
{
output_ids[O_
L
1 + i]->value = ppins[input_pins[i] - 1].oavalue;
output_ids
[
O_
IN
1
+
i
]
->
value
=
ppins
[
input_pins
[
i
]
-
1
].
oavalue
;
output_ids[O_
L
1 + i]->update = 1;
output_ids
[
O_
IN
1
+
i
]
->
update
=
1
;
}
}
}
}
*/
// SpareParts.WritePinOA(output_pins[1],
if
((
output_ids
[
O_OUT
]
->
value
!=
ppins
[
output_pins
[
1
]
-
1
].
oavalue
))
{
// (ppins[output_pins[1] - 1].oavalue + ((output_pins_alm * 200.0) / NSTEPJ) + 55) / 2);
output_ids
[
O_OUT
]
->
value
=
ppins
[
output_pins
[
1
]
-
1
].
oavalue
;
SpareParts
.
WritePinOA
(
output_pins
[
1
],
((
output_pins_alm
*
200.0
)
/
NSTEPJ
)
+
55
);
output_ids
[
O_OUT
]
->
update
=
1
;
}
SetUpdate
(
1
);
// TODO update only when necessary
}
}
unsigned
short
cpart_lblock
::
GetInputId
(
char
*
name
)
{
unsigned
short
cpart_lblock
::
GetInputId
(
char
*
name
)
{
...
@@ -360,6 +366,8 @@ void cpart_lblock::ConfigurePropertiesWindow(void) {
...
@@ -360,6 +366,8 @@ void cpart_lblock::ConfigurePropertiesWindow(void) {
SetPCWComboWithPinNames
(
"combo8"
,
input_pins
[
7
]);
SetPCWComboWithPinNames
(
"combo8"
,
input_pins
[
7
]);
SetPCWComboWithPinNames
(
"combo9"
,
output_pins
[
0
]);
SetPCWComboWithPinNames
(
"combo9"
,
output_pins
[
0
]);
SpareParts
.
WPropCmd
(
"label_10"
,
PWA_LABELSETTEXT
,
std
::
to_string
(
output_pins
[
1
]).
c_str
());
SpareParts
.
WPropCmd
(
"combo11"
,
PWA_COMBOSETITEMS
,
"NOT,BUFFER,AND,NAND,OR,NOR,XOR,XNOR,"
);
SpareParts
.
WPropCmd
(
"combo11"
,
PWA_COMBOSETITEMS
,
"NOT,BUFFER,AND,NAND,OR,NOR,XOR,XNOR,"
);
SpareParts
.
WPropCmd
(
"combo11"
,
PWA_COMBOPROPEV
,
"1"
);
SpareParts
.
WPropCmd
(
"combo11"
,
PWA_COMBOPROPEV
,
"1"
);
switch
(
gatetype
)
{
switch
(
gatetype
)
{
...
...
src/parts/other_logic_block.h
View file @
c42b5089
...
@@ -60,6 +60,7 @@ private:
...
@@ -60,6 +60,7 @@ private:
unsigned
char
output_pins
[
2
];
unsigned
char
output_pins
[
2
];
unsigned
long
output_pins_alm
;
unsigned
long
output_pins_alm
;
unsigned
char
output_value
;
unsigned
char
output_value
;
unsigned
char
output_value_prev
;
int
OWidth
;
int
OWidth
;
int
OHeight
;
int
OHeight
;
int
xoff
;
int
xoff
;
...
...
src/picsimlab5.cc
View file @
c42b5089
...
@@ -165,9 +165,12 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) {
...
@@ -165,9 +165,12 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) {
const
PCWProp
*
items
=
SpareParts
.
GetPart
(
PartSelected
)
->
GetPCWProperties
();
const
PCWProp
*
items
=
SpareParts
.
GetPart
(
PartSelected
)
->
GetPCWProperties
();
Windows
[
PW_WPROP
]
->
SetName
(
"window1"
);
// must be the same as in xml
Windows
[
PW_WPROP
]
->
SetName
(
"window1"
);
// must be the same as in xml
Application
->
ACreateWindow
(
Windows
[
PW_WPROP
]);
Application
->
ACreateWindow
(
Windows
[
PW_WPROP
]);
Windows
[
PW_WPROP
]
->
HideExclusive
();
Windows
[
PW_WPROP
]
->
DestroyChilds
();
Windows
[
PW_WPROP
]
->
DestroyChilds
();
Windows
[
PW_WPROP
]
->
SetTitle
(
SpareParts
.
GetPart
(
PartSelected
)
->
GetName
());
Windows
[
PW_WPROP
]
->
SetTitle
(
SpareParts
.
GetPart
(
PartSelected
)
->
GetName
());
Windows
[
PW_WPROP
]
->
SetWidth
(
370
);
Windows
[
PW_WPROP
]
->
SetWidth
(
370
);
Windows
[
PW_WPROP
]
->
SetX
(
SpareParts
.
GetPart
(
PartSelected
)
->
GetX
()
+
GetX
()
-
offsetx
);
Windows
[
PW_WPROP
]
->
SetY
(
SpareParts
.
GetPart
(
PartSelected
)
->
GetY
()
+
GetY
()
-
offsety
);
CLabel
*
label
;
CLabel
*
label
;
CCombo
*
combo
;
CCombo
*
combo
;
...
@@ -388,9 +391,6 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) {
...
@@ -388,9 +391,6 @@ void CPWindow5::pmenu2_Properties_EvMenuActive(CControl* control) {
SpareParts
.
GetPart
(
PartSelected
)
->
ConfigurePropertiesWindow
();
SpareParts
.
GetPart
(
PartSelected
)
->
ConfigurePropertiesWindow
();
Windows
[
PW_WPROP
]
->
SetX
(
SpareParts
.
GetPart
(
PartSelected
)
->
GetX
()
+
GetX
()
-
offsetx
);
Windows
[
PW_WPROP
]
->
SetY
(
SpareParts
.
GetPart
(
PartSelected
)
->
GetY
()
+
GetY
()
-
offsety
);
Windows
[
PW_WPROP
]
->
Draw
();
Windows
[
PW_WPROP
]
->
Draw
();
Windows
[
PW_WPROP
]
->
ShowExclusive
();
Windows
[
PW_WPROP
]
->
ShowExclusive
();
}
else
{
}
else
{
...
...
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