소스 검색

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 년 전
부모
커밋
8220d0196b
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  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();