Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 364 → Rev 372

/Misc Projects/PcMarlinInterface/PcMarlinInterface.pro
File deleted
/Misc Projects/PcMarlinInterface/PcMarlinInterface.pro.user
File deleted
/Misc Projects/PcMarlinInterface/GCodeInterface.pro
0,0 → 1,35
#-------------------------------------------------
#
# Project created by QtCreator 2015-01-02T06:41:32
#
#-------------------------------------------------
 
QT += core gui serialport
 
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
TARGET = PcMarlinInterface
TEMPLATE = app
 
 
SOURCES += main.cpp \
MainWindow.cpp \
SerialHelper.cpp \
MacroWidget.cpp \
SerialWidget.cpp \
IOWidget.cpp \
PasteController.cpp
 
HEADERS += GlobalDefines.h \
MainWindow.h \
SerialHelper.h \
MacroWidget.h \
SerialWidget.h \
IOWidget.h \
PasteController.h
 
RESOURCES += Resources.qrc
 
RC_FILE = Icon.rc
 
FORMS +=
/Misc Projects/PcMarlinInterface/GCodeInterface.pro.user
0,0 → 1,257
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.3.0, 2015-06-25T15:18:35. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{22bd4f67-ea17-48ee-8299-171e5aa125c2}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.4.0 MSVC2013 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.4.0 MSVC2013 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.54.win64_msvc2013_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Kevin/Documents/Code/QT/build-GCodeInterface-Desktop_Qt_5_4_0_MSVC2013_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Kevin/Documents/Code/QT/build-GCodeInterface-Desktop_Qt_5_4_0_MSVC2013_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">GCodeInterface</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Kevin/Documents/Code/QT/GCodeInterface/GCodeInterface.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">GCodeInterface.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">18</value>
</data>
<data>
<variable>Version</variable>
<value type="int">18</value>
</data>
</qtcreator>
/Misc Projects/PcMarlinInterface/GlobalDefines.h
23,6 → 23,11
#include <QAction>
#include <QStatusBar>
 
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QQueue>
#include <QTextStream>
#include <QTime>
#include <QTimer>
#include <QFileDialog>
#include <QFileInfo>
/Misc Projects/PcMarlinInterface/IOWidget.cpp
5,7 → 5,7
// Serial data UI
textData = new QTextEdit();
textData->setCurrentFont(QFont("Consolas", 8));
textData->append("Waiting for serial connection...");
textData->append("Waiting for serial connection... ");
textData->setMinimumSize(400, 100);
textData->setReadOnly(true);
textTransmit = new QLineEdit();
28,7 → 28,9
connect(textTransmit, SIGNAL(returnPressed()), btnTransmit, SIGNAL(clicked()));
connect(btnClear, SIGNAL(clicked()), this, SLOT(ClearBtn()));
 
EnableTransmit(false);
// EnableTransmit(false);
textTransmit->setEnabled(false);
btnTransmit->setEnabled(false);
lastTransmit = true;
}
 
47,13 → 49,15
str = QString(data);
}
 
emit TransmitByteArray(str.toUtf8());
textData->setTextColor(Qt::darkBlue);
 
QStringList cmds = str.split('\n');
QTime curTime = QTime::currentTime();
QStringList cmds = str.split('\n', QString::SkipEmptyParts);
for (int i = 0; i < cmds.size(); i++) {
textData->append("TX: " + cmds[i]);
emit TransmitByteArray((cmds[i] + '\n').toUtf8());
textData->setTextColor(Qt::darkBlue);
textData->append(curTime.toString("[HH:mm:ss:zzz]: ") + cmds[i]);
}
textData->moveCursor(QTextCursor::End);
textData->ensureCursorVisible();
 
// Save a flag indicating last activity was a transmit
lastTransmit = true;
62,13 → 66,17
void IOWidget::ProcessReceivedByte(QByteArray data)
{
textData->setTextColor(Qt::darkRed);
data.replace("\n", "\nRX: ");
QTime curTime = QTime::currentTime();
QString timeString = "\n" + curTime.toString("[HH:mm:ss:zzz]: ");
if (data.endsWith('\n')) data.remove(data.size()-1, 1);
data.replace('\n', timeString);
if (lastTransmit) {
textData->insertPlainText("\nRX: " + QString(data));
textData->insertPlainText(timeString + QString(data));
} else {
textData->insertPlainText(QString(data));
}
textData->moveCursor(QTextCursor::End);
textData->ensureCursorVisible();
lastTransmit = false;
}
 
