当前位置: 首页>>代码示例>>C++>>正文


C++ SERIAL_ECHOPGM函数代码示例

本文整理汇总了C++中SERIAL_ECHOPGM函数的典型用法代码示例。如果您正苦于以下问题:C++ SERIAL_ECHOPGM函数的具体用法?C++ SERIAL_ECHOPGM怎么用?C++ SERIAL_ECHOPGM使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SERIAL_ECHOPGM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: check_for_free_memory_corruption

int check_for_free_memory_corruption(const char * const title) {
  SERIAL_ECHO(title);

  char *ptr = END_OF_HEAP(), *sp = top_of_stack();
  int n = sp - ptr;

  SERIAL_ECHOPAIR("\nfmc() n=", n);
  SERIAL_ECHOPAIR("\n&__brkval: ", hex_address(&__brkval));
  SERIAL_ECHOPAIR("=",             hex_address(__brkval));
  SERIAL_ECHOPAIR("\n__bss_end: ", hex_address(&__bss_end));
  SERIAL_ECHOPAIR(" sp=",          hex_address(sp));

  if (sp < ptr)  {
    SERIAL_ECHOPGM(" sp < Heap ");
    // SET_INPUT_PULLUP(63);           // if the developer has a switch wired up to their controller board
    // safe_delay(5);                  // this code can be enabled to pause the display as soon as the
    // while ( READ(63))               // malfunction is detected.   It is currently defaulting to a switch
    //   idle();                       // being on pin-63 which is unassigend and available on most controller
    // safe_delay(20);                 // boards.
    // while ( !READ(63))
    //   idle();
    safe_delay(20);
    #ifdef M100_FREE_MEMORY_DUMPER
      M100_dump_routine("   Memory corruption detected with sp<Heap\n", (char*)0x1B80, (char*)0x21FF);
    #endif
  }

  // Scan through the range looking for the biggest block of 0xE5's we can find
  int block_cnt = 0;
  for (int i = 0; i < n; i++) {
    if (ptr[i] == TEST_BYTE) {
      int16_t j = count_test_bytes(ptr + i);
      if (j > 8) {
        // SERIAL_ECHOPAIR("Found ", j);
        // SERIAL_ECHOLNPAIR(" bytes free at ", hex_address(ptr + i));
        i += j;
        block_cnt++;
        SERIAL_ECHOPAIR(" (", block_cnt);
        SERIAL_ECHOPAIR(") found=", j);
        SERIAL_ECHOPGM("   ");
      }
    }
  }
  SERIAL_ECHOPAIR("  block_found=", block_cnt);

  if (block_cnt != 1 || __brkval != 0x0000)
    SERIAL_ECHOLNPGM("\nMemory Corruption detected in free memory area.");

  if (block_cnt == 0)       // Make sure the special case of no free blocks shows up as an
    block_cnt = -1;         // error to the calling code!

  SERIAL_ECHOPGM(" return=");
  if (block_cnt == 1) {
    SERIAL_CHAR('0');       // if the block_cnt is 1, nothing has broken up the free memory
    SERIAL_EOL();             // area and it is appropriate to say 'no corruption'.
    return 0;
  }
  SERIAL_ECHOLNPGM("true");
  return block_cnt;
}
开发者ID:AJMartel,项目名称:3DPrinter,代码行数:60,代码来源:M100_Free_Mem_Chk.cpp

示例2: debug_current_and_destination

    void debug_current_and_destination(PGM_P title) {

      // if the title message starts with a '!' it is so important, we are going to
      // ignore the status of the g26_debug_flag
      if (*title != '!' && !g26_debug_flag) return;

      const float de = destination[E_AXIS] - current_position[E_AXIS];

      if (de == 0.0) return; // Printing moves only

      const float dx = destination[X_AXIS] - current_position[X_AXIS],
                  dy = destination[Y_AXIS] - current_position[Y_AXIS],
                  xy_dist = HYPOT(dx, dy);

      if (xy_dist == 0.0) return;

      const float fpmm = de / xy_dist;
      SERIAL_ECHOPAIR_F("   fpmm=", fpmm, 6);
      SERIAL_ECHOPAIR_F("    current=( ", current_position[X_AXIS], 6);
      SERIAL_ECHOPAIR_F(", ", current_position[Y_AXIS], 6);
      SERIAL_ECHOPAIR_F(", ", current_position[Z_AXIS], 6);
      SERIAL_ECHOPAIR_F(", ", current_position[E_AXIS], 6);
      SERIAL_ECHOPGM(" )   destination=( "); debug_echo_axis(X_AXIS);
      SERIAL_ECHOPGM(", "); debug_echo_axis(Y_AXIS);
      SERIAL_ECHOPGM(", "); debug_echo_axis(Z_AXIS);
      SERIAL_ECHOPGM(", "); debug_echo_axis(E_AXIS);
      SERIAL_ECHOPGM(" )   ");
      serialprintPGM(title);
      SERIAL_EOL();
    }
