Compare commits

..
Author SHA1 Message Date
weng haishi 6be6fdd7c7 feat: add timestamp to ofl update workflow so that concurrent post_merge_profiles are not silently dropped (#15898)
# Description

<!--
> Please provide a summary of the changes made in this PR. Include
details such as:
  > * What issue does this PR address or fix?
  > * What new features or enhancements does this PR introduce?
> * Are there any breaking changes or dependencies that need to be
considered?
-->

If a vendor runs `/bot merge` while the cronjob is running, it might be
dropped because the table might be cleared before `post_merge_profiles`
completes. Instead we can add a timestamp so that we don't accidentally
drop any PR merges that occur while the OFL cronjob is running.

# Screenshots/Recordings/Graphs

<!--
> Please attach relevant screenshots to showcase the UI changes.
> Please attach images that can help explain the changes.
-->

## Tests

<!--
> Please describe the tests that you have conducted to verify the
changes made in this PR.
-->

<!--
> A guide for users on how to download the artifacts from this PR.
-->

[How to Download Pull Requests Artifacts for
Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
2026-09-25 17:53:22 +08:00
Ian Chua 521a30a45c feat: add timestamp to ofl update workflow so that concurrent post_merge_profiles are not silently dropped 2026-09-25 16:53:45 +08:00
7 changed files with 255 additions and 474 deletions
+55 -62
View File
@@ -12,9 +12,9 @@ name: Daily OFL OTA Update
# vendor-dispatch path is also what makes post_merge_profiles.yml call the OTA auto-publish API after
# uploading - see post_merge_profiles.yml for both sides of that contract.
#
# If at least one branch was dispatched this run, a final step clears OFL's pending-publish
# table (POST /api/v1/ota/ofl/pending/clear) - the daily "published everything, reset" signal.
# That table is populated only by this pipeline's own auto-publish calls.
# At the start of each run, the pending-publish table is cleared up to a captured
# timestamp (POST /api/v1/ota/ofl/pending/clear?timestamp=...). Changes merged after
# that timestamp remain pending for the next run.
on:
schedule:
@@ -34,6 +34,32 @@ jobs:
if: ${{ github.repository == 'OrcaSlicer/OrcaSlicer' }}
runs-on: ubuntu-24.04
steps:
- name: Capture start timestamp and clear OFL pending queue
id: start
shell: bash
env:
OTA_API_BASE_URL: ${{ vars.OTA_API_BASE_URL }}
OTA_API_KEY: ${{ secrets.OFL_OTA_PUBLISH_KEY }}
run: |
set -euo pipefail
[ -n "$OTA_API_BASE_URL" ] || { echo "::error::vars.OTA_API_BASE_URL is not set"; exit 1; }
[ -n "$OTA_API_KEY" ] || { echo "::error::secrets.OFL_OTA_PUBLISH_KEY is not set"; exit 1; }
timestamp="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
echo "timestamp=$timestamp" >> "$GITHUB_OUTPUT"
resp_file="$RUNNER_TEMP/ota-pending-clear-response.json"
status="$(curl -sS -o "$resp_file" -w '%{http_code}' -X POST \
"${OTA_API_BASE_URL%/}/api/v1/ota/ofl/pending/clear?timestamp=$timestamp" \
-H "Authorization: Bearer $OTA_API_KEY")"
body="$(cat "$resp_file")"
echo "$body"
if [ "$status" != "200" ]; then
echo "::error::OTA pending-clear call failed with HTTP $status"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v7
with:
@@ -46,13 +72,12 @@ jobs:
run: git fetch origin '+refs/heads/*:refs/remotes/origin/*'
- name: Scan branches and publish changed OFL profiles
id: scan
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SCAN_UNTIL: ${{ steps.start.outputs.timestamp }}
run: |
set -euo pipefail
published_any=false
mapfile -t branches < <(
gh api "repos/${{ github.repository }}/branches" --paginate --jq '.[].name' \
@@ -62,85 +87,53 @@ jobs:
for branch in "${branches[@]}"; do
echo "::group::$branch"
# Use this workflow's own last successful run as the checkpoint. A
# successful post_merge_profiles.yml run may record an OFL merge as
# pending without publishing OFL, so its history must not advance
# this scan's checkpoint. Keep the branch filter aligned with the
# branch being inspected so each branch has its own checkpoint.
# A failed daily run naturally gets retried from the previous
# successful daily checkpoint; a branch with no prior run is
# treated as changed below.
# post_merge_profiles.yml's own run history, not this workflow's: this
# workflow only ever runs against main (schedule, or workflow_dispatch
# --ref main), so its head branch never varies - filtering ITS history
# by $branch would never match anything except main. post_merge_profiles.yml
# genuinely runs per-branch (this dispatch below sets --ref "$branch"),
# so its history is the real per-branch checkpoint. It also means a
# failed publish naturally gets retried tomorrow: the checkpoint only
# advances on a run that actually succeeded.
# --method GET is required, not cosmetic: gh api defaults to POST
# whenever -f fields are present unless a method is given
# explicitly, and POST on this list-runs endpoint 404s - confirmed
# on real Actions infrastructure, not just reasoned about.
since="$(gh api --method GET "repos/${{ github.repository }}/actions/workflows/ofl-ota-cronjob.yml/runs" \
since="$(gh api --method GET "repos/${{ github.repository }}/actions/workflows/post_merge_profiles.yml/runs" \
-f status=success -f branch="$branch" -f per_page=1 \
--jq '.workflow_runs[0].run_started_at // empty')"
if [ -z "$since" ]; then
echo "No prior successful run for $branch; treating OFL as changed."
changed=true
else
changed_files="$(git log --since="$since" --name-only --pretty=format: "origin/$branch" -- \
echo "No prior successful run for $branch; checking OFL changes up to $SCAN_UNTIL."
changed_files="$(git log --until="$SCAN_UNTIL" --name-only --pretty=format: "origin/$branch" -- \
resources/profiles/OrcaFilamentLibrary resources/profiles/OrcaFilamentLibrary.json \
| sed '/^$/d')"
if [ -n "$changed_files" ]; then
echo "OFL changed on $branch since $since:"
echo "$changed_files"
changed=true
else
echo "No OFL changes on $branch since $since."
changed=false
fi
else
changed_files="$(git log --since="$since" --until="$SCAN_UNTIL" --name-only --pretty=format: "origin/$branch" -- \
resources/profiles/OrcaFilamentLibrary resources/profiles/OrcaFilamentLibrary.json \
| sed '/^$/d')"
fi
if [ -n "$changed_files" ]; then
echo "OFL changed on $branch from ${since:-the beginning} through $SCAN_UNTIL:"
echo "$changed_files"
changed=true
else
echo "No OFL changes on $branch through $SCAN_UNTIL."
changed=false
fi
if [ "$changed" = true ]; then
# Tolerate a per-branch failure (e.g. a pre-existing release branch
# whose post_merge_profiles.yml predates the vendor/auto_publish
# inputs) rather than aborting the whole scan under set -e.
if gh workflow run post_merge_profiles.yml \
if ! gh workflow run post_merge_profiles.yml \
--repo "${{ github.repository }}" \
--ref "$branch" \
-f vendor="$VENDOR" -f auto_publish=true; then
published_any=true
else
echo "::warning::failed to dispatch post_merge_profiles.yml for $branch - its post_merge_profiles.yml at this ref may predate the vendor/auto_publish inputs"
fi
fi
echo "::endgroup::"
done
echo "published_any=$published_any" >> "$GITHUB_OUTPUT"
- name: Clear OFL pending queue
# Only when this run actually kicked off at least one publish - the
# daily reset is scoped to today's real activity, not called on a day
# where every branch reported no changes. Note "published_any" reflects
# a successful DISPATCH, not a confirmed live publish: gh workflow run
# is fire-and-forget, so this workflow never learns whether the
# dispatched post_merge_profiles.yml run actually reached its own
# auto-publish call. Acceptable since the table is populated only by
# our own auto-publish calls, not by anything else.
if: steps.scan.outputs.published_any == 'true'
shell: bash
env:
OTA_API_BASE_URL: ${{ vars.OTA_API_BASE_URL }}
OTA_API_KEY: ${{ secrets.OFL_OTA_PUBLISH_KEY }}
run: |
set -euo pipefail
[ -n "$OTA_API_BASE_URL" ] || { echo "::error::vars.OTA_API_BASE_URL is not set"; exit 1; }
[ -n "$OTA_API_KEY" ] || { echo "::error::secrets.OFL_OTA_PUBLISH_KEY is not set"; exit 1; }
resp_file="$RUNNER_TEMP/ota-pending-clear-response.json"
status="$(curl -sS -o "$resp_file" -w '%{http_code}' -X POST \
"${OTA_API_BASE_URL%/}/api/v1/ota/ofl/pending/clear" \
-H "Authorization: Bearer $OTA_API_KEY")"
body="$(cat "$resp_file")"
echo "$body"
if [ "$status" != "200" ]; then
echo "::error::OTA pending-clear call failed with HTTP $status"
exit 1
fi
+18 -34
View File
@@ -9,8 +9,6 @@
#include "libslic3r/libslic3r.h"
#include "libslic3r/Utils.hpp"
#include <slic3r/GUI/DeviceCore/DevDefs.h>
#include <slic3r/GUI/GUI_App.hpp>
namespace Slic3r
{
@@ -153,48 +151,34 @@ DevFirmwareVersionInfo DevNozzle::GetFirmwareInfo() const
int DevNozzle::GetLogicExtruderId() const
{
int total_ext_count = GetTotalExtruderCount();
if (GUI::wxGetApp().preset_bundle->is_bbl_vendor()) {
if (total_ext_count == 1) {
return LOGIC_UNIQUE_EXTRUDER_ID;
} else if (total_ext_count == 2) {
if (AtLeftExtruder()) {
return LOGIC_L_EXTRUDER_ID;
} else if (AtRightExtruder()) {
return LOGIC_R_EXTRUDER_ID;
}
}
assert(0);
if (total_ext_count == 1) {
return LOGIC_UNIQUE_EXTRUDER_ID;
} else if (total_ext_count == 2) {
if (AtLeftExtruder()) {
return LOGIC_L_EXTRUDER_ID;
} else if (AtRightExtruder()) {
return LOGIC_R_EXTRUDER_ID;
}
}
// For some reason, BBL's logical extruder ID is inverted:
// physical extruder id = 0 (MAIN_EXTRUDER_ID) vs logical extruder id = 1 (LOGIC_R_EXTRUDER_ID)
// Likely because logical id reads from left to right (left = 0, right = 1)
// For generic N extruders, this inversion does not apply.
if (IsOnRack()) return INVALID_EXTRUDER_ID;
return m_nozzle_id;
assert(0);
return LOGIC_UNIQUE_EXTRUDER_ID;
}
int DevNozzle::GetExtruderId() const
{
if (GUI::wxGetApp().preset_bundle->is_bbl_vendor()) {
int total_ext_count = GetTotalExtruderCount();
if (total_ext_count == 1) {
return MAIN_EXTRUDER_ID;
} else if (total_ext_count == 2) {
if (AtRightExtruder()) {
return MAIN_EXTRUDER_ID;
} else if (AtLeftExtruder()) {
return DEPUTY_EXTRUDER_ID;
}
}
int total_ext_count = GetTotalExtruderCount();
if (total_ext_count == 1) {
return MAIN_EXTRUDER_ID;
} else if (total_ext_count == 2) {
if (AtRightExtruder()) {
return MAIN_EXTRUDER_ID;
} else if (AtLeftExtruder()) {
return DEPUTY_EXTRUDER_ID;
}
}
return m_nozzle_id;
return MAIN_EXTRUDER_ID;
}
bool DevNozzle::AtLeftExtruder() const
+12 -17
View File
@@ -1199,24 +1199,19 @@ int MachineObject::get_bed_temperature_limit()
bool MachineObject::is_filament_installed()
{
// if (m_extder_system->GetTotalExtderCount() > 0) {
// // right//or single
// auto ext = m_extder_system->m_extders[MAIN_EXTRUDER_ID];
// if (ext.m_ext_has_filament) {
// return true;
// }
// }
// /*left*/
// if (m_extder_system->GetTotalExtderCount() > 1) {
// auto ext = m_extder_system->m_extders[DEPUTY_EXTRUDER_ID];
// if (ext.m_ext_has_filament) {
// return true;
// }
// }
for (auto& ext : m_extder_system->m_extders) {
if (ext.m_ext_has_filament)
if (m_extder_system->GetTotalExtderCount() > 0) {
// right//or single
auto ext = m_extder_system->m_extders[MAIN_EXTRUDER_ID];
if (ext.m_ext_has_filament) {
return true;
}
}
/*left*/
if (m_extder_system->GetTotalExtderCount() > 1) {
auto ext = m_extder_system->m_extders[DEPUTY_EXTRUDER_ID];
if (ext.m_ext_has_filament) {
return true;
}
}
return false;
}
+167 -344
View File
@@ -1875,25 +1875,13 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent)
void StatusBasePanel::reset_temp_misc_control()
{
// reset temp string
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->SetIconNormal();
m_tempCtrl_nozzle->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_nozzle->GetTextCtrl()->SetValue(TEMP_BLANK_STR);
m_tempCtrl_nozzle->SetIconNormal();
m_tempCtrl_nozzle->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_nozzle->GetTextCtrl()->SetValue(TEMP_BLANK_STR);
m_tempCtrl_nozzle_deputy->SetIconNormal();
m_tempCtrl_nozzle_deputy->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_nozzle_deputy->GetTextCtrl()->SetValue(TEMP_BLANK_STR);
m_tempCtrl_nozzle->Enable(true);
m_tempCtrl_nozzle_deputy->Enable(true);
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles) {
tempCtrl->SetIconNormal();
tempCtrl->SetLabel(TEMP_BLANK_STR);
tempCtrl->GetTextCtrl()->SetValue(TEMP_BLANK_STR);
tempCtrl->Enable(true);
}
}
m_tempCtrl_nozzle_deputy->SetIconNormal();
m_tempCtrl_nozzle_deputy->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_nozzle_deputy->GetTextCtrl()->SetValue(TEMP_BLANK_STR);
m_tempCtrl_bed->SetIconNormal();
m_tempCtrl_bed->SetLabel(TEMP_BLANK_STR);
@@ -1903,6 +1891,8 @@ void StatusBasePanel::reset_temp_misc_control()
m_tempCtrl_chamber->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_chamber->GetTextCtrl()->SetValue(TEMP_BLANK_STR);
m_tempCtrl_nozzle->Enable(true);
m_tempCtrl_nozzle_deputy->Enable(true);
m_tempCtrl_chamber->Enable(true);
m_tempCtrl_bed->Enable(true);
@@ -2473,26 +2463,12 @@ void StatusPanel::wire_controls()
if (id == m_tempCtrl_bed->GetType()) {
on_set_bed_temp();
} else if (id == m_tempCtrl_nozzle->GetType()) {
// NOTE: this check assumes any future m_tempCtrl_nozzles population constructs those
// TempInput widgets with the same "type" id as m_tempCtrl_nozzle (as m_tempCtrl_nozzle_deputy
// already does today), so their events route into this branch too.
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
if (e.GetString() == wxString::Format("%d", MAIN_EXTRUDER_ID)) {
on_set_nozzle_temp(MAIN_EXTRUDER_ID);
} else if (e.GetString() == wxString::Format("%d", DEPUTY_EXTRUDER_ID)) {
on_set_nozzle_temp(DEPUTY_EXTRUDER_ID);
} else {
on_set_nozzle_temp(UNIQUE_EXTRUDER_ID);//there is only one nozzle
}
if (e.GetString() == wxString::Format("%d", MAIN_EXTRUDER_ID)) {
on_set_nozzle_temp(MAIN_EXTRUDER_ID);
} else if (e.GetString() == wxString::Format("%d", DEPUTY_EXTRUDER_ID)) {
on_set_nozzle_temp(DEPUTY_EXTRUDER_ID);
} else {
// N-extruder widgets all share TEMP_OF_NORMAL_TYPE, so e.GetString() can't
// disambiguate them; identify the one that fired by object identity instead.
for (size_t i = 0; i < m_tempCtrl_nozzles.size(); ++i) {
if (m_tempCtrl_nozzles[i] == e.GetEventObject()) {
on_set_nozzle_temp((int)i);
break;
}
}
on_set_nozzle_temp(UNIQUE_EXTRUDER_ID);//there is only one nozzle
}
} else if (id == m_tempCtrl_chamber->GetType()) {
if (!m_tempCtrl_chamber->IsOnChanging()) {
@@ -2517,17 +2493,10 @@ void StatusPanel::wire_controls()
m_setting_button->Connect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(StatusPanel::on_camera_enter), NULL, this);
m_tempCtrl_bed->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_kill_focus), NULL, this);
m_tempCtrl_bed->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this);
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles) {
tempCtrl->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
tempCtrl->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
}
}
m_tempCtrl_nozzle->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
m_tempCtrl_chamber->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_cham_temp_kill_focus), NULL, this);
m_tempCtrl_chamber->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_cham_temp_set_focus), NULL, this);
m_switch_lamp->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_lamp_switch), NULL, this);
@@ -2588,19 +2557,11 @@ StatusPanel::~StatusPanel()
m_setting_button->Disconnect(wxEVT_LEFT_DCLICK, wxMouseEventHandler(StatusPanel::on_camera_enter), NULL, this);
m_tempCtrl_bed->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_kill_focus), NULL, this);
m_tempCtrl_bed->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this);
m_tempCtrl_nozzle->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles) {
tempCtrl->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
tempCtrl->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
}
}
m_tempCtrl_nozzle_deputy->Disconnect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this);
m_tempCtrl_nozzle_deputy->Disconnect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this);
m_switch_lamp->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_lamp_switch), NULL, this);
/*m_switch_nozzle_fan->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_nozzle_fan_switch), NULL, this);
@@ -3070,14 +3031,8 @@ void StatusPanel::show_printing_status(bool ctrl_area, bool temp_area)
}
if (!temp_area) {
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->Enable(false);
m_tempCtrl_nozzle_deputy->Enable(false);
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles)
tempCtrl->Enable(false);
}
m_tempCtrl_nozzle->Enable(false);
m_tempCtrl_nozzle_deputy->Enable(false);
m_tempCtrl_bed->Enable(false);
m_tempCtrl_chamber->Enable(false);
m_switch_speed->Enable(false);
@@ -3088,14 +3043,8 @@ void StatusPanel::show_printing_status(bool ctrl_area, bool temp_area)
m_switch_cham_fan->Enable(false);*/
m_switch_fan->Enable(false);
} else {
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->Enable();
m_tempCtrl_nozzle_deputy->Enable();
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles)
tempCtrl->Enable();
}
m_tempCtrl_nozzle->Enable();
m_tempCtrl_nozzle_deputy->Enable();
m_tempCtrl_bed->Enable();
m_tempCtrl_chamber->Enable();
m_switch_speed->Enable();
@@ -3124,18 +3073,11 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj)
m_tempCtrl_bed->SetMaxTemp(limit);
if (obj->nozzle_temp_range.size() >= 2) {
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->SetMinTemp(obj->nozzle_temp_range[0]);
m_tempCtrl_nozzle->SetMaxTemp(obj->nozzle_temp_range[1]);
m_tempCtrl_nozzle->SetMinTemp(obj->nozzle_temp_range[0]);
m_tempCtrl_nozzle->SetMaxTemp(obj->nozzle_temp_range[1]);
m_tempCtrl_nozzle_deputy->SetMinTemp(obj->nozzle_temp_range[0]);
m_tempCtrl_nozzle_deputy->SetMaxTemp(obj->nozzle_temp_range[1]);
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles) {
tempCtrl->SetMinTemp(obj->nozzle_temp_range[0]);
tempCtrl->SetMaxTemp(obj->nozzle_temp_range[1]);
}
}
m_tempCtrl_nozzle_deputy->SetMinTemp(obj->nozzle_temp_range[0]);
m_tempCtrl_nozzle_deputy->SetMaxTemp(obj->nozzle_temp_range[1]);
}
// update temprature if not input temp target
@@ -3153,118 +3095,76 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj)
bool to_update_layout = false;
int nozzle_num = obj->GetExtderSystem()->GetTotalExtderCount();
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
if (nozzle_num == 1)
{
m_tempCtrl_nozzle->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(MAIN_EXTRUDER_ID));
m_tempCtrl_nozzle->SetCurrType(TEMP_OF_NORMAL_TYPE);
m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_NORMAL_TYPE);
m_tempCtrl_nozzle_deputy->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_nozzle_deputy->Hide();
if (m_tempCtrl_nozzle->GetMinSize() != TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON)
{
to_update_layout = true;
m_tempCtrl_nozzle->SetMinSize(TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON);
}
}
else if (nozzle_num == 2)
{
m_tempCtrl_nozzle->SetCurrType(TEMP_OF_MAIN_NOZZLE_TYPE);
m_tempCtrl_nozzle->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(MAIN_EXTRUDER_ID));
m_tempCtrl_nozzle->Show();
m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_DEPUTY_NOZZLE_TYPE);
m_tempCtrl_nozzle_deputy->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(DEPUTY_EXTRUDER_ID));
m_tempCtrl_nozzle_deputy->Show();
if (m_tempCtrl_nozzle->GetMinSize() != TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON)
{
to_update_layout = true;
m_tempCtrl_nozzle->SetMinSize(TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON);
}
}
}
else
if (nozzle_num == 1)
{
m_tempCtrl_nozzle->Hide();
m_tempCtrl_nozzle->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(MAIN_EXTRUDER_ID));
m_tempCtrl_nozzle->SetCurrType(TEMP_OF_NORMAL_TYPE);
m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_NORMAL_TYPE);
m_tempCtrl_nozzle_deputy->SetLabel(TEMP_BLANK_STR);
m_tempCtrl_nozzle_deputy->Hide();
for (size_t i = 0; i < m_tempCtrl_nozzles.size(); ++i)
if (m_tempCtrl_nozzle->GetMinSize() != TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON)
{
m_tempCtrl_nozzles[i]->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent((int)i));
m_tempCtrl_nozzles[i]->SetCurrType(TEMP_OF_NORMAL_TYPE);
m_tempCtrl_nozzles[i]->Show();
to_update_layout = true;
m_tempCtrl_nozzle->SetMinSize(TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON);
}
}
else if (nozzle_num == 2)
{
m_tempCtrl_nozzle->SetCurrType(TEMP_OF_MAIN_NOZZLE_TYPE);
m_tempCtrl_nozzle->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(MAIN_EXTRUDER_ID));
m_tempCtrl_nozzle->Show();
m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_DEPUTY_NOZZLE_TYPE);
m_tempCtrl_nozzle_deputy->SetCurrTemp(obj->GetExtderSystem()->GetNozzleTempCurrent(DEPUTY_EXTRUDER_ID));
m_tempCtrl_nozzle_deputy->Show();
if (m_tempCtrl_nozzle->GetMinSize() != TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON)
{
to_update_layout = true;
m_tempCtrl_nozzle->SetMinSize(TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON);
}
}
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
if (m_temp_nozzle_timeout > 0) {
m_temp_nozzle_timeout--;
} else {
if (!nozzle_temp_input) {
auto main_extder = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID);
if (main_extder)
if (m_temp_nozzle_timeout > 0) {
m_temp_nozzle_timeout--;
} else {
if (!nozzle_temp_input) {
auto main_extder = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID);
if (main_extder)
{
m_tempCtrl_nozzle->SetTagTemp(main_extder->GetTargetTemp());
m_tempCtrl_nozzle->SetCurrTemp((int)main_extder->GetCurrentTemp());
if (main_extder->GetTargetTemp() - main_extder->GetCurrentTemp() > TEMP_THRESHOLD_VAL)
{
m_tempCtrl_nozzle->SetTagTemp(main_extder->GetTargetTemp());
m_tempCtrl_nozzle->SetCurrTemp((int)main_extder->GetCurrentTemp());
if (main_extder->GetTargetTemp() - main_extder->GetCurrentTemp() > TEMP_THRESHOLD_VAL)
{
m_tempCtrl_nozzle->SetIconActive();
}
else
{
m_tempCtrl_nozzle->SetIconNormal();
}
m_tempCtrl_nozzle->SetIconActive();
}
}
}
if (m_temp_nozzle_deputy_timeout > 0) {
m_temp_nozzle_deputy_timeout--;
}
else {
if (!nozzle_temp_input && nozzle_num >= 2) {
auto deputy_extder = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID);
if (deputy_extder)
else
{
m_tempCtrl_nozzle_deputy->SetTagTemp(deputy_extder->GetTargetTemp());
m_tempCtrl_nozzle_deputy->SetCurrTemp((int)deputy_extder->GetCurrentTemp());
if (deputy_extder->GetTargetTemp() - deputy_extder->GetCurrentTemp() > TEMP_THRESHOLD_VAL)
{
m_tempCtrl_nozzle_deputy->SetIconActive();
}
else
{
m_tempCtrl_nozzle_deputy->SetIconNormal();
}
m_tempCtrl_nozzle->SetIconNormal();
}
}
}
}
if (m_temp_nozzle_deputy_timeout > 0) {
m_temp_nozzle_deputy_timeout--;
}
else {
assert(m_temp_nozzle_timeouts.size() == m_tempCtrl_nozzles.size());
for (size_t i = 0; i < m_temp_nozzle_timeouts.size(); ++i) {
if (m_temp_nozzle_timeouts[i] > 0) {
m_temp_nozzle_timeouts[i]--;
} else {
if (!nozzle_temp_input) {
auto extder = obj->GetExtderSystem()->GetExtderById(i);
if (extder)
{
m_tempCtrl_nozzles[i]->SetTagTemp(extder->GetTargetTemp());
m_tempCtrl_nozzles[i]->SetCurrTemp((int)extder->GetCurrentTemp());
if (extder->GetTargetTemp() - extder->GetCurrentTemp() > TEMP_THRESHOLD_VAL)
{
m_tempCtrl_nozzles[i]->SetIconActive();
}
else
{
m_tempCtrl_nozzles[i]->SetIconNormal();
}
}
if (!nozzle_temp_input && nozzle_num >= 2) {
auto deputy_extder = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID);
if (deputy_extder)
{
m_tempCtrl_nozzle_deputy->SetTagTemp(deputy_extder->GetTargetTemp());
m_tempCtrl_nozzle_deputy->SetCurrTemp((int)deputy_extder->GetCurrentTemp());
if (deputy_extder->GetTargetTemp() - deputy_extder->GetCurrentTemp() > TEMP_THRESHOLD_VAL)
{
m_tempCtrl_nozzle_deputy->SetIconActive();
}
else
{
m_tempCtrl_nozzle_deputy->SetIconNormal();
}
}
}
@@ -3337,15 +3237,10 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
/*extder*/
auto extder_system = obj->GetExtderSystem();
m_nozzle_num = extder_system->GetTotalExtderCount();
// m_extruderImage/m_extruder_book only have dedicated pages for 1 and 2 nozzles (see
// create_extruder_control()); 3+ reuses the 2-nozzle page and style, which is a cosmetic
// fallback only (ExtruderImage::doRender's own "m_nozzle_num >= 2" branch already draws the
// same two-icon graphic for any count >= 2) -- this just avoids indexing past the vector's end.
int display_num = m_nozzle_num < (int)m_extruderImage.size() ? m_nozzle_num : (int)m_extruderImage.size();
int select_index = display_num - 1;
int select_index = m_nozzle_num - 1;
if (m_nozzle_num >= 2) {
m_extruder_book->SetSelection(display_num);
m_extruder_book->SetSelection(m_nozzle_num);
/*style*/
m_nozzle_btn_panel->Show();
@@ -3391,7 +3286,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
}
} else {
m_nozzle_btn_panel->Hide();
m_extruder_book->SetSelection(display_num);
m_extruder_book->SetSelection(m_nozzle_num);
m_extruderImage[select_index]->setExtruderCount(m_nozzle_num);
if (extder_system->GetTotalExtderSize() > 0)
@@ -3578,50 +3473,34 @@ void StatusPanel::update_ams(MachineObject *obj)
// m_ams_control->SetExtruder(obj->is_filament_at_extruder(), obj->m_extder_data.extders[MAIN_NOZZLE_ID].snow.ams_id, obj->m_extder_data.extders[MAIN_NOZZLE_ID].snow.slot_id);
//} else {
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
/*right*/
if (obj->GetExtderSystem()->GetTotalExtderCount() > 0) {
auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID);
if (ext->HasFilamentInExt()) {
if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
if (obj->GetExtderSystem()->GetTotalExtderCount() > 0) {
auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID);
if (ext->HasFilamentInExt()) {
if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
m_ams_control->SetExtruder(ext->HasFilamentInExt(), MAIN_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
}
m_ams_control->SetExtruder(ext->HasFilamentInExt(), MAIN_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
}
/*left*/
if (obj->GetExtderSystem()->GetTotalExtderCount() > 1) {
auto ext = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID);
if (ext->HasFilamentInExt()) {
if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
/*left*/
if (obj->GetExtderSystem()->GetTotalExtderCount() > 1) {
auto ext = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID);
if (ext->HasFilamentInExt()) {
if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
m_ams_control->SetExtruder(ext->HasFilamentInExt(), DEPUTY_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
}
} else {
/*all extruders, in id order*/
for (const auto& ext : obj->GetExtderSystem()->GetExtruders()) {
if (ext.HasFilamentInExt()) {
if (ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
} else {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
}
m_ams_control->SetExtruder(ext.HasFilamentInExt(), ext.GetExtId(), ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
}
m_ams_control->SetExtruder(ext->HasFilamentInExt(), DEPUTY_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
}
update_filament_loading_panel(obj);
@@ -4306,48 +4185,33 @@ void StatusPanel::on_set_nozzle_temp(int nozzle_id)
try {
long nozzle_temp;
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
if (nozzle_id == MAIN_EXTRUDER_ID) {
wxString str = m_tempCtrl_nozzle->GetTextCtrl()->GetValue();
if (str.ToLong(&nozzle_temp) && obj) {
set_hold_count(m_temp_nozzle_timeout);
if (nozzle_temp > m_tempCtrl_nozzle->get_max_temp()) {
nozzle_temp = m_tempCtrl_nozzle->get_max_temp();
m_tempCtrl_nozzle->SetTagTemp(wxString::Format("%d", nozzle_temp));
m_tempCtrl_nozzle->Warning(false);
}
if (m_tempCtrl_nozzle->GetCurrType() == TempInputType::TEMP_OF_NORMAL_TYPE) {
obj->command_set_nozzle(nozzle_temp);
} else {
obj->command_set_nozzle_new(MAIN_EXTRUDER_ID, nozzle_temp);
}
if (nozzle_id == MAIN_EXTRUDER_ID) {
wxString str = m_tempCtrl_nozzle->GetTextCtrl()->GetValue();
if (str.ToLong(&nozzle_temp) && obj) {
set_hold_count(m_temp_nozzle_timeout);
if (nozzle_temp > m_tempCtrl_nozzle->get_max_temp()) {
nozzle_temp = m_tempCtrl_nozzle->get_max_temp();
m_tempCtrl_nozzle->SetTagTemp(wxString::Format("%d", nozzle_temp));
m_tempCtrl_nozzle->Warning(false);
}
}
if (nozzle_id == DEPUTY_EXTRUDER_ID) {
wxString str = m_tempCtrl_nozzle_deputy->GetTextCtrl()->GetValue();
if (str.ToLong(&nozzle_temp) && obj) {
set_hold_count(m_temp_nozzle_deputy_timeout);
if (nozzle_temp > m_tempCtrl_nozzle_deputy->get_max_temp()) {
nozzle_temp = m_tempCtrl_nozzle_deputy->get_max_temp();
m_tempCtrl_nozzle_deputy->SetTagTemp(wxString::Format("%d", nozzle_temp));
m_tempCtrl_nozzle_deputy->Warning(false);
}
obj->command_set_nozzle_new(DEPUTY_EXTRUDER_ID, nozzle_temp);
if (m_tempCtrl_nozzle->GetCurrType() == TempInputType::TEMP_OF_NORMAL_TYPE) {
obj->command_set_nozzle(nozzle_temp);
} else {
obj->command_set_nozzle_new(MAIN_EXTRUDER_ID, nozzle_temp);
}
}
}
else if (nozzle_id >= 0 && nozzle_id < (int)m_tempCtrl_nozzles.size()) {
assert(m_tempCtrl_nozzles.size() == m_temp_nozzle_timeouts.size());
wxString str = m_tempCtrl_nozzles[nozzle_id]->GetTextCtrl()->GetValue();
if (nozzle_id == DEPUTY_EXTRUDER_ID) {
wxString str = m_tempCtrl_nozzle_deputy->GetTextCtrl()->GetValue();
if (str.ToLong(&nozzle_temp) && obj) {
set_hold_count(m_temp_nozzle_timeouts[nozzle_id]);
if (nozzle_temp > m_tempCtrl_nozzles[nozzle_id]->get_max_temp()) {
nozzle_temp = m_tempCtrl_nozzles[nozzle_id]->get_max_temp();
m_tempCtrl_nozzles[nozzle_id]->SetTagTemp(wxString::Format("%d", nozzle_temp));
m_tempCtrl_nozzles[nozzle_id]->Warning(false);
set_hold_count(m_temp_nozzle_deputy_timeout);
if (nozzle_temp > m_tempCtrl_nozzle_deputy->get_max_temp()) {
nozzle_temp = m_tempCtrl_nozzle_deputy->get_max_temp();
m_tempCtrl_nozzle_deputy->SetTagTemp(wxString::Format("%d", nozzle_temp));
m_tempCtrl_nozzle_deputy->Warning(false);
}
obj->command_set_nozzle_new(nozzle_id, nozzle_temp);
obj->command_set_nozzle_new(DEPUTY_EXTRUDER_ID, nozzle_temp);
}
}
} catch (...) {
@@ -4431,44 +4295,26 @@ void StatusPanel::on_ams_load_curr()
return;
}
// Filament Track Switch is calibrated: the load can go to either/any extruder, so ask
// the user which. Record each extruder's currently-loaded slot so the dialog can grey
// out a side that already holds this filament.
// NOTE: FeedDirectionDialog/SetExtruderMapping (Widgets/AMSItem.{hpp,cpp}) take the real
// extruder count in the non-BBL path now, but that class's own internals haven't been
// audited for N > 2 -- this only fixes what's local to StatusPanel.cpp.
int extruder_count;
std::vector<std::pair<std::string, std::string>> extruderSlots;
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
extruder_count = 2;
extruderSlots.assign(2, {"", ""});
if (auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID); ext.has_value())
// Filament Track Switch is calibrated: the load can go to either extruder, so ask the
// user which. Record each extruder's currently-loaded slot so the dialog can grey out a
// side that already holds this filament.
std::vector<std::pair<std::string, std::string>> extruderSlots(2, {"", ""});
if (auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID); ext.has_value())
{
if (ext->HasFilamentInExt())
{
if (ext->HasFilamentInExt())
{
extruderSlots[MAIN_EXTRUDER_ID] = {ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id};
}
extruderSlots[MAIN_EXTRUDER_ID] = {ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id};
}
if (auto ext = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID); ext.has_value())
}
if (auto ext = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID); ext.has_value())
{
if (ext->HasFilamentInExt())
{
if (ext->HasFilamentInExt())
{
extruderSlots[DEPUTY_EXTRUDER_ID] = {ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id};
}
}
} else {
extruder_count = obj->GetExtderSystem()->GetTotalExtderCount();
extruderSlots.assign(extruder_count, {"", ""});
for (const auto& ext : obj->GetExtderSystem()->GetExtruders())
{
if (ext.HasFilamentInExt())
{
extruderSlots[ext.GetExtId()] = {ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id};
}
extruderSlots[DEPUTY_EXTRUDER_ID] = {ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id};
}
}
FeedDirectionDialog dialog(nullptr, extruder_count, obj->printer_type);
FeedDirectionDialog dialog(nullptr, 2, obj->printer_type);
dialog.SetExtruderMapping(obj, curr_ams_id, curr_can_id, extruderSlots);
auto rtn = dialog.ShowModal();
@@ -4570,50 +4416,34 @@ void StatusPanel::on_ams_switch(SimpleEvent &event)
{
if(obj){
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
/*right*/
if (obj->GetExtderSystem()->GetTotalExtderCount() > 0) {
auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID);
if (ext->HasFilamentInExt()) {
if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
/*right*/
if (obj->GetExtderSystem()->GetTotalExtderCount() > 0) {
auto ext = obj->GetExtderSystem()->GetExtderById(MAIN_EXTRUDER_ID);
if (ext->HasFilamentInExt()) {
if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
m_ams_control->SetExtruder(ext->HasFilamentInExt(), MAIN_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
}
m_ams_control->SetExtruder(ext->HasFilamentInExt(), MAIN_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
}
/*left*/
if (obj->GetExtderSystem()->GetTotalExtderCount() > 1) {
auto ext = obj->GetExtderSystem()->GetExtderById(DEPUTY_EXTRUDER_ID);
if (ext->HasFilamentInExt()) {
if (ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext->GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
/*left*/
if (obj->GetExtderSystem()->GetTotalExtderCount() > 1) {
auto ext = obj->GetExtderSystem()->GetExtruders()[DEPUTY_EXTRUDER_ID];
if (ext.HasFilamentInExt()) {
if (ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
m_ams_control->SetExtruder(ext->HasFilamentInExt(), DEPUTY_EXTRUDER_ID, ext->GetSlotNow().ams_id, ext->GetSlotNow().slot_id);
}
} else {
/*all extruders, in id order*/
for (const auto& ext : obj->GetExtderSystem()->GetExtruders()) {
if (ext.HasFilamentInExt()) {
if (ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_MAIN_ID) || ext.GetSlotNow().ams_id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, "0", AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP3);
} else {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_LOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_COMBO_LOAD_STEP2);
}
} else {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
}
m_ams_control->SetExtruder(ext.HasFilamentInExt(), ext.GetExtId(), ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id);
} else {
m_ams_control->SetAmsStep(ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id, AMSPassRoadType::AMS_ROAD_TYPE_UNLOAD, AMSPassRoadSTEP::AMS_ROAD_STEP_NONE);
}
m_ams_control->SetExtruder(ext.HasFilamentInExt(), DEPUTY_EXTRUDER_ID, ext.GetSlotNow().ams_id, ext.GetSlotNow().slot_id);
}
}
}
@@ -5539,17 +5369,10 @@ void StatusPanel::msw_rescale()
m_bpButton_xy->Rescale();
auto size = TEMP_CTRL_MIN_SIZE_ALIGN_ONE_ICON;
if (obj && obj->GetExtderSystem()->GetTotalExtderCount() >= 2) size = TEMP_CTRL_MIN_SIZE_ALIGN_TWO_ICON;
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
m_tempCtrl_nozzle->SetMinSize(size);
m_tempCtrl_nozzle->Rescale();
m_tempCtrl_nozzle_deputy->SetMinSize(size);
m_tempCtrl_nozzle_deputy->Rescale();
} else {
for (auto& tempCtrl : m_tempCtrl_nozzles) {
tempCtrl->SetMinSize(size);
tempCtrl->Rescale();
}
}
m_tempCtrl_nozzle->SetMinSize(size);
m_tempCtrl_nozzle->Rescale();
m_tempCtrl_nozzle_deputy->SetMinSize(size);
m_tempCtrl_nozzle_deputy->Rescale();
m_line_nozzle->SetSize(wxSize(-1, FromDIP(1)));
m_tempCtrl_bed->SetMinSize(size);
m_tempCtrl_bed->Rescale();
-4
View File
@@ -482,10 +482,6 @@ protected:
int m_temp_nozzle_timeout{ 0 };
TempInput* m_tempCtrl_nozzle_deputy;
int m_temp_nozzle_deputy_timeout{ 0 };
std::vector<TempInput*> m_tempCtrl_nozzles;
std::vector<int> m_temp_nozzle_timeouts;
TempInput * m_tempCtrl_bed;
int m_temp_bed_timeout {0};
TempInput * m_tempCtrl_chamber;
+3 -10
View File
@@ -837,21 +837,14 @@ void MultiNozzleStatusTable::UpdateRackInfo(std::weak_ptr<DevNozzleRack> rack)
bool has_right = false;
for (auto& elem : nozzles_in_extruder) {
auto& nozzle = elem.second;
int extruder_id{};
if (wxGetApp().preset_bundle->is_bbl_vendor()) {
extruder_id = nozzle.AtLeftExtruder() ? 0 : 1;
if (nozzle.AtRightExtruder())
has_right = true;
}
else
extruder_id = nozzle.GetExtruderId();
int extruder_id = nozzle.AtLeftExtruder() ? 0 : 1;
if (nozzle.AtRightExtruder())
has_right = true;
NozzleVolumeType volume_type = DevNozzle::ToNozzleVolumeType(nozzle.m_nozzle_flow);
m_badge->SetExtruderInfo(extruder_id, format_diameter_to_str(nozzle.GetNozzleDiameter()), volume_type);
}
// TODO: Update for N extruders
m_badge->SetExtruderValid(has_right);
}
}
-3
View File
@@ -170,9 +170,6 @@ void TempInput::SetFinish()
wxCommandEvent event(wxCUSTOMEVT_SET_TEMP_FINISH);
event.SetInt(temp_type);
event.SetString(wxString::Format("%d", m_input_type));
// N-extruder temp controls all share TEMP_OF_NORMAL_TYPE, so the string payload above can't
// tell them apart; carry widget identity so the listener can find which one fired.
event.SetEventObject(this);
wxPostEvent(this->GetParent(), event);
}