Farmers' requests 1

- remove the UI and related stuff to setting a farm number (the
communication protocol must remain intact)
- remove confirmation after print finished ("Print OK")

Both requests are highly welcome, since they allow for lowering the code
size by >1KB

PFW-963, PFW-927
This commit is contained in:
D.R.racer 2021-01-19 09:58:02 +01:00
parent 5c3513a6cc
commit a9d8ddc89c
3 changed files with 28 additions and 60 deletions

View file

@ -714,10 +714,10 @@ static void factory_reset(char level)
// Force the "Follow calibration flow" message at the next boot up.
calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION);
eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard
farm_no = 0;
// farm_no = 0;
farm_mode = false;
eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode);
EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
// EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0);
eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0);
@ -1051,10 +1051,10 @@ void setup()
setup_powerhold();
farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE);
EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
if ((farm_mode == 0xFF && farm_no == 0) || ((uint16_t)farm_no == 0xFFFF))
// EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
if ((farm_mode == 0xFF /*&& farm_no == 0*/) /*|| ((uint16_t)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 ((uint16_t)farm_no == 0xFFFF) farm_no = 0;
// if ((uint16_t)farm_no == 0xFFFF) farm_no = 0;
if (farm_mode)
{
no_response = true; //we need confirmation by recieving PRUSA thx
@ -1370,9 +1370,9 @@ void setup()
#endif
farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE);
EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
if ((farm_mode == 0xFF && farm_no == 0) || (farm_no == static_cast<int>(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_no == static_cast<int>(0xFFFF)) farm_no = 0;
// EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
if ((farm_mode == 0xFF /*&& farm_no == 0*/) /*|| (farm_no == static_cast<int>(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_no == static_cast<int>(0xFFFF)) farm_no = 0;
if (farm_mode)
{
prusa_statistics(8);
@ -3893,7 +3893,7 @@ void process_commands()
gcode_PRUSA_BadRAMBoFanTest();
}else if (code_seen("FAN")) { // PRUSA FAN
printf_P(_N("E0:%d RPM\nPRN0:%d RPM\n"), 60*fan_speed[0], 60*fan_speed[1]);
}else if (code_seen("fn")) { // PRUSA fn
}/*else if (code_seen("fn")) { // PRUSA fn
if (farm_mode) {
printf_P(_N("%d"), farm_no);
}
@ -3901,7 +3901,7 @@ void process_commands()
puts_P(_N("Not in farm mode."));
}
}
}*/
else if (code_seen("thx")) // PRUSA thx
{
no_response = false;
@ -5556,7 +5556,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT)
farm_mode = 1;
PingTime = _millis();
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
// EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
SilentModeMenu = SILENT_MODE_OFF;
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
fCheckModeInit(); // alternatively invoke printer reset

View file

@ -89,7 +89,6 @@ unsigned int custom_message_state = 0;
bool isPrintPaused = false;
uint8_t farm_mode = 0;
int farm_no = 0;
int farm_timer = 8;
uint8_t farm_status = 0;
bool printer_connected = true;
@ -137,7 +136,7 @@ static void prusa_stat_farm_number();
static void prusa_stat_diameter();
static void prusa_stat_temperatures();
static void prusa_stat_printinfo();
static void lcd_farm_no();
//static void lcd_farm_no();
static void lcd_menu_xyz_y_min();
static void lcd_menu_xyz_skew();
static void lcd_menu_xyz_offset();
@ -671,39 +670,7 @@ void lcdui_print_extruder(void)
// Print farm number (5 chars total)
void lcdui_print_farm(void)
{
int chars = lcd_printf_P(_N(" F0 "));
// lcd_space(5 - chars);
/*
// Farm number display
if (farm_mode)
{
lcd_set_cursor(6, 2);
lcd_puts_P(PSTR(" F"));
lcd_print(farm_no);
lcd_puts_P(PSTR(" "));
// Beat display
lcd_set_cursor(LCD_WIDTH - 1, 0);
if ( (_millis() - kicktime) < 60000 ) {
lcd_puts_P(PSTR("L"));
}else{
lcd_puts_P(PSTR(" "));
}
}
else {
#ifdef SNMM
lcd_puts_P(PSTR(" E"));
lcd_print(get_ext_nr() + 1);
#else
lcd_set_cursor(LCD_WIDTH - 8 - 2, 2);
lcd_puts_P(PSTR(" "));
#endif
}
*/
lcd_printf_P(_N(" F0 "));
}
#ifdef CMD_DIAGNOSTICS
@ -1486,7 +1453,7 @@ void lcd_commands()
if (lcd_commands_step == 1 && !blocks_queued())
{
lcd_confirm_print();
// lcd_confirm_print();
lcd_commands_step = 0;
lcd_commands_type = LcdCommands::Idle;
}
@ -5833,7 +5800,7 @@ static void lcd_settings_menu()
if (farm_mode)
{
MENU_ITEM_SUBMENU_P(PSTR("Farm number"), lcd_farm_no);
// MENU_ITEM_SUBMENU_P(PSTR("Farm number"), lcd_farm_no);
MENU_ITEM_FUNCTION_P(PSTR("Disable farm mode"), lcd_disable_farm_mode);
}
@ -6465,7 +6432,7 @@ void unload_filament()
}
static void lcd_farm_no()
/*static void lcd_farm_no()
{
char step = 0;
int enc_dif = 0;
@ -6520,8 +6487,8 @@ static void lcd_farm_no()
step++;
if(step == 3) {
_ret = 1;
farm_no = _farmno;
EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
// farm_no = _farmno;
// EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
prusa_statistics(20);
lcd_return_to_status();
}
@ -6530,7 +6497,7 @@ static void lcd_farm_no()
manage_heater();
} while (_ret == 0);
}
}*/
unsigned char lcd_choose_color() {
@ -6617,7 +6584,7 @@ unsigned char lcd_choose_color() {
}
void lcd_confirm_print()
/*void lcd_confirm_print()
{
uint8_t filament_type;
int enc_dif = 0;
@ -6694,7 +6661,7 @@ void lcd_confirm_print()
} while (_ret == 0);
}
}*/
#include "w25x20cl.h"
@ -6978,10 +6945,10 @@ static void lcd_main_menu()
if (IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal))
{
if (farm_mode)
{
MENU_ITEM_SUBMENU_P(PSTR("Farm number"), lcd_farm_no);
}
// if (farm_mode)
// {
// MENU_ITEM_SUBMENU_P(PSTR("Farm number"), lcd_farm_no);
// }
}
else
{

View file

@ -47,7 +47,7 @@ void lcd_pause_print();
void lcd_resume_print();
void lcd_print_stop();
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_load_filament_color_check();
//void lcd_mylang();
@ -127,7 +127,8 @@ extern CustomMsg custom_message_type;
extern unsigned int custom_message_state;
extern uint8_t farm_mode;
extern int farm_no;
// Farmers request removal of farm_no from the FW
constexpr const int farm_no = 0;
extern int farm_timer;
extern uint8_t farm_status;