Merge pull request #155 from PavelSindler/MK2

M110 fix from thess; fan kickstart; Farm mode: asking for color used, changed statistics
This commit is contained in:
XPila 2017-07-24 12:40:46 +02:00 committed by GitHub
commit 4c0a299a2a
5 changed files with 107 additions and 14 deletions

View File

@ -5,7 +5,7 @@
#include "Configuration_prusa.h" #include "Configuration_prusa.h"
// Firmware version // Firmware version
#define FW_version "3.0.12-1" #define FW_version "3.0.12-2"
#define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC "PRUSA3DFW"
#define FW_PRUSA3D_MAGIC_LEN 10 #define FW_PRUSA3D_MAGIC_LEN 10

View File

@ -68,7 +68,7 @@
// When first starting the main fan, run it at full speed for the // When first starting the main fan, run it at full speed for the
// given number of milliseconds. This gets the fan spinning reliably // given number of milliseconds. This gets the fan spinning reliably
// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu) // before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
//#define FAN_KICKSTART_TIME 100 #define FAN_KICKSTART_TIME 1000

View File

@ -1385,7 +1385,7 @@ void get_command()
continue; continue;
if(serial_char == '\n' || if(serial_char == '\n' ||
serial_char == '\r' || serial_char == '\r' ||
(serial_char == ':' && comment_mode == false) || (serial_char == ':' && comment_mode == false) ||
serial_count >= (MAX_CMD_SIZE - 1) ) serial_count >= (MAX_CMD_SIZE - 1) )
{ {
if(!serial_count) { //if empty line if(!serial_count) { //if empty line
@ -1394,8 +1394,7 @@ void get_command()
} }
cmdbuffer[bufindw+serial_count+1] = 0; //terminate string cmdbuffer[bufindw+serial_count+1] = 0; //terminate string
if(!comment_mode){ if(!comment_mode){
comment_mode = false; //for new command if ((strchr_pointer = strstr(cmdbuffer+bufindw+1, "PRUSA")) == NULL && (strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) {
if ((strchr_pointer = strstr(cmdbuffer+bufindw+1, "PRUSA")) == NULL && (strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) {
if ((strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL) if ((strchr_pointer = strchr(cmdbuffer+bufindw+1, 'N')) != NULL)
{ {
// Line number met. When sending a G-code over a serial line, each line may be stamped with its index, // Line number met. When sending a G-code over a serial line, each line may be stamped with its index,
@ -4341,7 +4340,13 @@ Sigma_Exit:
} }
} }
} }
break; break;
case 110: // M110 - reset line pos
if (code_seen('N'))
gcode_LastN = code_value_long();
else
gcode_LastN = 0;
break;
case 115: // M115 case 115: // M115
if (code_seen('V')) { if (code_seen('V')) {
// Report the Prusa version number. // Report the Prusa version number.

View File

@ -2042,7 +2042,7 @@ void lcd_diag_show_end_stops()
void prusa_statistics(int _message) { void prusa_statistics(int _message, uint8_t _fil_nr) {
switch (_message) switch (_message)
@ -2111,14 +2111,18 @@ void prusa_statistics(int _message) {
break; break;
case 4: // print succesfull case 4: // print succesfull
SERIAL_ECHOLN("{[RES:1]"); SERIAL_ECHO("{[RES:1][FIL:");
MYSERIAL.print(int(_fil_nr));
SERIAL_ECHO("]");
prusa_stat_printerstatus(status_number); prusa_stat_printerstatus(status_number);
prusa_stat_farm_number(); prusa_stat_farm_number();
SERIAL_ECHOLN("}"); SERIAL_ECHOLN("}");
farm_timer = 2; farm_timer = 2;
break; break;
case 5: // print not succesfull case 5: // print not succesfull
SERIAL_ECHOLN("{[RES:0]"); SERIAL_ECHO("{[RES:0][FIL:");
MYSERIAL.print(int(_fil_nr));
SERIAL_ECHO("]");
prusa_stat_printerstatus(status_number); prusa_stat_printerstatus(status_number);
prusa_stat_farm_number(); prusa_stat_farm_number();
SERIAL_ECHOLN("}"); SERIAL_ECHOLN("}");
@ -3603,8 +3607,91 @@ static void lcd_farm_no()
} }
unsigned char lcd_choose_color() {
//function returns index of currently chosen item
//following part can be modified from 2 to 255 items:
//-----------------------------------------------------
unsigned char items_no = 2;
const char *item[items_no];
item[0] = "Black";
item[1] = "Orange";
//-----------------------------------------------------
unsigned char active_rows;
static int first = 0;
int enc_dif = 0;
unsigned char cursor_pos = 1;
enc_dif = encoderDiff;
lcd_implementation_clear();
lcd.setCursor(0, 1);
lcd.print(">");
active_rows = items_no < 3 ? items_no : 3;
while (1) {
lcd_print_at_PGM(0, 0, PSTR("Choose color:"));
for (int i = 0; i < active_rows; i++) {
lcd.setCursor(1, i+1);
lcd.print(item[first + i]);
}
manage_heater();
manage_inactivity(true);
if (abs((enc_dif - encoderDiff)) > 4) {
if ((abs(enc_dif - encoderDiff)) > 1) {
if (enc_dif > encoderDiff) {
cursor_pos--;
}
if (enc_dif < encoderDiff) {
cursor_pos++;
}
if (cursor_pos > active_rows) {
cursor_pos = active_rows;
if (first < items_no - active_rows) {
first++;
lcd_implementation_clear();
}
}
if (cursor_pos < 1) {
cursor_pos = 1;
if (first > 0) {
first--;
lcd_implementation_clear();
}
}
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(0, 2);
lcd.print(" ");
lcd.setCursor(0, 3);
lcd.print(" ");
lcd.setCursor(0, cursor_pos);
lcd.print(">");
enc_dif = encoderDiff;
delay(100);
}
}
if (lcd_clicked()) {
while (lcd_clicked());
delay(10);
while (lcd_clicked());
return(cursor_pos + first - 1);
}
}
}
void lcd_confirm_print() void lcd_confirm_print()
{ {
uint8_t filament_type;
int enc_dif = 0; int enc_dif = 0;
int cursor_pos = 1; int cursor_pos = 1;
int _ret = 0; int _ret = 0;
@ -3653,14 +3740,14 @@ void lcd_confirm_print()
if (cursor_pos == 1) if (cursor_pos == 1)
{ {
_ret = 1; _ret = 1;
prusa_statistics(20); filament_type = lcd_choose_color();
prusa_statistics(4); prusa_statistics(4, filament_type);
} }
if (cursor_pos == 2) if (cursor_pos == 2)
{ {
_ret = 2; _ret = 2;
prusa_statistics(20); filament_type = lcd_choose_color();
prusa_statistics(5); prusa_statistics(5, filament_type);
} }
} }

View File

@ -26,8 +26,9 @@
void lcd_loading_color(); void lcd_loading_color();
void lcd_force_language_selection(); void lcd_force_language_selection();
void lcd_sdcard_stop(); void lcd_sdcard_stop();
void prusa_statistics(int _message); void prusa_statistics(int _message, uint8_t _col_nr = 0);
void lcd_confirm_print(); void lcd_confirm_print();
unsigned char lcd_choose_color();
void lcd_mylang(); void lcd_mylang();
bool lcd_detected(void); bool lcd_detected(void);