Changeset View
Changeset View
Standalone View
Standalone View
src/core/printthread.cpp
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | 124 | { | |||
---|---|---|---|---|---|
133 | emit finished(); | 133 | emit finished(); | ||
134 | 134 | | |||
135 | } | 135 | } | ||
136 | void PrintThread::nextLine() | 136 | void PrintThread::nextLine() | ||
137 | { | 137 | { | ||
138 | d->cline = d->gcodestream->readLine(); | 138 | d->cline = d->gcodestream->readLine(); | ||
139 | qCDebug(PRINT_THREAD) << "Nextline:" << d->cline; | 139 | qCDebug(PRINT_THREAD) << "Nextline:" << d->cline; | ||
140 | d->stillSize -= d->cline.size() + 1; //remove read chars | 140 | d->stillSize -= d->cline.size() + 1; //remove read chars | ||
141 | d->printProgress = float(d->totalSize - d->stillSize) * 100.0 / float(d->totalSize); | 141 | d->printProgress = float(d->totalSize - d->stillSize) * 100 / float(d->totalSize); | ||
patrickelectric: Such precision is not necessary. | |||||
142 | qCDebug(PRINT_THREAD) << "progress:" << QString::number(d->printProgress); | 142 | qCDebug(PRINT_THREAD) << "progress:" << QString::number(double(d->printProgress)); | ||
143 | emit printProgressChanged(d->printProgress); | 143 | emit printProgressChanged(d->printProgress); | ||
144 | 144 | | |||
145 | if (d->cline.startsWith(QStringLiteral(";-"))) { | 145 | if (d->cline.startsWith(QStringLiteral(";-"))) { | ||
146 | injectCommand(d->cline); | 146 | injectCommand(d->cline); | ||
147 | d->cline = QStringLiteral(""); | 147 | d->cline = QStringLiteral(""); | ||
148 | return; | 148 | return; | ||
149 | } | 149 | } | ||
150 | //Remove Comments from the gcode. | 150 | //Remove Comments from the gcode. | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 189 | { | |||
203 | qCDebug(PRINT_THREAD) << "attempting to inject " << cmd; | 203 | qCDebug(PRINT_THREAD) << "attempting to inject " << cmd; | ||
204 | parser.process(cmd); | 204 | parser.process(cmd); | ||
205 | 205 | | |||
206 | if (parser.isSet(QStringLiteral("pause"))) { | 206 | if (parser.isSet(QStringLiteral("pause"))) { | ||
207 | d->core->pause(parser.positionalArguments().at(0)); | 207 | d->core->pause(parser.positionalArguments().at(0)); | ||
208 | } else if (parser.isSet(QStringLiteral("extruder temperature"))) { | 208 | } else if (parser.isSet(QStringLiteral("extruder temperature"))) { | ||
209 | QStringList args = parser.positionalArguments().at(0).split(QLatin1Char(',')); | 209 | QStringList args = parser.positionalArguments().at(0).split(QLatin1Char(',')); | ||
210 | bool wait = !QString::compare(args.at(2).simplified(), QStringLiteral("true"), Qt::CaseInsensitive); | 210 | bool wait = !QString::compare(args.at(2).simplified(), QStringLiteral("true"), Qt::CaseInsensitive); | ||
211 | d->core->setExtruderTemp(args.at(0).toInt(), args.at(1).toInt(), wait); | 211 | d->core->setExtruderTemp(args.at(0).toUInt(), args.at(1).toUInt(), wait); | ||
So -1 will be 2ˆ32 -1, tests need to be done before settings extruder temperature. patrickelectric: So -1 will be 2ˆ32 -1, tests need to be done before settings extruder temperature. | |||||
212 | } else if (parser.isSet(QStringLiteral("bed temperature"))) { | 212 | } else if (parser.isSet(QStringLiteral("bed temperature"))) { | ||
213 | QStringList args = parser.positionalArguments().at(0).split(QLatin1Char(',')); | 213 | QStringList args = parser.positionalArguments().at(0).split(QLatin1Char(',')); | ||
214 | bool wait = !QString::compare(args.at(1).simplified(), QStringLiteral("true"), Qt::CaseInsensitive); | 214 | bool wait = !QString::compare(args.at(1).simplified(), QStringLiteral("true"), Qt::CaseInsensitive); | ||
215 | d->core->setBedTemp(args.at(0).toInt(), wait); | 215 | d->core->setBedTemp(args.at(0).toUInt(), wait); | ||
216 | } else if (parser.isSet(QStringLiteral("print speed"))) { | 216 | } else if (parser.isSet(QStringLiteral("print speed"))) { | ||
217 | d->core->setPrinterSpeed(parser.positionalArguments().at(0).toInt()); | 217 | d->core->setPrinterSpeed(parser.positionalArguments().at(0).toUInt()); | ||
218 | } else if (parser.isSet(QStringLiteral("fan speed"))) { | 218 | } else if (parser.isSet(QStringLiteral("fan speed"))) { | ||
219 | d->core->setFanSpeed(parser.positionalArguments().at(0).toInt(), parser.positionalArguments().at(1).toInt()); | 219 | d->core->setFanSpeed(parser.positionalArguments().at(0).toUInt(), parser.positionalArguments().at(1).toUInt()); | ||
220 | } else if (parser.isSet(QStringLiteral("flow rate"))) { | 220 | } else if (parser.isSet(QStringLiteral("flow rate"))) { | ||
221 | d->core->setFlowRate(parser.positionalArguments().at(0).toInt()); | 221 | d->core->setFlowRate(parser.positionalArguments().at(0).toUInt()); | ||
222 | } else if (parser.isSet(QStringLiteral("message"))) { | 222 | } else if (parser.isSet(QStringLiteral("message"))) { | ||
223 | d->core->showMessage(parser.positionalArguments().at(0)); | 223 | d->core->showMessage(parser.positionalArguments().at(0)); | ||
224 | } else if (parser.isSet(QStringLiteral("command"))) { | 224 | } else if (parser.isSet(QStringLiteral("command"))) { | ||
225 | d->core->pushCommand(parser.positionalArguments().at(0)); | 225 | d->core->pushCommand(parser.positionalArguments().at(0)); | ||
226 | } else { | 226 | } else { | ||
227 | qCDebug(PRINT_THREAD) << "Attempted to inject unknown command: " << parser.positionalArguments(); | 227 | qCDebug(PRINT_THREAD) << "Attempted to inject unknown command: " << parser.positionalArguments(); | ||
228 | } | 228 | } | ||
229 | } | 229 | } |
Such precision is not necessary.