diff --git a/term/basicdrawpane.cpp b/term/basicdrawpane.cpp index 660d1069..1d585761 100644 --- a/term/basicdrawpane.cpp +++ b/term/basicdrawpane.cpp @@ -55,7 +55,7 @@ void BasicDrawPane::paintEvent(wxPaintEvent & evt) gc->SetPen(pen[i]); x = 0; y = h/2; - xstep = w/(data[i].size()-1); + xstep = (double)w/(double)(data[i].size()-1); path.MoveToPoint(x, y); for(auto point : data[i]){ y = h/2-point*h/2; @@ -80,16 +80,9 @@ void BasicDrawPane::paintEvent(wxPaintEvent & evt) void BasicDrawPane::plotvalue(float values[]) { - //std::cout << "data:" << value << std::endl; - //data.at(xpos) += 0.1; for (int i = 0; i 50){ - Refresh(); - // time = wxGetUTCTimeMillis(); - //} - //oder - //Update(); + xpos = ((int)xpos+1)%data[0].size(); + Refresh(); } diff --git a/term/basicdrawpane.hpp b/term/basicdrawpane.hpp index cec00020..af0d1697 100644 --- a/term/basicdrawpane.hpp +++ b/term/basicdrawpane.hpp @@ -27,5 +27,5 @@ public: private: wxLongLong time; std::vector> data; - int x,y,xpos,xstep; + double x,y,xpos,xstep; }; diff --git a/term/mainframe.cpp b/term/mainframe.cpp index 070a8235..a35308fa 100644 --- a/term/mainframe.cpp +++ b/term/mainframe.cpp @@ -173,6 +173,8 @@ void ServoFrame::OnChannelChange(wxCommandEvent& event){ } int ServoFrame::send(const string& s,bool h){ + if(!connected) + connect(); if(connected){ if(h){//history if((history.size()==0 || history.back() != s) && !s.empty()){ @@ -181,9 +183,6 @@ int ServoFrame::send(const string& s,bool h){ histpos = history.size(); } txqueue.push(s); - }else{ - wxMessageBox( wxT("Not connected"), wxT("Error"), wxICON_EXCLAMATION); - return 0; } return 1; }