moved servoterm into own repo

This commit is contained in:
Rene Hopf
2017-03-30 17:47:48 +02:00
parent efd5d30cd7
commit f58130539d
23 changed files with 0 additions and 847 deletions

5
.gitignore vendored
View File

@@ -10,11 +10,6 @@
*.raw
*.swp
.DS_Store
term/build
term/xbuild
new_term/build
new_term/xbuild
term/win32/bin
.depend
*.list
*.out

View File

@@ -1,29 +1,11 @@
language: cpp
install:
- git clone git://sigrok.org/libserialport
- cd libserialport
- "./autogen.sh && ./configure --prefix=/usr && make && sudo make install"
- cd ..
before_install:
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
- sudo add-apt-repository -y ppa:kalakris/cmake
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get -qq update
- sudo apt-get install -qq cmake pkg-config libwxgtk3.0-dev libudev-dev
- sudo apt-get install -qq libstdc++-4.8-dev
- sudo apt-get install -qq g++-4.8
- export CXX="g++-4.8" CC="gcc-4.8"
- sudo apt-get install gcc-arm-embedded
script:
- make
- cd term/
- mkdir build/
- cd build/
- cmake ../
- make VERBOSE=1
- cd ..
- cd ..
- ls
notifications:
irc:

View File

@@ -1,45 +0,0 @@
project(Servoterm)
cmake_minimum_required(VERSION 2.8)
include(FindPkgConfig)
list(APPEND PKGDEPS libserialport)
#find_package(PkgConfig)
pkg_check_modules(PKGDEPS REQUIRED ${PKGDEPS})
include_directories(${PKGDEPS_STATIC_INCLUDE_DIRS})
link_directories(${PKGDEPS_STATIC_LIBRARY_DIRS})
list(APPEND SERVOTERM_LINK_LIBS ${PKGDEPS_STATIC_LIBRARIES})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
add_definitions("-std=c++11")
add_definitions("-DSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
add_definitions("-D__WXDEBUG__")
###find_package(libserialport REQUIRED)
set(SRC_LIST
main.cpp
mainframe.cpp mainframe.hpp
basicdrawpane.cpp basicdrawpane.hpp
)
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets 3.0 COMPONENTS core base REQUIRED)
include(${wxWidgets_USE_FILE})
if(APPLE)
#set(MACOSX_BUNDLE_ICON_FILE "stmbl.icns" )
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/resources/stmbl.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SRC_LIST} ${CMAKE_CURRENT_SOURCE_DIR}/resources/stmbl.icns)
else(APPLE)
add_executable(${PROJECT_NAME} ${SRC_LIST})
endif(APPLE)
MESSAGE(STATUS "wxWidgets_LIBRARIES = ${wxWidgets_LIBRARIES}")
list(APPEND SERVOTERM_LINK_LIBS ${wxWidgets_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${SERVOTERM_LINK_LIBS})
install(TARGETS ${PROJECT_NAME} DESTINATION bin/)
#target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES})
#target_link_libraries(${PROJECT_NAME} ${LIBSERIALPORT_LIBRARIES})

View File

@@ -1,86 +0,0 @@
#include "basicdrawpane.hpp"
#include <wx/graphics.h>
const wxPen BasicDrawPane::pen[] = {
*wxBLACK_PEN,
*wxRED_PEN,
*wxBLUE_PEN,
*wxGREEN_PEN,
wxPen(wxColour(255, 128, 0)),
wxPen(wxColour(128, 128, 64)),
wxPen(wxColour(128, 64, 128)),
wxPen(wxColour(64, 128, 128))
};
BasicDrawPane::BasicDrawPane(wxFrame* parent, int ch) : wxPanel(parent){
time = wxGetUTCTimeMillis();
Bind(wxEVT_PAINT, &BasicDrawPane::paintEvent, this);
xpos = 0;
channels = ch;
for (int i = 0; i<channels; i++) {
data.push_back(std::vector<float>());
for (int j = 0; j<1024; j++) {
data[i].push_back(0);
}
}
}
void BasicDrawPane::Clear(){
for (int i = 0; i<channels; i++) {
for (auto &d : data[i]){
d = 0;
}
}
xpos = 0;
Refresh();
}
/*
* Called by the system of by wxWidgets when the panel needs
* to be redrawn. You can also trigger this call by
* calling Refresh()/Update().
*/
void BasicDrawPane::paintEvent(wxPaintEvent & evt)
{
wxPaintDC dc(this);
wxCoord w,h;
dc.GetSize(&w, &h);
wxGraphicsContext *gc = wxGraphicsContext::Create( dc );
if (gc)
{
for (int i = 0; i<channels; i++) {
wxGraphicsPath path = gc->CreatePath();
gc->SetPen(pen[i]);
x = 0;
y = h/2;
xstep = (double)w/(double)(data[i].size()-1);
path.MoveToPoint(x, y);
for(auto point : data[i]){
y = h/2-point*h/2;
path.AddLineToPoint(x, y);
x += xstep;
}
gc->StrokePath(path);
}
//center line
wxGraphicsPath path = gc->CreatePath();
gc->SetPen(*wxGREY_PEN);
path.MoveToPoint(0, h/2);
path.AddLineToPoint(w, h/2);
path.CloseSubpath();
gc->StrokePath(path);
delete gc;
}
}
void BasicDrawPane::plotvalue(float values[])
{
for (int i = 0; i<channels; i++) {
data[i].at(xpos) = (float)values[i];
}
xpos = ((int)xpos+1)%data[0].size();
Refresh();
}

View File

@@ -1,31 +0,0 @@
#pragma once
#include <wx/wx.h>
#include <wx/splitter.h>
#include <wx/listctrl.h>
#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>
#include <math.h>
#include <vector>
#include <libserialport.h>
class BasicDrawPane : public wxPanel
{
public:
BasicDrawPane(wxFrame* parent, int ch);
void paintEvent(wxPaintEvent & evt);
void paintNow();
void plotvalue(float[]);
void Clear();
int channels;
static const wxPen pen[];
private:
wxLongLong time;
std::vector<std::vector<float>> data;
double x,y,xpos,xstep;
};

View File

@@ -1,63 +0,0 @@
# FindGLM - attempts to locate the glm matrix/vector library.
#
# This module defines the following variables (on success):
# GLM_INCLUDE_DIRS - where to find glm/glm.hpp
# GLM_FOUND - if the library was successfully located
#
# It is trying a few standard installation locations, but can be customized
# with the following variables:
# GLM_ROOT_DIR - root directory of a glm installation
# Headers are expected to be found in either:
# <GLM_ROOT_DIR>/glm/glm.hpp OR
# <GLM_ROOT_DIR>/include/glm/glm.hpp
# This variable can either be a cmake or environment
# variable. Note however that changing the value
# of the environment varible will NOT result in
# re-running the header search and therefore NOT
# adjust the variables set by this module.
#=============================================================================
# Copyright 2012 Carsten Neumann
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# default search dirs
SET(_glm_HEADER_SEARCH_DIRS
"/usr/include"
"/usr/local/include")
# check environment variable
SET(_glm_ENV_ROOT_DIR "$ENV{GLM_ROOT_DIR}")
IF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
SET(GLM_ROOT_DIR "${_glm_ENV_ROOT_DIR}")
ENDIF(NOT GLM_ROOT_DIR AND _glm_ENV_ROOT_DIR)
# put user specified location at beginning of search
IF(GLM_ROOT_DIR)
SET(_glm_HEADER_SEARCH_DIRS "${GLM_ROOT_DIR}"
"${GLM_ROOT_DIR}/include"
${_glm_HEADER_SEARCH_DIRS})
ENDIF(GLM_ROOT_DIR)
# locate header
FIND_PATH(GLM_INCLUDE_DIR "glm/glm.hpp"
PATHS ${_glm_HEADER_SEARCH_DIRS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLM DEFAULT_MSG
GLM_INCLUDE_DIR)
IF(GLM_FOUND)
SET(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
MESSAGE(STATUS "GLM_INCLUDE_DIR = ${GLM_INCLUDE_DIR}")
ENDIF(GLM_FOUND)

View File

@@ -1,15 +0,0 @@
find_library(LIBSERIALPORT_LIBRARY serialport REQUIRED)
MESSAGE(STATUS "LIBSERIALPORT_LIBRARY = ${LIBSERIALPORT_LIBRARY}")
find_path(LIBSERIALPORT_INCLUDE_DIR libserialport.h)
MESSAGE(STATUS "LIBSERIALPORT_INCLUDE_DIR = ${LIBSERIALPORT_INCLUDE_DIR}")
set(LIBSERIALPORT_LIBRARIES ${LIBSERIALPORT_LIBRARY})
set(LIBSERIALPORT_INCLUDE_DIRS ${LIBSERIALPORT_INCLUDE_DIR})
MESSAGE(STATUS "LIBSERIALPORT_LIBRARIES = ${LIBSERIALPORT_LIBRARIES}")
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(libserialport DEFAULT_MSG LIBSERIALPORT_LIBRARY LIBSERIALPORT_INCLUDE_DIR)

View File

@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Servoterm</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>stmbl.icns</string>
<key>CFBundleIdentifier</key>
<string></string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string></string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
</dict>
</plist>

View File

@@ -1,85 +0,0 @@
#include <wx/wx.h>
#include <wx/filedlg.h>
#include <fstream>
#include "mainframe.hpp"
class Servoterm: public wxApp
{
public:
bool OnInit();
void OnOpen(wxCommandEvent& WXUNUSED(event));
void OnWrite(wxCommandEvent& WXUNUSED(event));
void OnRead(wxCommandEvent& WXUNUSED(event));
void OnSave(wxCommandEvent& WXUNUSED(event));
private:
ServoFrame* servoframe;
wxString filename;
int writeID;
int readID;
};
IMPLEMENT_APP(Servoterm)
using std::cout;
using std::endl;
using std::ifstream;
using std::string;
bool Servoterm::OnInit()
{
servoframe = new ServoFrame(wxT("Servoterm"));
wxMenuBar *menuBar = new wxMenuBar;
wxMenu *fileMenu = new wxMenu;
filename = "";
writeID = wxNewId();
readID = wxNewId();
menuBar->Append(fileMenu, "&File");
fileMenu->Append(wxID_OPEN);
Bind(wxEVT_COMMAND_MENU_SELECTED, &Servoterm::OnOpen, this, wxID_OPEN);
//fileMenu->Append(wxID_SAVE);
//Bind(wxEVT_COMMAND_MENU_SELECTED, &Servoterm::OnSave, this, wxID_SAVE);
fileMenu->Append(writeID, "&Write");
Bind(wxEVT_COMMAND_MENU_SELECTED, &Servoterm::OnWrite, this, writeID);
fileMenu->Append(readID, "&Read");
Bind(wxEVT_COMMAND_MENU_SELECTED, &Servoterm::OnRead, this, readID);
wxMenu *helpMenu = new wxMenu;
menuBar->Append(helpMenu, "&Help" );
servoframe->SetMenuBar( menuBar );
//frame->CreateStatusBar();
//frame->SetStatusText("Statuskram und so");
servoframe->Show(TRUE);
return TRUE;
}
void Servoterm::OnRead(wxCommandEvent& WXUNUSED(event)){
servoframe->send("conf");
}
void Servoterm::OnWrite(wxCommandEvent& WXUNUSED(event)){
ifstream infile(filename);
string line;
while (std::getline(infile, line))
{
servoframe->send(line);
}
}
void Servoterm::OnSave(wxCommandEvent& WXUNUSED(event)){
}
void Servoterm::OnOpen(wxCommandEvent& WXUNUSED(event)){
wxFileDialog openFileDialog(servoframe, wxEmptyString, SRCDIR"/../conf", "","*", wxFD_OPEN|wxFD_FILE_MUST_EXIST);
if (openFileDialog.ShowModal() == wxID_CANCEL)
return;
filename = openFileDialog.GetPath();
servoframe->SetTitle(filename);
}

View File

@@ -1,296 +0,0 @@
#include "mainframe.hpp"
using std::cout;
using std::endl;
using std::string;
using std::to_string;
ServoFrame::ServoFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title){
ports = 0;
currentID = wxID_LOWEST;
addr = -1;
connected = false;
histpos = 0;
wxBoxSizer *mainsizer = new wxBoxSizer(wxHORIZONTAL);
wxSplitterWindow *mainsplitter = new wxSplitterWindow(this,wxID_ANY,wxDefaultPosition, wxSize(1024,700),wxSP_LIVE_UPDATE|wxSP_3DSASH);
wxImage::AddHandler(new wxGIFHandler);
mainsplitter->SetSashGravity(0);
mainsplitter->SetMinimumPaneSize(100);
mainsizer->Add(mainsplitter, 1,wxEXPAND,0);
timer = new wxTimer(this, wxID_ANY);
Bind(wxEVT_TIMER,&ServoFrame::OnTimer,this,wxID_ANY);
//top
wxPanel *top = new wxPanel(mainsplitter, wxID_ANY);
wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *leiste = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer *channelleiste = new wxBoxSizer(wxHORIZONTAL);
choose_port = new wxChoice (top, wxID_ANY);
connectbutton = new wxButton(top, wxID_ANY, wxT("&Connect"));
connectbutton->Disable();
clear = new wxButton(top, wxID_ANY, wxT("Clear"));
refresh = new wxButton(top, wxID_ANY, wxT("&Refresh"));
reset = new wxButton(top, wxID_ANY, wxT("Reset Fault"));
reset->Disable();
uhu = new wxRadioButton(top,wxID_ANY, "UHU");
stmbl = new wxRadioButton(top, wxID_ANY,"STMBL");
stmbl->SetValue(true);
refresh->Bind(wxEVT_BUTTON, &ServoFrame::OnRefresh, this, wxID_ANY);
connectbutton->Bind(wxEVT_BUTTON, &ServoFrame::OnConnect, this, wxID_ANY);
clear->Bind(wxEVT_BUTTON, &ServoFrame::OnClear, this, wxID_ANY);
reset->Bind(wxEVT_BUTTON, &ServoFrame::OnReset, this, wxID_ANY);
listports();
leiste->Add(choose_port, 0,wxALIGN_LEFT|wxALL,3);
leiste->Add(connectbutton,0,wxALIGN_LEFT|wxALL,3);
leiste->Add(refresh,0,wxALIGN_LEFT|wxALL,3);
leiste->Add(clear,0,wxALIGN_LEFT|wxALL,3);
leiste->Add(reset,0,wxALIGN_LEFT|wxALL,3);
leiste->Add(uhu,0,wxALIGN_LEFT|wxALL,3);
leiste->Add(stmbl,0,wxALIGN_LEFT|wxALL,3);
topsizer->Add(leiste);
drawpanel = new BasicDrawPane((wxFrame*)top,8);
topsizer->Add(drawpanel, 1,wxEXPAND,0);
wxArrayString waves;
waves.push_back("0");
waves.push_back("net0.cmd");
waves.push_back("net0.fb");
waves.push_back("pid0.pwm_cmd");
waves.push_back("pos_minus0.out");
//channels
channelstartID = currentID-1;//next ID
for(int i = 0;i<drawpanel->channels;i++){
wxBoxSizer *channelsizer = new wxBoxSizer(wxVERTICAL);
channelchoice.push_back(new wxComboBox (top, ++currentID, _T(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER));
channelchoice.back()->Bind(wxEVT_COMBOBOX,&ServoFrame::OnChannelChange, this, currentID);
channelchoice.back()->Bind(wxEVT_TEXT_ENTER,&ServoFrame::OnChannelChange, this, currentID);
channelchoice.back()->Set(waves);
channelchoice.back()->SetSelection(0);
wxPanel *c_panel;
c_panel = new wxPanel(top, wxID_NEW, wxPoint(150, 20), wxSize(20, 20), wxBORDER_NONE);
c_panel->SetBackgroundColour(drawpanel->pen[i].GetColour());
wxBoxSizer *sizer1 = new wxBoxSizer(wxHORIZONTAL);
sizer1->Add(c_panel, 0,wxALIGN_LEFT|wxALL,3);
sizer1->Add(channelchoice.back(), 1,wxALIGN_LEFT|wxALL,3);
channelsizer->Add(sizer1);
channelleiste->Add(channelsizer);
}
topsizer->Add(channelleiste);
top->SetSizer(topsizer);
//bottom
wxPanel *bottom = new wxPanel(mainsplitter, wxID_ANY);
text = new wxTextCtrl((wxFrame*)bottom,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY);
textinput = new wxTextCtrl((wxFrame*)bottom,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_PROCESS_ENTER);
textinput->Bind(wxEVT_TEXT_ENTER, &ServoFrame::OnInput, this, wxID_ANY);
textinput->Bind(wxEVT_KEY_DOWN, &ServoFrame::OnKeyDown, this, wxID_ANY);
//use monospace font
wxFont font = textinput->GetFont();
font = wxFont(font.GetPointSize(), wxTELETYPE, font.GetStyle(), font.GetWeight(), font.GetUnderlined());
textinput->SetFont(font);
text->SetFont(font);
wxBoxSizer *bottomsizer = new wxBoxSizer(wxVERTICAL);
bottomsizer->Add(text, 1,wxEXPAND|wxALL,3);
bottomsizer->Add(textinput, 0,wxEXPAND|wxALL,3);
bottom->SetSizer(bottomsizer);
mainsplitter->SplitHorizontally(top, bottom,500);
this->SetSizer(mainsizer);
mainsizer->SetSizeHints(this);
}
void ServoFrame::OnKeyDown(wxKeyEvent& event){
if(event.GetKeyCode() == 315){//up
if(histpos > 0 && history.size()>0){
textinput->SetValue(history.at(--histpos));
textinput->SetInsertionPointEnd();
}
}
else if(event.GetKeyCode() == 317){//down
if(histpos < history.size()-1 && history.size()>0){
textinput->SetValue(history.at(++histpos));
textinput->SetInsertionPointEnd();
}else if(histpos < history.size()){
histpos++;
textinput->SetValue(wxT(""));
}
}else if (event.GetKeyCode() == 9){}//tab
else{
event.Skip();
}
}
void ServoFrame::OnChannelChange(wxCommandEvent& event){
int channel = (int)((event.GetId()-channelstartID-2));
wxString value = event.GetString();
string df = "term0.wave";
df += to_string(channel);
df += " = ";
df += value;
send(df);
}
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()){
history.push_back(s);
}
histpos = history.size();
}
txqueue.push(s);
}
return 1;
}
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, "\n", 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;
if(uhu->GetValue()){
for (int i=0; i<ret; i++) {
if ((buf[i]>>7)) {
values[0] = (float)(buf[i]-128-64)/64;
drawpanel->plotvalue(values);
}else{
text->AppendText(wxString::FromAscii(buf[i] & 0x7f));
}
}
}else if(stmbl->GetValue()){
for (int i=0; i<ret; i++){
if(addr >= 0){
values[addr++] = (buf[i]-128) / 128.0;
if(addr == 8){
drawpanel->plotvalue(values);
addr = -1;
}
}else if (buf[i] == 0xff) {
addr = 0;
}else{
text->AppendText(wxString::FromAscii(buf[i] & 0x7f));
}
}
}
}else if(ret < 0){//disconnect on failure
disconnect();
}
}
}
void ServoFrame::OnRefresh(wxCommandEvent& WXUNUSED(event)){
listports();
}
void ServoFrame::OnReset(wxCommandEvent& WXUNUSED(event)){
send("fault0.reset = 1");
send("fault0.reset = 0");
}
void ServoFrame::listports(){
int selection = 0;
string description;
if (ports) {
sp_free_port_list(ports);
}
if(sp_list_ports(&ports) == SP_OK){
wxString str;
choose_port->Clear();
if(ports){
for (int i = 0; ports[i]; i++) {
description = sp_get_port_description(ports[i]);
choose_port->Append(description);
if(description.find("STMBL") != std::string::npos){
selection = i;
}
}
choose_port->SetSelection(selection);
connectbutton->Enable();
}else{
connectbutton->Disable();
}
}
}
void ServoFrame::OnClear(wxCommandEvent& WXUNUSED(event)){
text->Clear();
drawpanel->Clear();
}
void ServoFrame::OnConnect(wxCommandEvent& WXUNUSED(event)){
if(connected)
disconnect();
else
connect();
}
void ServoFrame::connect(){
if(choose_port->IsEmpty())
return;
port = ports[choose_port->GetSelection()];
if(sp_open(port, SP_MODE_READ_WRITE) == SP_OK){//port available and can be opened
sp_set_baudrate(port,38400);
sp_set_bits(port, 8);
sp_set_stopbits(port, 1);
sp_set_parity(port, SP_PARITY_NONE);
sp_set_xon_xoff(port, SP_XONXOFF_DISABLED);
sp_set_flowcontrol(port, SP_FLOWCONTROL_NONE);
connected = true;
connectbutton->SetLabel(wxT("&Disonnect"));
refresh->Disable();
reset->Enable();
choose_port->Disable();
uhu->Disable();
stmbl->Disable();
textinput->SetFocus();
timer->Start(50);
}else{
wxMessageBox( wxT("Cannot open port"), wxT("Error"), wxICON_EXCLAMATION);
listports();
}
}
void ServoFrame::disconnect(){
if(sp_close(port) == SP_OK){
connected = false;
connectbutton->SetLabel(wxT("&Connect"));
refresh->Enable();
reset->Disable();
choose_port->Enable();
uhu->Enable();
stmbl->Enable();
timer->Stop();
}
listports();
}
void ServoFrame::OnInput(wxCommandEvent& event){
string s =string(textinput->GetValue().mb_str());
send(s,true);
textinput->Clear();
}

