2014-08-19 21:40:31 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <wx/wx.h>
|
|
|
|
#include <wx/splitter.h>
|
|
|
|
#include <wx/listctrl.h>
|
2014-08-20 17:13:43 +00:00
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/artprov.h>
|
|
|
|
#include <wx/stattext.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
#include <wx/choice.h>
|
|
|
|
#include <wx/arrstr.h>
|
|
|
|
#include <wx/button.h>
|
2014-10-02 19:21:33 +00:00
|
|
|
#include <wx/config.h>
|
2014-11-13 19:44:14 +00:00
|
|
|
#include <wx/slider.h>
|
2014-08-20 17:13:43 +00:00
|
|
|
#include <math.h>
|
2014-09-16 21:24:55 +00:00
|
|
|
#include <vector>
|
2015-11-26 22:33:47 +00:00
|
|
|
#include <queue>
|
2014-08-20 17:13:43 +00:00
|
|
|
#include <libserialport.h>
|
2014-09-21 00:32:12 +00:00
|
|
|
#include "basicdrawpane.hpp"
|
2014-08-19 21:40:31 +00:00
|
|
|
|
2015-01-27 21:06:24 +00:00
|
|
|
class ServoFrame : public wxFrame
|
2014-08-19 21:40:31 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-01-27 21:06:24 +00:00
|
|
|
ServoFrame(const wxString& title);
|
2015-11-17 14:25:28 +00:00
|
|
|
int send(const std::string& s,bool h = false);
|
2014-08-20 17:13:43 +00:00
|
|
|
private:
|
2014-09-18 01:16:17 +00:00
|
|
|
wxButton *connectbutton;
|
2014-08-20 17:13:43 +00:00
|
|
|
wxButton *refresh;
|
2014-09-17 22:35:14 +00:00
|
|
|
wxButton *clear;
|
2015-10-28 16:21:42 +00:00
|
|
|
wxButton *reset;
|
2014-09-22 18:54:34 +00:00
|
|
|
wxRadioButton *uhu;
|
|
|
|
wxRadioButton *stmbl;
|
2015-01-15 22:26:29 +00:00
|
|
|
wxTimer * timer;
|
2014-08-20 17:13:43 +00:00
|
|
|
struct sp_port **ports;
|
|
|
|
struct sp_port *port;
|
|
|
|
wxChoice *choose_port;
|
2015-07-02 17:31:10 +00:00
|
|
|
std::vector<wxComboBox *> channelchoice;
|
2014-11-13 19:44:14 +00:00
|
|
|
std::vector<wxSlider *> channelpos;
|
|
|
|
std::vector<wxSlider *> channelgain;
|
2014-08-20 17:13:43 +00:00
|
|
|
bool connected;
|
|
|
|
void OnConnect(wxCommandEvent& WXUNUSED(event));
|
|
|
|
void OnRefresh(wxCommandEvent& WXUNUSED(event));
|
2015-10-28 16:21:42 +00:00
|
|
|
void OnReset(wxCommandEvent& WXUNUSED(event));
|
2014-09-17 22:35:14 +00:00
|
|
|
void OnClear(wxCommandEvent& WXUNUSED(event));
|
2014-08-21 01:44:43 +00:00
|
|
|
void OnInput(wxCommandEvent& event);
|
2014-10-31 15:00:08 +00:00
|
|
|
void OnChannelChange(wxCommandEvent& event);
|
2014-11-13 19:44:14 +00:00
|
|
|
void OnPosChange(wxCommandEvent& event);
|
|
|
|
void OnGainChange(wxCommandEvent& event);
|
2014-09-21 02:20:14 +00:00
|
|
|
void OnKeyDown(wxKeyEvent& event);
|
2015-01-15 22:26:29 +00:00
|
|
|
void OnTimer(wxTimerEvent& evt);
|
2014-09-18 01:16:17 +00:00
|
|
|
void connect();
|
|
|
|
void disconnect();
|
2014-08-20 17:13:43 +00:00
|
|
|
void listports();
|
2015-03-14 23:07:51 +00:00
|
|
|
static const int bufsize = 20000;
|
2015-01-27 21:06:24 +00:00
|
|
|
unsigned char buf[ServoFrame::bufsize+1];
|
2014-08-21 01:44:43 +00:00
|
|
|
wxTextCtrl *text;
|
|
|
|
wxTextCtrl *textinput;
|
2014-11-13 19:44:14 +00:00
|
|
|
wxWindowID currentID;
|
|
|
|
wxWindowID channelstartID;//StartID of channel config
|
2014-08-21 01:44:43 +00:00
|
|
|
BasicDrawPane *drawpanel;
|
2014-09-21 02:20:14 +00:00
|
|
|
std::vector<wxString> history;
|
|
|
|
int histpos;
|
2014-11-03 00:29:57 +00:00
|
|
|
int addr;
|
2015-03-14 23:07:51 +00:00
|
|
|
float values[16];
|
2015-11-26 22:33:47 +00:00
|
|
|
std::queue<std::string> txqueue;
|
2014-08-19 21:40:31 +00:00
|
|
|
};
|