用户工具

站点工具


knowledge:3d_print:2022100101

APE G1 "Belt test"功能研究

在源码ultralcd.cpp中7253行可以看到LCD菜单中“Belt test”功能的定义。

static void lcd_belttest_v()
{
    lcd_belttest();
    menu_back_if_clicked();
}

void lcd_belttest()
{
    lcd_clear();
	// Belttest requires high power mode. Enable it.
	FORCE_HIGH_POWER_START;
    
    uint16_t   X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X));
    uint16_t   Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
	lcd_printf_P(_T(MSG_CHECKING_X));
	lcd_set_cursor(0,1), lcd_printf_P(PSTR("X: %u -> ..."),X);
    KEEPALIVE_STATE(IN_HANDLER);
    
	// N.B: it doesn't make sense to handle !lcd_selfcheck...() because selftest_sg throws its own error screen
	// that clobbers ours, with more info than we could provide. So on fail we just fall through to take us back to status.
    if (lcd_selfcheck_axis_sg(X_AXIS)){
		X = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X));
		lcd_set_cursor(10,1), lcd_printf_P(PSTR("%u"),X); // Show new X value next to old one.
        lcd_puts_at_P(0,2,_T(MSG_CHECKING_Y));
		lcd_set_cursor(0,3), lcd_printf_P(PSTR("Y: %u -> ..."),Y);
		if (lcd_selfcheck_axis_sg(Y_AXIS))
		{
			Y = eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y));
			lcd_set_cursor(10,3),lcd_printf_P(PSTR("%u"),Y);
			lcd_set_cursor(19, 3);
			lcd_print(LCD_STR_UPLEVEL);
			lcd_wait_for_click_delay(10);
		}
    }
	
	FORCE_HIGH_POWER_END;
    KEEPALIVE_STATE(NOT_BUSY);
}
knowledge/3d_print/2022100101.txt · 最后更改: 2023/06/07 04:23 由 127.0.0.1