cons, term txqueue

This commit is contained in:
Rene Hopf
2015-11-26 23:33:47 +01:00
parent 294bb9cc0b
commit 446cacd833
4 changed files with 68 additions and 11 deletions
+53
View File
@@ -0,0 +1,53 @@
conf0.r = 9.600000
conf0.l = 0.013300
conf0.j = 0.000026
conf0.psi = 0.055000
conf0.polecount = 4.000000
conf0.mot_type = 0.000000
conf0.out_rev = 0.000000
conf0.high_motor_temp = 80.000000
conf0.max_motor_temp = 100.000000
conf0.phase_time = 0.500000
conf0.phase_cur = 1.000000
conf0.max_vel = 800.000000
conf0.max_acc = 100000.000077
conf0.max_force = 2.800000
conf0.max_dc_cur = 5.000000
conf0.max_ac_cur = 6.800000
conf0.fb_type = 2.000000
conf0.fb_polecount = 1.000000
conf0.fb_offset = 1.324000
conf0.fb_rev = 0.000000
conf0.fb_res = 1000.000000
conf0.autophase = 0.000000
conf0.cmd_type = 1.000000
conf0.cmd_unit = 0.000000
conf0.cmd_rev = 0.000000
conf0.cmd_res = 2000.000000
conf0.en_condition = 0.000000
conf0.error_out = 0.000000
conf0.pos_staic = 0.000000
conf0.sin_offset = 0.000000
conf0.cos_offset = 0.000000
conf0.sin_gain = 1.000000
conf0.cos_gain = 1.000000
conf0.max_dc_volt = 370.000000
conf0.max_hv_temp = 90.000000
conf0.max_core_temp = 55.000000
conf0.max_pos_error = 1.570796
conf0.high_dc_volt = 350.000000
conf0.low_dc_volt = 12.000000
conf0.high_hv_temp = 70.000000
conf0.fan_hv_temp = 60.000000
conf0.fan_core_temp = 450.000000
conf0.fan_motor_temp = 60.000000
conf0.p = 0.990000
conf0.pos_p = 150.000000
conf0.vel_p = 1.000000
conf0.acc_p = 0.200000
conf0.acc_pi = 100.000000
conf0.cur_p = 0.500000
conf0.cur_i = 0.000000
conf0.cur_ff = 1.000000
conf0.cur_ind = 0.900000
conf0.max_sat = 0.200000
+3 -4
View File
@@ -78,7 +78,7 @@ void Servoterm::OnDq(wxCommandEvent& WXUNUSED(event)){
}
void Servoterm::OnRead(wxCommandEvent& WXUNUSED(event)){
servoframe->send("conf");
}
void Servoterm::OnWrite(wxCommandEvent& WXUNUSED(event)){
@@ -86,8 +86,7 @@ void Servoterm::OnWrite(wxCommandEvent& WXUNUSED(event)){
string line;
while (std::getline(infile, line))
{
if(!servoframe->send(line))
break;
servoframe->send(line);
}
}
@@ -97,7 +96,7 @@ void Servoterm::OnSave(wxCommandEvent& WXUNUSED(event)){
}
void Servoterm::OnOpen(wxCommandEvent& WXUNUSED(event)){
wxFileDialog openFileDialog(servoframe, wxEmptyString, SRCDIR"/..", "","*", wxFD_OPEN|wxFD_FILE_MUST_EXIST);
wxFileDialog openFileDialog(servoframe, wxEmptyString, SRCDIR"/../conf", "","*", wxFD_OPEN|wxFD_FILE_MUST_EXIST);
if (openFileDialog.ShowModal() == wxID_CANCEL)
return;
filename = openFileDialog.GetPath();
+10 -7
View File
@@ -180,13 +180,7 @@ int ServoFrame::send(const string& s,bool h){
}
histpos = history.size();
}
int ret1 = sp_nonblocking_write(port, s.c_str(), s.length());
int ret2 = sp_nonblocking_write(port, "\r", 1);
if(ret1 != s.length() || ret2!=1){
wxMessageBox( wxT("Error while sending"), wxT("Error"), wxICON_EXCLAMATION);
disconnect();
return 0;
}
txqueue.push(s);
}else{
wxMessageBox( wxT("Not connected"), wxT("Error"), wxICON_EXCLAMATION);
return 0;
@@ -197,6 +191,15 @@ int ServoFrame::send(const string& s,bool h){
void ServoFrame::OnTimer(wxTimerEvent& evt){
int ret;
if(connected){
if(!txqueue.empty()){
int ret1 = sp_nonblocking_write(port, txqueue.front().c_str(), txqueue.front().length());
int ret2 = sp_nonblocking_write(port, "\r", 1);
if(ret1 != txqueue.front().length() || ret2!=1){
wxMessageBox( wxT("Error while sending"), wxT("Error"), wxICON_EXCLAMATION);
disconnect();
}
txqueue.pop();
}
ret = sp_nonblocking_read(port, buf, bufsize);
if(ret > 0){
buf[ret] = 0;
+2
View File
@@ -14,6 +14,7 @@
#include <wx/slider.h>
#include <math.h>
#include <vector>
#include <queue>
#include <libserialport.h>
#include "basicdrawpane.hpp"
@@ -62,4 +63,5 @@ private:
int histpos;
int addr;
float values[16];
std::queue<std::string> txqueue;
};