79,11 → 87,17
 
void IOWidget::EnableTransmit(bool enable)
{
textData->setTextColor(Qt::black);
if (enable) {
textTransmit->setEnabled(true);
btnTransmit->setEnabled(true);
textData->insertPlainText("connected!");
} else {
textTransmit->setEnabled(false);
btnTransmit->setEnabled(false);
textData->append("Serial disconnected.");
textData->append("Waiting for serial connection... ");
}
textData->moveCursor(QTextCursor::End);
textData->ensureCursorVisible();
}
/Misc Projects/PcMarlinInterface/MacroWidget.cpp
5,8 → 5,8
sigmapTransmit = new QSignalMapper();
sigmapKeybind = new QSignalMapper();
 
btnExport = new QPushButton("&Export");
btnImport = new QPushButton("&Import");
btnExport = new QPushButton("Export");
btnImport = new QPushButton("Import");
btnAddMacro = new QPushButton("&Add");
btnRemoveMacro = new QPushButton("&Remove");
btnClear = new QPushButton("&Clear");
/Misc Projects/PcMarlinInterface/MainWindow.cpp
51,6 → 51,7
pasteDockWidget->hide();
connect(serialWidget, SIGNAL(Connected(bool)), pasteWidget, SLOT(EnableTransmit(bool)));
connect(pasteWidget, SIGNAL(TransmitData(QByteArray)), ioWidget, SLOT(PreprocessTransmit(QByteArray)));
connect(serialWidget, SIGNAL(ReceivedByte(QByteArray)), pasteWidget, SLOT(ProcessData(QByteArray)));
 
// Connect local widgets
connect(btnMacro, SIGNAL(clicked()), macroDockWidget->toggleViewAction(), SLOT(trigger()));
/Misc Projects/PcMarlinInterface/MainWindow.h
6,6 → 6,7
#include "MacroWidget.h"
#include "IOWidget.h"
#include "PasteController.h"
#include "GerberParser.h"
 
