parent
4c27d057b8
commit
52965bd05d
|
|
@ -5,6 +5,3 @@ const uint16_t _nPrinterType PROGMEM=PRINTER_TYPE;
|
|||
const char _sPrinterName[] PROGMEM=PRINTER_NAME;
|
||||
const uint16_t _nPrinterMmuType PROGMEM=PRINTER_MMU_TYPE;
|
||||
const char _sPrinterMmuName[] PROGMEM=PRINTER_MMU_NAME;
|
||||
|
||||
uint16_t nPrinterType;
|
||||
PGM_P sPrinterName;
|
||||
|
|
@ -12,8 +12,6 @@ extern const uint16_t _nPrinterType;
|
|||
extern const char _sPrinterName[] PROGMEM;
|
||||
extern const uint16_t _nPrinterMmuType;
|
||||
extern const char _sPrinterMmuName[] PROGMEM;
|
||||
extern uint16_t nPrinterType;
|
||||
extern PGM_P sPrinterName;
|
||||
|
||||
// Firmware version
|
||||
#define FW_MAJOR 3
|
||||
|
|
|
|||
|
|
@ -8049,27 +8049,27 @@ Sigma_Exit:
|
|||
else if(code_seen('Q'))
|
||||
SERIAL_PROTOCOLLN((float)eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)/1000.0);
|
||||
break;
|
||||
case ClPrintChecking::_Model: // ~ .2
|
||||
fSetMmuMode(MMU2::mmu2.Enabled());
|
||||
case ClPrintChecking::_Model: { // ~ .2
|
||||
uint16_t type = nPrinterType(MMU2::mmu2.Enabled());
|
||||
if(code_seen('P'))
|
||||
{
|
||||
uint16_t nPrinterModel;
|
||||
nPrinterModel=(uint16_t)code_value_long();
|
||||
// based on current state of MMU (active/stopped/connecting) perform a runtime update of the printer type
|
||||
printer_model_check(nPrinterModel);
|
||||
printer_model_check(nPrinterModel, type);
|
||||
}
|
||||
else if(code_seen('Q'))
|
||||
SERIAL_PROTOCOLLN(nPrinterType);
|
||||
break;
|
||||
case ClPrintChecking::_Smodel: // ~ .3
|
||||
fSetMmuMode(MMU2::mmu2.Enabled());
|
||||
SERIAL_PROTOCOLLN(type);
|
||||
} break;
|
||||
case ClPrintChecking::_Smodel: { // ~ .3
|
||||
const char *type = sPrinterType(MMU2::mmu2.Enabled());
|
||||
if(code_seen('P'))
|
||||
{
|
||||
printer_smodel_check(strchr_pointer);
|
||||
printer_smodel_check(strchr_pointer, type);
|
||||
}
|
||||
else if(code_seen('Q'))
|
||||
SERIAL_PROTOCOLLNRPGM(sPrinterName);
|
||||
break;
|
||||
SERIAL_PROTOCOLLNRPGM(type);
|
||||
} break;
|
||||
case ClPrintChecking::_Version: // ~ .4
|
||||
if(code_seen('P'))
|
||||
fw_version_check(++strchr_pointer);
|
||||
|
|
|
|||
|
|
@ -328,15 +328,15 @@ void nozzle_diameter_check(uint16_t nDiameter) {
|
|||
}
|
||||
}
|
||||
|
||||
void printer_model_check(uint16_t nPrinterModel) {
|
||||
void printer_model_check(uint16_t nPrinterModel, uint16_t actualPrinterModel) {
|
||||
if (oCheckModel == ClCheckModel::_None)
|
||||
return;
|
||||
if (nPrinterModel == nPrinterType)
|
||||
if (nPrinterModel == actualPrinterModel)
|
||||
return;
|
||||
// SERIAL_ECHO_START;
|
||||
// SERIAL_ECHOLNPGM("Printer model differs from the G-code ...");
|
||||
// SERIAL_ECHOPGM("actual : ");
|
||||
// SERIAL_ECHOLN(nPrinterType);
|
||||
// SERIAL_ECHOLN(actualPrinterModel);
|
||||
// SERIAL_ECHOPGM("expected: ");
|
||||
// SERIAL_ECHOLN(nPrinterModel);
|
||||
switch (oCheckModel) {
|
||||
|
|
@ -470,16 +470,16 @@ if(!pStrEnd)
|
|||
return pStrBegin;
|
||||
}
|
||||
|
||||
void printer_smodel_check(const char *pStrPos) {
|
||||
void printer_smodel_check(const char *pStrPos, const char *actualPrinterSModel) {
|
||||
char* pResult;
|
||||
size_t nLength,nPrinterNameLength;
|
||||
|
||||
nPrinterNameLength = strlen_P(sPrinterName);
|
||||
nPrinterNameLength = strlen_P(actualPrinterSModel);
|
||||
pResult=code_string(pStrPos,&nLength);
|
||||
|
||||
if(pResult != NULL && nLength == nPrinterNameLength) {
|
||||
// Only compare them if the lengths match
|
||||
if (strncmp_P(pResult, sPrinterName, nLength) == 0) return;
|
||||
if (strncmp_P(pResult, actualPrinterSModel, nLength) == 0) return;
|
||||
}
|
||||
|
||||
switch(oCheckModel)
|
||||
|
|
@ -501,13 +501,21 @@ lcd_update_enable(true); // display / status-line recovery
|
|||
}
|
||||
}
|
||||
|
||||
void __attribute__((noinline)) fSetMmuMode(bool bMMu) {
|
||||
uint16_t nPrinterType(bool bMMu) {
|
||||
if (bMMu) {
|
||||
nPrinterType = pgm_read_word(&_nPrinterMmuType);
|
||||
sPrinterName = _sPrinterMmuName;
|
||||
} else {
|
||||
nPrinterType = pgm_read_word(&_nPrinterType);
|
||||
sPrinterName = _sPrinterName;
|
||||
return pgm_read_word(&_nPrinterMmuType);
|
||||
}
|
||||
else {
|
||||
return pgm_read_word(&_nPrinterType);
|
||||
}
|
||||
}
|
||||
|
||||
const char *sPrinterType(bool bMMu) {
|
||||
if (bMMu) {
|
||||
return _sPrinterMmuName;
|
||||
}
|
||||
else {
|
||||
return _sPrinterName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,12 +87,13 @@ extern ClCheckGcode oCheckGcode;
|
|||
|
||||
void fCheckModeInit();
|
||||
void nozzle_diameter_check(uint16_t nDiameter);
|
||||
void printer_model_check(uint16_t nPrinterModel);
|
||||
void printer_smodel_check(const char* pStrPos);
|
||||
void printer_model_check(uint16_t nPrinterModel, uint16_t actualPrinterModel);
|
||||
void printer_smodel_check(const char *pStrPos, const char *actualPrinterSModel);
|
||||
void fw_version_check(const char *pVersion);
|
||||
void gcode_level_check(uint16_t nGcodeLevel);
|
||||
|
||||
void fSetMmuMode(bool bMMu);
|
||||
uint16_t nPrinterType(bool bMMu);
|
||||
const char *sPrinterType(bool bMMu);
|
||||
|
||||
#define IP4_STR_SIZE 16
|
||||
extern void ip4_to_str(char* dest, uint8_t* IP);
|
||||
|
|
|
|||
Loading…
Reference in New Issue