farm mode: detection if printer is connected to monitoring, PRN1 sends also farm number
This commit is contained in:
parent
f6edfb7c19
commit
608717d110
8 changed files with 68 additions and 10 deletions
|
@ -5,7 +5,7 @@
|
||||||
#include "Configuration_prusa.h"
|
#include "Configuration_prusa.h"
|
||||||
|
|
||||||
// Firmware version
|
// Firmware version
|
||||||
#define FW_version "3.0.10-4"
|
#define FW_version "3.0.10-5"
|
||||||
|
|
||||||
#define FW_PRUSA3D_MAGIC "PRUSA3DFW"
|
#define FW_PRUSA3D_MAGIC "PRUSA3DFW"
|
||||||
#define FW_PRUSA3D_MAGIC_LEN 10
|
#define FW_PRUSA3D_MAGIC_LEN 10
|
||||||
|
|
|
@ -108,7 +108,7 @@ FORCE_INLINE void serialprintPGM(const char *str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_buffer_empty();
|
||||||
void get_command();
|
void get_command();
|
||||||
void process_commands();
|
void process_commands();
|
||||||
void ramming();
|
void ramming();
|
||||||
|
@ -297,6 +297,7 @@ extern unsigned int heating_status_counter;
|
||||||
extern bool custom_message;
|
extern bool custom_message;
|
||||||
extern unsigned int custom_message_type;
|
extern unsigned int custom_message_type;
|
||||||
extern unsigned int custom_message_state;
|
extern unsigned int custom_message_state;
|
||||||
|
extern unsigned long PingTime;
|
||||||
|
|
||||||
|
|
||||||
// Handling multiple extruders pins
|
// Handling multiple extruders pins
|
||||||
|
|
|
@ -803,6 +803,11 @@ void repeatcommand_front()
|
||||||
cmdbuffer_front_already_processed = true;
|
cmdbuffer_front_already_processed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_buffer_empty()
|
||||||
|
{
|
||||||
|
if (buflen == 0) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
void setup_killpin()
|
void setup_killpin()
|
||||||
{
|
{
|
||||||
|
@ -1954,7 +1959,7 @@ void process_commands()
|
||||||
int8_t SilentMode;
|
int8_t SilentMode;
|
||||||
#endif
|
#endif
|
||||||
if(code_seen("PRUSA")){
|
if(code_seen("PRUSA")){
|
||||||
if (code_seen("Ping")) {
|
if (code_seen("Ping")) { //PRUSA Ping
|
||||||
if (farm_mode) {
|
if (farm_mode) {
|
||||||
PingTime = millis();
|
PingTime = millis();
|
||||||
MYSERIAL.print(farm_no); MYSERIAL.println(": OK");
|
MYSERIAL.print(farm_no); MYSERIAL.println(": OK");
|
||||||
|
@ -3110,11 +3115,13 @@ void process_commands()
|
||||||
|
|
||||||
case 98: //activate farm mode
|
case 98: //activate farm mode
|
||||||
farm_mode = 1;
|
farm_mode = 1;
|
||||||
|
PingTime = millis();
|
||||||
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 99: //deactivate farm mode
|
case 99: //deactivate farm mode
|
||||||
farm_mode = 0;
|
farm_mode = 0;
|
||||||
|
lcd_printer_connected();
|
||||||
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1806,6 +1806,11 @@ const char * const MSG_PRESS_LANG_TABLE[LANG_NUM] PROGMEM = {
|
||||||
MSG_PRESS_DE
|
MSG_PRESS_DE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char MSG_PRINTER_DISCONNECTED_EN[] PROGMEM = "Printer disconnected";
|
||||||
|
const char * const MSG_PRINTER_DISCONNECTED_LANG_TABLE[1] PROGMEM = {
|
||||||
|
MSG_PRINTER_DISCONNECTED_EN
|
||||||
|
};
|
||||||
|
|
||||||
const char MSG_PRINT_ABORTED_EN[] PROGMEM = "Print aborted";
|
const char MSG_PRINT_ABORTED_EN[] PROGMEM = "Print aborted";
|
||||||
const char MSG_PRINT_ABORTED_CZ[] PROGMEM = "Tisk prerusen";
|
const char MSG_PRINT_ABORTED_CZ[] PROGMEM = "Tisk prerusen";
|
||||||
const char MSG_PRINT_ABORTED_IT[] PROGMEM = "Stampa abortita";
|
const char MSG_PRINT_ABORTED_IT[] PROGMEM = "Stampa abortita";
|
||||||
|
|
|
@ -357,6 +357,8 @@ extern const char* const MSG_PREHEAT_NOZZLE_LANG_TABLE[LANG_NUM];
|
||||||
#define MSG_PREHEAT_NOZZLE LANG_TABLE_SELECT(MSG_PREHEAT_NOZZLE_LANG_TABLE)
|
#define MSG_PREHEAT_NOZZLE LANG_TABLE_SELECT(MSG_PREHEAT_NOZZLE_LANG_TABLE)
|
||||||
extern const char* const MSG_PRESS_LANG_TABLE[LANG_NUM];
|
extern const char* const MSG_PRESS_LANG_TABLE[LANG_NUM];
|
||||||
#define MSG_PRESS LANG_TABLE_SELECT(MSG_PRESS_LANG_TABLE)
|
#define MSG_PRESS LANG_TABLE_SELECT(MSG_PRESS_LANG_TABLE)
|
||||||
|
extern const char* const MSG_PRINTER_DISCONNECTED_LANG_TABLE[1];
|
||||||
|
#define MSG_PRINTER_DISCONNECTED LANG_TABLE_SELECT_EXPLICIT(MSG_PRINTER_DISCONNECTED_LANG_TABLE, 0)
|
||||||
extern const char* const MSG_PRINT_ABORTED_LANG_TABLE[LANG_NUM];
|
extern const char* const MSG_PRINT_ABORTED_LANG_TABLE[LANG_NUM];
|
||||||
#define MSG_PRINT_ABORTED LANG_TABLE_SELECT(MSG_PRINT_ABORTED_LANG_TABLE)
|
#define MSG_PRINT_ABORTED LANG_TABLE_SELECT(MSG_PRINT_ABORTED_LANG_TABLE)
|
||||||
extern const char* const MSG_PRUSA3D_LANG_TABLE[LANG_NUM];
|
extern const char* const MSG_PRUSA3D_LANG_TABLE[LANG_NUM];
|
||||||
|
|
|
@ -265,3 +265,4 @@
|
||||||
#define MSG_MENU_CALIBRATION "Calibration"
|
#define MSG_MENU_CALIBRATION "Calibration"
|
||||||
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]"
|
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]"
|
||||||
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]"
|
#define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]"
|
||||||
|
#define MSG_PRINTER_DISCONNECTED "Printer disconnected"
|
|
@ -103,7 +103,8 @@ uint8_t farm_mode = 0;
|
||||||
int farm_no = 0;
|
int farm_no = 0;
|
||||||
int farm_timer = 30;
|
int farm_timer = 30;
|
||||||
int farm_status = 0;
|
int farm_status = 0;
|
||||||
|
unsigned long allert_timer = millis();
|
||||||
|
bool printer_connected = true;
|
||||||
|
|
||||||
|
|
||||||
bool menuExiting = false;
|
bool menuExiting = false;
|
||||||
|
@ -491,6 +492,12 @@ static void lcd_status_screen()
|
||||||
else if (feedmultiply > 999)
|
else if (feedmultiply > 999)
|
||||||
feedmultiply = 999;
|
feedmultiply = 999;
|
||||||
#endif //ULTIPANEL
|
#endif //ULTIPANEL
|
||||||
|
|
||||||
|
if (farm_mode && !printer_connected) {
|
||||||
|
lcd.setCursor(0, 3);
|
||||||
|
lcd_printPGM(MSG_PRINTER_DISCONNECTED);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ULTIPANEL
|
#ifdef ULTIPANEL
|
||||||
|
@ -1893,6 +1900,9 @@ void prusa_statistics(int _message) {
|
||||||
SERIAL_ECHO("{");
|
SERIAL_ECHO("{");
|
||||||
prusa_stat_printerstatus(1);
|
prusa_stat_printerstatus(1);
|
||||||
status_number = 1;
|
status_number = 1;
|
||||||
|
SERIAL_ECHO("[PFN:");
|
||||||
|
SERIAL_ECHO(farm_no);
|
||||||
|
SERIAL_ECHO("]");
|
||||||
SERIAL_ECHOLN("}");
|
SERIAL_ECHOLN("}");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2686,8 +2696,7 @@ char reset_menu() {
|
||||||
static void lcd_disable_farm_mode() {
|
static void lcd_disable_farm_mode() {
|
||||||
int8_t disable = lcd_show_fullscreen_message_yes_no_and_wait_P(PSTR("Disable farm mode?"), true, false); //allow timeouting, default no
|
int8_t disable = lcd_show_fullscreen_message_yes_no_and_wait_P(PSTR("Disable farm mode?"), true, false); //allow timeouting, default no
|
||||||
if (disable) {
|
if (disable) {
|
||||||
farm_mode = 0;
|
enquecommand_P(PSTR("G99"));
|
||||||
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
|
|
||||||
lcd_return_to_status();
|
lcd_return_to_status();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2698,6 +2707,20 @@ static void lcd_disable_farm_mode() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void lcd_ping_allert() {
|
||||||
|
if ((abs(millis() - allert_timer)*0.001) > PING_ALLERT_PERIOD) {
|
||||||
|
allert_timer = millis();
|
||||||
|
SET_OUTPUT(BEEPER);
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
WRITE(BEEPER, HIGH);
|
||||||
|
delay(50);
|
||||||
|
WRITE(BEEPER, LOW);
|
||||||
|
delay(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef SNMM
|
#ifdef SNMM
|
||||||
|
|
||||||
|
@ -4473,11 +4496,27 @@ void lcd_update(uint8_t lcdDrawUpdateOverride)
|
||||||
lcd_next_update_millis = millis() + LCD_UPDATE_INTERVAL;
|
lcd_next_update_millis = millis() + LCD_UPDATE_INTERVAL;
|
||||||
}
|
}
|
||||||
if (!SdFatUtil::test_stack_integrity()) stack_error();
|
if (!SdFatUtil::test_stack_integrity()) stack_error();
|
||||||
if (farm_mode && ((millis() - PingTime) > PING_TIME * 1000)) {
|
lcd_ping(); //check that we have received ping command if we are in farm mode
|
||||||
// beep once per minute
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcd_printer_connected() {
|
||||||
|
printer_connected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_ping() {
|
||||||
|
if (farm_mode) {
|
||||||
|
bool empty = is_buffer_empty();
|
||||||
|
if ((millis() - PingTime) * 0.001 > (empty ? PING_TIME : PING_TIME_LONG)) { //if commands buffer is empty use shorter time period
|
||||||
|
//if there are comamnds in buffer, some long gcodes can delay execution of ping command
|
||||||
|
//therefore longer period is used
|
||||||
|
printer_connected = false;
|
||||||
|
lcd_ping_allert();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lcd_printer_connected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
void lcd_ignore_click(bool b)
|
void lcd_ignore_click(bool b)
|
||||||
{
|
{
|
||||||
ignore_click = b;
|
ignore_click = b;
|
||||||
|
|
|
@ -215,6 +215,9 @@ static void extr_unload_3();
|
||||||
static void lcd_disable_farm_mode();
|
static void lcd_disable_farm_mode();
|
||||||
|
|
||||||
void stack_error();
|
void stack_error();
|
||||||
|
static void lcd_ping_allert();
|
||||||
|
void lcd_printer_connected();
|
||||||
|
void lcd_ping();
|
||||||
|
|
||||||
void lcd_calibrate_extruder();
|
void lcd_calibrate_extruder();
|
||||||
void lcd_farm_sdcard_menu();
|
void lcd_farm_sdcard_menu();
|
||||||
|
|
Loading…
Reference in a new issue