mirror of
https://github.com/usatiuk/EggbotWireless.git
synced 2025-10-26 16:57:48 +01:00
some minor tweaks
This commit is contained in:
@@ -62,7 +62,7 @@ export class GcodeSenderComponent extends React.PureComponent<
|
|||||||
const gcodeLinesQueue = [...this.state.gcodeLinesQueue];
|
const gcodeLinesQueue = [...this.state.gcodeLinesQueue];
|
||||||
const gcodeLinesSent = [...this.state.gcodeLinesSent];
|
const gcodeLinesSent = [...this.state.gcodeLinesSent];
|
||||||
const { executing } = this.state;
|
const { executing } = this.state;
|
||||||
if (executing && status.commandQueue < 5) {
|
if (executing && status.commandQueue < 1) {
|
||||||
if (gcodeLinesQueue && gcodeLinesQueue.length > 0) {
|
if (gcodeLinesQueue && gcodeLinesQueue.length > 0) {
|
||||||
const command = gcodeLinesQueue.shift();
|
const command = gcodeLinesQueue.shift();
|
||||||
console.log(parseCommand(command));
|
console.log(parseCommand(command));
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export default class GcodeVisualiser extends React.PureComponent<
|
|||||||
: "blue"
|
: "blue"
|
||||||
}
|
}
|
||||||
strokeWidth={
|
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"
|
: "blue"
|
||||||
}
|
}
|
||||||
strokeWidth={
|
strokeWidth={
|
||||||
(command.Z ? command.Z : lastPos.eng) ? 2 : 1
|
(command.Z ? command.Z : lastPos.eng) ? 1 : 0.5
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ String WebAPI::getStatusJson() {
|
|||||||
doc["mmS"] = status.mmS;
|
doc["mmS"] = status.mmS;
|
||||||
doc["pEng"] = status.pEng;
|
doc["pEng"] = status.pEng;
|
||||||
doc["xLim"] = status.xLim;
|
doc["xLim"] = status.xLim;
|
||||||
|
doc["batt"] = analogRead(A0);
|
||||||
|
|
||||||
String out;
|
String out;
|
||||||
serializeJson(doc, out);
|
serializeJson(doc, out);
|
||||||
|
|||||||
@@ -6,5 +6,6 @@ constexpr unsigned int stsUpdDelay{10};
|
|||||||
constexpr float defRPM{2}, defEggLength{60}, defEggDia{45}, xLimit{85};
|
constexpr float defRPM{2}, defEggLength{60}, defEggDia{45}, xLimit{85};
|
||||||
constexpr float defYDegPerMM{360 / (PI * defEggDia)},
|
constexpr float defYDegPerMM{360 / (PI * defEggDia)},
|
||||||
defXDegPerMM{xLimit / defEggLength};
|
defXDegPerMM{xLimit / defEggLength};
|
||||||
|
constexpr int adjustDelay{100};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -31,4 +31,4 @@ void Pen::init() {
|
|||||||
|
|
||||||
bool Pen::getEngaged() { return engaged; }
|
bool Pen::getEngaged() { return engaged; }
|
||||||
|
|
||||||
Pen pen(7, 100, 175);
|
Pen pen(7, 100, 180);
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "Stepper.h"
|
#include "Stepper.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include <util/atomic.h>
|
||||||
|
|
||||||
Stepper::Stepper(int stepPin, int dirPin,
|
Stepper::Stepper(int stepPin, int dirPin, int stepsPerRevolution, int limit,
|
||||||
int stepsPerRevolution, int limit, float degreesPerMM)
|
float degreesPerMM)
|
||||||
: dirPin(dirPin),
|
: dirPin(dirPin),
|
||||||
stepPin(stepPin),
|
stepPin(stepPin),
|
||||||
stepsPerRevolution(stepsPerRevolution),
|
stepsPerRevolution(stepsPerRevolution),
|
||||||
@@ -16,7 +17,7 @@ void Stepper::doStep() {
|
|||||||
if (remainingSteps > 0) {
|
if (remainingSteps > 0) {
|
||||||
digitalWrite(dirPin, direction);
|
digitalWrite(dirPin, direction);
|
||||||
digitalWrite(stepPin, 1);
|
digitalWrite(stepPin, 1);
|
||||||
delayMicroseconds(2);
|
delayMicroseconds(10);
|
||||||
digitalWrite(stepPin, 0);
|
digitalWrite(stepPin, 0);
|
||||||
remainingSteps--;
|
remainingSteps--;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "common/Status.h"
|
#include "common/Status.h"
|
||||||
|
|
||||||
int curRPM = defRPM;
|
int curRPM = defRPM;
|
||||||
int adjustDelay = 100;
|
|
||||||
bool needAdjust;
|
bool needAdjust;
|
||||||
|
|
||||||
int calculateDelay(float rpm, int stepsPerRevolution) {
|
int calculateDelay(float rpm, int stepsPerRevolution) {
|
||||||
@@ -23,20 +22,14 @@ void adjustRPM() {
|
|||||||
unsigned int stepsY = eggStepper.getRemainingSteps();
|
unsigned int stepsY = eggStepper.getRemainingSteps();
|
||||||
if (stepsX != 0 && stepsY != 0) {
|
if (stepsX != 0 && stepsY != 0) {
|
||||||
if (stepsX > stepsY) {
|
if (stepsX > stepsY) {
|
||||||
float rpm = (float)curRPM * (float)stepsY / (float)stepsX;
|
eggStepperRPM = (float)curRPM * (float)stepsY / (float)stepsX;
|
||||||
eggStepperRPM = rpm;
|
|
||||||
} else if (stepsY > stepsX) {
|
} else if (stepsY > stepsX) {
|
||||||
float rpm = (float)curRPM * (float)stepsX / (float)stepsY;
|
servoStepperRPM = (float)curRPM * (float)stepsX / (float)stepsY;
|
||||||
servoStepperRPM = rpm;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int newEggStepperDelay =
|
eggStepperDelay = calculateDelay(eggStepperRPM, STEPS_PER_REVOLUTION);
|
||||||
calculateDelay(eggStepperRPM, STEPS_PER_REVOLUTION);
|
servoStepperDelay = calculateDelay(servoStepperRPM, STEPS_PER_REVOLUTION);
|
||||||
int newServoStepperDelay =
|
|
||||||
calculateDelay(servoStepperRPM, STEPS_PER_REVOLUTION);
|
|
||||||
eggStepperDelay = newEggStepperDelay;
|
|
||||||
servoStepperDelay = newServoStepperDelay;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Command command;
|
Command command;
|
||||||
@@ -125,7 +118,7 @@ volatile bool armed = false;
|
|||||||
/*
|
/*
|
||||||
We use our own timer for more precise timings
|
We use our own timer for more precise timings
|
||||||
And it ticks only when armed, to ensure
|
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) {
|
ISR(TIMER2_COMPA_vect) {
|
||||||
if (armed) {
|
if (armed) {
|
||||||
|
|||||||
Reference in New Issue
Block a user