class MainWindow : public QMainWindow
{
/Misc Projects/PcMarlinInterface/PasteController.cpp
7,13 → 7,17
xPos = yPos = zPos = 0.0;
X_Incr = X_Decr = Y_Incr = Y_Decr = Z_Incr = Z_Decr = E_Incr = false;
 
transmittingData = false;
queueCmds = new QQueue<QString>();
 
tmrUpdate = new QTimer(this);
connect(tmrUpdate, SIGNAL(timeout()), this, SLOT(UpdatePosition()));
connect(tmrUpdate, SIGNAL(timeout()), this, SLOT(MoveToolhead()));
 
QString helpString = "";
helpString.append("XY Control: Arrow Keys or H/J/K/L\n");
helpString.append("Z Control: PgUp/PgDown\n");
helpString.append("Extruder Control: Space");
helpString.append(" - Hold Shift for Slower Movement\n");
helpString.append("Extruder Trigger: Space");
labelHelp = new QLabel(helpString);
 
QVBoxLayout *helpLayout = new QVBoxLayout();
26,13 → 30,14
connect(btnEnableHotkeys, SIGNAL(clicked()), this, SLOT(ToggleHotkeys()));
 
btnInit = new QPushButton("&Initialize Printer");
connect(btnInit, SIGNAL(clicked()), this, SLOT(InitializePrinter()));
 
btnHome = new QPushButton("&Home Printhead");
connect(btnHome, SIGNAL(clicked()), this, SLOT(ResetPosition()));
 
QVBoxLayout *miscBtnLayout = new QVBoxLayout();
miscBtnLayout->addWidget(btnInit);
miscBtnLayout->addWidget(btnEnableHotkeys);
miscBtnLayout->addWidget(btnInit);
miscBtnLayout->addWidget(btnHome);
 
QGroupBox *miscBtnBox = new QGroupBox("Preset Commands");
52,36 → 57,37
btnForward->setIcon(iconUp);
btnForward->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnForward->setAutoRaise(true);
connect(btnForward, SIGNAL(clicked()), this, SLOT(UpdatePositionSingle()));
connect(btnForward, SIGNAL(clicked()), this, SLOT(MoveToolheadSingle()));
btnBackward = new QToolButton();
btnBackward->setIcon(iconDown);
btnBackward->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnBackward->setAutoRaise(true);
connect(btnBackward, SIGNAL(clicked()), this, SLOT(UpdatePositionSingle()));
connect(btnBackward, SIGNAL(clicked()), this, SLOT(MoveToolheadSingle()));
btnLeft = new QToolButton();
btnLeft->setIcon(iconLeft);
btnLeft->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnLeft->setAutoRaise(true);
connect(btnLeft, SIGNAL(clicked()), this, SLOT(UpdatePositionSingle()));
connect(btnLeft, SIGNAL(clicked()), this, SLOT(MoveToolheadSingle()));
btnRight = new QToolButton();
btnRight->setIcon(iconRight);
btnRight->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnRight->setAutoRaise(true);
connect(btnRight, SIGNAL(clicked()), this, SLOT(UpdatePositionSingle()));
connect(btnRight, SIGNAL(clicked()), this, SLOT(MoveToolheadSingle()));
btnUp = new QToolButton();
btnUp->setIcon(iconAdd);
btnUp->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnUp->setAutoRaise(true);
connect(btnUp, SIGNAL(clicked()), this, SLOT(UpdatePositionSingle()));
connect(btnUp, SIGNAL(clicked()), this, SLOT(MoveToolheadSingle()));
btnDown = new QToolButton();
btnDown->setIcon(iconRemove);
btnDown->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnDown->setAutoRaise(true);
connect(btnDown, SIGNAL(clicked()), this, SLOT(UpdatePositionSingle()));
connect(btnDown, SIGNAL(clicked()), this, SLOT(MoveToolheadSingle()));
btnExtrude = new QToolButton();
btnExtrude->setIcon(iconDelete);
btnExtrude->setIconSize(QSize(BTN_ICON_SIZE,BTN_ICON_SIZE));
btnExtrude->setAutoRaise(true);
connect(btnExtrude, SIGNAL(clicked()), this, SLOT(ExtrudeSingle()));
 
QGridLayout *btnXYELayout = new QGridLayout();
btnXYELayout->addWidget(btnForward, 0, 1, 1, 1);
113,17 → 119,19
textXValue->setMaximumWidth(60);
textXValue->setFont(QFont("", 10, QFont::Bold));
textXValue->setAlignment(Qt::AlignCenter);
textXValue->setText(QString::number(xPos, 'f', 2));
textYValue = new QLineEdit();
textYValue->setReadOnly(true);
textYValue->setMaximumWidth(60);
textYValue->setFont(QFont("", 10, QFont::Bold));
textYValue->setAlignment(Qt::AlignCenter);
textYValue->setText(QString::number(yPos, 'f', 2));
textZValue = new QLineEdit();
textZValue->setReadOnly(true);
textZValue->setMaximumWidth(60);
textZValue->setFont(QFont("", 10, QFont::Bold));
textZValue->setAlignment(Qt::AlignCenter);
UpdatePosition();
textZValue->setText(QString::number(zPos, 'f', 2));
 
QHBoxLayout *posValueLayout = new QHBoxLayout();
posValueLayout->addWidget(labelXPos);
160,7 → 168,7
 
labelEForwardSteps = new QLabel("Extrude Step (mm):");
sliderEForwardSteps = new QSlider(Qt::Horizontal);
textEForwardSteps = new QSpinBox();
textEForwardSteps = new QDoubleSpinBox();
textEForwardSteps->setMinimumWidth(60);
labelEForwardSpeed = new QLabel("Extrude Speed (mm/s):");
sliderEForwardSpeed = new QSlider(Qt::Horizontal);
168,12 → 176,16
textEForwardSpeed->setMinimumWidth(60);
labelEBackwardSteps = new QLabel("Retract Step (mm):");
sliderEBackwardSteps = new QSlider(Qt::Horizontal);
textEBackwardSteps = new QSpinBox();
textEBackwardSteps = new QDoubleSpinBox();
textEBackwardSteps->setMinimumWidth(60);
labelEBackwardSpeed = new QLabel("Retract Speed: (mm/s)");
sliderEBackwardSpeed = new QSlider(Qt::Horizontal);
textEBackwardSpeed = new QSpinBox();
textEBackwardSpeed->setMinimumWidth(60);
labelExtrusionHeight = new QLabel("Extrude Height (mm):");
sliderExtrusionHeight = new QSlider(Qt::Horizontal);
textExtrusionHeight = new QDoubleSpinBox();
textExtrusionHeight->setMinimumWidth(60);
labelEZSteps = new QLabel("Z Axis Step (mm):");
sliderEZSteps = new QSlider(Qt::Horizontal);
textEZSteps = new QDoubleSpinBox();
181,32 → 193,33
 
connect(sliderXYSteps, SIGNAL(valueChanged(int)), this, SLOT(QSliderToQDoubleSpinBox(int)));
connect(textXYSteps, SIGNAL(valueChanged(double)), this, SLOT(QDoubleSpinBoxToQSlider(double)));
sliderXYSteps->setRange(0, 5000);
textXYSteps->setRange(0,50);
sliderXYSteps->setRange(0, 1000);
textXYSteps->setRange(0,10);
textXYSteps->setSingleStep(0.1);
textXYSteps->setValue(10);
textXYSteps->setValue(0.5);
connect(sliderXYSpeed, SIGNAL(valueChanged(int)), textXYSpeed, SLOT(setValue(int)));
connect(textXYSpeed, SIGNAL(valueChanged(int)), sliderXYSpeed, SLOT(setValue(int)));
sliderXYSpeed->setRange(1, 10000);
textXYSpeed->setRange(1, 10000);
textXYSpeed->setValue(4000);
sliderXYSpeed->setRange(1, 4000);
textXYSpeed->setRange(1, 4000);
textXYSpeed->setSingleStep(100);
textXYSpeed->setValue(600);
connect(sliderZSteps, SIGNAL(valueChanged(int)), this, SLOT(QSliderToQDoubleSpinBox(int)));
connect(textZSteps, SIGNAL(valueChanged(double)), this, SLOT(QDoubleSpinBoxToQSlider(double)));
sliderZSteps->setRange(0, 5000);
textZSteps->setRange(0, 50);
sliderZSteps->setRange(0, 1000);
textZSteps->setRange(0, 10);
textZSteps->setSingleStep(0.1);
textZSteps->setValue(10);
textZSteps->setValue(0.5);
connect(sliderZSpeed, SIGNAL(valueChanged(int)), textZSpeed, SLOT(setValue(int)));
connect(textZSpeed, SIGNAL(valueChanged(int)), sliderZSpeed, SLOT(setValue(int)));
sliderZSpeed->setRange(1, 10000);
textZSpeed->setRange(1, 10000);
textZSpeed->setValue(1000);
sliderZSpeed->setRange(1, 1000);
textZSpeed->setRange(1, 1000);
textZSpeed->setSingleStep(100);
textZSpeed->setValue(400);
connect(sliderRepeatDelay, SIGNAL(valueChanged(int)), textRepeatDelay, SLOT(setValue(int)));
connect(textRepeatDelay, SIGNAL(valueChanged(int)), sliderRepeatDelay, SLOT(setValue(int)));
connect(textRepeatDelay, SIGNAL(valueChanged(int)), this, SLOT(UpdateTimer(int)));
sliderRepeatDelay->setRange(20, 500);
textRepeatDelay->setRange(20, 500);
textRepeatDelay->setValue(100);
sliderRepeatDelay->setRange(1, 200);
textRepeatDelay->setRange(1, 200);
textRepeatDelay->setValue(45);
 
QGridLayout *xyRepeatLayout = new QGridLayout();
xyRepeatLayout->addWidget(labelXYSteps, 0, 0);
228,28 → 241,40
QGroupBox *xyRepeatBox = new QGroupBox("Movement Settings");
xyRepeatBox->setLayout(xyRepeatLayout);
 
connect(sliderEForwardSteps, SIGNAL(valueChanged(int)), textEForwardSteps, SLOT(setValue(int)));
connect(textEForwardSteps, SIGNAL(valueChanged(int)), sliderEForwardSteps, SLOT(setValue(int)));
sliderEForwardSteps->setRange(1, 10000);
textEForwardSteps->setRange(1, 10000);
textEForwardSteps->setValue(4000);
connect(sliderEForwardSteps, SIGNAL(valueChanged(int)), this, SLOT(QSliderToQDoubleSpinBox(int)));
connect(textEForwardSteps, SIGNAL(valueChanged(double)), this, SLOT(QDoubleSpinBoxToQSlider(double)));
sliderEForwardSteps->setRange(0, 10000);
textEForwardSteps->setRange(0, 100);
textEForwardSteps->setSingleStep(0.1);
textEForwardSteps->setValue(8);
connect(sliderEForwardSpeed, SIGNAL(valueChanged(int)), textEForwardSpeed, SLOT(setValue(int)));
connect(textEForwardSpeed, SIGNAL(valueChanged(int)), sliderEForwardSpeed, SLOT(setValue(int)));
sliderEForwardSpeed->setRange(1, 10000);
textEForwardSpeed->setRange(1, 10000);
textEForwardSpeed->setValue(1000);
connect(sliderEBackwardSteps, SIGNAL(valueChanged(int)), textEBackwardSteps, SLOT(setValue(int)));
connect(textEBackwardSteps, SIGNAL(valueChanged(int)), sliderEBackwardSteps, SLOT(setValue(int)));
sliderEBackwardSteps->setRange(1, 10000);
textEBackwardSteps->setRange(1, 10000);
textEBackwardSteps->setValue(2000);
textEForwardSpeed->setSingleStep(100);
textEForwardSpeed->setValue(800);
connect(sliderEBackwardSteps, SIGNAL(valueChanged(int)), this, SLOT(QSliderToQDoubleSpinBox(int)));
connect(textEBackwardSteps, SIGNAL(valueChanged(double)), this, SLOT(QDoubleSpinBoxToQSlider(double)));
sliderEBackwardSteps->setRange(0, 10000);
textEBackwardSteps->setRange(0, 100);
textEBackwardSteps->setSingleStep(0.1);
textEBackwardSteps->setValue(2);
connect(sliderEBackwardSpeed, SIGNAL(valueChanged(int)), textEBackwardSpeed, SLOT(setValue(int)));
connect(textEBackwardSpeed, SIGNAL(valueChanged(int)), sliderEBackwardSpeed, SLOT(setValue(int)));
sliderEBackwardSpeed->setRange(1, 10000);
textEBackwardSpeed->setRange(1, 10000);
textEBackwardSpeed->setValue(2000);
textEBackwardSpeed->setSingleStep(100);
textEBackwardSpeed->setValue(1600);
connect(sliderExtrusionHeight, SIGNAL(valueChanged(int)), this, SLOT(QSliderToQDoubleSpinBox(int)));
connect(textExtrusionHeight, SIGNAL(valueChanged(double)), this, SLOT(QDoubleSpinBoxToQSlider(double)));
connect(textExtrusionHeight, SIGNAL(valueChanged(double)), this, SLOT(SetBaseHeight()));
sliderExtrusionHeight->setRange(0, 400);
textExtrusionHeight->setRange(0, 4);
textExtrusionHeight->setSingleStep(0.1);
textExtrusionHeight->setValue(2);
connect(sliderEZSteps, SIGNAL(valueChanged(int)), this, SLOT(QSliderToQDoubleSpinBox(int)));
connect(textEZSteps, SIGNAL(valueChanged(double)), this, SLOT(QDoubleSpinBoxToQSlider(double)));
connect(textEZSteps, SIGNAL(valueChanged(double)), this, SLOT(SetBaseHeight()));
sliderEZSteps->setRange(0, 1000);
textEZSteps->setRange(0, 10);
textEZSteps->setSingleStep(0.1);
268,9 → 293,12
extruderLayout->addWidget(labelEBackwardSpeed, 4, 0);
extruderLayout->addWidget(sliderEBackwardSpeed, 4, 1);
extruderLayout->addWidget(textEBackwardSpeed, 4, 2);
extruderLayout->addWidget(labelEZSteps, 5, 0);
extruderLayout->addWidget(sliderEZSteps, 5, 1);
extruderLayout->addWidget(textEZSteps, 5, 2);
extruderLayout->addWidget(labelExtrusionHeight, 5, 0);
extruderLayout->addWidget(sliderExtrusionHeight, 5, 1);
extruderLayout->addWidget(textExtrusionHeight, 5, 2);
extruderLayout->addWidget(labelEZSteps, 6, 0);
extruderLayout->addWidget(sliderEZSteps, 6, 1);
extruderLayout->addWidget(textEZSteps, 6, 2);
 
QGroupBox *extruderBox = new QGroupBox("Extruder Settings");
extruderBox->setLayout(extruderLayout);
289,9 → 317,10
mainLayout->addLayout(column1Layout);
mainLayout->addLayout(column2Layout);
 
EnableTransmit(false);
 
setLayout(mainLayout);
setFixedSize(sizeHint());
 
}
 
