show message that printer is not connected to monitoring on printer start
This commit is contained in:
parent
27cc5e51c3
commit
863fe1f054
|
|
@ -543,6 +543,8 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
|
||||||
#define PING_TIME 60 //time in s
|
#define PING_TIME 60 //time in s
|
||||||
#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes
|
#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid false triggering when dealing with long gcodes
|
||||||
#define PING_ALLERT_PERIOD 60 //time in s
|
#define PING_ALLERT_PERIOD 60 //time in s
|
||||||
|
#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring
|
||||||
|
#define NC_BUTTON_LONG_PRESS 15 //time in s
|
||||||
|
|
||||||
#define LONG_PRESS_TIME 1000 //time in ms for button long press
|
#define LONG_PRESS_TIME 1000 //time in ms for button long press
|
||||||
#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release
|
#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release
|
||||||
|
|
|
||||||
|
|
@ -942,18 +942,21 @@ void setup()
|
||||||
lcd_splash();
|
lcd_splash();
|
||||||
setup_killpin();
|
setup_killpin();
|
||||||
setup_powerhold();
|
setup_powerhold();
|
||||||
|
|
||||||
farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE);
|
farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE);
|
||||||
EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
|
EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
|
||||||
if ((farm_mode == 0xFF && farm_no == 0) || (farm_no == 0xFFFF)) farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode
|
if ((farm_mode == 0xFF && farm_no == 0) || ((uint16_t)farm_no == 0xFFFF))
|
||||||
if (farm_no == 0xFFFF) farm_no = 0;
|
farm_mode = false; //if farm_mode has not been stored to eeprom yet and farm number is set to zero or EEPROM is fresh, deactivate farm mode
|
||||||
|
if ((uint16_t)farm_no == 0xFFFF) farm_no = 0;
|
||||||
|
|
||||||
selectedSerialPort = eeprom_read_byte((uint8_t*)EEPROM_SECOND_SERIAL_ACTIVE);
|
selectedSerialPort = eeprom_read_byte((uint8_t*)EEPROM_SECOND_SERIAL_ACTIVE);
|
||||||
if (selectedSerialPort == 0xFF) selectedSerialPort = 0;
|
if (selectedSerialPort == 0xFF) selectedSerialPort = 0;
|
||||||
if (farm_mode)
|
if (farm_mode)
|
||||||
{
|
{
|
||||||
|
no_response = true; //we need confirmation by recieving PRUSA thx
|
||||||
|
important_status = 8;
|
||||||
prusa_statistics(8);
|
prusa_statistics(8);
|
||||||
selectedSerialPort = 1;
|
//selectedSerialPort = 1;
|
||||||
}
|
}
|
||||||
MYSERIAL.begin(BAUDRATE);
|
MYSERIAL.begin(BAUDRATE);
|
||||||
fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream
|
fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream
|
||||||
|
|
|
||||||
|
|
@ -360,6 +360,16 @@ bool is_buffer_empty()
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void proc_commands() {
|
||||||
|
if (buflen)
|
||||||
|
{
|
||||||
|
process_commands();
|
||||||
|
if (!cmdbuffer_front_already_processed)
|
||||||
|
cmdqueue_pop_front();
|
||||||
|
cmdbuffer_front_already_processed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void get_command()
|
void get_command()
|
||||||
{
|
{
|
||||||
// Test and reserve space for the new command string.
|
// Test and reserve space for the new command string.
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ int lcd_commands_step=0;
|
||||||
bool isPrintPaused = false;
|
bool isPrintPaused = false;
|
||||||
uint8_t farm_mode = 0;
|
uint8_t farm_mode = 0;
|
||||||
int farm_no = 0;
|
int farm_no = 0;
|
||||||
int farm_timer = 30;
|
int farm_timer = 8;
|
||||||
int farm_status = 0;
|
int farm_status = 0;
|
||||||
unsigned long allert_timer = millis();
|
unsigned long allert_timer = millis();
|
||||||
bool printer_connected = true;
|
bool printer_connected = true;
|
||||||
|
|
@ -160,7 +160,7 @@ float pid_temp = DEFAULT_PID_TEMP;
|
||||||
|
|
||||||
bool long_press_active = false;
|
bool long_press_active = false;
|
||||||
long long_press_timer = millis();
|
long long_press_timer = millis();
|
||||||
long button_blanking_time = millis();
|
unsigned long button_blanking_time = millis();
|
||||||
bool button_pressed = false;
|
bool button_pressed = false;
|
||||||
|
|
||||||
bool menuExiting = false;
|
bool menuExiting = false;
|
||||||
|
|
@ -467,15 +467,15 @@ static void lcd_status_screen()
|
||||||
farm_timer--;
|
farm_timer--;
|
||||||
if (farm_timer < 1)
|
if (farm_timer < 1)
|
||||||
{
|
{
|
||||||
farm_timer = 180;
|
farm_timer = 10;
|
||||||
prusa_statistics(0);
|
prusa_statistics(0);
|
||||||
}
|
}
|
||||||
switch (farm_timer)
|
switch (farm_timer)
|
||||||
{
|
{
|
||||||
case 45:
|
case 8:
|
||||||
prusa_statistics(21);
|
prusa_statistics(21);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 5:
|
||||||
if (IS_SD_PRINTING)
|
if (IS_SD_PRINTING)
|
||||||
{
|
{
|
||||||
prusa_statistics(20);
|
prusa_statistics(20);
|
||||||
|
|
@ -2993,7 +2993,7 @@ void lcd_diag_show_end_stops()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void prusa_statistics(int _message) {
|
void prusa_statistics(int _message, uint8_t _fil_nr) {
|
||||||
#ifdef DEBUG_DISABLE_PRUSA_STATISTICS
|
#ifdef DEBUG_DISABLE_PRUSA_STATISTICS
|
||||||
return;
|
return;
|
||||||
#endif //DEBUG_DISABLE_PRUSA_STATISTICS
|
#endif //DEBUG_DISABLE_PRUSA_STATISTICS
|
||||||
|
|
@ -3063,14 +3063,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("}");
|
||||||
|
|
@ -3102,7 +3106,7 @@ void prusa_statistics(int _message) {
|
||||||
prusa_stat_printerstatus(status_number);
|
prusa_stat_printerstatus(status_number);
|
||||||
prusa_stat_farm_number();
|
prusa_stat_farm_number();
|
||||||
SERIAL_ECHOLN("}");
|
SERIAL_ECHOLN("}");
|
||||||
farm_timer = 5;
|
farm_timer = 4;
|
||||||
break;
|
break;
|
||||||
case 21: // temperatures
|
case 21: // temperatures
|
||||||
SERIAL_ECHO("{");
|
SERIAL_ECHO("{");
|
||||||
|
|
@ -3129,7 +3133,7 @@ void prusa_statistics(int _message) {
|
||||||
SERIAL_ECHOLN("}");
|
SERIAL_ECHOLN("}");
|
||||||
break;
|
break;
|
||||||
case 92: // Error - Min temp
|
case 92: // Error - Min temp
|
||||||
SERIAL_ECHOLN("{[ERR:3]");
|
SERIAL_ECHO("{[ERR:3]");
|
||||||
prusa_stat_farm_number();
|
prusa_stat_farm_number();
|
||||||
SERIAL_ECHOLN("}");
|
SERIAL_ECHOLN("}");
|
||||||
break;
|
break;
|
||||||
|
|
@ -5170,14 +5174,99 @@ 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] = "Orange";
|
||||||
|
item[1] = "Black";
|
||||||
|
//-----------------------------------------------------
|
||||||
|
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);
|
||||||
|
proc_commands();
|
||||||
|
if (abs((enc_dif - encoderDiff)) > 12) {
|
||||||
|
|
||||||
|
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());
|
||||||
|
switch(cursor_pos + first - 1) {
|
||||||
|
case 0: return 1; break;
|
||||||
|
case 1: return 0; break;
|
||||||
|
default: return 99; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
int _t = 0;
|
int _t = 0;
|
||||||
|
|
||||||
|
enc_dif = encoderDiff;
|
||||||
lcd_implementation_clear();
|
lcd_implementation_clear();
|
||||||
|
|
||||||
lcd.setCursor(0, 0);
|
lcd.setCursor(0, 0);
|
||||||
|
|
@ -5185,8 +5274,7 @@ void lcd_confirm_print()
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
if (abs(enc_dif - encoderDiff) > 12) {
|
||||||
if (abs((enc_dif - encoderDiff)) > 2) {
|
|
||||||
if (enc_dif > encoderDiff) {
|
if (enc_dif > encoderDiff) {
|
||||||
cursor_pos--;
|
cursor_pos--;
|
||||||
}
|
}
|
||||||
|
|
@ -5194,6 +5282,7 @@ void lcd_confirm_print()
|
||||||
if (enc_dif < encoderDiff) {
|
if (enc_dif < encoderDiff) {
|
||||||
cursor_pos++;
|
cursor_pos++;
|
||||||
}
|
}
|
||||||
|
enc_dif = encoderDiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor_pos > 2) { cursor_pos = 2; }
|
if (cursor_pos > 2) { cursor_pos = 2; }
|
||||||
|
|
@ -5241,6 +5330,7 @@ void lcd_confirm_print()
|
||||||
|
|
||||||
manage_heater();
|
manage_heater();
|
||||||
manage_inactivity();
|
manage_inactivity();
|
||||||
|
proc_commands();
|
||||||
|
|
||||||
} while (_ret == 0);
|
} while (_ret == 0);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue