Replace calibration state with a new calibration bitmap
- Move calibration status/declarations to util.h - Allows to query the status of each step independently without assuming any order - Allows to extend the calibration with new steps transparently
This commit is contained in:
parent
2552fee4c7
commit
9a018230ce
|
|
@ -524,36 +524,6 @@ your extruder heater takes 2 minutes to hit the target on heating.
|
|||
|
||||
#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm). Used by the volumetric extrusion.
|
||||
|
||||
// Calibration status of the machine, to be stored into the EEPROM,
|
||||
// (unsigned char*)EEPROM_CALIBRATION_STATUS
|
||||
enum CalibrationStatus
|
||||
{
|
||||
// Freshly assembled, needs to peform a self-test and the XYZ calibration.
|
||||
CALIBRATION_STATUS_ASSEMBLED = 255,
|
||||
|
||||
// For the wizard: self test has been performed, now the XYZ calibration is needed.
|
||||
CALIBRATION_STATUS_XYZ_CALIBRATION = 250,
|
||||
|
||||
// For the wizard: factory assembled, needs to run Z calibration.
|
||||
CALIBRATION_STATUS_Z_CALIBRATION = 240,
|
||||
|
||||
#ifdef TEMP_MODEL
|
||||
// The XYZ calibration has been performed, needs to run Temp model calibration.
|
||||
CALIBRATION_STATUS_TEMP_MODEL_CALIBRATION = 235,
|
||||
#endif //TEMP_MODEL
|
||||
|
||||
// The XYZ calibration AND OR Temp model calibration has been performed, now it remains to run the V2Calibration.gcode.
|
||||
CALIBRATION_STATUS_LIVE_ADJUST = 230,
|
||||
|
||||
// Calibrated, ready to print.
|
||||
CALIBRATION_STATUS_CALIBRATED = 1,
|
||||
|
||||
// Legacy: resetted by issuing a G86 G-code.
|
||||
// This value can only be expected after an upgrade from the initial MK2 firmware releases.
|
||||
// Currently the G86 sets the calibration status to
|
||||
CALIBRATION_STATUS_UNKNOWN = 0,
|
||||
};
|
||||
|
||||
// Try to maintain a minimum distance from the bed even when Z is
|
||||
// unknown when doing the following operations
|
||||
#define MIN_Z_FOR_LOAD 50 // lcd filament loading or autoload
|
||||
|
|
|
|||
|
|
@ -65,7 +65,4 @@ FORCE_INLINE void Config_StoreSettings() {}
|
|||
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
|
||||
#endif
|
||||
|
||||
inline uint8_t calibration_status() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS); }
|
||||
inline void calibration_status_store(uint8_t status) { eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS, status); }
|
||||
inline bool calibration_status_pinda() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA); }
|
||||
#endif//CONFIG_STORE_H
|
||||
|
|
|
|||
|
|
@ -89,13 +89,13 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
|||
| 0x0FFA 4090 | uint16 | EEPROM_BABYSTEP_Y | ??? | ff ffh 65535 | Babystep for Y axis _unsued_ | ^ | D3 Ax0ffa C2
|
||||
| 0x0FF8 4088 | uint16 | EEPROM_BABYSTEP_Z | ??? | ff ffh 65535 | Babystep for Z axis _lagacy_ | ^ | D3 Ax0ff8 C2
|
||||
| ^ | ^ | ^ | ^ | ^ | multiple values stored now in EEPROM_Sheets_base | ^ | ^
|
||||
| 0x0FF7 4087 | uint8 | EEPROM_CALIBRATION_STATUS | ffh 255 | ffh 255 | Assembled _default_ | ??? | D3 Ax0ff7 C1
|
||||
| 0x0FF7 4087 | uint8 | EEPROM_CALIBRATION_STATUS_V1 | ffh 255 | ffh 255 | Calibration status (<v3.12) | ??? | D3 Ax0ff7 C1
|
||||
| ^ | ^ | ^ | 01h 1 | ^ | Calibrated | ^ | ^
|
||||
| ^ | ^ | ^ | e6h 230 | ^ | needs Live Z adjustment | ^ | ^
|
||||
| ^ | ^ | ^ | ebh 235 | ^ | needs Temp Model calibration | ^ | ^
|
||||
| ^ | ^ | ^ | f0h 240 | ^ __P__ | needs Z calibration | ^ | ^
|
||||
| ^ | ^ | ^ | fah 250 | ^ | needs XYZ calibration | ^ | ^
|
||||
| ^ | ^ | ^ | 00h 0 | ^ | Unknown | ^ | ^
|
||||
| ^ | ^ | ^ | 00h 0 | ^ | Unknown (legacy) | ^ | ^
|
||||
| 0x0FF5 4085 | uint16 | EEPROM_BABYSTEP_Z0 | ??? | ff ffh 65535 | Babystep for Z ??? | ??? | D3 Ax0ff5 C2
|
||||
| 0x0FF1 4081 | unint32 | EEPROM_FILAMENTUSED | ??? | 00 00 00 00h 0 __S/P__| Filament used in meters | ??? | D3 Ax0ff1 C4
|
||||
| 0x0FED 4077 | unint32 | EEPROM_TOTALTIME | ??? | 00 00 00 00h 0 __S/P__| Total print time | ??? | D3 Ax0fed C4
|
||||
|
|
@ -348,6 +348,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
|||
| 0x0CA7 3239 | uint8 | EEPROM_HEAT_BED_ON_LOAD_FILAMENT | ffh 255 | ffh 255 | Heat bed on load filament unknown state | LCD menu | D3 Ax0ca7 C1
|
||||
| ^ | ^ | ^ | 00h 0 | ^ | Do not heat bed on load filament | ^ | ^
|
||||
| ^ | ^ | ^ | 01h 1 | ^ | Heat bed on load filament | ^ | ^
|
||||
| 0x0CA6 3238 | uint8 | EEPROM_CALIBRATION_STATUS_V2 | ffh 255 | ffh 255 | Calibration status (>=v3.12) | ??? | D3 Ax0ca6 C1
|
||||
|
||||
|Address begin|Bit/Type | Name | Valid values | Default/FactoryReset | Description |Gcode/Function| Debug code
|
||||
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--:
|
||||
|
|
@ -370,7 +371,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
|||
#define EEPROM_BABYSTEP_X 4092 //unused
|
||||
#define EEPROM_BABYSTEP_Y 4090 //unused
|
||||
#define EEPROM_BABYSTEP_Z 4088 //legacy, multiple values stored now in EEPROM_Sheets_base
|
||||
#define EEPROM_CALIBRATION_STATUS 4087
|
||||
#define EEPROM_CALIBRATION_STATUS_V1 4087 // legacy, used up to v3.11
|
||||
#define EEPROM_BABYSTEP_Z0 4085
|
||||
#define EEPROM_FILAMENTUSED 4081
|
||||
// uint32_t
|
||||
|
|
@ -575,9 +576,10 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE);
|
|||
#define EEPROM_MMU_ENABLED (EEPROM_FSENSOR_JAM_DETECTION-1) // uint8_t
|
||||
#define EEPROM_TOTAL_TOOLCHANGE_COUNT (EEPROM_MMU_ENABLED-4)
|
||||
#define EEPROM_HEAT_BED_ON_LOAD_FILAMENT (EEPROM_TOTAL_TOOLCHANGE_COUNT-1) //uint8
|
||||
#define EEPROM_CALIBRATION_STATUS_V2 (EEPROM_HEAT_BED_ON_LOAD_FILAMENT-1) //uint8
|
||||
|
||||
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
|
||||
#define EEPROM_LAST_ITEM EEPROM_HEAT_BED_ON_LOAD_FILAMENT
|
||||
#define EEPROM_LAST_ITEM EEPROM_CALIBRATION_STATUS_V2
|
||||
// !!!!!
|
||||
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
|
||||
// !!!!!
|
||||
|
|
|
|||
|
|
@ -464,3 +464,24 @@ void ip4_to_str(char* dest, uint8_t* IP)
|
|||
{
|
||||
sprintf_P(dest, PSTR("%u.%u.%u.%u"), IP[0], IP[1], IP[2], IP[3]);
|
||||
}
|
||||
|
||||
|
||||
bool calibration_status_get(CalibrationStatus components)
|
||||
{
|
||||
CalibrationStatus status = eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_V2);
|
||||
return ((status & components) == components);
|
||||
}
|
||||
|
||||
void calibration_status_set(CalibrationStatus components)
|
||||
{
|
||||
CalibrationStatus status = eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_V2);
|
||||
status |= components;
|
||||
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_V2, status);
|
||||
}
|
||||
|
||||
void calibration_status_clear(CalibrationStatus components)
|
||||
{
|
||||
CalibrationStatus status = eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_V2);
|
||||
status &= ~components;
|
||||
eeprom_update_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_V2, status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,3 +100,35 @@ const char *sPrinterType(bool bMMu);
|
|||
|
||||
#define IP4_STR_SIZE 16
|
||||
extern void ip4_to_str(char* dest, uint8_t* IP);
|
||||
|
||||
// Calibration status of the machine
|
||||
// (unsigned char*)EEPROM_CALIBRATION_STATUS_V2
|
||||
typedef uint8_t CalibrationStatus;
|
||||
const CalibrationStatus CALIBRATION_STATUS_SELFTEST = 0b00000001; // Selftest
|
||||
const CalibrationStatus CALIBRATION_STATUS_XYZ = 0b00000010; // XYZ calibration
|
||||
const CalibrationStatus CALIBRATION_STATUS_Z = 0b00000100; // Z calibration
|
||||
#ifdef TEMP_MODEL
|
||||
const CalibrationStatus CALIBRATION_STATUS_TEMP_MODEL = 0b00001000; // Temperature model calibration
|
||||
#endif
|
||||
const CalibrationStatus CALIBRATION_STATUS_LIVE_ADJUST = 0b00010000; // 1st layer calibration
|
||||
const CalibrationStatus CALIBRATION_STATUS_UNKNOWN = 0b10000000; // Freshly assembled or unknown status
|
||||
|
||||
// Calibration steps performed by the wizard
|
||||
const CalibrationStatus CALIBRATION_WIZARD_STEPS =
|
||||
CALIBRATION_STATUS_SELFTEST |
|
||||
CALIBRATION_STATUS_XYZ |
|
||||
CALIBRATION_STATUS_Z |
|
||||
#ifdef TEMP_MODEL
|
||||
CALIBRATION_STATUS_TEMP_MODEL |
|
||||
#endif
|
||||
CALIBRATION_STATUS_LIVE_ADJUST;
|
||||
|
||||
// Calibration steps enforced after service prep
|
||||
const CalibrationStatus CALIBRATION_FORCE_PREP = CALIBRATION_STATUS_Z;
|
||||
|
||||
bool calibration_status_get(CalibrationStatus components);
|
||||
void calibration_status_set(CalibrationStatus components);
|
||||
void calibration_status_clear(CalibrationStatus components);
|
||||
|
||||
// PINDA has an independent calibration flag
|
||||
inline bool calibration_status_pinda() { return eeprom_read_byte((uint8_t*)EEPROM_CALIBRATION_STATUS_PINDA); }
|
||||
|
|
|
|||
Loading…
Reference in New Issue