FIX: optimize the switching cancel

jira: [none]
Change-Id: I60f4e5bcbbe67e6c86793a651e8837a551a762a3
(cherry picked from commit 27c6d46dc20003111bda97c516bf9bf04730d7e6)
This commit is contained in:
xin.zhang
2025-03-11 10:02:22 +08:00
committed by Noisyfox
parent b0943a2d0b
commit ba5641b311
2 changed files with 12 additions and 3 deletions

View File

@@ -35,7 +35,9 @@
#define HOLD_COUNT_MAX 3
#define HOLD_COUNT_CAMERA 6
#define HOLD_TIME_MAX 3 // 3 seconds
#define HOLD_TIME_SWITCHING 6 // 6 seconds
#define GET_VERSION_RETRYS 10
#define RETRY_INTERNAL 2000

View File

@@ -409,10 +409,17 @@ ExtruderSwithingStatus::ExtruderSwithingStatus(wxWindow *parent)
void ExtruderSwithingStatus::updateBy(MachineObject *obj)
{
m_obj = obj;
Show(m_obj != nullptr);
if (m_obj && (time(nullptr) - m_last_ctrl_time) > HOLD_TIME_MAX)
if (!m_obj)
{
updateBy(obj->m_extder_data);
Show(false);
}
else
{
/*do not display while command sended in a mean while*/
if ((time(nullptr) - m_last_ctrl_time) > HOLD_TIME_SWITCHING)
{
updateBy(obj->m_extder_data);
}
}
}