FIX: ams control display bug

jira: none
Change-Id: I72c5977ff4246c19f4bf5ce7e20f797c0efe9e9a
This commit is contained in:
zhimin.zeng 2024-12-05 14:29:52 +08:00 committed by lane.wei
parent f4ce4b3600
commit 7f43d427c3
2 changed files with 16 additions and 2 deletions

View File

@ -730,9 +730,11 @@ public:
txt1->SetForegroundColour(0x6B6B6B);
int ams4 = 0, ams1 = 0;
GetAMSCount(index, ams4, ams1);
auto val4 = new SpinInput(this, {}, {}, wxDefaultPosition, {FromDIP(60), -1}, 0, 0, 4, ams4);
auto val1 = new SpinInput(this, {}, {}, wxDefaultPosition, {FromDIP(60), -1}, 0, 0, 8, ams1);
auto val4 = new SpinInput(this, {}, {}, wxDefaultPosition, {FromDIP(60), -1}, 0, 0, 4 - ams1, ams4);
auto val1 = new SpinInput(this, {}, {}, wxDefaultPosition, {FromDIP(60), -1}, 0, 0, 4 - ams4, ams1);
auto event_handler = [index, val4, val1, extruder](auto &evt) {
val4->SetRange(0, 4 - val1->GetValue());
val1->SetRange(0, 4 - val4->GetValue());
SetAMSCount(index, val4->GetValue(), val1->GetValue());
UpdateAMSCount(index, extruder);
};
@ -900,6 +902,10 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
void ExtruderGroup::update_ams()
{
int display_capacity = 8;
if (ams_n4 * 4 + ams_n1 * 2 <= 8)
is_upward = false;
bool display_front_ams = !is_upward;
size_t i = 0;
for (; i < ams_n4 && i < 4; ++i) {

View File

@ -2523,6 +2523,14 @@ void AMSPreview::Update(AMSinfo amsinfo)
{
m_amsinfo = amsinfo;
m_ams_item_type = amsinfo.ams_type;
if (m_ams_item_type == AMSModel::GENERIC_AMS || m_ams_item_type == AMSModel::AMS_LITE || m_ams_item_type == AMSModel::N3F_AMS) {
SetMinSize(AMS_PREV_FOUR_SIZE);
SetMaxSize(AMS_PREV_FOUR_SIZE);
} else {
SetMinSize(AMS_PREV_SINGLE_SIZE);
SetMaxSize(AMS_PREV_SINGLE_SIZE);
}
}
void AMSPreview::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)