Try immediate EEPROM writes for flash size optimization
This commit is contained in:
parent
1dada5ba81
commit
14306e59c8
|
|
@ -7725,7 +7725,6 @@ Sigma_Exit:
|
|||
case 850: {
|
||||
//! ### M850 - set sheet parameters
|
||||
//! //!@n M850 - Set sheet data S[id] Z[offset] L[label] B[bed_temp] P[PINDA_TEMP] A[IS_ACTIVE]
|
||||
bool bHasZ = false, bHasLabel = false, bHasBed = false, bHasPinda = false, bHasIsActive = false;
|
||||
uint8_t iSel = 0;
|
||||
int16_t zraw = 0;
|
||||
float z_val = 0;
|
||||
|
|
@ -7757,7 +7756,7 @@ Sigma_Exit:
|
|||
SERIAL_PROTOCOLLNPGM(" Z VALUE OUT OF RANGE");
|
||||
break;
|
||||
}
|
||||
bHasZ = true;
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[iSel].z_offset)),zraw);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -7767,13 +7766,13 @@ Sigma_Exit:
|
|||
|
||||
if (code_seen('L'))
|
||||
{
|
||||
bHasLabel = true;
|
||||
char *src = strchr_pointer + 1;
|
||||
while (*src == ' ') ++src;
|
||||
if (*src != '\0')
|
||||
{
|
||||
strncpy(strLabel,src,7);
|
||||
}
|
||||
eeprom_update_block(strLabel,EEPROM_Sheets_base->s[iSel].name,sizeof(Sheet::name));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -7782,8 +7781,8 @@ Sigma_Exit:
|
|||
|
||||
if (code_seen('B'))
|
||||
{
|
||||
bHasBed = true;
|
||||
iBedC = code_value_uint8();
|
||||
eeprom_update_byte(&EEPROM_Sheets_base->s[iSel].bed_temp, iBedC);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -7792,8 +7791,8 @@ Sigma_Exit:
|
|||
|
||||
if (code_seen('P'))
|
||||
{
|
||||
bHasPinda = true;
|
||||
iPindaC = code_value_uint8();
|
||||
eeprom_update_byte(&EEPROM_Sheets_base->s[iSel].pinda_temp, iPindaC);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -7802,8 +7801,8 @@ Sigma_Exit:
|
|||
|
||||
if (code_seen('A'))
|
||||
{
|
||||
bHasIsActive = true;
|
||||
bIsActive |= code_value_uint8() || (eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)) == iSel);
|
||||
if(bIsActive) eeprom_update_byte(&EEPROM_Sheets_base->active_sheet, iSel);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -7815,26 +7814,6 @@ Sigma_Exit:
|
|||
if (!eeprom_is_sheet_initialized(iSel))
|
||||
SERIAL_PROTOCOLLNPGM(" NOT INITIALIZED");
|
||||
|
||||
if (bHasZ)
|
||||
{
|
||||
eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[iSel].z_offset)),zraw);
|
||||
}
|
||||
if (bHasLabel)
|
||||
{
|
||||
eeprom_update_block(strLabel,EEPROM_Sheets_base->s[iSel].name,sizeof(Sheet::name));
|
||||
}
|
||||
if (bHasBed)
|
||||
{
|
||||
eeprom_update_byte(&EEPROM_Sheets_base->s[iSel].bed_temp, iBedC);
|
||||
}
|
||||
if (bHasPinda)
|
||||
{
|
||||
eeprom_update_byte(&EEPROM_Sheets_base->s[iSel].pinda_temp, iPindaC);
|
||||
}
|
||||
if (bHasIsActive && bIsActive)
|
||||
{
|
||||
eeprom_update_byte(&EEPROM_Sheets_base->active_sheet, iSel);
|
||||
}
|
||||
|
||||
SERIAL_PROTOCOLPGM(" Z");
|
||||
SERIAL_PROTOCOL_F(z_val,4);
|
||||
|
|
|
|||
Loading…
Reference in New Issue