Jelajahi Sumber

Magic numbers are bad...

VintagePC 2 tahun lalu
induk
melakukan
ba52430e1d
2 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 1 1
      Firmware/mmu2.cpp
  2. 2 0
      Firmware/mmu2.h

+ 1 - 1
Firmware/mmu2.cpp

@@ -244,7 +244,7 @@ bool MMU2::RetryIfPossible(uint16_t ec){
 
 void MMU2::ResetRetryAttempts(){
     SERIAL_ECHOLNPGM("ResetRetryAttempts");
-    retryAttempts = 3;
+    retryAttempts = MAX_RETRIES;
 }
 
 void MMU2::DecrementRetryAttempts(){

+ 2 - 0
Firmware/mmu2.h

@@ -6,6 +6,8 @@ struct E_Step;
 
 namespace MMU2 {
 
+static constexpr uint8_t MAX_RETRIES = 3U;
+
 /// @@TODO hmmm, 12 bytes... may be we can reduce that
 struct xyz_pos_t {
     float xyz[3];