Commit 45fc6b0c authored by Simone Primarosa's avatar Simone Primarosa

Merge pull request #2 from MagoKimbra/master

Update from master
parents e92e02e0 6d4099ba
...@@ -7224,11 +7224,6 @@ void prepare_move() { ...@@ -7224,11 +7224,6 @@ void prepare_move() {
if (!prepare_move_cartesian()) return; if (!prepare_move_cartesian()) return;
#endif #endif
#ifdef IDLE_OOZING_PREVENT || EXTRUDER_RUNOUT_PREVENT
axis_last_activity = millis();
axis_is_moving = false;
#endif
set_current_to_destination(); set_current_to_destination();
} }
......
...@@ -605,30 +605,30 @@ float junction_deviation = 0.1; ...@@ -605,30 +605,30 @@ float junction_deviation = 0.1;
#endif #endif
// Compute direction bits for this block // Compute direction bits for this block
uint8_t db = 0; uint8_t dirb = 0;
#if ENABLED(COREXY) #if ENABLED(COREXY)
if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis if (dx < 0) dirb |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) db |= BIT(Y_HEAD); // ...and Y if (dy < 0) dirb |= BIT(Y_HEAD); // ...and Y
if (dz < 0) db |= BIT(Z_AXIS); if (dz < 0) dirb |= BIT(Z_AXIS);
if (da < 0) db |= BIT(A_AXIS); // Motor A direction if (da < 0) dirb |= BIT(A_AXIS); // Motor A direction
if (db < 0) db |= BIT(B_AXIS); // Motor B direction if (db < 0) dirb |= BIT(B_AXIS); // Motor B direction
#elif ENABLED(COREXZ) #elif ENABLED(COREXZ)
if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis if (dx < 0) dirb |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) db |= BIT(Y_AXIS); if (dy < 0) dirb |= BIT(Y_AXIS);
if (dz < 0) db |= BIT(Z_HEAD); // ...and Z if (dz < 0) dirb |= BIT(Z_HEAD); // ...and Z
if (da < 0) db |= BIT(A_AXIS); // Motor A direction if (da < 0) dirb |= BIT(A_AXIS); // Motor A direction
if (dc < 0) db |= BIT(C_AXIS); // Motor B direction if (dc < 0) dirb |= BIT(C_AXIS); // Motor B direction
#else #else
if (dx < 0) db |= BIT(X_AXIS); if (dx < 0) dirb |= BIT(X_AXIS);
if (dy < 0) db |= BIT(Y_AXIS); if (dy < 0) dirb |= BIT(Y_AXIS);
if (dz < 0) db |= BIT(Z_AXIS); if (dz < 0) dirb |= BIT(Z_AXIS);
#endif #endif
if (de < 0) db |= BIT(E_AXIS); if (de < 0) dirb |= BIT(E_AXIS);
block->direction_bits = db; block->direction_bits = dirb;
block->active_driver = driver; block->active_driver = driver;
//enable active axes // Enable active axes
#if ENABLED(COREXY) #if ENABLED(COREXY)
if (block->steps[A_AXIS] || block->steps[B_AXIS]) { if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
enable_x(); enable_x();
......
...@@ -2260,103 +2260,129 @@ char *ftostr52(const float &x) { ...@@ -2260,103 +2260,129 @@ char *ftostr52(const float &x) {
#include "Nextion.h" #include "Nextion.h"
bool NextionON = false; bool NextionON = false;
bool PageInfo = false;
char buffer[100] = {0}; char buffer[100] = {0};
char lcd_status_message[30] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1 char lcd_status_message[30] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
uint8_t lcd_status_message_level = 0; uint8_t lcd_status_message_level = 0;
// Text // Text
NexText Hotend0 = NexText(1, 3, "t0"); NexText Hotend0 = NexText(1, 1, "t0");
NexText Hotend1 = NexText(1, 7, "t1"); NexText Hotend1 = NexText(1, 4, "t1");
NexText Hotend2 = NexText(1, 9, "t2"); NexText Hotend2 = NexText(1, 5, "t2");
NexText Hotend3 = NexText(1, 12, "t3"); NexText Hotend21 = NexText(1, 6, "h2");
NexText Bed = NexText(1, 16, "t4"); NexText LedStatus = NexText(1, 7, "t4");
NexText LedStatus = NexText(1, 26, "t5"); NexText LedCoord = NexText(1, 8, "t5");
NexText LedCoord = NexText(1, 27, "t6");
NexText set0 = NexText(2, 2, "set0"); NexText set0 = NexText(2, 2, "set0");
NexText set1 = NexText(2, 15, "set1"); NexText set1 = NexText(2, 15, "set1");
// Picture
NexPicture Menu = NexPicture(1, 10, "p0");
NexPicture MSD = NexPicture(1, 11, "p1");
NexPicture MSetup = NexPicture(1, 12, "p2");
NexPicture Hend0 = NexPicture(1, 13, "p3");
NexPicture Hend1 = NexPicture(1, 14, "p4");
NexPicture Hend2 = NexPicture(1, 15, "p5");
NexPicture Fanpic = NexPicture(1, 19, "p6");
// Progress Bar // Progress Bar
NexProgressBar jp0 = NexProgressBar(1, 2, "jp0");
NexProgressBar jp1 = NexProgressBar(1, 5, "jp1"); // Wafeform
NexProgressBar jp2 = NexProgressBar(1, 8, "jp2"); NexWaveform Graph0 = NexWaveform(1, 9, "s0");
NexProgressBar jp3 = NexProgressBar(1, 11, "jp3");
NexProgressBar jp4 = NexProgressBar(1, 14, "jp4");
// Touch area // Touch area
NexHotspot homex = NexHotspot(1, 17, "homex"); NexHotspot hot0 = NexHotspot(1, 14, "hot0");
NexHotspot homey = NexHotspot(1, 18, "homey"); NexHotspot hot1 = NexHotspot(1, 16, "hot1");
NexHotspot homez = NexHotspot(1, 19, "homez"); NexHotspot hot2 = NexHotspot(1, 18, "hot2");
NexHotspot home0 = NexHotspot(1, 20, "home0");
NexHotspot hot0 = NexHotspot(1, 21, "hot0");
NexHotspot hot1 = NexHotspot(1, 22, "hot1");
NexHotspot hot2 = NexHotspot(1, 23, "hot2");
NexHotspot hot3 = NexHotspot(1, 24, "hot3");
NexHotspot hot4 = NexHotspot(1, 25, "hot4");
NexHotspot m11 = NexHotspot(2, 14, "m11"); NexHotspot m11 = NexHotspot(2, 14, "m11");
NexHotspot tup = NexHotspot(2, 16, "tup"); NexHotspot tup = NexHotspot(2, 16, "tup");
NexHotspot tdown = NexHotspot(2, 17, "tdown"); NexHotspot tdown = NexHotspot(2, 17, "tdown");
NexTouch *nexListenList[] = NexTouch *nex_listen_list[] =
{ {
&homex, &Menu,
&homey, &MSD,
&homez, &MSetup,
&home0, &Fanpic,
&hot0, &hot0,
&hot1, &hot1,
&hot2, &hot2,
&hot3,
&hot4,
&m11, &m11,
&tup, &tup,
&tdown, &tdown,
NULL NULL
}; };
void homePopCallback(void *ptr) { void setpageInfo() {
if (ptr == &homex) sendCommand("page info");
enqueuecommands_P(PSTR("G28 X"));
else if (ptr == &homey) PageInfo = true;
enqueuecommands_P(PSTR("G28 Y"));
else if (ptr == &homey) #if HAS_TEMP_0
enqueuecommands_P(PSTR("G28 Z")); Hend0.setPic(7);
else if (ptr == &home0) #endif
enqueuecommands_P(PSTR("G28")); #if HAS_TEMP_1
Hend1.setPic(7);
#endif
#if HAS_TEMP_1
Hend2.setPic(7);
#elif HAS_TEMP_BED
Hotend21.setText("BED");
Hend2.setPic(8);
#endif
#if ENABLED(SDSUPPORT)
MSD.setPic(4);
#endif
}
void setFan() {
uint32_t number = 0;
Fanpic.getPic(&number);
if (number == 9) number = 10;
else number = 9;
Fanpic.setPic(number);
} }
void hotPopCallback(void *ptr) { void hotPopCallback(void *ptr) {
sendCommand("page 2"); sendCommand("page 2");
PageInfo = false;
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
if (ptr == &hot0) { if (ptr == &hot0) {
if (degTargetHotend(0) != 0) { if (degTargetHotend(0) != 0) {
itoa(degTargetHotend(0), buffer, 10); itoa(degTargetHotend(0), buffer, 10);
} }
set1.setText("M104 T0 S"); set1.setText("M104 T0 S");
sendCommand("page 2");
} }
if (ptr == &hot1) { if (ptr == &hot1) {
if (degTargetHotend(1) != 0) { if (degTargetHotend(1) != 0) {
itoa(degTargetHotend(1), buffer, 10); itoa(degTargetHotend(1), buffer, 10);
} }
set1.setText("M104 T1 S"); set1.setText("M104 T1 S");
sendCommand("page 2");
} }
#if HAS_TEMP_2
if (ptr == &hot2) { if (ptr == &hot2) {
if (degTargetHotend(2) != 0) { if (degTargetHotend(2) != 0) {
itoa(degTargetHotend(2), buffer, 10); itoa(degTargetHotend(2), buffer, 10);
} }
set1.setText("M104 T2 S"); set1.setText("M104 T2 S");
sendCommand("page 2");
} }
if (ptr == &hot3) { #elif HAS_TEMP_BED
if (degTargetHotend(3) != 0) { if (ptr == &hot2) {
itoa(degTargetHotend(3), buffer, 10);
}
set1.setText("M104 T3 S");
}
if (ptr == &hot4) {
if (degTargetBed() != 0) { if (degTargetBed() != 0) {
itoa(degTargetBed(), buffer, 10); itoa(degTargetBed(), buffer, 10);
} }
set1.setText("M140 S"); set1.setText("M140 S");
} }
#endif
set0.setText(buffer); set0.setText(buffer);
} }
...@@ -2381,10 +2407,24 @@ void sethotPopCallback(void *ptr) { ...@@ -2381,10 +2407,24 @@ void sethotPopCallback(void *ptr) {
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
set1.getText(buffer, sizeof(buffer)); set1.getText(buffer, sizeof(buffer));
enqueuecommands_P(buffer); enqueuecommands_P(buffer);
sendCommand("page menu"); setpageInfo();
lcd_setstatus(lcd_status_message); lcd_setstatus(lcd_status_message);
} }
void setpagePopCallback(void *ptr) {
if (ptr == &Menu)
sendCommand("page menu");
if (ptr == &MSD)
sendCommand("page msd");
if (ptr == &MSetup)
sendCommand("page setup");
}
void setfanPopCallback(void *ptr) {
if (fanSpeed) fanSpeed = 0;
else fanSpeed = 255;
}
millis_t next_lcd_update_ms; millis_t next_lcd_update_ms;
void lcd_init() { void lcd_init() {
...@@ -2394,20 +2434,24 @@ void lcd_init() { ...@@ -2394,20 +2434,24 @@ void lcd_init() {
} }
else { else {
ECHO_LM(DB, "Nextion LCD connected!"); ECHO_LM(DB, "Nextion LCD connected!");
homex.attachPop(homePopCallback, &homex); #if HAS_TEMP_0
homey.attachPop(homePopCallback, &homey);
homez.attachPop(homePopCallback, &homez);
home0.attachPop(homePopCallback, &home0);
hot0.attachPop(hotPopCallback, &hot0); hot0.attachPop(hotPopCallback, &hot0);
#endif
#if HAS_TEMP_1
hot1.attachPop(hotPopCallback, &hot1); hot1.attachPop(hotPopCallback, &hot1);
#endif
#if HAS_TEMP_2 || HAS_TEMP_BED
hot2.attachPop(hotPopCallback, &hot2); hot2.attachPop(hotPopCallback, &hot2);
hot3.attachPop(hotPopCallback, &hot3); #endif
hot4.attachPop(hotPopCallback, &hot4); Menu.attachPop(setpagePopCallback, &Menu);
MSD.attachPop(setpagePopCallback, &MSD);
MSetup.attachPop(setpagePopCallback, &Menu);
Fanpic.attachPop(setfanPopCallback, &Fanpic);
m11.attachPop(sethotPopCallback, &m11); m11.attachPop(sethotPopCallback, &m11);
tup.attachPop(settempPopCallback, &tup); tup.attachPop(settempPopCallback, &tup);
tdown.attachPop(settempPopCallback, &tdown); tdown.attachPop(settempPopCallback, &tdown);
delay(SPLASH_SCREEN_DURATION); // wait to display the splash screen delay(SPLASH_SCREEN_DURATION); // wait to display the splash screen
sendCommand("page menu"); setpageInfo();
lcd_setstatus(WELCOME_MSG); lcd_setstatus(WELCOME_MSG);
} }
} }
...@@ -2422,8 +2466,6 @@ static void temptoLCD(int h, int T1, int T2) { ...@@ -2422,8 +2466,6 @@ static void temptoLCD(int h, int T1, int T2) {
strcat(buffer, valuetemp); strcat(buffer, valuetemp);
uint32_t color = 1023; uint32_t color = 1023;
uint32_t prc = (T1/(T2 + 0.1)) * 100; uint32_t prc = (T1/(T2 + 0.1)) * 100;
String tempprc = String(prc);
String bar_id = "j" + String(h);
if (prc >= 50 && prc < 75) if (prc >= 50 && prc < 75)
color = 65519; color = 65519;
...@@ -2437,35 +2479,21 @@ static void temptoLCD(int h, int T1, int T2) { ...@@ -2437,35 +2479,21 @@ static void temptoLCD(int h, int T1, int T2) {
{ {
Hotend0.setText(buffer); Hotend0.setText(buffer);
Hotend0.setColor(color); Hotend0.setColor(color);
jp0.setValue(prc); Graph0.addValue(0, T1);
break; break;
} }
case 1: case 1:
{ {
Hotend1.setText(buffer); Hotend1.setText(buffer);
Hotend1.setColor(color); Hotend1.setColor(color);
jp1.setValue(prc); Graph0.addValue(1, T1);
break; break;
} }
case 2: case 2:
{ {
Hotend2.setText(buffer); Hotend2.setText(buffer);
Hotend2.setColor(color); Hotend2.setColor(color);
jp2.setValue(prc); Graph0.addValue(2, T1);
break;
}
case 3:
{
Hotend3.setText(buffer);
Hotend3.setColor(color);
jp3.setValue(prc);
break;
}
case 4:
{
Bed.setText(buffer);
Bed.setColor(color);
jp4.setValue(prc);
break; break;
} }
} }
...@@ -2514,16 +2542,24 @@ void lcd_update() { ...@@ -2514,16 +2542,24 @@ void lcd_update() {
if (!NextionON) return; if (!NextionON) return;
millis_t ms = millis(); nexLoop(nex_listen_list);
if (ms > next_lcd_update_ms) { millis_t ms = millis();
nexLoop(nexListenList); if (ms > next_lcd_update_ms && PageInfo) {
for (int h = 0; h < HOTENDS; h++) temptoLCD(h, degHotend(h), degTargetHotend(h)); if (fanSpeed > 0) setFan();
#if TEMP_SENSOR_BED != 0 #if HAS_TEMP_0
temptoLCD(4, degBed(), degTargetBed()); temptoLCD(0, degHotend(0), degTargetHotend(0));
#endif
#if HAS_TEMP_1
temptoLCD(1, degHotend(1), degTargetHotend(1));
#endif
#if HAS_TEMP_2
temptoLCD(2, degHotend(2), degTargetHotend(2));
#elif HAS_TEMP_BED
temptoLCD(2, degBed(), degTargetBed());
#endif #endif
coordtoLCD(); coordtoLCD();
......
...@@ -114,12 +114,13 @@ ...@@ -114,12 +114,13 @@
#elif ENABLED(NEXTION) #elif ENABLED(NEXTION)
#define LCD_UPDATE_INTERVAL 1000 #define LCD_UPDATE_INTERVAL 100
void homePopCallback(void *ptr); void setpagePopCallback(void *ptr);
void hotPopCallback(void *ptr); void hotPopCallback(void *ptr);
void sethotPopCallback(void *ptr); void sethotPopCallback(void *ptr);
void settempPopCallback(void *ptr); void settempPopCallback(void *ptr);
void setfanPopCallback(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