Merge pull request #53 from PavelSindler/MK2

farm mode improved
This commit is contained in:
PavelSindler 2017-03-01 15:38:12 +01:00 committed by GitHub
commit 09f9162078
4 changed files with 60 additions and 40 deletions

View file

@ -5,7 +5,7 @@
#include "Configuration_prusa.h"
// Firmware version
#define FW_version "3.0.10-2"
#define FW_version "3.0.10-3"
#define FW_PRUSA3D_MAGIC "PRUSA3DFW"
#define FW_PRUSA3D_MAGIC_LEN 10
@ -31,13 +31,13 @@
// Offsets of the Z heiths of the calibration points from the first point.
// The offsets are saved as 16bit signed int, scaled to tenths of microns.
#define EEPROM_BED_CALIBRATION_Z_JITTER (EEPROM_BED_CALIBRATION_VEC_Y-2*8)
#define EEPROM_FARM_MODE (EEPROM_BED_CALIBRATION_Z_JITTER-4)
#define EEPROM_FARM_MODE (EEPROM_BED_CALIBRATION_Z_JITTER-1)
#define EEPROM_FARM_NUMBER (EEPROM_FARM_MODE-3)
// Correction of the bed leveling, in micrometers.
// Maximum 50 micrometers allowed.
// Bed correction is valid if set to 1. If set to zero or 255, the successive 4 bytes are invalid.
#define EEPROM_BED_CORRECTION_VALID (EEPROM_FARM_MODE-1)
#define EEPROM_BED_CORRECTION_VALID (EEPROM_FARM_NUMBER-1)
#define EEPROM_BED_CORRECTION_LEFT (EEPROM_BED_CORRECTION_VALID-1)
#define EEPROM_BED_CORRECTION_RIGHT (EEPROM_BED_CORRECTION_LEFT-1)
#define EEPROM_BED_CORRECTION_FRONT (EEPROM_BED_CORRECTION_RIGHT-1)

View file

@ -264,6 +264,7 @@ unsigned int usb_printing_counter;
int lcd_change_fil_state = 0;
int feedmultiplyBckp = 100;
unsigned char lang_selected = 0;
int8_t FarmMode = 0;
bool prusa_sd_card_upload = false;
@ -920,9 +921,10 @@ void factory_reset(char level, bool quiet)
// Force the "Follow calibration flow" message at the next boot up.
calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION);
farm_no = 0;
EEPROM_save_B(EEPROM_FARM_MODE, &farm_no);
farm_mode = false;
farm_mode == false;
eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode);
EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
WRITE(BEEPER, HIGH);
_delay_ms(100);
WRITE(BEEPER, LOW);
@ -1118,19 +1120,12 @@ void setup()
#if defined(Z_AXIS_ALWAYS_ON)
enable_z();
#endif
EEPROM_read_B(EEPROM_FARM_MODE, &farm_no);
if (farm_no > 0)
farm_mode = eeprom_read_byte((uint8_t*)EEPROM_FARM_MODE);
EEPROM_read_B(EEPROM_FARM_NUMBER, &farm_no);
if (farm_mode)
{
farm_mode = true;
farm_no = farm_no;
prusa_statistics(8);
}
else
{
farm_mode = false;
farm_no = 0;
}
// Enable Toshiba FlashAir SD card / WiFi enahanced card.
card.ToshibaFlashAir_enable(eeprom_read_byte((unsigned char*)EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY) == 1);
@ -3107,16 +3102,14 @@ void process_commands()
}
break;
case 98:
farm_no = 21;
EEPROM_save_B(EEPROM_FARM_MODE, &farm_no);
farm_mode = true;
case 98: //activate farm mode
farm_mode = 1;
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
break;
case 99:
farm_no = 0;
EEPROM_save_B(EEPROM_FARM_MODE, &farm_no);
farm_mode = false;
case 99: //deactivate farm mode
farm_mode = 0;
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
break;

View file

@ -99,7 +99,7 @@ int8_t SilentModeMenu = 0;
int lcd_commands_type=LCD_COMMAND_IDLE;
int lcd_commands_step=0;
bool isPrintPaused = false;
bool farm_mode = false;
uint8_t farm_mode = 0;
int farm_no = 0;
int farm_timer = 30;
int farm_status = 0;
@ -2380,6 +2380,7 @@ static void lcd_settings_menu()
if (farm_mode)
{
MENU_ITEM(submenu, PSTR("Farm number"), lcd_farm_no);
MENU_ITEM(function, PSTR("Disable farm mode"), lcd_disable_farm_mode);
}
END_MENU();
@ -2679,6 +2680,13 @@ char reset_menu() {
}
static void lcd_disable_farm_mode() {
farm_mode = 0;
eeprom_update_byte((unsigned char *)EEPROM_FARM_MODE, farm_mode);
lcd_return_to_status();
}
#ifdef SNMM
static void extr_mov(float shift, float feed_rate) { //move extruder no matter what the current heater temperature is
@ -2896,6 +2904,7 @@ static void extr_unload_3() {
extr_unload();
}
static void fil_load_menu()
{
START_MENU();
@ -2936,6 +2945,7 @@ static void change_extr_menu(){
static void lcd_farm_no()
{
char step = 0;
int enc_dif = 0;
int _farmno = farm_no;
int _ret = 0;
@ -2949,32 +2959,50 @@ static void lcd_farm_no()
if (abs((enc_dif - encoderDiff)) > 2) {
if (enc_dif > encoderDiff) {
_farmno--;
switch (step) {
case(0): if (_farmno >= 100) _farmno -= 100; break;
case(1): if (_farmno % 100 >= 10) _farmno -= 10; break;
case(2): if (_farmno % 10 >= 1) _farmno--; break;
default: break;
}
}
if (enc_dif < encoderDiff) {
_farmno++;
switch (step) {
case(0): if (_farmno < 900) _farmno += 100; break;
case(1): if (_farmno % 100 < 90) _farmno += 10; break;
case(2): if (_farmno % 10 <= 8)_farmno++; break;
default: break;
}
}
enc_dif = 0;
encoderDiff = 0;
}
if (_farmno > 254) { _farmno = 1; }
if (_farmno < 1) { _farmno = 254; }
lcd.setCursor(0, 2);
if (_farmno < 100) lcd.print("0");
if (_farmno < 10) lcd.print("0");
lcd.print(_farmno);
lcd.print(" ");
lcd.setCursor(0, 3);
lcd.print(" ");
lcd.setCursor(step, 3);
lcd.print("^");
delay(100);
if (lcd_clicked())
{
_ret = 1;
farm_no = _farmno;
EEPROM_save_B(EEPROM_FARM_MODE, &farm_no);
prusa_statistics(20);
lcd_return_to_status();
delay(200);
step++;
if(step == 3) {
_ret = 1;
farm_no = _farmno;
EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
prusa_statistics(20);
lcd_return_to_status();
}
}
manage_heater();

View file

@ -95,7 +95,7 @@ void lcd_mylang();
extern unsigned long lcd_timeoutToStatus;
extern int lcd_commands_type;
extern bool farm_mode;
extern uint8_t farm_mode;
extern int farm_no;
extern int farm_timer;
extern int farm_status;
@ -212,8 +212,7 @@ static void extr_unload_0();
static void extr_unload_1();
static void extr_unload_2();
static void extr_unload_3();
static void stack_test();
static int test();
static void lcd_disable_farm_mode();
void stack_error();