开发者ID:teemuatlut,项目名称:Marlin,代码行数:30,代码来源:ubl.cpp

示例3: serialprintPGM

  void PrintJobRecovery::debug(PGM_P const prefix) {
    serialprintPGM(prefix);
    SERIAL_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot));
    if (info.valid_head) {
      if (info.valid_head == info.valid_foot) {
        SERIAL_ECHOPGM("current_position: ");
        LOOP_XYZE(i) {
          SERIAL_ECHO(info.current_position[i]);
          if (i < E_AXIS) SERIAL_CHAR(',');
        }
        SERIAL_EOL();
        SERIAL_ECHOLNPAIR("feedrate: ", info.feedrate);

        #if HOTENDS > 1
          SERIAL_ECHOLNPAIR("active_hotend: ", int(info.active_hotend));
        #endif

        SERIAL_ECHOPGM("target_temperature: ");
        HOTEND_LOOP() {
          SERIAL_ECHO(info.target_temperature[e]);
          if (e < HOTENDS - 1) SERIAL_CHAR(',');
        }
        SERIAL_EOL();

        #if HAS_HEATED_BED
          SERIAL_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed);
        #endif

        #if FAN_COUNT
          SERIAL_ECHOPGM("fan_speed: ");
          FANS_LOOP(i) {
            SERIAL_ECHO(int(info.fan_speed[i]));
            if (i < FAN_COUNT - 1) SERIAL_CHAR(',');
          }
          SERIAL_EOL();
        #endif

        #if HAS_LEVELING
          SERIAL_ECHOLNPAIR("leveling: ", int(info.leveling), "\n fade: ", int(info.fade));
        #endif
        #if ENABLED(FWRETRACT)
          SERIAL_ECHOPGM("retract: ");
          for (int8_t e = 0; e < EXTRUDERS; e++) {
            SERIAL_ECHO(info.retract[e]);
            if (e < EXTRUDERS - 1) SERIAL_CHAR(',');
          }
          SERIAL_EOL();
          SERIAL_ECHOLNPAIR("retract_hop: ", info.retract_hop);
        #endif
        SERIAL_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r));
        SERIAL_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue));
        for (uint8_t i = 0; i < info.commands_in_queue; i++) SERIAL_ECHOLNPAIR("> ", info.command_queue[i]);
        SERIAL_ECHOLNPAIR("sd_filename: ", info.sd_filename);
        SERIAL_ECHOLNPAIR("sdpos: ", info.sdpos);
        SERIAL_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed);
      }
      else
开发者ID:szymonrychu,项目名称:Marlin,代码行数:57,代码来源:power_loss_recovery.cpp

示例4: SERIAL_ECHOLNPGM

/**
 * M900: Get or Set Linear Advance K-factor
 *
 *  K<factor>   Set advance K factor
 */
void GcodeSuite::M900() {

  #if EXTRUDERS < 2
    constexpr uint8_t tmp_extruder = 0;
  #else
    const uint8_t tmp_extruder = parser.seenval('T') ? parser.value_int() : active_extruder;
    if (tmp_extruder >= EXTRUDERS) {
      SERIAL_ECHOLNPGM("?T value out of range.");
      return;
    }
  #endif

  if (parser.seenval('K')) {
    const float newK = parser.floatval('K');
    if (WITHIN(newK, 0, 10)) {
      planner.synchronize();
      planner.extruder_advance_K[tmp_extruder] = newK;
    }
    else
      SERIAL_ECHOLNPGM("?K value out of range (0-10).");
  }
  else {
    SERIAL_ECHO_START();
    #if EXTRUDERS < 2
      SERIAL_ECHOLNPAIR("Advance K=", planner.extruder_advance_K[0]);
    #else
      SERIAL_ECHOPGM("Advance K");
      LOOP_L_N(i, EXTRUDERS) {
        SERIAL_CHAR(' '); SERIAL_ECHO(int(i));
        SERIAL_CHAR('='); SERIAL_ECHO(planner.extruder_advance_K[i]);
      }
      SERIAL_EOL();
    #endif
  }
开发者ID:teemuatlut,项目名称:Marlin,代码行数:39,代码来源:M900.cpp

示例5: SERIAL_ECHOPGM

 void PrintCounter::debug(const char func[]) {
   if (DEBUGGING(INFO)) {
     SERIAL_ECHOPGM("PrintCounter::");
     serialprintPGM(func);
     SERIAL_ECHOLNPGM("()");
   }
 }
开发者ID:ClumsyApe,项目名称:Marlin,代码行数:7,代码来源:printcounter.cpp

示例6: SERIAL_ECHOPGM

void CardReader::chdir(const char* relpath)
{
	SdFile newfile;
	SdFile* parent=&root;

	if(workDir.isOpen())
	{ parent=&workDir; }

	if(!newfile.open(*parent,relpath, O_READ))
	{
		SERIAL_ECHO_START;
		SERIAL_ECHOPGM(MSG_SD_CANT_ENTER_SUBDIR);
		SERIAL_ECHOLN(relpath);
	}
	else
	{
		if(workDirDepth < MAX_DIR_DEPTH)
		{
			for(int d = ++workDirDepth; d--;)
			{ workDirParents[d+1] = workDirParents[d]; }
			workDirParents[0]=*parent;
		}
		workDir=newfile;
	}
}
开发者ID:CCHS-Melbourne,项目名称:LaserCutter,代码行数:25,代码来源:cardreader.cpp

示例7: SERIAL_ECHOPGM

 void Stopwatch::debug(const char func[]) {
   if (DEBUGGING(INFO)) {
     SERIAL_ECHOPGM("Stopwatch::");
     serialprintPGM(func);
     SERIAL_ECHOLNPGM("()");
   }
 }
开发者ID:StephS,项目名称:Marlin_Gladiola,代码行数:7,代码来源:stopwatch.cpp

示例8: checkHitEndstops

void checkHitEndstops()
{
 if( endstop_x_hit || endstop_y_hit || endstop_z_hit) {
   SERIAL_ECHO_START;
   SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
   if(endstop_x_hit) {
     SERIAL_ECHOPAIR(" X:",(float)endstops_trigsteps[X_AXIS]/axis_steps_per_unit[X_AXIS]);
     LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "X");
   }
   if(endstop_y_hit) {
     SERIAL_ECHOPAIR(" Y:",(float)endstops_trigsteps[Y_AXIS]/axis_steps_per_unit[Y_AXIS]);
     LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Y");
   }
   if(endstop_z_hit) {
     SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/axis_steps_per_unit[Z_AXIS]);
     LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
   }
   SERIAL_ECHOLN("");
   endstop_x_hit=false;
   endstop_y_hit=false;
   endstop_z_hit=false;
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
   if (abort_on_endstop_hit)
   {
     card.sdprinting = false;
     card.closefile();
     quickStop();
     setTargetHotend0(0);
     setTargetHotend1(0);
     setTargetHotend2(0);
   }
#endif
 }
}
开发者ID:AllenMcAfee,项目名称:Ultimaker2Marlin,代码行数:34,代码来源:stepper.cpp

示例9: checkHitEndstops

void checkHitEndstops()
{
 if( endstop_x_hit || endstop_y_hit || endstop_z_hit || endstop_p_hit || endstop_v_hit) {
   SERIAL_ECHO_START;
   SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
   if(endstop_x_hit) {
     SERIAL_ECHOPAIR(" X:",(float)endstops_trigsteps[X_AXIS]/axis_steps_per_unit[X_AXIS]);
   }
   if(endstop_y_hit) {
     SERIAL_ECHOPAIR(" Y:",(float)endstops_trigsteps[Y_AXIS]/axis_steps_per_unit[Y_AXIS]);
   }
   if(endstop_z_hit) {
     SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/axis_steps_per_unit[Z_AXIS]);
   }
   if(endstop_p_hit) {
     SERIAL_ECHOPAIR(" P:",(float)endstops_trigsteps[P_AXIS]/axis_steps_per_unit[P_AXIS]);
   }
   if(endstop_v_hit) {
     SERIAL_ECHOPAIR(" V:",(float)endstops_trigsteps[V_AXIS]/axis_steps_per_unit[V_AXIS]);
   }

   SERIAL_ECHOLN("");
   endstop_x_hit=false;
   endstop_y_hit=false;
   endstop_z_hit=false;
   endstop_p_hit=false;
   endstop_v_hit=false;
 }
}
开发者ID:stoeckli,项目名称:deltaSpray,代码行数:29,代码来源:stepper.cpp

示例10: MIXER_STEPPER_LOOP

void Mixer::normalize(const uint8_t tool_index) {
  float cmax = 0;
  #ifdef MIXER_NORMALIZER_DEBUG
    float csum = 0;
  #endif
  MIXER_STEPPER_LOOP(i) {
    const float v = collector[i];
    NOLESS(cmax, v);
    #ifdef MIXER_NORMALIZER_DEBUG
      csum += v;
    #endif
  }
  #ifdef MIXER_NORMALIZER_DEBUG
    SERIAL_ECHOPGM("Mixer: Old relation : [ ");
    MIXER_STEPPER_LOOP(i) {
      SERIAL_ECHO_F(collector[i] / csum, 3);
      SERIAL_CHAR(' ');
    }
    SERIAL_ECHOLNPGM("]");
  #endif

  // Scale all values so their maximum is COLOR_A_MASK
  const float scale = float(COLOR_A_MASK) / cmax;
  MIXER_STEPPER_LOOP(i) color[tool_index][i] = collector[i] * scale;

  #ifdef MIXER_NORMALIZER_DEBUG
    csum = 0;
    SERIAL_ECHOPGM("Mixer: Normalize to : [ ");
    MIXER_STEPPER_LOOP(i) {
      SERIAL_ECHO(uint16_t(color[tool_index][i]));
      SERIAL_CHAR(' ');
      csum += color[tool_index][i];
    }
    SERIAL_ECHOLNPGM("]");
    SERIAL_ECHOPGM("Mixer: New relation : [ ");
    MIXER_STEPPER_LOOP(i) {
      SERIAL_ECHO_F(uint16_t(color[tool_index][i]) / csum, 3);
      SERIAL_CHAR(' ');
    }
    SERIAL_ECHOLNPGM("]");
  #endif

  #if ENABLED(GRADIENT_MIX)
    refresh_gradient();
  #endif
}
开发者ID:szymonrychu,项目名称:Marlin,代码行数:46,代码来源:mixing.cpp

示例11: strlen

  /**
   * Get a long pretty path based on a DOS 8.3 path
   */
  void CardReader::printLongPath(char *path) {
    lsAction = LS_GetFilename;

    int i, pathLen = strlen(path);

    // SERIAL_ECHOPGM("Full Path: "); SERIAL_ECHOLN(path);

    // Zero out slashes to make segments
    for (i = 0; i < pathLen; i++) if (path[i] == '/') path[i] = '\0';

    SdFile diveDir = root; // start from the root for segment 1
    for (i = 0; i < pathLen;) {

      if (path[i] == '\0') i++; // move past a single nul

      char *segment = &path[i]; // The segment after most slashes

      // If a segment is empty (extra-slash) then exit
      if (!*segment) break;

      // Go to the next segment
      while (path[++i]) { }

      // SERIAL_ECHOPGM("Looking for segment: "); SERIAL_ECHOLN(segment);

      // Find the item, setting the long filename
      diveDir.rewind();
      lsDive("", diveDir, segment);

      // Print /LongNamePart to serial output
      SERIAL_PROTOCOLCHAR('/');
      SERIAL_PROTOCOL(longFilename[0] ? longFilename : "???");

      // If the filename was printed then that's it
      if (!filenameIsDir) break;

      // SERIAL_ECHOPGM("Opening dir: "); SERIAL_ECHOLN(segment);

      // Open the sub-item as the new dive parent
      SdFile dir;
      if (!dir.open(diveDir, segment, O_READ)) {
        SERIAL_EOL;
        SERIAL_ECHO_START;
        SERIAL_ECHOPGM(MSG_SD_CANT_OPEN_SUBDIR);
        SERIAL_ECHO(segment);
        break;
      }

      diveDir.close();
      diveDir = dir;

    } // while i<pathLen

    SERIAL_EOL;
  }
开发者ID:M-Prime,项目名称:M_Prime_One,代码行数:58,代码来源:cardreader.cpp

示例12: automatic_current_control

void automatic_current_control(TMC2130Stepper &st, String axisID) {
  // Check otpw even if we don't use automatic control. Allows for flag inspection.
  const bool is_otpw = st.checkOT();

  // Report if a warning was triggered
  static bool previous_otpw = false;
  if (is_otpw && !previous_otpw) {
    char timestamp[10];
    duration_t elapsed = print_job_timer.duration();
    const bool has_days = (elapsed.value > 60*60*24L);
    (void)elapsed.toDigital(timestamp, has_days);
    SERIAL_ECHO(timestamp);
    SERIAL_ECHOPGM(": ");
    SERIAL_ECHO(axisID);
    SERIAL_ECHOLNPGM(" driver overtemperature warning!");
  }
  previous_otpw = is_otpw;

  #if ENABLED(AUTOMATIC_CURRENT_CONTROL) && CURRENT_STEP > 0
    // Return if user has not enabled current control start with M906 S1.
    if (!auto_current_control) return;

    /**
     * Decrease current if is_otpw is true.
     * Bail out if driver is disabled.
     * Increase current if OTPW has not been triggered yet.
     */
    uint16_t current = st.getCurrent();
    if (is_otpw) {
      st.setCurrent(current - CURRENT_STEP, R_SENSE, HOLD_MULTIPLIER);
      #if ENABLED(REPORT_CURRENT_CHANGE)
        SERIAL_ECHO(axisID);
        SERIAL_ECHOPAIR(" current decreased to ", st.getCurrent());
      #endif
    }

    else if (!st.isEnabled())
      return;

    else if (!is_otpw && !st.getOTPW()) {
      current += CURRENT_STEP;
      if (current <= AUTO_ADJUST_MAX) {
        st.setCurrent(current, R_SENSE, HOLD_MULTIPLIER);
        #if ENABLED(REPORT_CURRENT_CHANGE)
          SERIAL_ECHO(axisID);
          SERIAL_ECHOPAIR(" current increased to ", st.getCurrent());
        #endif
      }
    }
    SERIAL_EOL();
  #endif
}
开发者ID:aon3d,项目名称:Marlin,代码行数:52,代码来源:tmc2130.cpp

示例13: ENABLED

void Endstops::report_state() {
  if (endstop_hit_bits) {
    #if ENABLED(ULTRA_LCD)
      char chrX = ' ', chrY = ' ', chrZ = ' ', chrP = ' ';
      #define _SET_STOP_CHAR(A,C) (chr## A = C)
    #else
      #define _SET_STOP_CHAR(A,C) ;
    #endif

    #define _ENDSTOP_HIT_ECHO(A,C) do{ \
      SERIAL_ECHOPAIR(" " STRINGIFY(A) ":", stepper.triggered_position_mm(A ##_AXIS)); \
      _SET_STOP_CHAR(A,C); }while(0)

    #define _ENDSTOP_HIT_TEST(A,C) \
      if (TEST(endstop_hit_bits, A ##_MIN) || TEST(endstop_hit_bits, A ##_MAX)) \
        _ENDSTOP_HIT_ECHO(A,C)

    SERIAL_ECHO_START;
    SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
    _ENDSTOP_HIT_TEST(X, 'X');
    _ENDSTOP_HIT_TEST(Y, 'Y');
    _ENDSTOP_HIT_TEST(Z, 'Z');

    #if ENABLED(Z_MIN_PROBE_ENDSTOP)
      #define P_AXIS Z_AXIS
      if (TEST(endstop_hit_bits, Z_MIN_PROBE)) _ENDSTOP_HIT_ECHO(P, 'P');
    #endif
    SERIAL_EOL;

    #if ENABLED(ULTRA_LCD)
      char msg[3 * strlen(MSG_LCD_ENDSTOPS) + 8 + 1]; // Room for a UTF 8 string
      sprintf_P(msg, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP);
      lcd_setstatus(msg);
    #endif

    hit_on_purpose();

    #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED) && ENABLED(SDSUPPORT)
      if (stepper.abort_on_endstop_hit) {
        card.sdprinting = false;
        card.closefile();
        quickstop_stepper();
        thermalManager.disable_all_heaters(); // switch off all heaters.
      }
    #endif
  }
} // Endstops::report_state
开发者ID:zborschuk,项目名称:3D-Print-Projects,代码行数:47,代码来源:endstops.cpp

示例14: SERIAL_ECHOPGM

void CardReader::chdir(const char * relpath) {
  SdFile newfile;
  SdFile *parent = &root;

  if (workDir.isOpen()) parent = &workDir;

  if (!newfile.open(*parent, relpath, O_READ)) {
    SERIAL_ECHO_START;
    SERIAL_ECHOPGM(MSG_SD_CANT_ENTER_SUBDIR);
    SERIAL_ECHOLN(relpath);
  }
  else {
    if (workDirDepth < MAX_DIR_DEPTH)
      workDirParents[workDirDepth++] = *parent;
    workDir = newfile;
  }
}
开发者ID:M-Prime,项目名称:M_Prime_One,代码行数:17,代码来源:cardreader.cpp

示例15: extrapolate_one_point

/**
 * Extrapolate a single point from its neighbors
 */
static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
  #if ENABLED(DEBUG_LEVELING_FEATURE)
    if (DEBUGGING(LEVELING)) {
      SERIAL_ECHOPGM("Extrapolate [");
      if (x < 10) SERIAL_CHAR(' ');
      SERIAL_ECHO((int)x);
      SERIAL_CHAR(xdir ? (xdir > 0 ? '+' : '-') : ' ');
      SERIAL_CHAR(' ');
      if (y < 10) SERIAL_CHAR(' ');
      SERIAL_ECHO((int)y);
      SERIAL_CHAR(ydir ? (ydir > 0 ? '+' : '-') : ' ');
      SERIAL_CHAR(']');
    }
  #endif
  if (!isnan(z_values[x][y])) {
    #if ENABLED(DEBUG_LEVELING_FEATURE)
      if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM(" (done)");
    #endif
    return;  // Don't overwrite good values.
  }
  SERIAL_EOL();

  // Get X neighbors, Y neighbors, and XY neighbors
  const uint8_t x1 = x + xdir, y1 = y + ydir, x2 = x1 + xdir, y2 = y1 + ydir;
  float a1 = z_values[x1][y ], a2 = z_values[x2][y ],
        b1 = z_values[x ][y1], b2 = z_values[x ][y2],
        c1 = z_values[x1][y1], c2 = z_values[x2][y2];

  // Treat far unprobed points as zero, near as equal to far
  if (isnan(a2)) a2 = 0.0;
  if (isnan(a1)) a1 = a2;
  if (isnan(b2)) b2 = 0.0;
  if (isnan(b1)) b1 = b2;
  if (isnan(c2)) c2 = 0.0;
  if (isnan(c1)) c1 = c2;

  const float a = 2 * a1 - a2, b = 2 * b1 - b2, c = 2 * c1 - c2;

  // Take the average instead of the median
  z_values[x][y] = (a + b + c) / 3.0;

  // Median is robust (ignores outliers).
  // z_values[x][y] = (a < b) ? ((b < c) ? b : (c < a) ? a : c)
  //                                : ((c < b) ? b : (a < c) ? a : c);
}
开发者ID:teemuatlut,项目名称:Marlin,代码行数:48,代码来源:abl.cpp


注:本文中的SERIAL_ECHOPGM函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。