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
258542b8
Commit
258542b8
authored
Aug 08, 2020
by
lcgamboa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chg: support to set second serial port name !minor
parent
355f26d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
4 deletions
+56
-4
src/boards/board_Curiosity_HPC.cc
src/boards/board_Curiosity_HPC.cc
+52
-3
src/boards/board_Curiosity_HPC.h
src/boards/board_Curiosity_HPC.h
+4
-1
No files found.
src/boards/board_Curiosity_HPC.cc
View file @
258542b8
...
...
@@ -30,6 +30,9 @@
#include"../picsimlab5.h" //Spare Parts
#include"board_Curiosity_HPC.h"
char
*
serial_list
(
void
);
/* ids of inputs of input map*/
enum
{
...
...
@@ -231,6 +234,36 @@ cboard_Curiosity_HPC::cboard_Curiosity_HPC(void)
label5
->
SetText
(
lxT
(
"RA7"
));
label5
->
SetAlign
(
1
);
Window1
.
CreateChild
(
label5
);
//label6
label6
=
new
CLabel
();
label6
->
SetFOwner
(
&
Window1
);
label6
->
SetName
(
lxT
(
"label6_p8"
));
label6
->
SetX
(
13
);
label6
->
SetY
(
305
+
30
-
120
);
label6
->
SetWidth
(
150
);
label6
->
SetHeight
(
20
);
label6
->
SetEnable
(
1
);
label6
->
SetVisible
(
1
);
label6
->
SetText
(
lxT
(
"Second serial port:"
));
label6
->
SetAlign
(
1
);
Window1
.
CreateChild
(
label6
);
//combo1
combo1
=
new
CCombo
();
combo1
->
SetFOwner
(
&
Window1
);
combo1
->
SetName
(
lxT
(
"combo1_p8"
));
combo1
->
SetX
(
13
);
combo1
->
SetY
(
305
+
55
-
120
);
combo1
->
SetWidth
(
150
);
combo1
->
SetHeight
(
20
);
combo1
->
SetEnable
(
1
);
combo1
->
SetVisible
(
1
);
#ifndef _WIN_
combo1
->
SetText
(
lxT
(
"/dev/tnt4"
));
#else
combo1
->
SetText
(
lxT
(
"COM2"
));
#endif
combo1
->
SetItems
(
serial_list
());
Window1
.
CreateChild
(
combo1
);
}
//Destructor called once on board destruction
...
...
@@ -248,8 +281,18 @@ cboard_Curiosity_HPC::~cboard_Curiosity_HPC(void)
Window1
.
DestroyChild
(
label3
);
Window1
.
DestroyChild
(
label4
);
Window1
.
DestroyChild
(
label5
);
Window1
.
DestroyChild
(
label6
);
Window1
.
DestroyChild
(
combo1
);
}
void
cboard_Curiosity_HPC
::
MSetSerial
(
const
char
*
port
)
{
pic_set_serial
(
&
pic
,
0
,
port
,
0
,
0
,
0
);
pic_set_serial
(
&
pic
,
1
,
combo1
->
GetText
(),
0
,
0
,
0
);
}
//Reset board status
void
...
...
@@ -312,7 +355,8 @@ cboard_Curiosity_HPC::WritePreferences(void)
//write selected microcontroller of board_Curiosity_HPC to preferences
Window1
.
saveprefs
(
lxT
(
"Curiosity_HPC_proc"
),
Proc
);
Window1
.
saveprefs
(
lxT
(
"Curiosity_HPC_jmp"
),
String
().
Format
(
"%i"
,
jmp
[
0
]));
Window1
.
saveprefs
(
lxT
(
"Curiosity_HPC_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
Window1
.
saveprefs
(
lxT
(
"Curiosity_HPC_clock"
),
String
().
Format
(
"%2.1f"
,
Window1
.
GetClock
()));
Window1
.
saveprefs
(
lxT
(
"Curiosity_HPC_serial2"
),
combo1
->
GetText
());
}
//Called whe configuration file load preferences
...
...
@@ -337,9 +381,14 @@ cboard_Curiosity_HPC::ReadPreferences(char *name, char *value)
jmp
[
i
]
=
1
;
}
}
if
(
!
strcmp
(
name
,
"Curiosity_HPC_clock"
))
if
(
!
strcmp
(
name
,
"Curiosity_HPC_clock"
))
{
Window1
.
SetClock
(
atof
(
value
));
}
if
(
!
strcmp
(
name
,
"Curiosity_HPC_serial2"
))
{
Window1
.
SetClock
(
atof
(
value
));
combo1
->
SetText
(
value
);
pic_set_serial
(
&
pic
,
1
,
value
,
0
,
0
,
0
);
}
}
...
...
src/boards/board_Curiosity_HPC.h
View file @
258542b8
...
...
@@ -51,7 +51,8 @@ class cboard_Curiosity_HPC:public board_picsim
CLabel
*
label3
;
//label of gauge RA5
CLabel
*
label4
;
//label of gauge RA6
CLabel
*
label5
;
//label of gauge RA7
CLabel
*
label6
;
//label of second serial
CCombo
*
combo1
;
//combo of second serial
public:
//Constructor called once on board creation
...
...
@@ -90,6 +91,8 @@ class cboard_Curiosity_HPC:public board_picsim
unsigned
short
get_in_id
(
char
*
name
);
//return the output ids numbers of names used in output map
unsigned
short
get_out_id
(
char
*
name
);
//Set Serial port name
void
MSetSerial
(
const
char
*
port
);
};
#endif
/* BOARD_Curiosity_HPC_H */
\ No newline at end of file
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