Fix device popup, mapping, and status-parse defects

- Allow mapping to EMPTY trays only from the multi-machine send page and keep
  both panels pickable in the LEFT_AND_RIGHT view
- Guard the error-dialog cloud snapshot against stale callbacks and fall back
  to the local illustration on timeout
- Parse the ipcam storage-check ack and axis/chamber pushes defensively
- Strip fan-control telemetry, initialize the upgrade error code, restore the
  .json filter in the model-id scan
- Fix best-position popup tray lookup, gradient placement, and colour-list
  ownership
- Cover switch binding sets and invalid-track transients in DevMapping tests
This commit is contained in:
SoftFever
2026-07-18 01:46:10 +08:00
parent 12720ccbd8
commit 4683c17f6f
11 changed files with 181 additions and 69 deletions

View File

@@ -79,7 +79,7 @@ void UiStyledAMSPanel::OnPaint(wxPaintEvent& event)
int labelX = offset;
int labelY = m_isTop ? offset : (height - offset - FromDIP(27)); // true=顶部, false=底部
int labelY = m_isTop ? offset : (height - offset - FromDIP(27)); // true=top, false=bottom
wxRect labelRect(labelX, labelY, width - 2 * offset, FromDIP(10));
@@ -340,8 +340,7 @@ void UiAMSSlot::DrawRectangle(wxPaintDC& dc, const wxSize& cli)
for (int i = 0; i < m_bgColours.size(); i++)
{
baseX += step * i;
wxRect rr(baseX, (cli.y - rectangleH) / 2, step, rectangleH);
wxRect rr(baseX + step * i, (cli.y - rectangleH) / 2, step, rectangleH);
dc.SetBrush(wxBrush(LightenColour(m_bgColours[i])));
dc.SetPen(wxPen(LightenColour(m_bgColours[i])));
@@ -1010,8 +1009,9 @@ wxString ReselectMachineDialog::getTrayID(MachineObject* obj, const std::string&
if (filaSys)
{
DevAms* ams = filaSys->GetAmsById(amsID);
int ams_id_int = std::stoi(amsID);
int slot_id_int = std::stoi(slotID);
if (!ams) { return ""; }
int ams_id_int = atoi(amsID.c_str());
int slot_id_int = atoi(slotID.c_str());
int tray_id = 0;
if (ams->GetAmsType() == DevAmsType::AMS || ams->GetAmsType() == DevAmsType::AMS_LITE || ams->GetAmsType() == DevAmsType::N3F) {
tray_id = ams_id_int * 4 + slot_id_int;

View File

@@ -131,10 +131,12 @@ private:
bool IsDark(const wxColour& c)
{
int brightness = (c.Red() * 299 + c.Green() * 587 + c.Blue() * 114) / 1000;
return brightness < 128; // 0-255 range128 mid
return brightness < 128; // 0-255 range, 128 mid
}
private:
const std::vector<wxColour>& m_bgColours;
// Copied, not referenced: the slot repaints long after construction, so it must not
// depend on the caller's vector staying alive.
std::vector<wxColour> m_bgColours;
wxString m_text;
DataStatusType m_status;
wxSize m_size;