310 wxConvLocal)); |
315 wxConvLocal)); |
311 myhsizer->Add (busname, 0, wxLEFT, 5); |
316 myhsizer->Add (busname, 0, wxLEFT, 5); |
312 myhsizer = |
317 myhsizer = |
313 new wxStaticBoxSizer (new |
318 new wxStaticBoxSizer (new |
314 wxStaticBox (panel, wxID_ANY, |
319 wxStaticBox (panel, wxID_ANY, |
315 _T ("Node ID (Hexa)")), wxHORIZONTAL); |
320 _T ("Node ID (Decimal)")), wxHORIZONTAL); |
316 myentrysizer->Add (myhsizer, 0, wxEXPAND | wxALL, 5); |
321 myentrysizer->Add (myhsizer, 0, wxEXPAND | wxALL, 5); |
317 node_id = |
322 node_id = |
318 new wxSpinCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, |
323 new wxSpinCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, |
319 wxDefaultSize, wxSP_ARROW_KEYS, 1, 127, node_id_ext, |
324 wxDefaultSize, wxSP_ARROW_KEYS, 1, 127, node_id_ext, |
320 _T ("wxSpinCtrl")); |
325 _T ("wxSpinCtrl")); |
540 _T ("Bool Input 1"), _T ("Bool Input 2"), |
545 _T ("Bool Input 1"), _T ("Bool Input 2"), |
541 _T ("Bool Input 3"), _T ("Bool Input 4"), |
546 _T ("Bool Input 3"), _T ("Bool Input 4"), |
542 _T ("Bool Input 5"), _T ("Bool Input 6"), |
547 _T ("Bool Input 5"), _T ("Bool Input 6"), |
543 _T ("Bool Input 7"), _T ("Bool Input 8"), |
548 _T ("Bool Input 7"), _T ("Bool Input 8"), |
544 }; |
549 }; |
545 panel = new wxPanel (book); |
|
546 book->AddPage(panel, wxT("Graphic"), true); |
|
547 mysizer = new wxBoxSizer (wxVERTICAL); |
|
548 panel->SetSizer (mysizer); |
|
549 //panel->Hide (); |
|
550 myhsizer = |
|
551 new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T ("Graphic")), |
|
552 wxVERTICAL); |
|
553 mysizer->Add (myhsizer, 0, wxEXPAND | wxALL, 10); |
|
554 mygraphpan = |
|
555 new wxPanel (panel, wxID_ANY, wxDefaultPosition, wxSize (0, 350), |
|
556 wxTAB_TRAVERSAL, wxT ("Graphic")); |
|
557 myhsizer->Add (mygraphpan, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
558 echelle = |
|
559 new wxSlider (panel, wxID_ANY, 44, 44, 1000, wxDefaultPosition, |
|
560 wxDefaultSize, wxSL_HORIZONTAL, wxDefaultValidator, |
|
561 wxT ("slider")); |
|
562 myhsizer->Add (echelle, 0, wxEXPAND | wxALL, 0); |
|
563 mybsizer = new wxBoxSizer (wxHORIZONTAL); |
|
564 mysizer->Add (mybsizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 5); |
|
565 myhsizer = |
|
566 new wxStaticBoxSizer (new |
|
567 wxStaticBox (panel, wxID_ANY, |
|
568 _T ("Select viewable Inputs")), |
|
569 wxHORIZONTAL); |
|
570 mybsizer->Add (myhsizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 10); |
|
571 inlist = |
|
572 new wxListBox (panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 28, |
|
573 choice, wxLB_EXTENDED | wxLB_HSCROLL); |
|
574 myhsizer->Add (inlist, wxEXPAND | wxALL, wxEXPAND | wxALL, 5); |
|
575 myhsizer = |
|
576 new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T ("Legende")), |
|
577 wxHORIZONTAL); |
|
578 mybsizer->Add (myhsizer, wxEXPAND | wxALL, wxEXPAND | wxALL, 10); |
|
579 mylegpan = |
|
580 new wxPanel (panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, |
|
581 wxTAB_TRAVERSAL, wxT ("Legende")); |
|
582 myhsizer->Add (mylegpan, wxEXPAND | wxALL, wxEXPAND | wxALL, 15); |
|
583 quit = new wxButton (panel, QUIT, _T ("QUIT")); |
|
584 mysizer->Add (quit, 0, wxALL, 5); |
|
585 |
550 |
586 panel = new wxPanel (book); |
551 panel = new wxPanel (book); |
587 book->InsertPage (0, panel, wxT ("Control"), true); |
552 book->InsertPage (0, panel, wxT ("Control"), true); |
588 mysizer = new wxBoxSizer (wxVERTICAL); |
553 mysizer = new wxBoxSizer (wxVERTICAL); |
589 panel->SetSizer (mysizer); |
554 panel->SetSizer (mysizer); |
895 |
859 |
896 static int |
860 static int |
897 get_bit (UNS8 input, int bit) |
861 get_bit (UNS8 input, int bit) |
898 { |
862 { |
899 return input & (((UNS8) 1) << bit - 1) ? 1 : 0; |
863 return input & (((UNS8) 1) << bit - 1) ? 1 : 0; |
900 } |
|
901 |
|
902 void |
|
903 MyFrame::Paint () |
|
904 { |
|
905 double vmax = old_max; |
|
906 double vmin = old_min; |
|
907 double vdelta = vmax - vmin; |
|
908 double vech = ((float) vdelta) / 10.0; |
|
909 |
|
910 double hmax = frame->echelle->GetValue (); |
|
911 double hech = hdelta / 11; |
|
912 |
|
913 double d = 300 / vdelta; |
|
914 double g = 0; |
|
915 double top = 5; |
|
916 double left = 50; |
|
917 |
|
918 double tmpi = 0; |
|
919 wxString tmps; |
|
920 double p = 0; |
|
921 double q = 0; |
|
922 int i = 0; |
|
923 int j = 0; |
|
924 wxColor col[8] = |
|
925 { wxColor (wxT ("BLUE")), wxColor (wxT ("RED")), wxColor (wxT ("GREEN")), |
|
926 wxColor (wxT ("GREY")), |
|
927 wxColor (wxT ("ORANGE")), wxColor (wxT ("YELLOW")), |
|
928 wxColor (wxT ("PINK")), wxColor (wxT ("BLACK")) |
|
929 }; |
|
930 hdelta = hmax - 0; |
|
931 g = (Gtime / hdelta) * 44.00; |
|
932 |
|
933 wxClientDC MonDc (mygraphpan); |
|
934 MonDc.Clear (); |
|
935 |
|
936 MonDc.SetPen (wxPen (wxColour (200, 200, 200), 5, wxSOLID)); |
|
937 MonDc.DrawRectangle ((int) left, (int) top, 660, 300); |
|
938 |
|
939 MonDc.SetPen (wxPen (wxColor (150, 200, 150), 2, wxSOLID)); |
|
940 MonDc. |
|
941 SetFont (wxFont |
|
942 (9, wxSWISS, wxNORMAL, wxNORMAL, false, wxT ("Arial Black"))); |
|
943 for (i = 0; i < 11; i++) |
|
944 { |
|
945 tmpi = (vmin + (vech * i)); |
|
946 tmps.Printf (wxT ("%d"), (int) tmpi); |
|
947 MonDc.DrawRotatedText (tmps, 0, (int) (293 - (30 * i) + top), 0); |
|
948 } |
|
949 for (i = 0; i < 12; i++) |
|
950 { |
|
951 tmpi = (hech * i * 100); |
|
952 if (tmpi < 1000) |
|
953 tmps.Printf (wxT ("%ims"), (int) tmpi); |
|
954 if (tmpi > 1000) |
|
955 tmps.Printf (wxT ("%is"), (int) (tmpi / 1000)); |
|
956 MonDc.DrawRotatedText (tmps, (int) ((60 * i) + left) - 10, |
|
957 (int) (317 + top), 0); |
|
958 } |
|
959 for (j = 1; j < 10; j++) |
|
960 MonDc.DrawLine ((int) left, (int) (300 - (30 * j) + top), |
|
961 (int) (left + 660), (int) (300 - (30 * j) + top)); |
|
962 MonDc.SetPen (wxPen (wxColor (150, 200, 150), 2, wxSOLID)); |
|
963 for (j = 1; j < 22; j++) |
|
964 MonDc.DrawLine ((int) (30 * j + left), (int) (300 + top), |
|
965 (int) (30 * j + left), (int) (top)); |
|
966 MonDc.SetPen (wxPen (wxColor (150, 170, 150), 1, wxSOLID)); |
|
967 for (j = 1; j < 22; j++) |
|
968 MonDc.DrawLine ((int) (30 * j + left - 15), (int) (300 + top), |
|
969 (int) (30 * j + left - 15), (int) (top)); |
|
970 MonDc.DrawLine ((int) (30 * 22 + left - 15), (int) (300 + top), |
|
971 (int) (30 * 22 + left - 15), (int) (top)); |
|
972 |
|
973 double m = (-vmin) * d; |
|
974 MonDc.SetPen (wxPen (wxColor (170, 170, 150), 3, wxSOLID)); |
|
975 MonDc.DrawLine ((int) (left), (int) (300 + top - m), (int) (left + 660), |
|
976 (int) (300 + top - m)); |
|
977 |
|
978 wxClientDC MaLeg (mylegpan); |
|
979 MaLeg.Clear (); |
|
980 |
|
981 MaLeg.SetPen (wxPen (wxColour (150, 200, 100), 2, wxSOLID)); |
|
982 MaLeg. |
|
983 SetFont (wxFont |
|
984 (7, wxSWISS, wxNORMAL, wxNORMAL, false, wxT ("Arial Black"))); |
|
985 for (int k = 1, tmpi = 0; k < 30; k++) |
|
986 { |
|
987 if ((tmpi < 8) && is_set (k, inlist, in)) |
|
988 { |
|
989 if (k <= 4) |
|
990 tmps.Printf (wxT ("Analogue Output %d"), k); |
|
991 if ((k > 4) && (k <= 12)) |
|
992 tmps.Printf (wxT ("Bool Output %d"), k - 4); |
|
993 if ((k > 12) && (k <= 20)) |
|
994 tmps.Printf (wxT ("Analogue Input %d"), k - 12); |
|
995 if ((k > 20) && (k <= 28)) |
|
996 tmps.Printf (wxT ("Bool Input %d"), k - 20); |
|
997 |
|
998 MaLeg.DrawRotatedText (tmps, 0, 10 * tmpi, 0); |
|
999 MaLeg.SetPen (wxPen (col[tmpi], 4, wxSOLID)); |
|
1000 MaLeg.DrawLine (100, 10 * tmpi + 6, 115, 10 * tmpi + 6); |
|
1001 //////////////////////////////////////////DAW//////////////////////////////////////// |
|
1002 MonDc.SetPen (wxPen (col[tmpi], 4, wxSOLID)); |
|
1003 if (k <= 4) |
|
1004 y[k - 1][(int) g] = Write_Analogue_Output_16_Bit[k - 1]; |
|
1005 if ((k > 4) && (k <= 12)) |
|
1006 y[k - 1][(int) g] = get_bit (Write_Outputs_8_Bit[0], k - 4); |
|
1007 if ((k > 12) && (k <= 20)) |
|
1008 y[k - 1][(int) g] = Read_Analogue_Input_16_Bit[k - 1 - 12]; |
|
1009 if ((k > 20) && (k <= 28)) |
|
1010 y[k - 1][(int) g] = get_bit (Read_Inputs_8_Bit[0], k - 20); |
|
1011 |
|
1012 if (y[k - 1][(int) g] > old_max) |
|
1013 old_max = y[k - 1][(int) g]; |
|
1014 if (y[k - 1][(int) g] < old_min) |
|
1015 old_min = y[k - 1][(int) g]; |
|
1016 for (j = 1; j < (g + 1); j++) |
|
1017 { |
|
1018 p = (y[k - 1][j - 1] - vmin) * d; |
|
1019 q = (y[k - 1][j] - vmin) * d; |
|
1020 MonDc.DrawLine ((int) (15 * (j - 1) + left), |
|
1021 (int) (300 + top - p), (int) (15 * j + left), |
|
1022 (int) (300 + top - q)); |
|
1023 } |
|
1024 ///////////////////////////////////////////////////////////////////////////////////// |
|
1025 tmpi++; |
|
1026 } |
|
1027 } |
|
1028 } |
864 } |
1029 |
865 |
1030 void |
866 void |
1031 actu_output (void) |
867 actu_output (void) |
1032 { |
868 { |