printer types and motherboard types added to eeprom; min extrude temp lowered because of woodfil

This commit is contained in:
PavelSindler 2018-02-22 00:09:12 +01:00
parent 74f6bbfa6b
commit 0323af531d
9 changed files with 99 additions and 3 deletions

View File

@ -132,6 +132,9 @@
// Power loss errors (total)
#define EEPROM_POWER_COUNT_TOT (EEPROM_FERROR_COUNT_TOT - 2) // uint16
#define EEPROM_PRINTER_TYPE (EEPROM_POWER_COUNT_TOT - 2) // uint16
#define EEPROM_BOARD_TYPE (EEPROM_PRINTER_TYPE - 2) // uint16
//TMC2130 configuration
#define EEPROM_TMC_AXIS_SIZE //axis configuration block size

View File

@ -6,6 +6,7 @@
*------------------------------------*/
// Printer revision
#define PRINTER_TYPE PRINTER_MK25
#define FILAMENT_SIZE "1_75mm_MK25"
#define NOZZLE_TYPE "E3Dv6full"
@ -154,7 +155,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#endif
// Extrude mintemp
#define EXTRUDE_MINTEMP 190
#define EXTRUDE_MINTEMP 180
// Extruder cooling fans
#define EXTRUDER_0_AUTO_FAN_PIN 8

View File

@ -380,6 +380,7 @@ void temp_compensation_apply();
void temp_compensation_start();
void show_fw_version_warnings();
void erase_eeprom_section(uint16_t offset, uint16_t bytes);
uint8_t check_printer_version();
#ifdef PINDA_THERMISTOR
float temp_compensation_pinda_thermistor_offset(float temperature_pinda);

View File

