Commit 258542b8 authored by lcgamboa's avatar lcgamboa

chg: support to set second serial port name !minor

parent 355f26d1
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
#include"../picsimlab5.h" //Spare Parts #include"../picsimlab5.h" //Spare Parts
#include"board_Curiosity_HPC.h" #include"board_Curiosity_HPC.h"
char *
serial_list(void);
/* ids of inputs of input map*/ /* ids of inputs of input map*/
enum enum
{ {
...@@ -231,6 +234,36 @@ cboard_Curiosity_HPC::cboard_Curiosity_HPC(void) ...@@ -231,6 +234,36 @@ cboard_Curiosity_HPC::cboard_Curiosity_HPC(void)
label5->SetText (lxT ("RA7")); label5->SetText (lxT ("RA7"));
label5->SetAlign (1); label5->SetAlign (1);
Window1.CreateChild (label5); 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 //Destructor called once on board destruction
...@@ -248,8 +281,18 @@ cboard_Curiosity_HPC::~cboard_Curiosity_HPC(void) ...@@ -248,8 +281,18 @@ cboard_Curiosity_HPC::~cboard_Curiosity_HPC(void)
Window1.DestroyChild (label3); Window1.DestroyChild (label3);
Window1.DestroyChild (label4); Window1.DestroyChild (label4);
Window1.DestroyChild (label5); 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 //Reset board status
void void
...@@ -312,7 +355,8 @@ cboard_Curiosity_HPC::WritePreferences(void) ...@@ -312,7 +355,8 @@ cboard_Curiosity_HPC::WritePreferences(void)
//write selected microcontroller of board_Curiosity_HPC to preferences //write selected microcontroller of board_Curiosity_HPC to preferences
Window1.saveprefs (lxT ("Curiosity_HPC_proc"), Proc); Window1.saveprefs (lxT ("Curiosity_HPC_proc"), Proc);
Window1.saveprefs (lxT ("Curiosity_HPC_jmp"), String ().Format ("%i", jmp[0])); 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 //Called whe configuration file load preferences
...@@ -339,7 +383,12 @@ cboard_Curiosity_HPC::ReadPreferences(char *name, char *value) ...@@ -339,7 +383,12 @@ cboard_Curiosity_HPC::ReadPreferences(char *name, char *value)
} }
if (!strcmp (name, "Curiosity_HPC_clock")) if (!strcmp (name, "Curiosity_HPC_clock"))
{ {
Window1.SetClock (atof(value)); Window1.SetClock (atof (value));
}
if (!strcmp (name, "Curiosity_HPC_serial2"))
{
combo1->SetText (value);
pic_set_serial (&pic,1, value , 0, 0, 0);
} }
} }
......
...@@ -51,7 +51,8 @@ class cboard_Curiosity_HPC:public board_picsim ...@@ -51,7 +51,8 @@ class cboard_Curiosity_HPC:public board_picsim
CLabel *label3; //label of gauge RA5 CLabel *label3; //label of gauge RA5
CLabel *label4; //label of gauge RA6 CLabel *label4; //label of gauge RA6
CLabel *label5; //label of gauge RA7 CLabel *label5; //label of gauge RA7
CLabel *label6; //label of second serial
CCombo *combo1; //combo of second serial
public: public:
//Constructor called once on board creation //Constructor called once on board creation
...@@ -90,6 +91,8 @@ class cboard_Curiosity_HPC:public board_picsim ...@@ -90,6 +91,8 @@ class cboard_Curiosity_HPC:public board_picsim
unsigned short get_in_id(char * name); unsigned short get_in_id(char * name);
//return the output ids numbers of names used in output map //return the output ids numbers of names used in output map
unsigned short get_out_id(char * name); unsigned short get_out_id(char * name);
//Set Serial port name
void MSetSerial(const char * port);
}; };
#endif /* BOARD_Curiosity_HPC_H */ #endif /* BOARD_Curiosity_HPC_H */
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment