ENH: change extruder icon colour when loading filament

Change-Id: Ifd1e9c868702352790de9ddf25f256d504875785
This commit is contained in:
tao.jin 2022-09-29 10:29:51 +08:00 committed by Lane.Wei
parent 633d14e711
commit d97db7e617
6 changed files with 56 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,28 @@
<svg width="28" height="70" viewBox="0 0 28 70" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.4305 1.49971V38.4918H9.92413V1.49971M9.92413 1.49887C9.92542 0.67099 11.8291 0 14.1773 0L9.92413 1.49887ZM14.1773 0C16.5255 0 18.4292 0.67099 18.4305 1.49887L14.1773 0Z" fill="url(#paint0_linear_8143_31825)" fill-opacity="0.2"/>
<line x1="18.6913" y1="1.32383" x2="18.6913" y2="38.3703" stroke="url(#paint1_linear_8143_31825)" stroke-width="0.523139" stroke-linecap="round"/>
<line x1="9.83127" y1="1.32383" x2="9.83127" y2="38.3703" stroke="url(#paint2_linear_8143_31825)" stroke-width="0.523139" stroke-linecap="round"/>
<path d="M11.6962 14.887L13.8367 16.7217C14.0326 16.8897 14.3217 16.8897 14.5176 16.7217L16.6582 14.887" stroke="#00AE42" stroke-opacity="0.3" stroke-width="1.04628" stroke-linecap="round"/>
<path d="M11.6962 25.1636L13.8367 26.9983C14.0326 27.1663 14.3217 27.1663 14.5176 26.9983L16.6582 25.1636" stroke="#00AE42" stroke-opacity="0.8" stroke-width="1.04628" stroke-linecap="round"/>
<path d="M11.7663 32.6333L13.8396 34.1412C14.0231 34.2746 14.2716 34.2746 14.455 34.1412L16.5283 32.6333" stroke="#00AE42" stroke-width="1.04628" stroke-linecap="round"/>
<path d="M7.79767 62.6204H19.9192L19.0534 66.0837H8.66349L7.79767 62.6204Z" fill="#ACACAC"/>
<rect y="38.2791" width="28" height="25.1646" rx="2.61569" fill="#D3D3D3"/>
<circle cx="14.0008" cy="50.5056" r="6.91139" fill="#AEAEAE"/>
<circle cx="13.9372" cy="50.4983" r="6.49367" fill="#E3E3E3"/>
<circle cx="13.9779" cy="50.5003" r="4.76203" fill="#00AE42"/>
<rect x="13.1147" y="66.0845" width="1.73165" height="3.03038" fill="#939191"/>
<defs>
<linearGradient id="paint0_linear_8143_31825" x1="14.1773" y1="0" x2="14.1773" y2="38.4918" gradientUnits="userSpaceOnUse">
<stop stop-color="#00AE42" stop-opacity="0"/>
<stop offset="1" stop-color="#00AE42"/>
</linearGradient>
<linearGradient id="paint1_linear_8143_31825" x1="18.4297" y1="37.1869" x2="18.4297" y2="1.06226" gradientUnits="userSpaceOnUse">
<stop stop-color="#00AE42"/>
<stop offset="1" stop-color="#00AE42" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint2_linear_8143_31825" x1="9.56971" y1="37.1869" x2="9.5697" y2="1.06226" gradientUnits="userSpaceOnUse">
<stop stop-color="#00AE42"/>
<stop offset="1" stop-color="#00AE42" stop-opacity="0"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -358,6 +358,7 @@ MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string
mc_print_sub_stage = 0;
mc_left_time = 0;
home_flag = -1;
hw_switch_state = 0;
printing_speed_lvl = PrintingSpeedLevel::SPEED_LEVEL_INVALID;
}
@ -1046,6 +1047,18 @@ bool MachineObject::is_axis_at_home(std::string axis)
}
}
bool MachineObject::is_filament_at_extruder()
{
if (hw_switch_state == 1)
return true;
else if (hw_switch_state == 0)
return false;
else {
//default
return true;
}
}
wxString MachineObject::get_curr_stage()
{
if (stage_list_info.empty()) {
@ -1820,6 +1833,9 @@ int MachineObject::parse_json(std::string payload)
if (jj.contains("home_flag")) {
home_flag = jj["home_flag"].get<int>();
}
if (jj.contains("hw_switch_state")) {
hw_switch_state = jj["hw_switch_state"].get<int>();
}
if (jj.contains("mc_remaining_time")) {
if (jj["mc_remaining_time"].is_string())

View File

@ -466,6 +466,7 @@ public:
int mc_left_time; /* left time in seconds */
int last_mc_print_stage;
int home_flag;
int hw_switch_state;
bool is_system_printing();
int print_error;
@ -476,6 +477,8 @@ public:
bool is_axis_at_home(std::string axis);
bool is_filament_at_extruder();
wxString get_curr_stage();
// return curr stage index of stage list
int get_curr_stage_idx();

View File

@ -177,6 +177,7 @@ void StatusBasePanel::init_bitmaps()
m_thumbnail_sdcard = ScalableBitmap(this, "monitor_sdcard_thumbnail", 120);
//m_bitmap_camera = create_scaled_bitmap("monitor_camera", nullptr, 18);
m_bitmap_extruder = *cache.load_png("monitor_extruder", FromDIP(28), FromDIP(70), false, false);
m_bitmap_extruder_load = *cache.load_png("monitor_extruder_load", FromDIP(28), FromDIP(70), false, false);
m_bitmap_sdcard_state_on = create_scaled_bitmap("sdcard_state_on", nullptr, 20);
m_bitmap_sdcard_state_off = create_scaled_bitmap("sdcard_state_off", nullptr, 20);
}
@ -1305,6 +1306,13 @@ void StatusPanel::update(MachineObject *obj)
update_temp_ctrl(obj);
update_misc_ctrl(obj);
if (obj && obj->is_filament_at_extruder()) {
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder_load);
}
else {
m_bitmap_extruder_img->SetBitmap(m_bitmap_extruder);
}
// BBS hide tasklist info
// update_tasklist(obj);
update_ams(obj);

View File

@ -81,6 +81,7 @@ protected:
ScalableBitmap m_bitmap_use_time;
ScalableBitmap m_bitmap_use_weight;
wxBitmap m_bitmap_extruder;
wxBitmap m_bitmap_extruder_load;
CameraRecordingStatus m_state_recording{CameraRecordingStatus::RECORDING_NONE};
CameraTimelapseStatus m_state_timelapse{CameraTimelapseStatus::TIMELAPSE_NONE};