Browse Source

Lock onto the first error source until cleared

Do not overwrite the error source if the error flag is already set.

As checks are performed in priority order, this ensures min/maxtemp
user-level handlers are triggered even if the thermal model can detect
an issue in the same cycle.

This restores MAXTEMP handling, which was simply shadowed.
Yuri D'Elia 3 năm trước cách đây
mục cha
commit
8220d0196b
1 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 8 4
      Firmware/temperature.cpp

+ 8 - 4
Firmware/temperature.cpp

@@ -485,12 +485,16 @@ void set_temp_error(TempErrorSource source, uint8_t index, TempErrorType type)
     }
 #endif
 
-    // set the error state
+    // set the initial error source
+    if(!temp_error_state.error) {
+        temp_error_state.source = (uint8_t)source;
+        temp_error_state.index = index;
+        temp_error_state.type = (uint8_t)type;
+    }
+
+    // always set the error state
     temp_error_state.error = true;
     temp_error_state.assert = true;
-    temp_error_state.source = (uint8_t)source;
-    temp_error_state.index = index;
-    temp_error_state.type = (uint8_t)type;
 }
 
 void handle_temp_error();