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
21d222df
Commit
21d222df
authored
Jan 14, 2024
by
lcgamboa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chg: Code refactor - Add callbacks to isolate gui access. !minor
parent
f70b0271
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
155 additions
and
112 deletions
+155
-112
VERSION
VERSION
+1
-1
src/lib/part.cc
src/lib/part.cc
+2
-13
src/lib/picsimlab.cc
src/lib/picsimlab.cc
+44
-91
src/lib/picsimlab.h
src/lib/picsimlab.h
+7
-4
src/lib/spareparts.cc
src/lib/spareparts.cc
+1
-1
src/picsimlab1.cc
src/picsimlab1.cc
+86
-2
src/picsimlab1.h
src/picsimlab1.h
+8
-0
src/picsimlab1_d.cc
src/picsimlab1_d.cc
+1
-0
src/picsimlab3.cc
src/picsimlab3.cc
+5
-0
No files found.
VERSION
View file @
21d222df
...
...
@@ -2,5 +2,5 @@ PACKAGE=picsimlab
MAINVER=0
MINORVER=9
VERSION=0.9.1
DATE=24011
3
DATE=24011
4
VERSION_STABLE=0.9.1
src/lib/part.cc
View file @
21d222df
...
...
@@ -103,23 +103,11 @@ void part::ReadInputMap(std::string fname) {
if
(
!
strcmp
(
"width"
,
name
))
{
sscanf
(
value
,
"%i"
,
&
x1
);
Width
=
x1
;
// Window1.SetplWidth(x1);
// Window1.draw1.SetWidth(x1*Window1.GetScale());
// Window1.SetWidth(185+x1*Window1.GetScale());
}
if
(
!
strcmp
(
"height"
,
name
))
{
sscanf
(
value
,
"%i"
,
&
y1
);
Height
=
y1
;
// Window1.SetplHeight(y1);
// Window1.draw1.SetHeight(y1*Window1.GetScale());
/*
#ifdef _WIN_
Window1.SetHeight(75+y1*Window1.GetScale());
#else
Window1.SetHeight(90+y1*Window1.GetScale());
#endif
*/
}
}
while
(
value
!=
NULL
);
...
...
@@ -513,7 +501,8 @@ void part::DrawSlider(const output_t* output, const unsigned char pos, const std
canvas
.
RotatedText
(
val
,
output
->
x1
+
1
,
output
->
y1
+
5
+
pos
/
1.66
,
0
);
}
void
part
::
DrawPotentiometer
(
const
output_t
*
output
,
const
unsigned
char
pos
,
const
std
::
string
val
,
const
lxFont
font
)
{
void
part
::
DrawPotentiometer
(
const
output_t
*
output
,
const
unsigned
char
pos
,
const
std
::
string
val
,
const
lxFont
font
)
{
canvas
.
SetColor
(
179
,
179
,
179
);
canvas
.
Rectangle
(
1
,
output
->
x1
,
output
->
y1
,
output
->
x2
-
output
->
x1
,
output
->
y2
-
output
->
y1
);
canvas
.
SetFgColor
(
0
,
0
,
0
);
...
...
src/lib/picsimlab.cc
View file @
21d222df
...
...
@@ -71,7 +71,6 @@ CPICSimLab::CPICSimLab() {
tgo
=
0
;
plWidth
=
10
;
plHeight
=
10
;
need_clkupdate
=
0
;
use_dsr_reset
=
1
;
settodestroy
=
0
;
sync
=
0
;
...
...
@@ -85,6 +84,12 @@ CPICSimLab::CPICSimLab() {
OnUpdateStatus
=
NULL
;
OnConfigure
=
NULL
;
OnClockSet
=
NULL
;
OnReadPreferences
=
NULL
;
OnSavePrefs
=
NULL
;
OnLoadHexFile
=
NULL
;
OnOpenLoadHexFileDialog
=
NULL
;
board_Event
=
NULL
;
board_ButtonEvent
=
NULL
;
}
...
...
@@ -196,11 +201,6 @@ void CPICSimLab::Set_mcudbg(int pd) {
void
CPICSimLab
::
SetDebugPort
(
unsigned
short
dp
)
{
debug_port
=
dp
;
if
(
debug
)
{
CToggleButton
*
togglebutton
=
(
CToggleButton
*
)
Window
->
GetChildByName
(
"togglebutton1"
);
togglebutton
->
SetCheck
(
0
);
(
Window
->*
(
togglebutton
->
EvOnToggleButton
))(
NULL
);
}
}
void
CPICSimLab
::
SetRemotecPort
(
unsigned
short
rcp
)
{
...
...
@@ -215,14 +215,8 @@ int CPICSimLab::GetDebugStatus(void) {
return
debug
;
}
void
CPICSimLab
::
SetDebugStatus
(
int
dbs
,
int
updatebtn
)
{
if
(
debug
!=
dbs
)
{
debug
=
dbs
;
if
(
updatebtn
)
{
CToggleButton
*
togglebutton
=
(
CToggleButton
*
)
Window
->
GetChildByName
(
"togglebutton1"
);
(
Window
->*
(
togglebutton
->
EvOnToggleButton
))(
NULL
);
}
}
void
CPICSimLab
::
SetDebugStatus
(
int
dbs
)
{
debug
=
dbs
;
}
void
CPICSimLab
::
UpdateStatus
(
const
PICSimlabStatus
field
,
const
std
::
string
msg
)
{
...
...
@@ -232,19 +226,8 @@ void CPICSimLab::UpdateStatus(const PICSimlabStatus field, const std::string msg
}
void
CPICSimLab
::
SetClock
(
const
float
clk
,
const
int
update
)
{
if
(
Window
)
{
CCombo
*
combo
=
(
CCombo
*
)
Window
->
GetChildByName
(
"combo1"
);
if
(
update
)
{
if
(
clk
<
1
)
{
combo
->
SetText
(
FloatStrFormat
(
"%2.1f"
,
clk
));
}
else
{
combo
->
SetText
(
FloatStrFormat
(
"%2.0f"
,
clk
));
}
need_clkupdate
=
0
;
}
else
{
need_clkupdate
=
1
;
}
if
((
OnClockSet
))
{
(
*
OnClockSet
)(
clk
,
update
);
}
NSTEP
=
(
int
)(
clk
*
NSTEPKT
);
NSTEPJ
=
NSTEP
/
JUMPSTEPS
;
...
...
@@ -280,8 +263,9 @@ void CPICSimLab::SavePrefs(std::string name, std::string value) {
}
void
CPICSimLab
::
OpenLoadHexFileDialog
(
void
)
{
CItemMenu
*
imenu
=
(
CItemMenu
*
)
Window
->
GetChildByName
(
"menu1_File_LoadHex"
);
(
Window
->*
(
imenu
->
EvMenuActive
))(
NULL
);
if
(
OnOpenLoadHexFileDialog
)
{
(
*
OnOpenLoadHexFileDialog
)();
}
}
void
CPICSimLab
::
SetNeedReboot
(
int
nr
)
{
...
...
@@ -358,8 +342,8 @@ void CPICSimLab::EndSimulation(int saveold, const char* newpath) {
SavePrefs
(
"picsimlab_debugt"
,
std
::
to_string
(
GetDebugType
()));
SavePrefs
(
"picsimlab_debugp"
,
std
::
to_string
(
GetDebugPort
()));
SavePrefs
(
"picsimlab_remotecp"
,
std
::
to_string
(
GetRemotecPort
()));
if
(
Window
)
{
SavePrefs
(
"picsimlab_position"
,
std
::
to_string
(
Window
->
GetX
())
+
","
+
std
::
to_string
(
Window
->
GetY
())
);
if
(
OnSavePrefs
)
{
(
*
OnSavePrefs
)(
);
}
SavePrefs
(
"picsimlab_scale"
,
std
::
to_string
(
scale
));
SavePrefs
(
"picsimlab_dsr_reset"
,
std
::
to_string
(
GetUseDSRReset
()));
...
...
@@ -777,7 +761,9 @@ void CPICSimLab::SaveWorkspace(std::string fnpzw) {
SavePrefs
(
"picsimlab_debug"
,
std
::
to_string
(
GetDebugStatus
()));
SavePrefs
(
"picsimlab_debugt"
,
std
::
to_string
(
GetDebugType
()));
SavePrefs
(
"picsimlab_debugp"
,
std
::
to_string
(
GetDebugPort
()));
SavePrefs
(
"picsimlab_position"
,
std
::
to_string
(
Window
->
GetX
())
+
","
+
std
::
to_string
(
Window
->
GetY
()));
if
(
OnSavePrefs
)
{
(
*
OnSavePrefs
)();
}
SavePrefs
(
"picsimlab_scale"
,
std
::
to_string
(
scale
));
SavePrefs
(
"osc_on"
,
std
::
to_string
(
pboard
->
GetUseOscilloscope
()));
SavePrefs
(
"spare_on"
,
std
::
to_string
(
pboard
->
GetUseSpareParts
()));
...
...
@@ -865,7 +851,7 @@ void CPICSimLab::Configure(const char* home, int use_default_board, int create,
char
*
name
;
char
*
value
;
int
i
,
j
;
int
i
;
int
lc
;
int
load_demo
=
0
;
...
...
@@ -953,11 +939,8 @@ void CPICSimLab::Configure(const char* home, int use_default_board, int create,
if
(
disable_debug
)
{
debug
=
0
;
}
if
(
Window
)
{
((
CToggleButton
*
)
Window
->
GetChildByName
(
"togglebutton1"
))
->
SetCheck
(
debug
);
}
#endif
SetDebugStatus
(
debug
,
0
);
SetDebugStatus
(
debug
);
}
if
(
!
strcmp
(
name
,
"picsimlab_debugt"
))
{
...
...
@@ -974,26 +957,11 @@ void CPICSimLab::Configure(const char* home, int use_default_board, int create,
sscanf
(
value
,
"%i"
,
&
spare_on
);
}
if
(
!
strcmp
(
name
,
"picsimlab_position"
))
{
sscanf
(
value
,
"%i,%i"
,
&
i
,
&
j
);
if
(
Window
)
{
Window
->
SetX
(
i
);
Window
->
SetY
(
j
);
}
printf
(
"PICSimLab: Window position x=%i y=%i
\n
"
,
i
,
j
);
}
if
(
!
strcmp
(
name
,
"picsimlab_scale"
))
{
if
(
create
)
{
double
s
;
sscanf
(
value
,
"%lf"
,
&
s
);
SetScale
(
s
);
if
(
Window
)
{
((
CDraw
*
)
Window
->
GetChildByName
(
"draw1"
))
->
SetWidth
(
plWidth
*
GetScale
());
Window
->
SetWidth
(
185
+
plWidth
*
GetScale
());
((
CDraw
*
)
Window
->
GetChildByName
(
"draw1"
))
->
SetHeight
(
plHeight
*
GetScale
());
Window
->
SetHeight
(
90
+
plHeight
*
GetScale
());
}
pboard
->
SetScale
(
GetScale
());
printf
(
"PICSimLab: Window scale %5.2f
\n
"
,
GetScale
());
}
...
...
@@ -1009,22 +977,15 @@ void CPICSimLab::Configure(const char* home, int use_default_board, int create,
if
(
!
strcmp
(
name
,
"picsimlab_lfile"
))
{
SetFNAME
(
std
::
string
(
value
));
if
(
Window
)
{
if
(
GetFNAME
().
length
()
>
1
)
Window
->
GetChildByName
(
"menu1"
)
->
GetChildByName
(
"menu1_File"
)
->
GetChildByName
(
"menu1_File_ReloadLast"
)
->
SetEnable
(
1
);
else
Window
->
GetChildByName
(
"menu1"
)
->
GetChildByName
(
"menu1_File"
)
->
GetChildByName
(
"menu1_File_ReloadLast"
)
->
SetEnable
(
0
);
}
}
if
(
pboard
!=
NULL
)
if
(
pboard
)
{
pboard
->
ReadPreferences
(
name
,
value
);
}
if
(
OnReadPreferences
)
{
(
*
OnReadPreferences
)(
name
,
value
,
create
);
}
Oscilloscope
.
ReadPreferences
(
name
,
value
);
SpareParts
.
ReadPreferences
(
name
,
value
);
...
...
@@ -1053,9 +1014,11 @@ void CPICSimLab::Configure(const char* home, int use_default_board, int create,
#endif
}
/*
if ((OnConfigure)) {
(*OnConfigure)();
}
*/
pboard
->
MSetSerial
(
SERIALDEVICE
);
...
...
@@ -1108,28 +1071,26 @@ void CPICSimLab::Configure(const char* home, int use_default_board, int create,
break
;
}
pboard
->
Reset
();
if
((
OnConfigure
))
{
(
*
OnConfigure
)();
}
else
{
pboard
->
Reset
();
}
SetProcessorName
(
pboard
->
GetProcessorName
());
if
(
Window
)
{
pboard
->
EvOnShow
();
pboard
->
Draw
(((
CDraw
*
)
Window
->
GetChildByName
(
"draw1"
)));
((
CDraw
*
)
Window
->
GetChildByName
(
"draw1"
))
->
SetVisible
(
1
);
Window
->
SetTitle
(((
Instance
>
0
)
?
(
"PICSimLab["
+
std
::
to_string
(
Instance
)
+
"] - "
)
:
(
"PICSimLab - "
))
+
std
::
string
(
boards_list
[
lab
].
name
)
+
" - "
+
pboard
->
GetProcessorName
());
#ifdef _USE_PICSTARTP_
if
(
prog_init
()
>=
0
)
status
=
"PStart: Ok "
;
else
status
=
"PStart:Error"
;
if
(
prog_init
()
>=
0
)
status
=
"PStart: Ok "
;
else
status
=
"PStart:Error"
;
#else
status
=
""
;
status
=
""
;
#endif
UpdateStatus
(
PS_RUN
,
"Running..."
);
UpdateStatus
(
PS_RUN
,
"Running..."
);
if
(
Window
)
{
((
CThread
*
)
Window
->
GetChildByName
(
"thread1"
))
->
Run
();
// parallel thread
#ifndef __EMSCRIPTEN__
// FIXME remote control disabled
...
...
@@ -1137,9 +1098,8 @@ void CPICSimLab::Configure(const char* home, int use_default_board, int create,
#endif
((
CTimer
*
)
Window
->
GetChildByName
(
"timer1"
))
->
SetRunState
(
1
);
((
CTimer
*
)
Window
->
GetChildByName
(
"timer2"
))
->
SetRunState
(
1
);
Application
->
ProcessEvents
();
}
Application
->
ProcessEvents
();
Oscilloscope
.
SetBoard
(
pboard
);
Oscilloscope
.
SetBaseTimer
();
...
...
@@ -1250,16 +1210,9 @@ int CPICSimLab::LoadHexFile(std::string fname) {
GetBoard
()
->
Reset
();
if
(
GetMcuRun
())
Window
->
SetTitle
(
((
GetInstanceNumber
()
>
0
)
?
(
"PICSimLab["
+
std
::
to_string
(
GetInstanceNumber
())
+
"] - "
)
:
(
"PICSimLab - "
))
+
std
::
string
(
boards_list
[
GetLab
()].
name
)
+
" - "
+
GetBoard
()
->
GetProcessorName
()
+
" - "
+
((
const
char
*
)
basename
(((
CFileDialog
*
)
Window
->
GetChildByName
(
"filedialog1"
))
->
GetFileName
()).
c_str
()));
else
Window
->
SetTitle
(((
GetInstanceNumber
()
>
0
)
?
(
"PICSimLab["
+
std
::
to_string
(
GetInstanceNumber
())
+
"] - "
)
:
(
"PICSimLab - "
))
+
std
::
string
(
boards_list
[
GetLab
()].
name
)
+
" - "
+
GetBoard
()
->
GetProcessorName
());
if
(
OnLoadHexFile
)
{
(
*
OnLoadHexFile
)(
fname
);
}
ret
=
!
GetMcuRun
();
...
...
src/lib/picsimlab.h
View file @
21d222df
...
...
@@ -174,13 +174,11 @@ public:
/**
* @brief Set debug status flag
*/
void
SetDebugStatus
(
int
dbs
,
int
updatebtn
=
1
);
void
SetDebugStatus
(
int
dbs
);
void
SetClock
(
const
float
clk
,
const
int
update
=
1
);
float
GetClock
(
void
);
int
GetNeedClkUpdate
(
void
)
{
return
need_clkupdate
;
};
/**
* @brief Save the preferences
*/
...
...
@@ -270,6 +268,12 @@ public:
void
(
*
OnUpdateStatus
)(
const
int
field
,
const
std
::
string
msg
);
void
(
*
OnConfigure
)(
void
);
void
(
*
OnClockSet
)(
const
float
clk
,
const
int
update
);
void
(
*
OnReadPreferences
)(
const
char
*
name
,
const
char
*
value
,
const
int
create
);
void
(
*
OnSavePrefs
)(
void
);
void
(
*
OnLoadHexFile
)(
const
std
::
string
fname
);
void
(
*
OnOpenLoadHexFileDialog
)(
void
);
void
(
CControl
::*
board_Event
)(
CControl
*
control
);
void
(
CControl
::*
board_ButtonEvent
)(
CControl
*
control
,
const
uint
button
,
const
uint
x
,
const
uint
y
,
const
uint
mask
);
...
...
@@ -302,7 +306,6 @@ private:
int
debug_type
;
int
debug
;
int
need_resize
;
int
need_clkupdate
;
std
::
vector
<
std
::
string
>
prefs
;
int
NeedReboot
;
std
::
vector
<
std
::
string
>
Errors
;
...
...
src/lib/spareparts.cc
View file @
21d222df
...
...
@@ -469,7 +469,7 @@ bool CSpareParts::LoadConfig(std::string fname, const int disable_debug) {
((
CToggleButton
*
)
PICSimLab
.
GetWindow
()
->
GetChildByName
(
"togglebutton1"
))
->
SetCheck
(
x
);
}
#endif
PICSimLab
.
SetDebugStatus
(
x
,
0
);
PICSimLab
.
SetDebugStatus
(
x
);
PICSimLab
.
SetDebugType
(
y
);
}
else
if
(
!
strcmp
(
name
,
"osc_on"
))
{
unsigned
char
osc_on
;
...
...
src/picsimlab1.cc
View file @
21d222df
...
...
@@ -340,7 +340,7 @@ void CPWindow1::timer2_EvOnTime(CControl* control) {
WDestroy
();
}
if
(
PICSimLab
.
GetNeedClkUpdate
())
{
if
(
GetNeedClkUpdate
())
{
PICSimLab
.
SetClock
(
PICSimLab
.
GetClock
());
}
}
...
...
@@ -673,6 +673,12 @@ void CPWindow1::_EvOnCreate(CControl* control) {
PICSimLab
.
OnUpdateStatus
=
&
CPWindow1
::
UpdateStatus
;
PICSimLab
.
OnConfigure
=
&
CPWindow1
::
OnConfigure
;
PICSimLab
.
OnClockSet
=
&
CPWindow1
::
OnClockSet
;
PICSimLab
.
OnReadPreferences
=
&
CPWindow1
::
OnReadPreferences
;
PICSimLab
.
OnSavePrefs
=
&
CPWindow1
::
OnSavePrefs
;
PICSimLab
.
OnLoadHexFile
=
&
CPWindow1
::
OnLoadHexFile
;
PICSimLab
.
OnOpenLoadHexFileDialog
=
&
CPWindow1
::
OnOpenLoadHexFileDialog
;
PICSimLab
.
board_Event
=
EVONCOMBOCHANGE
&
CPWindow1
::
board_Event
;
PICSimLab
.
board_ButtonEvent
=
EVMOUSEBUTTONRELEASE
&
CPWindow1
::
board_ButtonEvent
;
PICSimLab
.
Init
(
this
);
...
...
@@ -876,6 +882,74 @@ void CPWindow1::OnConfigure(void) {
Window1
.
Configure
();
}
void
CPWindow1
::
OnClockSet
(
const
float
clk
,
const
int
update
)
{
if
(
update
)
{
if
(
clk
<
1
)
{
Window1
.
combo1
.
SetText
(
FloatStrFormat
(
"%2.1f"
,
clk
));
}
else
{
Window1
.
combo1
.
SetText
(
FloatStrFormat
(
"%2.0f"
,
clk
));
}
Window1
.
SetNeedClkUpdate
(
0
);
}
else
{
Window1
.
SetNeedClkUpdate
(
1
);
}
}
void
CPWindow1
::
OnReadPreferences
(
const
char
*
name
,
const
char
*
value
,
const
int
create
)
{
if
(
!
strcmp
(
name
,
"picsimlab_debug"
))
{
#ifndef NO_DEBUG
Window1
.
togglebutton1
.
SetCheck
(
PICSimLab
.
GetDebugStatus
());
#endif
}
if
(
!
strcmp
(
name
,
"picsimlab_position"
))
{
int
i
,
j
;
sscanf
(
value
,
"%i,%i"
,
&
i
,
&
j
);
Window1
.
SetX
(
i
);
Window1
.
SetY
(
j
);
printf
(
"PICSimLab: Window position x=%i y=%i
\n
"
,
i
,
j
);
}
if
(
!
strcmp
(
name
,
"picsimlab_scale"
))
{
if
(
create
)
{
Window1
.
draw1
.
SetWidth
(
PICSimLab
.
plWidth
*
PICSimLab
.
GetScale
());
Window1
.
SetWidth
(
185
+
PICSimLab
.
plWidth
*
PICSimLab
.
GetScale
());
Window1
.
draw1
.
SetHeight
(
PICSimLab
.
plHeight
*
PICSimLab
.
GetScale
());
Window1
.
SetHeight
(
90
+
PICSimLab
.
plHeight
*
PICSimLab
.
GetScale
());
}
}
if
(
!
strcmp
(
name
,
"picsimlab_lfile"
))
{
if
(
PICSimLab
.
GetFNAME
().
length
()
>
1
)
Window1
.
menu1_File_ReloadLast
.
SetEnable
(
1
);
else
Window1
.
menu1_File_ReloadLast
.
SetEnable
(
1
);
}
}
void
CPWindow1
::
OnSavePrefs
(
void
)
{
PICSimLab
.
SavePrefs
(
"picsimlab_position"
,
std
::
to_string
(
Window1
.
GetX
())
+
","
+
std
::
to_string
(
Window1
.
GetY
()));
}
void
CPWindow1
::
OnLoadHexFile
(
const
std
::
string
fname
)
{
if
(
PICSimLab
.
GetMcuRun
())
Window1
.
SetTitle
(((
PICSimLab
.
GetInstanceNumber
()
>
0
)
?
(
"PICSimLab["
+
std
::
to_string
(
PICSimLab
.
GetInstanceNumber
())
+
"] - "
)
:
(
"PICSimLab - "
))
+
std
::
string
(
boards_list
[
PICSimLab
.
GetLab
()].
name
)
+
" - "
+
PICSimLab
.
GetBoard
()
->
GetProcessorName
()
+
" - "
+
((
const
char
*
)
basename
(
fname
).
c_str
()));
else
Window1
.
SetTitle
(((
PICSimLab
.
GetInstanceNumber
()
>
0
)
?
(
"PICSimLab["
+
std
::
to_string
(
PICSimLab
.
GetInstanceNumber
())
+
"] - "
)
:
(
"PICSimLab - "
))
+
std
::
string
(
boards_list
[
PICSimLab
.
GetLab
()].
name
)
+
" - "
+
PICSimLab
.
GetBoard
()
->
GetProcessorName
());
}
void
CPWindow1
::
OnOpenLoadHexFileDialog
(
void
)
{
Window1
.
menu1_File_LoadHex_EvMenuActive
(
NULL
);
}
void
CPWindow1
::
Configure
(
void
)
{
menu1_Microcontroller
.
DestroyChilds
();
std
::
string
sdev
=
PICSimLab
.
GetBoard
()
->
GetSupportedDevices
();
...
...
@@ -915,6 +989,16 @@ void CPWindow1::Configure(void) {
menu1_Tools_ArduinoBootloader
.
SetEnable
(
false
);
}
#endif
PICSimLab
.
GetBoard
()
->
Reset
();
PICSimLab
.
GetBoard
()
->
EvOnShow
();
PICSimLab
.
GetBoard
()
->
Draw
(
&
draw1
);
draw1
.
SetVisible
(
1
);
SetTitle
(((
PICSimLab
.
GetInstanceNumber
()
>
0
)
?
(
"PICSimLab["
+
std
::
to_string
(
PICSimLab
.
GetInstanceNumber
())
+
"] - "
)
:
(
"PICSimLab - "
))
+
std
::
string
(
boards_list
[
PICSimLab
.
GetLab
()].
name
)
+
" - "
+
PICSimLab
.
GetBoard
()
->
GetProcessorName
());
}
// Change frequency
...
...
@@ -1201,7 +1285,7 @@ void CPWindow1::togglebutton1_EvOnToggleButton(CControl* control) {
int
osc_on
=
PICSimLab
.
GetBoard
()
->
GetUseOscilloscope
();
int
spare_on
=
PICSimLab
.
GetBoard
()
->
GetUseSpareParts
();
PICSimLab
.
SetDebugStatus
(
togglebutton1
.
GetCheck
()
,
0
);
PICSimLab
.
SetDebugStatus
(
togglebutton1
.
GetCheck
());
PICSimLab
.
EndSimulation
();
PICSimLab
.
Configure
(
PICSimLab
.
GetHomePath
().
c_str
());
...
...
src/picsimlab1.h
View file @
21d222df
...
...
@@ -159,7 +159,14 @@ public:
void
DrawBoard
(
void
);
static
void
UpdateStatus
(
const
int
field
,
const
std
::
string
msg
);
static
void
OnConfigure
(
void
);
static
void
OnClockSet
(
const
float
clk
,
const
int
update
);
static
void
OnReadPreferences
(
const
char
*
name
,
const
char
*
value
,
const
int
create
);
static
void
OnSavePrefs
(
void
);
static
void
OnLoadHexFile
(
const
std
::
string
fname
);
static
void
OnOpenLoadHexFileDialog
(
void
);
void
Configure
(
void
);
int
GetNeedClkUpdate
(
void
)
{
return
need_clkupdate
;
};
void
SetNeedClkUpdate
(
const
int
ncu
)
{
need_clkupdate
=
ncu
;
};
private:
CItemMenu
MBoard
[
BOARDS_MAX
];
...
...
@@ -168,6 +175,7 @@ private:
float
over
;
int
crt
;
int
zerocount
;
int
need_clkupdate
;
};
extern
CPWindow1
Window1
;
...
...
src/picsimlab1_d.cc
View file @
21d222df
...
...
@@ -488,6 +488,7 @@ CPWindow1::CPWindow1(void) {
over
=
0
;
crt
=
1
;
zerocount
=
0
;
need_clkupdate
=
0
;
#ifdef NO_TOOLS
menu1
.
DestroyChild
(
&
menu1_Tools
);
...
...
src/picsimlab3.cc
View file @
21d222df
...
...
@@ -62,6 +62,11 @@ void CPWindow3::button1_EvMouseButtonClick(CControl* control, uint button, uint
PICSimLab
.
SetDebugPort
(
spin1
.
GetValue
());
if
(
PICSimLab
.
GetDebugStatus
())
{
Window1
.
togglebutton1
.
SetCheck
(
0
);
Window1
.
togglebutton1_EvOnToggleButton
(
NULL
);
}
PICSimLab
.
SetRemotecPort
(
spin2
.
GetValue
());
#ifdef _USE_PICSTARTP_
...
...
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