term width fix, autoconnect

This commit is contained in:
Rene Hopf
2015-11-27 01:25:46 +01:00
parent a12dbd6d07
commit 610f27dc06
3 changed files with 6 additions and 14 deletions
+3 -10
View File
@@ -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<channels; i++) {
data[i].at(xpos) = (float)values[i];
}
xpos = (xpos+1)%data[0].size();
//if(wxGetUTCTimeMillis()-time > 50){
Refresh();
// time = wxGetUTCTimeMillis();
//}
//oder
//Update();
xpos = ((int)xpos+1)%data[0].size();
Refresh();
}
+1 -1
View File
@@ -27,5 +27,5 @@ public:
private:
wxLongLong time;
std::vector<std::vector<float>> data;
int x,y,xpos,xstep;
double x,y,xpos,xstep;
};
+2 -3
View File
@@ -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;
}