@ -41,6 +41,7 @@
#include "mesh_bed_calibration.h"
#endif
#include "printers.h"
#include "ultralcd.h"
#include "Configuration_prusa.h"
#include "planner.h"
@ -935,7 +936,22 @@ void show_fw_version_warnings() {
lcd_update_enable(true);
}
uint8_t check_printer_version()
{
uint8_t version_changed = 0;
uint16_t printer_type = eeprom_read_word((uint16_t*)EEPROM_PRINTER_TYPE);
uint16_t motherboard = eeprom_read_word((uint16_t*)EEPROM_BOARD_TYPE);
if (printer_type != PRINTER_TYPE) {
if (printer_type == 0xffff) eeprom_write_word((uint16_t*)EEPROM_PRINTER_TYPE, PRINTER_TYPE);
else version_changed |= 0b10;
}
if (motherboard != MOTHERBOARD) {
if(motherboard == 0xffff) eeprom_write_word((uint16_t*)EEPROM_BOARD_TYPE, MOTHERBOARD);
else version_changed |= 0b01;
}
return version_changed;
}
void erase_eeprom_section(uint16_t offset, uint16_t bytes)
{
@ -1022,7 +1038,15 @@ void setup()
SERIAL_ECHOLN((int)sizeof(block_t)*BLOCK_BUFFER_SIZE);
//lcd_update_enable(false); // why do we need this?? - andre
// loads data from EEPROM if available else uses defaults (and resets step acceleration rate)
bool previous_settings_retrieved = Config_RetrieveSettings(EEPROM_OFFSET);
bool previous_settings_retrieved = false;
uint8_t hw_changed = check_printer_version();
if (!(hw_changed & 0b10)) { //if printer version wasn't changed, check for eeprom version and retrieve settings from eeprom in case that version wasn't changed
previous_settings_retrieved = Config_RetrieveSettings(EEPROM_OFFSET);
}
else { //printer version was changed so use default settings
Config_ResetDefault();
}
SdFatUtil::set_stack_guard(); //writes magic number at the end of static variables to protect against overwriting static memory by stack
tp_init(); // Initialize temperature loop
@ -1193,8 +1217,27 @@ void setup()
show_fw_version_warnings();
switch (hw_changed) {
//if motherboard or printer type was changed inform user as it can indicate flashing wrong firmware version
//if user confirms with knob, new hw version (printer and/or motherboard) is written to eeprom and message will be not shown next time
case(0b01):
lcd_show_fullscreen_message_and_wait_P(MSG_CHANGED_MOTHERBOARD);
eeprom_write_word((uint16_t*)EEPROM_BOARD_TYPE, MOTHERBOARD);
break;
case(0b10):
lcd_show_fullscreen_message_and_wait_P(MSG_CHANGED_PRINTER);
eeprom_write_word((uint16_t*)EEPROM_PRINTER_TYPE, PRINTER_TYPE);
break;
case(0b11):
lcd_show_fullscreen_message_and_wait_P(MSG_CHANGED_BOTH);
eeprom_write_word((uint16_t*)EEPROM_PRINTER_TYPE, PRINTER_TYPE);
eeprom_write_word((uint16_t*)EEPROM_BOARD_TYPE, MOTHERBOARD);
break;
default: break; //no change, show no message
}
if (!previous_settings_retrieved) {
lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED); //if EEPROM version was changed, inform user that default setting were loaded
lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED); //if EEPROM version or printer type was changed, inform user that default setting were loaded
erase_eeprom_section(EEPROM_OFFSET, 156); //erase M500 part of eeprom
}
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) {

View File

@ -320,6 +320,27 @@ const char * const MSG_CARD_MENU_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_CARD_MENU_CZ
};
const char MSG_CHANGED_BOTH_EN[] PROGMEM = "Warning: both printer type and motherboard type changed.";
const char MSG_CHANGED_BOTH_CZ[] PROGMEM = "Varovani: doslo ke zmene typu tiskarny a motherboardu.";
const char * const MSG_CHANGED_BOTH_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_CHANGED_BOTH_EN,
MSG_CHANGED_BOTH_CZ
};
const char MSG_CHANGED_MOTHERBOARD_EN[] PROGMEM = "Warning: motherboard type changed.";
const char MSG_CHANGED_MOTHERBOARD_CZ[] PROGMEM = "Varovani: doslo ke zmene typu motherboardu.";
const char * const MSG_CHANGED_MOTHERBOARD_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_CHANGED_MOTHERBOARD_EN,
MSG_CHANGED_MOTHERBOARD_CZ
};
const char MSG_CHANGED_PRINTER_EN[] PROGMEM = "Warning: printer type changed.";
const char MSG_CHANGED_PRINTER_CZ[] PROGMEM = "Varovani: doslo ke zmene typu tiskarny.";
const char * const MSG_CHANGED_PRINTER_LANG_TABLE[LANG_NUM] PROGMEM = {
MSG_CHANGED_PRINTER_EN,
MSG_CHANGED_PRINTER_CZ
};
const char MSG_CHANGE_EXTR_EN[] PROGMEM = "Change extruder";
const char MSG_CHANGE_EXTR_CZ[] PROGMEM = "Zmenit extruder";
const char * const MSG_CHANGE_EXTR_LANG_TABLE[LANG_NUM] PROGMEM = {

View File

@ -120,6 +120,12 @@ extern const char* const MSG_CALIBRATION_PINDA_MENU_LANG_TABLE[LANG_NUM];
#define MSG_CALIBRATION_PINDA_MENU LANG_TABLE_SELECT(MSG_CALIBRATION_PINDA_MENU_LANG_TABLE)
extern const char* const MSG_CARD_MENU_LANG_TABLE[LANG_NUM];
#define MSG_CARD_MENU LANG_TABLE_SELECT(MSG_CARD_MENU_LANG_TABLE)
extern const char* const MSG_CHANGED_BOTH_LANG_TABLE[LANG_NUM];
#define MSG_CHANGED_BOTH LANG_TABLE_SELECT(MSG_CHANGED_BOTH_LANG_TABLE)
extern const char* const MSG_CHANGED_MOTHERBOARD_LANG_TABLE[LANG_NUM];
#define MSG_CHANGED_MOTHERBOARD LANG_TABLE_SELECT(MSG_CHANGED_MOTHERBOARD_LANG_TABLE)
extern const char* const MSG_CHANGED_PRINTER_LANG_TABLE[LANG_NUM];
#define MSG_CHANGED_PRINTER LANG_TABLE_SELECT(MSG_CHANGED_PRINTER_LANG_TABLE)
extern const char* const MSG_CHANGE_EXTR_LANG_TABLE[LANG_NUM];
#define MSG_CHANGE_EXTR LANG_TABLE_SELECT(MSG_CHANGE_EXTR_LANG_TABLE)
extern const char* const MSG_CHANGE_SUCCESS_LANG_TABLE[LANG_NUM];

View File

@ -406,3 +406,7 @@
#define MSG_FW_VERSION_ALPHA "Pouzivate alpha verzi firmwaru. Jedna se o vyvojovou verzi. Pouzivani teto verze firmware neni doporuceno a muze zpusobit poskozeni tiskarny."
#define MSG_FW_VERSION_BETA "Pouzivate beta verzi firmwaru. Jedna se o vyvojovou verzi. Pouzivani teto verze firmware neni doporuceno a muze zpusobit poskozeni tiskarny."
#define MSG_FW_VERSION_RC "Tato verze firmware je release candidate. Nektere z funkci nemusi pracovat spolehlive."
#define MSG_CHANGED_MOTHERBOARD "Varovani: doslo ke zmene typu motherboardu."
#define MSG_CHANGED_PRINTER "Varovani: doslo ke zmene typu tiskarny."
#define MSG_CHANGED_BOTH "Varovani: doslo ke zmene typu tiskarny a motherboardu."

View File

@ -412,3 +412,6 @@
#define(length=20, lines=8) MSG_FW_VERSION_ALPHA "You are using firmware alpha version. This is development version. Using this version is not recommended and may cause printer damage."
#define(length=20, lines=8) MSG_FW_VERSION_BETA "You are using firmware beta version. This is development version. Using this version is not recommended and may cause printer damage."
#define(length=20, lines=8) MSG_FW_VERSION_RC "This firmware version is release candidate. Some of the features may not work properly."
#define(length=20, lines=4) MSG_CHANGED_MOTHERBOARD "Warning: motherboard type changed."
#define(length=20, lines=4) MSG_CHANGED_PRINTER "Warning: printer type changed."
#define(length=20, lines=4) MSG_CHANGED_BOTH "Warning: both printer type and motherboard type changed."

14
Firmware/printers.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef PRINTERS_H
#define PRINTERS_H
#define PRINTER_UNKNOWN 0
#define PRINTER_MK1 100
#define PRINTER_MK2 200
#define PRINTER_MK2_SNMM 201
#define PRINTER_MK25 250
#define PRINTER_MK25_SNMM 251
#define PRINTER_MK3 300
#define PRINTER_MK3_SNMM 301
#endif //PRINTERS_H