PasteController::~PasteController()
301,8 → 330,34
 
void PasteController::EnableTransmit(bool en) {
connected = en;
btnEnableHotkeys->setEnabled(en);
btnInit->setEnabled(en);
btnHome->setEnabled(en);
btnForward->setEnabled(en);
btnBackward->setEnabled(en);
btnLeft->setEnabled(en);
btnRight->setEnabled(en);
btnDown->setEnabled(en);
btnUp->setEnabled(en);
btnExtrude->setEnabled(en);
}
 
void PasteController::InitializePrinter() {
queueCmds->enqueue("G90\n"); // Absolute positioning
queueCmds->enqueue("M83\n"); // Relative extrusion
queueCmds->enqueue("M204 S3000"); // Default acceleration (movement)
queueCmds->enqueue("M205 X10"); // Maximum XY jerk
queueCmds->enqueue("M302"); // Allow cold extrusions
 
if (!transmittingData) {
transmittingData = true;
emit TransmitData(queueCmds->head().toUtf8());
}
 
ResetPosition();
SetBaseHeight();
}
 
void PasteController::ToggleHotkeys() {
if (hotkeysEnabled) {
qApp->removeEventFilter(this);
314,20 → 369,45
hotkeysEnabled = !hotkeysEnabled;
}
 
void PasteController::UpdatePosition() {
if (X_Incr && !X_Decr) xPos += textXYSteps->value();
if (!X_Incr && X_Decr) xPos -= textXYSteps->value();
if (Y_Incr && !Y_Decr) yPos += textXYSteps->value();
if (!Y_Incr && Y_Decr) yPos -= textXYSteps->value();
if (Z_Incr && !Z_Decr) zPos += textZSteps->value();
if (!Z_Incr && Z_Decr) zPos -= textZSteps->value();
void PasteController::MoveToolhead() {
if (X_Incr && !X_Decr)
xPos = (xPos + textXYSteps->value() < X_MAX) ? xPos + textXYSteps->value() : X_MAX;
if (!X_Incr && X_Decr)
xPos = (xPos - textXYSteps->value() > X_MIN) ? xPos - textXYSteps->value() : X_MIN;
if (Y_Incr && !Y_Decr)
yPos = (yPos + textXYSteps->value() < Y_MAX) ? yPos + textXYSteps->value() : Y_MAX;
if (!Y_Incr && Y_Decr)
yPos = (yPos - textXYSteps->value() > Y_MIN) ? yPos - textXYSteps->value() : Y_MIN;
if (Z_Incr && !Z_Decr)
zPos = (zPos + textZSteps->value() < Z_MAX) ? zPos + textZSteps->value() : Z_MAX;
if (!Z_Incr && Z_Decr)
zPos = (zPos - textZSteps->value() > Z_MIN) ? zPos - textZSteps->value() : Z_MIN;
 
textXValue->setText(QString::number(xPos, 'f', 2));
textYValue->setText(QString::number(yPos, 'f', 2));
textZValue->setText(QString::number(zPos, 'f', 2));
UpdatePosition();
 
QString str;
QTextStream strIO(&str);
if (Z_Incr || Z_Decr) {
strIO << "G0";
strIO << " Z" << zPos;
strIO << " F" << textZSpeed->value();
strIO << "\n";
} else {
strIO << "G0";
strIO << " X" << xPos;
strIO << " Y" << yPos;
strIO << " F" << textXYSpeed->value();
strIO << "\n";
}
 
queueCmds->enqueue(str);
if (!transmittingData) {
transmittingData = true;
emit TransmitData(queueCmds->head().toUtf8());
}
}
 
void PasteController::UpdatePositionSingle() {
void PasteController::MoveToolheadSingle() {
if (QObject::sender() == btnRight) xPos += textXYSteps->value();
if (QObject::sender() == btnLeft) xPos -= textXYSteps->value();
if (QObject::sender() == btnForward) yPos += textXYSteps->value();
335,19 → 415,131
if (QObject::sender() == btnUp) zPos += textZSteps->value();
if (QObject::sender() == btnDown) zPos -= textZSteps->value();
 
UpdatePosition();
 
QString str;
QTextStream strIO(&str);
if (QObject::sender() == btnRight || QObject::sender() == btnLeft ||
QObject::sender() == btnForward || QObject::sender() == btnBackward) {
strIO << "G0";
strIO << " X" << xPos;
strIO << " Y" << yPos;
strIO << " F" << textXYSpeed->value();
strIO << "\n";
} else if (QObject::sender() == btnUp || QObject::sender() == btnDown) {
strIO << "G0";
strIO << " Z" << zPos;
strIO << " F" << textZSpeed->value();
strIO << "\n";
}
 
queueCmds->enqueue(str);
if (!transmittingData) {
transmittingData = true;
emit TransmitData(queueCmds->head().toUtf8());
}
}
 
void PasteController::UpdatePosition() {
textXValue->setText(QString::number(xPos, 'f', 2));
textYValue->setText(QString::number(yPos, 'f', 2));
textZValue->setText(QString::number(zPos, 'f', 2));
}
 
void PasteController::UpdateTimer(int delay) {
tmrUpdate->setInterval(delay);
void PasteController::ExtrudeSingle() {
QString str;
// Move printdown down
str = "G0 Z" + QString::number(textExtrusionHeight->value()) +
" F" + QString::number(textZSpeed->value()) + "\n";
zPos = textExtrusionHeight->value();
queueCmds->enqueue(str);
 
// Extrude paste
str = "G0 E-" + QString::number(textEForwardSteps->value()) +
" F" + QString::number(textEForwardSpeed->value()) + "\n";
queueCmds->enqueue(str);
 
// Retract paste
str = "G0 E" + QString::number(textEBackwardSteps->value()) +
" F" + QString::number(textEBackwardSpeed->value()) + "\n";
queueCmds->enqueue(str);
 
// Move printhead up
str = "G0 Z" + QString::number(textEZSteps->value() + textExtrusionHeight->value()) +
" F" + QString::number(textZSpeed->value()) + "\n";
zPos = textEZSteps->value() + textExtrusionHeight->value();
queueCmds->enqueue(str);
 
if (!transmittingData) {
transmittingData = true;
emit TransmitData(queueCmds->head().toUtf8());
}
}
 
void PasteController::ResetPosition() {
xPos = yPos = zPos = 0;
 
queueCmds->enqueue("G28\n"); // Home printhead
if (!transmittingData) {
transmittingData = true;
emit TransmitData(queueCmds->head().toUtf8());
}
 
MoveToolhead();
}
 
void PasteController::ProcessData(QByteArray data) {
static QString recvData;
if (transmittingData) {
// Need to wait for acknowledgement from the printer after each command
recvData.append(QString(data));
while (recvData.indexOf('\n') != -1) {
QString ret = recvData.left(recvData.indexOf('\n')+1);
recvData.remove(0, recvData.indexOf('\n')+1);
bool transmit = false;
if (ret.startsWith("ok")) {
// Last command successfully processed
queueCmds->dequeue();
transmit = true;
} else if (ret.startsWith("rs" || ret.startsWith("Resend"))) {
transmit = true;
} else if (ret.startsWith("!!" || ret.startsWith("Error"))) {
emit UpdateStatus("Hardware fault detected!");
queueCmds->clear();
} else if (ret.startsWith("echo")) {
// Ignore anything else sent
}
if (transmit && !queueCmds->isEmpty()) {
emit TransmitData(queueCmds->head().toUtf8());
} else if (queueCmds->isEmpty()){
transmittingData = false;
}
}
}
}
 
void PasteController::SetBaseHeight() {
if (connected) {
QString str = "G0 Z" + QString::number(textEZSteps->value() + textExtrusionHeight->value()) +
" F" + QString::number(textZSpeed->value()) + "\n";
zPos = textEZSteps->value() + textExtrusionHeight->value();
queueCmds->enqueue(str);
 
if (!transmittingData) {
transmittingData = true;
emit TransmitData(queueCmds->head().toUtf8());
}
UpdatePosition();
}
}
 
void PasteController::QSliderToQDoubleSpinBox(int) {
textXYSteps->setValue((double)sliderXYSteps->value()/100);
textZSteps->setValue((double)sliderZSteps->value()/100);
textEZSteps->setValue((double)sliderEZSteps->value()/100);
textEForwardSteps->setValue((double)sliderEForwardSteps->value()/100);
textEBackwardSteps->setValue((double)sliderEBackwardSteps->value()/100);
textExtrusionHeight->setValue((double)sliderExtrusionHeight->value()/100);
}
 
void PasteController::QDoubleSpinBoxToQSlider(double) {
354,13 → 546,11
sliderXYSteps->setValue(textXYSteps->value()*100);
sliderZSteps->setValue(textZSteps->value()*100);
sliderEZSteps->setValue(textEZSteps->value()*100);
sliderEForwardSteps->setValue((double)textEForwardSteps->value()*100);
sliderEBackwardSteps->setValue((double)textEBackwardSteps->value()*100);
sliderExtrusionHeight->setValue((double)textExtrusionHeight->value()*100);
}
 
void PasteController::ResetPosition() {
xPos = yPos = zPos = 0;
UpdatePosition();
}
 
bool PasteController::eventFilter(QObject *obj, QEvent *event)
{
// Only process keyboard press and release events
399,9 → 589,15
btnExtrude->setDown(true);
E_Incr = keychange = true;
}
if (X_Incr || X_Decr || Y_Incr || Y_Decr || Z_Incr || Z_Decr || E_Incr) {
UpdatePosition();
tmrUpdate->start();
if (E_Incr) {
ExtrudeSingle();
} else if (X_Incr || X_Decr || Y_Incr || Y_Decr || Z_Incr || Z_Decr) {
MoveToolhead();
if (keyevent->modifiers() == Qt::ShiftModifier) {
tmrUpdate->start(textRepeatDelay->value() * SLOW_MULTIPLIER);
} else {
tmrUpdate->start(textRepeatDelay->value());
}
}
if (keychange) return true;
}
440,7 → 636,7
btnExtrude->setDown(false);
E_Incr = keychange = false;
}
if (!X_Incr && !X_Decr && !Y_Incr && !Y_Decr && !Z_Incr && !Z_Decr && !E_Incr) {
if (!X_Incr && !X_Decr && !Y_Incr && !Y_Decr && !Z_Incr && !Z_Decr) {
tmrUpdate->stop();
}
if (keychange) return true;
/Misc Projects/PcMarlinInterface/PasteController.h
4,7 → 4,15
#include "GlobalDefines.h"
 
#define BTN_ICON_SIZE 32
#define X_MIN 0
#define X_MAX 290
#define Y_MIN 0
#define Y_MAX 270
#define Z_MIN 0
#define Z_MAX 240
 
#define SLOW_MULTIPLIER 4
 
class PasteController : public QWidget
{
Q_OBJECT
16,14 → 24,19
void EnableControls(void);
void DisableControls(void);
void TransmitData(QByteArray);
void UpdateStatus(QString);
 
public slots:
void EnableTransmit(bool);
void InitializePrinter(void);
void ToggleHotkeys(void);
void MoveToolhead(void);
void MoveToolheadSingle(void);
void UpdatePosition(void);
void UpdatePositionSingle(void);
void UpdateTimer(int);
void ExtrudeSingle(void);
void ResetPosition(void);
void ProcessData(QByteArray);
void SetBaseHeight(void);
 
void QSliderToQDoubleSpinBox(int);
void QDoubleSpinBoxToQSlider(double);
36,10 → 49,12
bool hotkeysEnabled;
double xPos,yPos,zPos;
bool X_Incr, X_Decr, Y_Incr, Y_Decr, Z_Incr, Z_Decr, E_Incr;
bool transmittingData;
 
void IncrementToolhead(double x, double y, double z);
void SingleExtrude(void);
 
QQueue<QString> *queueCmds;
QTimer *tmrUpdate;
 
QLabel *labelHelp;
89,7 → 104,7
// Extruder setting elements
QLabel *labelEForwardSteps;
QSlider *sliderEForwardSteps;
QSpinBox *textEForwardSteps;
QDoubleSpinBox *textEForwardSteps;
 
QLabel *labelEForwardSpeed;
QSlider *sliderEForwardSpeed;
97,12 → 112,16
 
QLabel *labelEBackwardSteps;
QSlider *sliderEBackwardSteps;
QSpinBox *textEBackwardSteps;
QDoubleSpinBox *textEBackwardSteps;
 
QLabel *labelEBackwardSpeed;
QSlider *sliderEBackwardSpeed;
QSpinBox *textEBackwardSpeed;
 
QLabel *labelExtrusionHeight;
QSlider *sliderExtrusionHeight;
QDoubleSpinBox *textExtrusionHeight;
 
QLabel *labelEZSteps;
QSlider *sliderEZSteps;
QDoubleSpinBox *textEZSteps;