some minor tweaks

This commit is contained in:
2019-08-06 11:45:50 +03:00
parent effbfbad2a
commit e3e5b2cc5d
7 changed files with 15 additions and 19 deletions

View File

@@ -62,7 +62,7 @@ export class GcodeSenderComponent extends React.PureComponent<
const gcodeLinesQueue = [...this.state.gcodeLinesQueue];
const gcodeLinesSent = [...this.state.gcodeLinesSent];
const { executing } = this.state;
if (executing && status.commandQueue < 5) {
if (executing && status.commandQueue < 1) {
if (gcodeLinesQueue && gcodeLinesQueue.length > 0) {
const command = gcodeLinesQueue.shift();
console.log(parseCommand(command));

View File

@@ -49,7 +49,7 @@ export default class GcodeVisualiser extends React.PureComponent<
: "blue"
}
strokeWidth={
(command.Z ? command.Z : lastPos.eng) ? 2 : 1
(command.Z ? command.Z : lastPos.eng) ? 1 : 0.5
}
/>
);
@@ -92,7 +92,7 @@ export default class GcodeVisualiser extends React.PureComponent<
: "blue"
}
strokeWidth={
(command.Z ? command.Z : lastPos.eng) ? 2 : 1
(command.Z ? command.Z : lastPos.eng) ? 1 : 0.5
}
/>
);

View File

@@ -17,6 +17,7 @@ String WebAPI::getStatusJson() {
doc["mmS"] = status.mmS;
doc["pEng"] = status.pEng;
doc["xLim"] = status.xLim;
doc["batt"] = analogRead(A0);
String out;
serializeJson(doc, out);

View File

@@ -6,5 +6,6 @@ constexpr unsigned int stsUpdDelay{10};
constexpr float defRPM{2}, defEggLength{60}, defEggDia{45}, xLimit{85};
constexpr float defYDegPerMM{360 / (PI * defEggDia)},
defXDegPerMM{xLimit / defEggLength};
constexpr int adjustDelay{100};
#endif

View File

@@ -31,4 +31,4 @@ void Pen::init() {
bool Pen::getEngaged() { return engaged; }
Pen pen(7, 100, 175);
Pen pen(7, 100, 180);

View File

@@ -1,8 +1,9 @@
#include "Stepper.h"
#include <Arduino.h>
#include <util/atomic.h>
Stepper::Stepper(int stepPin, int dirPin,
int stepsPerRevolution, int limit, float degreesPerMM)
Stepper::Stepper(int stepPin, int dirPin, int stepsPerRevolution, int limit,
float degreesPerMM)
: dirPin(dirPin),
stepPin(stepPin),
stepsPerRevolution(stepsPerRevolution),
@@ -16,7 +17,7 @@ void Stepper::doStep() {
if (remainingSteps > 0) {
digitalWrite(dirPin, direction);
digitalWrite(stepPin, 1);
delayMicroseconds(2);
delayMicroseconds(10);
digitalWrite(stepPin, 0);
remainingSteps--;
}

View File

@@ -8,7 +8,6 @@
#include "common/Status.h"
int curRPM = defRPM;
int adjustDelay = 100;
bool needAdjust;
int calculateDelay(float rpm, int stepsPerRevolution) {
@@ -23,20 +22,14 @@ void adjustRPM() {
unsigned int stepsY = eggStepper.getRemainingSteps();
if (stepsX != 0 && stepsY != 0) {
if (stepsX > stepsY) {
float rpm = (float)curRPM * (float)stepsY / (float)stepsX;
eggStepperRPM = rpm;
eggStepperRPM = (float)curRPM * (float)stepsY / (float)stepsX;
} else if (stepsY > stepsX) {
float rpm = (float)curRPM * (float)stepsX / (float)stepsY;
servoStepperRPM = rpm;
servoStepperRPM = (float)curRPM * (float)stepsX / (float)stepsY;
}
}
}
int newEggStepperDelay =
calculateDelay(eggStepperRPM, STEPS_PER_REVOLUTION);
int newServoStepperDelay =
calculateDelay(servoStepperRPM, STEPS_PER_REVOLUTION);
eggStepperDelay = newEggStepperDelay;
servoStepperDelay = newServoStepperDelay;
eggStepperDelay = calculateDelay(eggStepperRPM, STEPS_PER_REVOLUTION);
servoStepperDelay = calculateDelay(servoStepperRPM, STEPS_PER_REVOLUTION);
}
Command command;
@@ -125,7 +118,7 @@ volatile bool armed = false;
/*
We use our own timer for more precise timings
And it ticks only when armed, to ensure
that updateExecution() doesn't skip a single tick
that steppersRoutine() doesn't skip a single tick
*/
ISR(TIMER2_COMPA_vect) {
if (armed) {