fix precedence errors (#3611)

Fix a handful of precedence errors and 1 logic/precedence error.  None of the code will compile as intended without these changes.

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
foghatredbird 2024-01-15 06:35:08 -08:00 committed by GitHub
parent 9b76f51bd3
commit 1615832236
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View file

@ -1258,11 +1258,11 @@ bool MachineObject::is_axis_at_home(std::string axis)
return true; return true;
if (axis == "X") { if (axis == "X") {
return home_flag & 1 == 1; return (home_flag & 1) == 1;
} else if (axis == "Y") { } else if (axis == "Y") {
return home_flag >> 1 & 1 == 1; return (home_flag >> 1 & 1) == 1;
} else if (axis == "Z") { } else if (axis == "Z") {
return home_flag >> 2 & 1 == 1; return (home_flag >> 2 & 1) == 1;
} else { } else {
return true; return true;
} }

View file

@ -444,14 +444,14 @@ void MonitorPanel::show_status(int status)
{ {
if (!m_initialized) return; if (!m_initialized) return;
if (last_status == status)return; if (last_status == status)return;
if (last_status & (int)MonitorStatus::MONITOR_CONNECTING != 0) { if ((last_status & (int)MonitorStatus::MONITOR_CONNECTING) != 0) {
NetworkAgent* agent = wxGetApp().getAgent(); NetworkAgent* agent = wxGetApp().getAgent();
json j; json j;
j["dev_id"] = obj ? obj->dev_id : "obj_nullptr"; j["dev_id"] = obj ? obj->dev_id : "obj_nullptr";
if (status & (int)MonitorStatus::MONITOR_DISCONNECTED != 0) { if ((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0) {
j["result"] = "failed"; j["result"] = "failed";
} }
else if (status & (int)MonitorStatus::MONITOR_NORMAL != 0) { else if ((status & (int)MonitorStatus::MONITOR_NORMAL) != 0) {
j["result"] = "success"; j["result"] = "success";
} }
} }

View file

@ -6264,7 +6264,7 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
for (auto const& warning : state.warnings) { for (auto const& warning : state.warnings) {
if (warning.current) { if (warning.current) {
NotificationManager::NotificationLevel notif_level = NotificationManager::NotificationLevel::WarningNotificationLevel; NotificationManager::NotificationLevel notif_level = NotificationManager::NotificationLevel::WarningNotificationLevel;
if (evt.status.message_type == PrintStateBase::SlicingNotificationType::SlicingReplaceInitEmptyLayers | PrintStateBase::SlicingNotificationType::SlicingEmptyGcodeLayers) { if (evt.status.message_type == PrintStateBase::SlicingNotificationType::SlicingReplaceInitEmptyLayers || evt.status.message_type == PrintStateBase::SlicingNotificationType::SlicingEmptyGcodeLayers) {
notif_level = NotificationManager::NotificationLevel::SeriousWarningNotificationLevel; notif_level = NotificationManager::NotificationLevel::SeriousWarningNotificationLevel;
} }
notification_manager->push_slicing_warning_notification(warning.message, false, model_object, object_id, warning_step, warning.message_id, notif_level); notification_manager->push_slicing_warning_notification(warning.message, false, model_object, object_id, warning_step, warning.message_id, notif_level);

View file

@ -71,7 +71,7 @@ void StateHandler::update_binds()
void StateHandler::set_state(int state, int mask) void StateHandler::set_state(int state, int mask)
{ {
if (states_ & mask == state & mask) return; if ((states_ & mask) == (state & mask)) return;
int old = states_; int old = states_;
states_ = states_ & ~mask | state & mask; states_ = states_ & ~mask | state & mask;
if (old != states_ && (old | states2_) != (states_ | states2_)) { if (old != states_ && (old | states2_) != (states_ | states2_)) {