Add Bed/Pinda temp setting support to M850

This commit is contained in:
vintagepc 2019-09-13 18:17:53 -04:00
parent 6ad105f91f
commit bc31de2201
1 changed files with 46 additions and 15 deletions

View File

@ -3429,7 +3429,7 @@ extern uint8_t st_backlash_y;
//!@n M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
//!@n M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
//!@n M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
//!@n M850 - Set sheet data S[id] Z[offset] L[label]
//!@n M850 - Set sheet data S[id] Z[offset] L[label] B[bed_temp] P[PINDA_TEMP]
//!@n M860 - Wait for PINDA thermistor to reach target temperature.
//!@n M861 - Set / Read PINDA temperature compensation offsets
//!@n M900 - Set LIN_ADVANCE options, if enabled. See Configuration_adv.h for details.
@ -7213,12 +7213,14 @@ Sigma_Exit:
case 850: {
//! ### M850 - set sheet parameters
//! //!@n M850 - Set sheet data S[id] Z[offset] L[label]
bool bHasZ = false, bHasLabel = false;
//! //!@n M850 - Set sheet data S[id] Z[offset] L[label] B[bed_temp] P[PINDA_TEMP]
bool bHasZ = false, bHasLabel = false, bHasBed = false, bHasPinda = false;
uint8_t iSel = 0;
int16_t zraw = 0;
float z_val = 0;
char strLabel[8];
uint8_t iBedC = 0;
uint8_t iPindaC = 0;
strLabel[7] = '\0'; // null terminate.
size_t max_sheets = sizeof(EEPROM_Sheets_base->s)/sizeof(EEPROM_Sheets_base->s[0]);
@ -7244,6 +7246,11 @@ Sigma_Exit:
}
bHasZ = true;
}
else
{
zraw = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[iSel].z_offset)));
z_val = ((float)zraw/cs.axis_steps_per_unit[Z_AXIS]);
}
if (code_seen('L'))
{
@ -7257,31 +7264,51 @@ Sigma_Exit:
strncpy(strLabel,src,7);
}
}
else
{
eeprom_read_block(strLabel, EEPROM_Sheets_base->s[iSel].name, sizeof(Sheet::name));
}
if (code_seen('B'))
{
bHasBed = true;
iBedC = code_value_uint8();
}
else
{
iBedC = eeprom_read_byte(&EEPROM_Sheets_base->s[iSel].bed_temp);
}
if (code_seen('P'))
{
bHasPinda = true;
iPindaC = code_value_uint8();
}
else
iPindaC = eeprom_read_byte(&EEPROM_Sheets_base->s[iSel].pinda_temp);
{
}
SERIAL_PROTOCOLPGM("Sheet ");
SERIAL_PROTOCOL((int)iSel);
if (!bHasZ && !bHasLabel&& !eeprom_is_sheet_initialized(iSel))
{
if (!eeprom_is_sheet_initialized(iSel))
SERIAL_PROTOCOLLNPGM(" NOT INITIALIZED");
break;
}
if (bHasZ)
{
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[iSel].z_offset)),zraw);
}
else
{
zraw = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[iSel].z_offset)));
z_val = ((float)zraw/cs.axis_steps_per_unit[Z_AXIS]);
}
if (bHasLabel)
{
eeprom_update_block(strLabel,EEPROM_Sheets_base->s[iSel].name,sizeof(Sheet::name));
}
else
if (bHasBed)
{
eeprom_read_block(strLabel, EEPROM_Sheets_base->s[iSel].name, 7);
eeprom_update_byte(&EEPROM_Sheets_base->s[iSel].bed_temp, iBedC);
}
if (bHasPinda)
{
eeprom_update_byte(&EEPROM_Sheets_base->s[iSel].pinda_temp, iPindaC);
}
SERIAL_PROTOCOLPGM(" Z");
@ -7289,7 +7316,11 @@ Sigma_Exit:
SERIAL_PROTOCOLPGM(" R");
SERIAL_PROTOCOL((int)zraw);
SERIAL_PROTOCOLPGM(" L");
SERIAL_PROTOCOLLN(strLabel);
SERIAL_PROTOCOL(strLabel);
SERIAL_PROTOCOLPGM(" B");
SERIAL_PROTOCOL((int)iBedC);
SERIAL_PROTOCOLPGM(" P");
SERIAL_PROTOCOLLN((int)iPindaC);
break;
}