util.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. #include "Configuration.h"
  2. #include "ultralcd.h"
  3. #include "menu.h"
  4. #include "sound.h"
  5. #include "language.h"
  6. #include "util.h"
  7. #include <avr/pgmspace.h>
  8. #include "Prusa_farm.h"
  9. // Allocate the version string in the program memory. Otherwise the string lands either on the stack or in the global RAM.
  10. static const char FW_VERSION_STR[] PROGMEM = FW_VERSION;
  11. static const uint16_t FW_VERSION_NR[4] PROGMEM = { FW_MAJOR, FW_MINOR, FW_REVISION, FW_COMMIT_NR };
  12. const char* FW_VERSION_STR_P()
  13. {
  14. return FW_VERSION_STR;
  15. }
  16. const char FW_PRUSA3D_MAGIC_STR[] PROGMEM = FW_PRUSA3D_MAGIC;
  17. const char* FW_PRUSA3D_MAGIC_STR_P()
  18. {
  19. return FW_PRUSA3D_MAGIC_STR;
  20. }
  21. const char STR_REVISION_DEV [] PROGMEM = "dev";
  22. const char STR_REVISION_ALPHA[] PROGMEM = "alpha";
  23. const char STR_REVISION_BETA [] PROGMEM = "beta";
  24. const char STR_REVISION_RC [] PROGMEM = "rc";
  25. inline bool is_whitespace_or_nl(char c)
  26. {
  27. return c == ' ' || c == '\t' || c == '\n' || c == '\r';
  28. }
  29. inline bool is_whitespace_or_nl_or_eol(char c)
  30. {
  31. return c == 0 || c == ' ' || c == '\t' || c == '\n' || c == '\r';
  32. }
  33. inline bool is_digit(char c)
  34. {
  35. return c >= '0' && c <= '9';
  36. }
  37. // Parse a major.minor.revision version number.
  38. // Return true if valid.
  39. inline bool parse_version(const char *str, uint16_t version[4])
  40. {
  41. #if 0
  42. SERIAL_ECHOPGM("Parsing version string ");
  43. SERIAL_ECHO(str);
  44. SERIAL_ECHOLNPGM("");
  45. #endif
  46. const char *major = str;
  47. const char *p = str;
  48. while (is_digit(*p)) ++ p;
  49. if (*p != '.')
  50. return false;
  51. const char *minor = ++ p;
  52. while (is_digit(*p)) ++ p;
  53. if (*p != '.')
  54. return false;
  55. const char *rev = ++ p;
  56. while (is_digit(*p)) ++ p;
  57. if (! is_whitespace_or_nl_or_eol(*p) && *p != '-')
  58. return false;
  59. char *endptr = NULL;
  60. version[0] = strtol(major, &endptr, 10);
  61. if (endptr != minor - 1)
  62. return false;
  63. version[1] = strtol(minor, &endptr, 10);
  64. if (endptr != rev - 1)
  65. return false;
  66. version[2] = strtol(rev, &endptr, 10);
  67. if (endptr != p)
  68. return false;
  69. version[3] = FIRMWARE_REVISION_RELEASED;
  70. if (*p ++ == '-') {
  71. const char *q = p;
  72. while (! is_whitespace_or_nl_or_eol(*q))
  73. ++ q;
  74. uint8_t n = q - p;
  75. if (n == strlen_P(STR_REVISION_DEV) && strncmp_P(p, STR_REVISION_DEV, n) == 0)
  76. version[3] = FIRMWARE_REVISION_DEV;
  77. else if (n == strlen_P(STR_REVISION_ALPHA) && strncmp_P(p, STR_REVISION_ALPHA, n) == 0)
  78. version[3] = FIRMWARE_REVISION_ALPHA;
  79. else if (n == strlen_P(STR_REVISION_BETA) && strncmp_P(p, STR_REVISION_BETA, n) == 0)
  80. version[3] = FIRMWARE_REVISION_BETA;
  81. else if ((n == 2 || n == 3) && (p[0] == 'r' || p[0] == 'R') && (p[1] == 'c' || p[1] == 'C')) {
  82. if (n == 2)
  83. version[3] = FIRMWARE_REVISION_RC;
  84. else {
  85. if (is_digit(p[2]))
  86. version[3] = FIRMWARE_REVISION_RC + p[2] - '1';
  87. else
  88. return false;
  89. }
  90. } else
  91. return false;
  92. }
  93. #if 0
  94. SERIAL_ECHOPGM("Version parsed, major: ");
  95. SERIAL_ECHO(version[0]);
  96. SERIAL_ECHOPGM(", minor: ");
  97. SERIAL_ECHO(version[1]);
  98. SERIAL_ECHOPGM(", revision: ");
  99. SERIAL_ECHO(version[2]);
  100. SERIAL_ECHOPGM(", flavor: ");
  101. SERIAL_ECHO(version[3]);
  102. SERIAL_ECHOLNPGM("");
  103. #endif
  104. return true;
  105. }
  106. inline bool strncmp_PP(const char *p1, const char *p2, uint8_t n)
  107. {
  108. for (; n > 0; -- n, ++ p1, ++ p2) {
  109. if (pgm_read_byte(p1) >= 65 && pgm_read_byte(p1) <= 92) //p1 is upper case (p2 is always lowercase)
  110. {
  111. if ((pgm_read_byte(p1)+32) < pgm_read_byte(p2))
  112. return -1;
  113. if ((pgm_read_byte(p1)+32) > pgm_read_byte(p2))
  114. return 1;
  115. }
  116. else if (pgm_read_byte(p1) == 0) {
  117. return 0;
  118. }
  119. else { //p1 is lowercase
  120. if (pgm_read_byte(p1) < pgm_read_byte(p2))
  121. return -1;
  122. if (pgm_read_byte(p1) > pgm_read_byte(p2))
  123. return 1;
  124. }
  125. }
  126. return 0;
  127. }
  128. // 1 - yes, 0 - false, -1 - error;
  129. inline int8_t is_provided_version_newer(const char *version_string)
  130. {
  131. uint16_t ver_gcode[4];
  132. if (! parse_version(version_string, ver_gcode))
  133. return -1;
  134. for (uint8_t i = 0; i < 4; ++ i)
  135. {
  136. uint16_t v = (uint16_t)pgm_read_word(&FW_VERSION_NR[i]);
  137. if (ver_gcode[i] > v)
  138. return 1;
  139. else if (ver_gcode[i] < v)
  140. return 0;
  141. }
  142. return 0;
  143. }
  144. bool force_selftest_if_fw_version()
  145. {
  146. //if fw version used before flashing new firmware (fw version currently stored in eeprom) is lower then 3.1.2-RC2, function returns true to force selftest
  147. uint16_t ver_eeprom[4];
  148. uint16_t ver_with_calibration[4] = {3, 1, 2, 4}; //hardcoded 3.1.2-RC2 version
  149. bool force_selftest = false;
  150. ver_eeprom[0] = eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MAJOR);
  151. ver_eeprom[1] = eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MINOR);
  152. ver_eeprom[2] = eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_REVISION);
  153. ver_eeprom[3] = eeprom_read_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR);
  154. for (uint8_t i = 0; i < 4; ++i) {
  155. if (ver_with_calibration[i] > ver_eeprom[i]) {
  156. force_selftest = true;
  157. break;
  158. }
  159. else if (ver_with_calibration[i] < ver_eeprom[i])
  160. break;
  161. }
  162. //force selftest also in case that version used before flashing new firmware was 3.2.0-RC1
  163. if ((ver_eeprom[0] == 3) && (ver_eeprom[1] == 2) && (ver_eeprom[2] == 0) && (ver_eeprom[3] == 3)) force_selftest = true;
  164. return force_selftest;
  165. }
  166. bool show_upgrade_dialog_if_version_newer(const char *version_string)
  167. {
  168. if(oCheckVersion == ClCheckVersion::_None)
  169. return false;
  170. int8_t upgrade = is_provided_version_newer(version_string);
  171. if (upgrade < 0)
  172. return false;
  173. if (upgrade) {
  174. lcd_display_message_fullscreen_P(_i("New firmware version available:"));////MSG_NEW_FIRMWARE_AVAILABLE c=20 r=2
  175. lcd_puts_at_P(0, 2, PSTR(""));
  176. for (const char *c = version_string; ! is_whitespace_or_nl_or_eol(*c); ++ c)
  177. lcd_putc(*c);
  178. lcd_puts_at_P(0, 3, _i("Please upgrade."));////MSG_NEW_FIRMWARE_PLEASE_UPGRADE c=20
  179. Sound_MakeCustom(50,1000,false);
  180. delay_keep_alive(500);
  181. Sound_MakeCustom(50,1000,false);
  182. lcd_wait_for_click_delay(30);
  183. lcd_update_enable(true);
  184. lcd_clear();
  185. lcd_update(0);
  186. }
  187. // Succeeded.
  188. return true;
  189. }
  190. void update_current_firmware_version_to_eeprom()
  191. {
  192. for (int8_t i = 0; i < FW_PRUSA3D_MAGIC_LEN; ++ i){
  193. eeprom_update_byte((uint8_t*)(EEPROM_FIRMWARE_PRUSA_MAGIC+i), pgm_read_byte(FW_PRUSA3D_MAGIC_STR+i));
  194. }
  195. eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MAJOR, (uint16_t)pgm_read_word(&FW_VERSION_NR[0]));
  196. eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_MINOR, (uint16_t)pgm_read_word(&FW_VERSION_NR[1]));
  197. eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_REVISION, (uint16_t)pgm_read_word(&FW_VERSION_NR[2]));
  198. // See FirmwareRevisionFlavorType for the definition of firmware flavors.
  199. eeprom_update_word((uint16_t*)EEPROM_FIRMWARE_VERSION_FLAVOR, (uint16_t)pgm_read_word(&FW_VERSION_NR[3]));
  200. }
  201. #define MSG_PRINT_CHECKING_FAILED_TIMEOUT 30
  202. ClNozzleDiameter oNozzleDiameter=ClNozzleDiameter::_Diameter_400;
  203. ClCheckMode oCheckMode=ClCheckMode::_None;
  204. ClCheckModel oCheckModel=ClCheckModel::_None;
  205. ClCheckVersion oCheckVersion=ClCheckVersion::_None;
  206. ClCheckGcode oCheckGcode=ClCheckGcode::_None;
  207. void fCheckModeInit() {
  208. oCheckMode = (ClCheckMode)eeprom_read_byte((uint8_t *)EEPROM_CHECK_MODE);
  209. if (oCheckMode == ClCheckMode::_Undef) {
  210. oCheckMode = ClCheckMode::_Warn;
  211. eeprom_update_byte((uint8_t *)EEPROM_CHECK_MODE, (uint8_t)oCheckMode);
  212. }
  213. if (farm_mode) {
  214. oCheckMode = ClCheckMode::_Strict;
  215. if (eeprom_read_word((uint16_t *)EEPROM_NOZZLE_DIAMETER_uM) == EEPROM_EMPTY_VALUE16)
  216. eeprom_update_word((uint16_t *)EEPROM_NOZZLE_DIAMETER_uM, EEPROM_NOZZLE_DIAMETER_uM_DEFAULT);
  217. }
  218. oNozzleDiameter = (ClNozzleDiameter)eeprom_read_byte((uint8_t *)EEPROM_NOZZLE_DIAMETER);
  219. if ((oNozzleDiameter == ClNozzleDiameter::_Diameter_Undef) && !farm_mode) {
  220. oNozzleDiameter = ClNozzleDiameter::_Diameter_400;
  221. eeprom_update_byte((uint8_t *)EEPROM_NOZZLE_DIAMETER, (uint8_t)oNozzleDiameter);
  222. eeprom_update_word((uint16_t *)EEPROM_NOZZLE_DIAMETER_uM, EEPROM_NOZZLE_DIAMETER_uM_DEFAULT);
  223. }
  224. oCheckModel = (ClCheckModel)eeprom_read_byte((uint8_t *)EEPROM_CHECK_MODEL);
  225. if (oCheckModel == ClCheckModel::_Undef) {
  226. oCheckModel = ClCheckModel::_Warn;
  227. eeprom_update_byte((uint8_t *)EEPROM_CHECK_MODEL, (uint8_t)oCheckModel);
  228. }
  229. oCheckVersion = (ClCheckVersion)eeprom_read_byte((uint8_t *)EEPROM_CHECK_VERSION);
  230. if (oCheckVersion == ClCheckVersion::_Undef) {
  231. oCheckVersion = ClCheckVersion::_Warn;
  232. eeprom_update_byte((uint8_t *)EEPROM_CHECK_VERSION, (uint8_t)oCheckVersion);
  233. }
  234. oCheckGcode = (ClCheckGcode)eeprom_read_byte((uint8_t *)EEPROM_CHECK_GCODE);
  235. if (oCheckGcode == ClCheckGcode::_Undef) {
  236. oCheckGcode = ClCheckGcode::_Warn;
  237. eeprom_update_byte((uint8_t *)EEPROM_CHECK_GCODE, (uint8_t)oCheckGcode);
  238. }
  239. }
  240. void nozzle_diameter_check(uint16_t nDiameter) {
  241. uint16_t nDiameter_um;
  242. if (oCheckMode == ClCheckMode::_None)
  243. return;
  244. nDiameter_um = eeprom_read_word((uint16_t *)EEPROM_NOZZLE_DIAMETER_uM);
  245. if (nDiameter == nDiameter_um)
  246. return;
  247. // SERIAL_ECHO_START;
  248. // SERIAL_ECHOLNPGM("Printer nozzle diameter differs from the G-code ...");
  249. // SERIAL_ECHOPGM("actual : ");
  250. // SERIAL_ECHOLN((float)(nDiameter_um/1000.0));
  251. // SERIAL_ECHOPGM("expected: ");
  252. // SERIAL_ECHOLN((float)(nDiameter/1000.0));
  253. switch (oCheckMode) {
  254. case ClCheckMode::_Warn:
  255. // lcd_show_fullscreen_message_and_wait_P(_i("Printer nozzle diameter differs from the G-code. Continue?"));
  256. lcd_display_message_fullscreen_P(_i("Printer nozzle diameter differs from the G-code. Continue?")); ////MSG_NOZZLE_DIFFERS_CONTINUE c=20 r=5
  257. lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT);
  258. //???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery
  259. lcd_update_enable(true); // display / status-line recovery
  260. break;
  261. case ClCheckMode::_Strict:
  262. lcd_show_fullscreen_message_and_wait_P(_i(
  263. "Printer nozzle diameter differs from the G-code. Please check the value in settings. Print cancelled.")); ////MSG_NOZZLE_DIFFERS_CANCELLED c=20 r=9
  264. lcd_print_stop();
  265. break;
  266. case ClCheckMode::_None:
  267. case ClCheckMode::_Undef:
  268. break;
  269. }
  270. if (!farm_mode) {
  271. bSettings = false; // flag ('fake parameter') for 'lcd_hw_setup_menu()' function
  272. menu_submenu(lcd_hw_setup_menu);
  273. }
  274. }
  275. void printer_model_check(uint16_t nPrinterModel) {
  276. if (oCheckModel == ClCheckModel::_None)
  277. return;
  278. if (nPrinterModel == nPrinterType)
  279. return;
  280. // SERIAL_ECHO_START;
  281. // SERIAL_ECHOLNPGM("Printer model differs from the G-code ...");
  282. // SERIAL_ECHOPGM("actual : ");
  283. // SERIAL_ECHOLN(nPrinterType);
  284. // SERIAL_ECHOPGM("expected: ");
  285. // SERIAL_ECHOLN(nPrinterModel);
  286. switch (oCheckModel) {
  287. case ClCheckModel::_Warn:
  288. // lcd_show_fullscreen_message_and_wait_P(_i("Printer model differs from the G-code. Continue?"));
  289. lcd_display_message_fullscreen_P(_T(MSG_GCODE_DIFF_PRINTER_CONTINUE));
  290. lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT);
  291. //???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery
  292. lcd_update_enable(true); // display / status-line recovery
  293. break;
  294. case ClCheckModel::_Strict:
  295. lcd_show_fullscreen_message_and_wait_P(_T(MSG_GCODE_DIFF_PRINTER_CANCELLED));
  296. lcd_print_stop();
  297. break;
  298. case ClCheckModel::_None:
  299. case ClCheckModel::_Undef:
  300. break;
  301. }
  302. }
  303. uint8_t mCompareValue(uint16_t nX, uint16_t nY) {
  304. if (nX > nY)
  305. return ((uint8_t)ClCompareValue::_Greater);
  306. if (nX < nY)
  307. return ((uint8_t)ClCompareValue::_Less);
  308. return ((uint8_t)ClCompareValue::_Equal);
  309. }
  310. void fw_version_check(const char *pVersion) {
  311. uint16_t aVersion[4];
  312. uint8_t nCompareValueResult;
  313. if (oCheckVersion == ClCheckVersion::_None)
  314. return;
  315. parse_version(pVersion, aVersion);
  316. nCompareValueResult = mCompareValue(aVersion[0], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_MAJOR)) << 6;
  317. nCompareValueResult += mCompareValue(aVersion[1], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_MINOR)) << 4;
  318. nCompareValueResult += mCompareValue(aVersion[2], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_REVISION)) << 2;
  319. nCompareValueResult += mCompareValue(aVersion[3], eeprom_read_word((uint16_t *)EEPROM_FIRMWARE_VERSION_FLAVOR));
  320. if (nCompareValueResult == COMPARE_VALUE_EQUAL)
  321. return;
  322. if ((nCompareValueResult < COMPARE_VALUE_EQUAL) && oCheckVersion == ClCheckVersion::_Warn)
  323. return;
  324. // SERIAL_ECHO_START;
  325. // SERIAL_ECHOLNPGM("Printer FW version differs from the G-code ...");
  326. // SERIAL_ECHOPGM("actual : ");
  327. // SERIAL_ECHOLN(FW_VERSION);
  328. // SERIAL_ECHOPGM("expected: ");
  329. // SERIAL_ECHOLN(pVersion);
  330. switch (oCheckVersion) {
  331. case ClCheckVersion::_Warn:
  332. // lcd_show_fullscreen_message_and_wait_P(_i("Printer FW version differs from the G-code. Continue?"));
  333. lcd_display_message_fullscreen_P(_i("G-code sliced for a newer firmware. Continue?")); ////MSG_GCODE_NEWER_FIRMWARE_CONTINUE c=20 r=5
  334. lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT);
  335. //???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery
  336. lcd_update_enable(true); // display / status-line recovery
  337. break;
  338. case ClCheckVersion::_Strict:
  339. lcd_show_fullscreen_message_and_wait_P(
  340. _i("G-code sliced for a newer firmware. Please update the firmware. Print cancelled.")); ////MSG_GCODE_NEWER_FIRMWARE_CANCELLED c=20 r=8
  341. lcd_print_stop();
  342. break;
  343. case ClCheckVersion::_None:
  344. case ClCheckVersion::_Undef:
  345. break;
  346. }
  347. }
  348. void gcode_level_check(uint16_t nGcodeLevel) {
  349. if (oCheckGcode == ClCheckGcode::_None)
  350. return;
  351. if (nGcodeLevel == (uint16_t)GCODE_LEVEL)
  352. return;
  353. if ((nGcodeLevel < (uint16_t)GCODE_LEVEL) && (oCheckGcode == ClCheckGcode::_Warn))
  354. return;
  355. // SERIAL_ECHO_START;
  356. // SERIAL_ECHOLNPGM("Printer G-code level differs from the G-code ...");
  357. // SERIAL_ECHOPGM("actual : ");
  358. // SERIAL_ECHOLN(GCODE_LEVEL);
  359. // SERIAL_ECHOPGM("expected: ");
  360. // SERIAL_ECHOLN(nGcodeLevel);
  361. switch (oCheckGcode) {
  362. case ClCheckGcode::_Warn:
  363. // lcd_show_fullscreen_message_and_wait_P(_i("Printer G-code level differs from the G-code. Continue?"));
  364. lcd_display_message_fullscreen_P(_i("G-code sliced for a different level. Continue?")); ////MSG_GCODE_DIFF_CONTINUE c=20 r=4
  365. lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT);
  366. //???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery
  367. lcd_update_enable(true); // display / status-line recovery
  368. break;
  369. case ClCheckGcode::_Strict:
  370. lcd_show_fullscreen_message_and_wait_P(
  371. _i("G-code sliced for a different level. Please re-slice the model again. Print cancelled.")); ////MSG_GCODE_DIFF_CANCELLED c=20 r=7
  372. lcd_print_stop();
  373. break;
  374. case ClCheckGcode::_None:
  375. case ClCheckGcode::_Undef:
  376. break;
  377. }
  378. }
  379. //-// -> cmdqueue ???
  380. #define PRINTER_NAME_LENGTH ((sizeof(PRINTER_MMU_NAME) > sizeof(PRINTER_NAME)) ? (sizeof(PRINTER_MMU_NAME) - 1) : (sizeof(PRINTER_NAME) - 1))
  381. #define GCODE_DELIMITER '"'
  382. #define ELLIPSIS "..."
  383. char *code_string(const char *pStr, size_t *nLength) {
  384. char* pStrBegin;
  385. char* pStrEnd;
  386. pStrBegin=strchr(pStr,GCODE_DELIMITER);
  387. if(!pStrBegin)
  388. return(NULL);
  389. pStrBegin++;
  390. pStrEnd=strchr(pStrBegin,GCODE_DELIMITER);
  391. if(!pStrEnd)
  392. return(NULL);
  393. *nLength=pStrEnd-pStrBegin;
  394. return pStrBegin;
  395. }
  396. void printer_smodel_check(const char *pStrPos) {
  397. char* pResult;
  398. size_t nLength,nPrinterNameLength;
  399. nPrinterNameLength = strlen_P(sPrinterName);
  400. pResult=code_string(pStrPos,&nLength);
  401. if(pResult != NULL && nLength == nPrinterNameLength) {
  402. // Only compare them if the lengths match
  403. if (strncmp_P(pResult, sPrinterName, nLength) == 0) return;
  404. }
  405. switch(oCheckModel)
  406. {
  407. case ClCheckModel::_Warn:
  408. // lcd_show_fullscreen_message_and_wait_P(_i("Printer model differs from the G-code. Continue?"));
  409. lcd_display_message_fullscreen_P(_T(MSG_GCODE_DIFF_PRINTER_CONTINUE));
  410. lcd_wait_for_click_delay(MSG_PRINT_CHECKING_FAILED_TIMEOUT);
  411. //???custom_message_type=CUSTOM_MSG_TYPE_STATUS; // display / status-line recovery
  412. lcd_update_enable(true); // display / status-line recovery
  413. break;
  414. case ClCheckModel::_Strict:
  415. lcd_show_fullscreen_message_and_wait_P(_T(MSG_GCODE_DIFF_PRINTER_CANCELLED));
  416. lcd_print_stop();
  417. break;
  418. case ClCheckModel::_None:
  419. case ClCheckModel::_Undef:
  420. break;
  421. }
  422. }
  423. void fSetMmuMode(bool bMMu) {
  424. if (bMMu) {
  425. nPrinterType = pgm_read_word(&_nPrinterMmuType);
  426. sPrinterName = _sPrinterMmuName;
  427. } else {
  428. nPrinterType = pgm_read_word(&_nPrinterType);
  429. sPrinterName = _sPrinterName;
  430. }
  431. }
  432. void ip4_to_str(char* dest, uint8_t* IP)
  433. {
  434. sprintf_P(dest, PSTR("%u.%u.%u.%u"), IP[0], IP[1], IP[2], IP[3]);
  435. }