Skip to content

Commit

Permalink
Fixed printer_smodel_check for MK3/S and possible older MMU machines (M…
Browse files Browse the repository at this point in the history
…arlinFirmware#4265)

Fixed printer_smodel_check for non MMU machines
Commit 136ef96 broke the compatibility check for MK3S without MMU.

May have fixed bug for older MMU machines.
Only comparing up to the length of the value from the g-code, would return equal on older MMU machines trying to run g-code sliced without the MMU.
Unfortunately if that is a feature, it will cause the different printer warning.
  • Loading branch information
AddioElectronics authored and DRracer committed Jul 21, 2023
1 parent 739459c commit 6f89ec0
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Firmware/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,16 +407,19 @@ return pStrBegin;
}

void printer_smodel_check(const char *pStrPos, const char *actualPrinterSModel) {
char* pResult;
size_t nLength;

pResult=code_string(pStrPos,&nLength);

if(pResult != NULL) {
// Only compare first 6 chars on MK3|MK3S
if (strncmp_P(pResult, PSTR("MK3"), 3) == 0) nLength = 6;
if (strncmp_P(pResult, actualPrinterSModel, nLength) == 0) return;
}
char* pResult;
size_t nLength;
size_t aLength;

pResult=code_string(pStrPos,&nLength);
if(pResult != NULL) {
aLength=strlen_P(actualPrinterSModel);
if(aLength > nLength) nLength = aLength;

// Only compare first 6 chars on MK3|MK3S if string longer than 4 characters
if (nLength > 4 && strncmp_P(pResult, PSTR("MK3"), 3) == 0) nLength = 6;
if (strncmp_P(pResult, actualPrinterSModel, nLength) == 0) return;
}

render_M862_warnings(
_T(MSG_GCODE_DIFF_PRINTER_CONTINUE)
Expand Down

0 comments on commit 6f89ec0

Please sign in to comment.