FIX:optimize the fan gear
Change-Id: I02361a71b56f1527d85b2085f13fb374faacdc32
This commit is contained in:
parent
b5967505bd
commit
e9045c2f4b
3 changed files with 30 additions and 12 deletions
|
@ -2336,18 +2336,36 @@ int MachineObject::parse_json(std::string payload)
|
|||
big_fan1_speed = (int)((fan_gear & 0x0000FF00) >> 8);
|
||||
cooling_fan_speed= (int)((fan_gear & 0x000000FF) >> 0);
|
||||
}
|
||||
/* if (jj.contains("cooling_fan_speed")) {
|
||||
else {
|
||||
if (jj.contains("cooling_fan_speed")) {
|
||||
cooling_fan_speed = stoi(jj["cooling_fan_speed"].get<std::string>());
|
||||
cooling_fan_speed = round(floor(cooling_fan_speed / float(1.5)));
|
||||
}
|
||||
else {
|
||||
cooling_fan_speed = 0;
|
||||
}
|
||||
|
||||
if (jj.contains("big_fan1_speed")) {
|
||||
big_fan1_speed = stoi(jj["big_fan1_speed"].get<std::string>());
|
||||
big_fan1_speed = round(floor(big_fan1_speed / float(1.5)));
|
||||
}
|
||||
else {
|
||||
big_fan1_speed = 0;
|
||||
}
|
||||
|
||||
if (jj.contains("big_fan2_speed")) {
|
||||
big_fan2_speed = stoi(jj["big_fan2_speed"].get<std::string>());
|
||||
}*/
|
||||
big_fan2_speed = round(floor(big_fan2_speed / float(1.5)));
|
||||
}
|
||||
else {
|
||||
big_fan2_speed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (jj.contains("heatbreak_fan_speed")) {
|
||||
heatbreak_fan_speed = stoi(jj["heatbreak_fan_speed"].get<std::string>());
|
||||
}
|
||||
|
||||
/* parse speed */
|
||||
try {
|
||||
if (jj.contains("spd_lvl")) {
|
||||
|
|
|
@ -1734,7 +1734,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
|||
if (m_switch_nozzle_fan_timeout > 0) {
|
||||
m_switch_nozzle_fan_timeout--;
|
||||
} else{
|
||||
int speed = floor(obj->cooling_fan_speed / float(25.5));
|
||||
int speed = round(obj->cooling_fan_speed / float(25.5));
|
||||
m_switch_nozzle_fan->SetValue(speed > 0 ? true : false);
|
||||
m_switch_nozzle_fan->setFanValue(speed * 10);
|
||||
m_fan_control_popup.update_fan_data(MachineObject::FanType::COOLING_FAN, obj);
|
||||
|
@ -1744,7 +1744,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
|||
if (m_switch_printing_fan_timeout > 0) {
|
||||
m_switch_printing_fan_timeout--;
|
||||
}else{
|
||||
int speed = floor(obj->big_fan1_speed / float(25.5));
|
||||
int speed = round(obj->big_fan1_speed / float(25.5));
|
||||
m_switch_printing_fan->SetValue(speed > 0 ? true : false);
|
||||
m_switch_printing_fan->setFanValue(speed * 10);
|
||||
m_fan_control_popup.update_fan_data(MachineObject::FanType::BIG_COOLING_FAN, obj);
|
||||
|
@ -1754,7 +1754,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
|
|||
if (m_switch_cham_fan_timeout > 0) {
|
||||
m_switch_cham_fan_timeout--;
|
||||
}else{
|
||||
int speed = floor(obj->big_fan2_speed / float(25.5));
|
||||
int speed = round(obj->big_fan2_speed / float(25.5));
|
||||
m_switch_cham_fan->SetValue(speed > 0 ? true : false);
|
||||
m_switch_cham_fan->setFanValue(speed * 10);
|
||||
m_fan_control_popup.update_fan_data(MachineObject::FanType::CHAMBER_FAN, obj);
|
||||
|
|
|
@ -462,7 +462,7 @@ void FanControl::set_name(wxString name)
|
|||
void FanControl::set_fan_speed(int g)
|
||||
{
|
||||
if (g < 0 || g > 255) return;
|
||||
int speed = floor(float(g) / float(25.5));
|
||||
int speed = round(float(g) / float(25.5));
|
||||
|
||||
if (m_current_speed != speed) {
|
||||
m_current_speed = speed;
|
||||
|
|
Loading…
Reference in a new issue