Commit 8da450d8 authored by MagoKimbra's avatar MagoKimbra

Fix Color Mixing & Update Nextion

parent 3f66083a
...@@ -66,7 +66,7 @@ static char command_queue[BUFSIZE][MAX_CMD_SIZE]; ...@@ -66,7 +66,7 @@ static char command_queue[BUFSIZE][MAX_CMD_SIZE];
float homing_feedrate[] = HOMING_FEEDRATE; float homing_feedrate[] = HOMING_FEEDRATE;
bool axis_relative_modes[] = AXIS_RELATIVE_MODES; bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
int feedrate_multiplier = 100; //100->1 200->2 int feedrate_multiplier = 100; // 100->1 200->2
int saved_feedrate_multiplier; int saved_feedrate_multiplier;
int extruder_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS(100); int extruder_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS(100);
int density_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS(100); int density_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS(100);
......
...@@ -163,6 +163,8 @@ volatile signed char count_direction[NUM_AXIS] = { 1 }; ...@@ -163,6 +163,8 @@ volatile signed char count_direction[NUM_AXIS] = { 1 };
#if DISABLED(COLOR_MIXING_EXTRUDER) #if DISABLED(COLOR_MIXING_EXTRUDER)
#define E_APPLY_STEP(v,Q) E_STEP_WRITE(v) #define E_APPLY_STEP(v,Q) E_STEP_WRITE(v)
#else
#define E_APPLY_STEP(v,Q)
#endif #endif
// intRes = intIn1 * intIn2 >> 16 // intRes = intIn1 * intIn2 >> 16
...@@ -715,20 +717,36 @@ ISR(TIMER1_COMPA_vect) { ...@@ -715,20 +717,36 @@ ISR(TIMER1_COMPA_vect) {
#define STEP_START(axis, AXIS) \ #define STEP_START(axis, AXIS) \
_COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \ _COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
if (_COUNTER(axis) > 0) { _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); } if (_COUNTER(axis) > 0) _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0);
#define STEP_START_MIXING \
for (uint8_t j = 0; j < DRIVER_EXTRUDERS; j++) { \
counter_m[j] += current_block->mix_event_count[j]; \
if (counter_m[j] > 0) En_STEP_WRITE(j, !INVERT_E_STEP_PIN); \
}
#define STEP_END(axis, AXIS) \
if (_COUNTER(axis) > 0) { \
_COUNTER(axis) -= current_block->step_event_count; \
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
}
#define STEP_END_MIXING \
for (uint8_t j = 0; j < DRIVER_EXTRUDERS; j++) { \
if (counter_m[j] > 0) { \
counter_m[j] -= current_block->step_event_count; \
En_STEP_WRITE(j, INVERT_E_STEP_PIN); \
} \
}
STEP_START(x, X); STEP_START(x, X);
STEP_START(y, Y); STEP_START(y, Y);
STEP_START(z, Z); STEP_START(z, Z);
#if DISABLED(ADVANCE) #if DISABLED(ADVANCE)
STEP_START(e, E);
#if ENABLED(COLOR_MIXING_EXTRUDER) #if ENABLED(COLOR_MIXING_EXTRUDER)
counter_e += current_block->steps[E_AXIS]; STEP_START_MIXING;
for (uint8_t j = 0; j < DRIVER_EXTRUDERS; j++) {
counter_m[j] += current_block->mix_event_count[j];
if (counter_m[j] > 0) En_STEP_WRITE(j, !INVERT_E_STEP_PIN);
}
#else
STEP_START(e, E);
#endif #endif
#endif #endif
...@@ -736,31 +754,13 @@ ISR(TIMER1_COMPA_vect) { ...@@ -736,31 +754,13 @@ ISR(TIMER1_COMPA_vect) {
HAL::delayMicroseconds(STEPPER_HIGH_LOW_DELAY); HAL::delayMicroseconds(STEPPER_HIGH_LOW_DELAY);
#endif #endif
#define STEP_END(axis, AXIS) \
if (_COUNTER(axis) > 0) { \
_COUNTER(axis) -= current_block->step_event_count; \
count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
_APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
}
STEP_END(x, X); STEP_END(x, X);
STEP_END(y, Y); STEP_END(y, Y);
STEP_END(z, Z); STEP_END(z, Z);
#if DISABLED(ADVANCE) #if DISABLED(ADVANCE)
STEP_END(e, E);
#if ENABLED(COLOR_MIXING_EXTRUDER) #if ENABLED(COLOR_MIXING_EXTRUDER)
// Always count the single E axis STEP_END_MIXING;
if (counter_e > 0) {
counter_e -= current_block->step_event_count;
count_position[E_AXIS] += count_direction[E_AXIS];
}
for (uint8_t j = 0; j < DRIVER_EXTRUDERS; j++) {
if (counter_m[j] > 0) {
counter_m[j] -= current_block->step_event_count;
En_STEP_WRITE(j, INVERT_E_STEP_PIN);
}
}
#else
STEP_END(e, E);
#endif #endif
#endif #endif
......
...@@ -23,17 +23,16 @@ ...@@ -23,17 +23,16 @@
#include "NexHardware.h" #include "NexHardware.h"
#include "NexButton.h" #include "NexButton.h"
#include "NexCrop.h" //#include "NexCrop.h"
#include "NexGauge.h" //#include "NexGauge.h"
#include "NexHotspot.h" #include "NexHotspot.h"
#include "NexPage.h" #include "NexPage.h"
#include "NexPicture.h" #include "NexPicture.h"
#include "NexProgressBar.h" #include "NexProgressBar.h"
#include "NexSlider.h" #include "NexSlider.h"
#include "NexText.h" #include "NexText.h"
#include "NexWaveform.h" //#include "NexWaveform.h"
#include "NexTimer.h" #include "NexTimer.h"
#include "NexVar.h" #include "NexVar.h"
#endif /* #ifndef __NEXTION_H__ */ #endif /* #ifndef __NEXTION_H__ */
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
NexPage Psetup = NexPage(5, 0, "setup"); NexPage Psetup = NexPage(5, 0, "setup");
NexPage Pmove = NexPage(6, 0, "move"); NexPage Pmove = NexPage(6, 0, "move");
NexPage Pspeed = NexPage(7, 0, "speed"); NexPage Pspeed = NexPage(7, 0, "speed");
NexPage Pgcode = NexPage(8, 0, "gcode");
// Page 0 Start // Page 0 Start
NexTimer startimer = NexTimer(0, 1, "tm0"); NexTimer startimer = NexTimer(0, 1, "tm0");
...@@ -115,6 +116,10 @@ ...@@ -115,6 +116,10 @@
// Page 7 Feed // Page 7 Feed
NexPicture SpeedOk = NexPicture(7, 2, "p0"); NexPicture SpeedOk = NexPicture(7, 2, "p0");
// Page 8 Gcode
NexText Tgcode = NexText(8, 1, "tgcode");
NexButton Benter = NexButton(8, 41, "benter");
NexTouch *nex_listen_list[] = NexTouch *nex_listen_list[] =
{ {
&Pstart, &Pstart,
...@@ -156,6 +161,7 @@ ...@@ -156,6 +161,7 @@
&ZUp, &ZUp,
&ZDown, &ZDown,
&SpeedOk, &SpeedOk,
&Benter,
NULL NULL
}; };
...@@ -424,6 +430,13 @@ ...@@ -424,6 +430,13 @@
setpageInfo(); setpageInfo();
} }
void setgcodePopCallback(void *ptr) {
memset(buffer, 0, sizeof(buffer));
Tgcode.getText(buffer, sizeof(buffer));
enqueuecommands_P(buffer);
Pmenu.show();
}
void setpagePopCallback(void *ptr) { void setpagePopCallback(void *ptr) {
if (ptr == &Menu) { if (ptr == &Menu) {
NextionPage = 3; NextionPage = 3;
...@@ -537,6 +550,7 @@ ...@@ -537,6 +550,7 @@
ZUp.attachPop(setmovePopCallback); ZUp.attachPop(setmovePopCallback);
ZDown.attachPop(setmovePopCallback); ZDown.attachPop(setmovePopCallback);
SpeedOk.attachPop(ExitPopCallback); SpeedOk.attachPop(ExitPopCallback);
Benter.attachPop(setgcodePopCallback);
startimer.enable(); startimer.enable();
} }
...@@ -639,7 +653,7 @@ ...@@ -639,7 +653,7 @@
if(IS_SD_PRINTING) { if(IS_SD_PRINTING) {
// Progress bar solid part // Progress bar solid part
sdbar.setValue(card.percentDone()); sdbar.setValue(card.percentDone());
NPlay.setPic(15); NPlay.setPic(17);
// Estimate End Time // Estimate End Time
uint16_t time = (millis() - print_job_start_ms) / 60000; uint16_t time = (millis() - print_job_start_ms) / 60000;
...@@ -654,7 +668,7 @@ ...@@ -654,7 +668,7 @@
} }
} }
else { else {
NPlay.setPic(14); NPlay.setPic(16);
} }
} }
else if (card.cardOK && SDstatus != 1) { else if (card.cardOK && SDstatus != 1) {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
void settempPopCallback(void *ptr); void settempPopCallback(void *ptr);
void setfanPopCallback(void *ptr); void setfanPopCallback(void *ptr);
void setmovePopCallback(void *ptr); void setmovePopCallback(void *ptr);
void setgcodePopCallback(void *ptr);
void lcd_update(); void lcd_update();
void lcd_init(); void lcd_init();
void lcd_setstatus(const char* message, const bool persist = false); void lcd_setstatus(const char* message, const bool persist = false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment