Ver código fonte

Merge pull request #4958 from bgort/m48_improvements

Improve M48 output; Add min, max, range, etc.
Roxy-3D 8 anos atrás
pai
commit
30fee51e86
1 arquivos alterados com 29 adições e 8 exclusões
  1. 29
    8
      Marlin/Marlin_main.cpp

+ 29
- 8
Marlin/Marlin_main.cpp Ver arquivo

4681
     }
4681
     }
4682
 
4682
 
4683
     if (verbose_level > 0)
4683
     if (verbose_level > 0)
4684
-      SERIAL_PROTOCOLLNPGM("M48 Z-Probe Repeatability test");
4684
+      SERIAL_PROTOCOLLNPGM("M48 Z-Probe Repeatability Test");
4685
 
4685
 
4686
     int8_t n_samples = code_seen('P') ? code_value_byte() : 10;
4686
     int8_t n_samples = code_seen('P') ? code_value_byte() : 10;
4687
     if (n_samples < 4 || n_samples > 50) {
4687
     if (n_samples < 4 || n_samples > 50) {
4747
 
4747
 
4748
     randomSeed(millis());
4748
     randomSeed(millis());
4749
 
4749
 
4750
-    double mean = 0, sigma = 0, sample_set[n_samples];
4750
+    double mean = 0.0, sigma = 0.0, min = 99999.9, max = -99999.9, sample_set[n_samples];
4751
+
4751
     for (uint8_t n = 0; n < n_samples; n++) {
4752
     for (uint8_t n = 0; n < n_samples; n++) {
4752
       if (n_legs) {
4753
       if (n_legs) {
4753
         int dir = (random(0, 10) > 5.0) ? -1 : 1;  // clockwise or counter clockwise
4754
         int dir = (random(0, 10) > 5.0) ? -1 : 1;  // clockwise or counter clockwise
4817
       } // n_legs
4818
       } // n_legs
4818
 
4819
 
4819
       // Probe a single point
4820
       // Probe a single point
4820
-      sample_set[n] = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, verbose_level);
4821
+      sample_set[n] = probe_pt(X_probe_location, Y_probe_location, stow_probe_after_each, 0);
4821
 
4822
 
4822
       /**
4823
       /**
4823
        * Get the current mean for the data points we have so far
4824
        * Get the current mean for the data points we have so far
4826
       for (uint8_t j = 0; j <= n; j++) sum += sample_set[j];
4827
       for (uint8_t j = 0; j <= n; j++) sum += sample_set[j];
4827
       mean = sum / (n + 1);
4828
       mean = sum / (n + 1);
4828
 
4829
 
4830
+      if(sample_set[n] < min) min = sample_set[n];
4831
+      if(sample_set[n] > max) max = sample_set[n];
4832
+
4829
       /**
4833
       /**
4830
        * Now, use that mean to calculate the standard deviation for the
4834
        * Now, use that mean to calculate the standard deviation for the
4831
        * data points we have so far
4835
        * data points we have so far
4840
           SERIAL_PROTOCOL(n + 1);
4844
           SERIAL_PROTOCOL(n + 1);
4841
           SERIAL_PROTOCOLPGM(" of ");
4845
           SERIAL_PROTOCOLPGM(" of ");
4842
           SERIAL_PROTOCOL((int)n_samples);
4846
           SERIAL_PROTOCOL((int)n_samples);
4843
-          SERIAL_PROTOCOLPGM("   z: ");
4844
-          SERIAL_PROTOCOL_F(current_position[Z_AXIS], 6);
4847
+          SERIAL_PROTOCOLPGM(": z: ");
4848
+          SERIAL_PROTOCOL_F(sample_set[n], 3);
4845
           if (verbose_level > 2) {
4849
           if (verbose_level > 2) {
4846
             SERIAL_PROTOCOLPGM(" mean: ");
4850
             SERIAL_PROTOCOLPGM(" mean: ");
4847
-            SERIAL_PROTOCOL_F(mean, 6);
4848
-            SERIAL_PROTOCOLPGM("   sigma: ");
4851
+            SERIAL_PROTOCOL_F(mean, 4);
4852
+            SERIAL_PROTOCOLPGM(" sigma: ");
4849
             SERIAL_PROTOCOL_F(sigma, 6);
4853
             SERIAL_PROTOCOL_F(sigma, 6);
4854
+            SERIAL_PROTOCOLPGM(" min: ");
4855
+            SERIAL_PROTOCOL_F(min, 3);
4856
+            SERIAL_PROTOCOLPGM(" max: ");
4857
+            SERIAL_PROTOCOL_F(max, 3);
4858
+            SERIAL_PROTOCOLPGM(" range: ");
4859
+            SERIAL_PROTOCOL_F(max-min, 3);
4850
           }
4860
           }
4851
         }
4861
         }
4852
         SERIAL_EOL;
4862
         SERIAL_EOL;
4856
 
4866
 
4857
     if (STOW_PROBE()) return;
4867
     if (STOW_PROBE()) return;
4858
 
4868
 
4869
+    SERIAL_PROTOCOLPGM("Finished!");
4870
+    SERIAL_EOL;
4871
+
4859
     if (verbose_level > 0) {
4872
     if (verbose_level > 0) {
4860
       SERIAL_PROTOCOLPGM("Mean: ");
4873
       SERIAL_PROTOCOLPGM("Mean: ");
4861
       SERIAL_PROTOCOL_F(mean, 6);
4874
       SERIAL_PROTOCOL_F(mean, 6);
4875
+      SERIAL_PROTOCOLPGM(" Min: ");
4876
+      SERIAL_PROTOCOL_F(min, 3);
4877
+      SERIAL_PROTOCOLPGM(" Max: ");
4878
+      SERIAL_PROTOCOL_F(max, 3);
4879
+      SERIAL_PROTOCOLPGM(" Range: ");
4880
+      SERIAL_PROTOCOL_F(max-min, 3);
4862
       SERIAL_EOL;
4881
       SERIAL_EOL;
4863
     }
4882
     }
4864
 
4883
 
4865
     SERIAL_PROTOCOLPGM("Standard Deviation: ");
4884
     SERIAL_PROTOCOLPGM("Standard Deviation: ");
4866
     SERIAL_PROTOCOL_F(sigma, 6);
4885
     SERIAL_PROTOCOL_F(sigma, 6);
4867
-    SERIAL_EOL; SERIAL_EOL;
4886
+    SERIAL_EOL;
4887
+
4888
+    SERIAL_EOL;
4868
 
4889
 
4869
     clean_up_after_endstop_or_probe_move();
4890
     clean_up_after_endstop_or_probe_move();
4870
 
4891
 

Carregando…
Cancelar
Salvar