void PAGE_ShowSafetyDialog() { if (disable_safety) { return; // don't show safety dialog when calibrating } if (dialog) { u64 unsafe = PROTOCOL_CheckSafe(); if (! unsafe) { GUI_RemoveObj(dialog); dialog = NULL; PROTOCOL_Init(0); } else { safety_string_cb(NULL, NULL); u32 crc = Crc(tempstring, strlen(tempstring)); if (crc != dialogcrc) { GUI_Redraw(dialog); dialogcrc = crc; } } } else { tempstring[0] = 0; dialogcrc = 0; dialog = GUI_CreateDialog(&gui->dialog, 10 + DLG_XOFFSET, 42 + DLG_YOFFSET, 300, 188, _tr("Safety"), safety_string_cb, safety_ok_cb, dtOk, NULL); } }
void PAGE_ShowSafetyDialog() { if (dialog) { u64 unsafe = safety_check(); if (! unsafe) { DialogClose(dialog, 0); safety_confirmed(); } else { safety_string_cb(NULL, NULL); u32 crc = Crc(tempstring, strlen(tempstring)); if (crc != dialogcrc) { GUI_Redraw(dialog); dialogcrc = crc; } } } else { tempstring[0] = 0; dialogcrc = 0; dialog = GUI_CreateDialog(&gui->dialog, DIALOG1_X, DIALOG1_Y, DIALOG1_WIDTH, DIALOG1_HEIGHT, NULL, safety_string_cb, safety_ok_cb, dtOk, NULL); } }