NEW:support led control

jira:[device page]

Change-Id: Id1ce67262a2c70e93425c0c79f2f3b2fd0a747a6
This commit is contained in:
tao wang 2024-12-03 22:13:11 +08:00 committed by lane.wei
parent 7700b911a6
commit b89aa86a8e
3 changed files with 17 additions and 1 deletions

View File

@ -2090,11 +2090,24 @@ int MachineObject::command_set_chamber_light(LIGHT_EFFECT effect, int on_time, i
j["system"]["led_off_time"] = off_time;
j["system"]["loop_times"] = loops;
j["system"]["interval_time"] = interval;
return this->publish_json(j.dump());
}
int MachineObject::command_set_chamber_light2(LIGHT_EFFECT effect, int on_time /*= 500*/, int off_time /*= 500*/, int loops /*= 1*/, int interval /*= 1000*/)
{
json j;
j["system"]["command"] = "ledctrl";
j["system"]["led_node"] = "chamber_light2";
j["system"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
j["system"]["led_mode"] = light_effect_str(effect);
j["system"]["led_on_time"] = on_time;
j["system"]["led_off_time"] = off_time;
j["system"]["loop_times"] = loops;
j["system"]["interval_time"] = interval;
return this->publish_json(j.dump());
}
int MachineObject::command_set_printer_nozzle(std::string nozzle_type, float diameter)
{
nozzle_setting_hold_count = HOLD_COUNT_MAX * 2;

View File

@ -1048,6 +1048,7 @@ public:
int command_ams_refresh_rfid(std::string tray_id);
int command_ams_control(std::string action);
int command_set_chamber_light(LIGHT_EFFECT effect, int on_time = 500, int off_time = 500, int loops = 1, int interval = 1000);
int command_set_chamber_light2(LIGHT_EFFECT effect, int on_time = 500, int off_time = 500, int loops = 1, int interval = 1000);
int command_set_work_light(LIGHT_EFFECT effect, int on_time = 500, int off_time = 500, int loops = 1, int interval = 1000);
int command_start_extrusion_cali(int tray_index, int nozzle_temp, int bed_temp, float max_volumetric_speed, std::string setting_id = "");
int command_stop_extrusion_cali();

View File

@ -4553,10 +4553,12 @@ void StatusPanel::on_lamp_switch(wxCommandEvent &event)
// do not update when timeout > 0
set_hold_count(this->m_switch_lamp_timeout);
obj->command_set_chamber_light(MachineObject::LIGHT_EFFECT::LIGHT_EFFECT_ON);
obj->command_set_chamber_light2(MachineObject::LIGHT_EFFECT::LIGHT_EFFECT_ON);
} else {
m_switch_lamp->SetValue(false);
set_hold_count(this->m_switch_lamp_timeout);
obj->command_set_chamber_light(MachineObject::LIGHT_EFFECT::LIGHT_EFFECT_OFF);
obj->command_set_chamber_light2(MachineObject::LIGHT_EFFECT::LIGHT_EFFECT_OFF);
}
}