View File

@@ -1,63 +0,0 @@
#pragma once
#include <wx/wx.h>
#include <wx/splitter.h>
#include <wx/listctrl.h>
#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>
#include <wx/config.h>
#include <math.h>
#include <vector>
#include <queue>
#include <libserialport.h>
#include "basicdrawpane.hpp"
class ServoFrame : public wxFrame
{
public:
ServoFrame(const wxString& title);
int send(const std::string& s,bool h = false);
private:
wxButton *connectbutton;
wxButton *refresh;
wxButton *clear;
wxButton *reset;
wxRadioButton *uhu;
wxRadioButton *stmbl;
wxTimer * timer;
struct sp_port **ports;
struct sp_port *port;
wxChoice *choose_port;
std::vector<wxComboBox *> channelchoice;
bool connected;
void OnConnect(wxCommandEvent& WXUNUSED(event));
void OnRefresh(wxCommandEvent& WXUNUSED(event));
void OnReset(wxCommandEvent& WXUNUSED(event));
void OnClear(wxCommandEvent& WXUNUSED(event));
void OnInput(wxCommandEvent& event);
void OnChannelChange(wxCommandEvent& event);
void OnPosChange(wxCommandEvent& event);
void OnGainChange(wxCommandEvent& event);
void OnKeyDown(wxKeyEvent& event);
void OnTimer(wxTimerEvent& evt);
void connect();
void disconnect();
void listports();
static const int bufsize = 20000;
unsigned char buf[ServoFrame::bufsize+1];
wxTextCtrl *text;
wxTextCtrl *textinput;
wxWindowID currentID;
wxWindowID channelstartID;//StartID of channel config
BasicDrawPane *drawpanel;
std::vector<wxString> history;
int histpos;
int addr;
float values[16];
std::queue<std::string> txqueue;
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 KiB

View File

@@ -1,102 +0,0 @@
#!/bin/bash
##
## This file is part of the sigrok-util project.
##
## Copyright (C) 2013-2014 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
set -e
# Build target: "i686" (32bit) or "x86_64" (64bit).
TARGET="i686"
#git clone https://github.com/mxe/mxe.git
#make build-requirements -j 16
#make MXE_TARGETS=i686-w64-mingw32.static gcc wxwidgets -j16
# The path where your MXE directory is located.
MXE=$HOME/dev/mxe
# The path where the cross-compiled packages will be installed.
PREFIX=$HOME/dev/stmbl/term/win32/
# The path where to download files to and where to build packages.
BUILDDIR=$HOME/dev/stmbl/term/win32/build
# Edit this to enable/disable/modify parallel compiles.
PARALLEL="-j 2"
# You usually don't need to change anything below this line.
# -----------------------------------------------------------------------------
VER_LIBUSB_WIN32=1.2.6.0
VER_ZADIG=v2.0.1.160
SF_MIRROR=switch.dl.sourceforge.net
WGET="wget --quiet"
GIT_CLONE="git clone --depth=1"
# -----------------------------------------------------------------------------
# We need to find tools in the toolchain.
export PATH=$MXE/usr/bin:$PATH
TOOLCHAIN_TRIPLET="$TARGET-w64-mingw32.static"
P="$PREFIX/lib/pkgconfig"
P2="$MXE/usr/$TOOLCHAIN_TRIPLET/lib/pkgconfig"
C="--host=$TOOLCHAIN_TRIPLET --prefix=$PREFIX"
CM="-DCMAKE_TOOLCHAIN_FILE=$MXE/usr/$TOOLCHAIN_TRIPLET/share/cmake/mxe-conf.cmake"
L="--disable-shared --enable-static"
if [ $TARGET == "i686" ]; then
export PKG_CONFIG_PATH_i686_w64_mingw32_static="$P:$P2"
else
export PKG_CONFIG_PATH_x86_64_w64_mingw32_static="$P:$P2"
fi
# Remove build directory contents (if any) and create a new build dir.
rm -rf $BUILDDIR
mkdir -p $BUILDDIR
cd $BUILDDIR
# -----------------------------------------------------------------------------
mkdir -p $PREFIX
# libserialport
$GIT_CLONE git://sigrok.org/libserialport
cd libserialport
./autogen.sh
./configure $C $L
make $PARALLEL V=1
make install
cd ..
# Servoterm
mkdir term
cd term
cmake $CM -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX -DDISABLE_WERROR=y ../../../
make $PARALLEL VERBOSE=1
make install
#makensis -DHOME=$HOME contrib/pulseview_cross.nsi
cd ..
rm -rf $BUILDDIR
rm -rf $PREFIX/lib $PREFIX/include