Пример #1
0
 void print_xyz(PGM_P const prefix, PGM_P const suffix, const float x, const float y, const float z) {
   serialprintPGM(prefix);
   SERIAL_CHAR('(');
   SERIAL_ECHO(x);
   SERIAL_ECHOPAIR(", ", y);
   SERIAL_ECHOPAIR(", ", z);
   SERIAL_CHAR(')');
   if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
 }
Пример #2
0
  /**
   * M80   : Turn on the Power Supply
   * M80 S : Report the current state and exit
   */
  void GcodeSuite::M80() {

    // S: Report the current power supply state and exit
    if (parser.seen('S')) {
      serialprintPGM(powersupply_on ? PSTR("PS:1\n") : PSTR("PS:0\n"));
      return;
    }

    PSU_ON();

    /**
     * If you have a switch on suicide pin, this is useful
     * if you want to start another print with suicide feature after
     * a print without suicide...
     */
    #if HAS_SUICIDE
      OUT_WRITE(SUICIDE_PIN, HIGH);
    #endif

    #if DISABLED(AUTO_POWER_CONTROL)
      delay(100); // Wait for power to settle
      restore_stepper_drivers();
    #endif

    #if HAS_LCD_MENU
      ui.reset_status();
    #endif
  }
Пример #3
0
 void PrintCounter::debug(const char func[]) {
   if (DEBUGGING(INFO)) {
     SERIAL_ECHOPGM("PrintCounter::");
     serialprintPGM(func);
     SERIAL_ECHOLNPGM("()");
   }
 }
Пример #4
0
 void Stopwatch::debug(const char func[]) {
   if (DEBUGGING(INFO)) {
     SERIAL_ECHOPGM("Stopwatch::");
     serialprintPGM(func);
     SERIAL_ECHOLNPGM("()");
   }
 }
Пример #5
0
    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();
    }
Пример #6
0
  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
Пример #7
0
void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) : PSTR(MSG_OFF)); }
Пример #8
0
void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
Пример #9
0
void serial_echopair_PGM(PGM_P const s_P, double v)        { serialprintPGM(s_P); SERIAL_ECHO(v); }
Пример #10
0
void serial_echopair_PGM(PGM_P const s_P, char v)          { serialprintPGM(s_P); SERIAL_CHAR(v); }
Пример #11
0
void serial_echopair_PGM(PGM_P const s_P, const char *v)   { serialprintPGM(s_P); SERIAL_ECHO(v); }
Пример #12
0
void serial_error_start() { serialprintPGM(errormagic); }
Пример #13
0
void serial_echo_start()  { serialprintPGM(echomagic); }
Пример #14
0
  void unified_bed_leveling::display_map(const int map_type) {
    constexpr uint8_t spaces = 8 * (GRID_MAX_POINTS_X - 2);

    SERIAL_PROTOCOLPGM("\nBed Topography Report");
    if (map_type == 0) {
      SERIAL_PROTOCOLPGM(":\n\n");
      serial_echo_xy(0, GRID_MAX_POINTS_Y - 1);
      SERIAL_ECHO_SP(spaces + 3);
      serial_echo_xy(GRID_MAX_POINTS_X - 1, GRID_MAX_POINTS_Y - 1);
      SERIAL_EOL();
      serial_echo_xy(MESH_MIN_X, MESH_MAX_Y);
      SERIAL_ECHO_SP(spaces);
      serial_echo_xy(MESH_MAX_X, MESH_MAX_Y);
      SERIAL_EOL();
    }
    else {
      SERIAL_PROTOCOLPGM(" for ");
      serialprintPGM(map_type == 1 ? PSTR("CSV:\n\n") : PSTR("LCD:\n\n"));
    }

    const float current_xi = get_cell_index_x(current_position[X_AXIS] + (MESH_X_DIST) / 2.0),
                current_yi = get_cell_index_y(current_position[Y_AXIS] + (MESH_Y_DIST) / 2.0);

    for (int8_t j = GRID_MAX_POINTS_Y - 1; j >= 0; j--) {
      for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
        const bool is_current = i == current_xi && j == current_yi;

        // is the nozzle here? then mark the number
        if (map_type == 0) SERIAL_CHAR(is_current ? '[' : ' ');

        const float f = z_values[i][j];
        if (isnan(f)) {
          serialprintPGM(map_type == 0 ? PSTR("    .   ") : PSTR("NAN"));
        }
        else if (map_type <= 1) {
          // if we don't do this, the columns won't line up nicely
          if (map_type == 0 && f >= 0.0) SERIAL_CHAR(' ');
          SERIAL_PROTOCOL_F(f, 3);
        }
        idle();
        if (map_type == 1 && i < GRID_MAX_POINTS_X - 1) SERIAL_CHAR(',');

        #if TX_BUFFER_SIZE > 0
          MYSERIAL.flushTX();
        #endif
        safe_delay(15);
        if (map_type == 0) {
          SERIAL_CHAR(is_current ? ']' : ' ');
          SERIAL_CHAR(' ');
        }
      }
      SERIAL_EOL();
      if (j && map_type == 0) { // we want the (0,0) up tight against the block of numbers
        SERIAL_CHAR(' ');
        SERIAL_EOL();
      }
    }

    if (map_type == 0) {
      serial_echo_xy(MESH_MIN_X, MESH_MIN_Y);
      SERIAL_ECHO_SP(spaces + 4);
      serial_echo_xy(MESH_MAX_X, MESH_MIN_Y);
      SERIAL_EOL();
      serial_echo_xy(0, 0);
      SERIAL_ECHO_SP(spaces + 5);
      serial_echo_xy(GRID_MAX_POINTS_X - 1, 0);
      SERIAL_EOL();
    }
  }
Пример #15
0
void tmc_say_stealth_status(TMC &st) {
  st.printLabel();
  SERIAL_ECHOPGM(" driver mode:\t");
  serialprintPGM(st.get_stealthChop_status() ? PSTR("stealthChop") : PSTR("spreadCycle"));
  SERIAL_EOL();
}
Пример #16
0
  /**
   * Produce one of these mesh maps:
   *   0: Human-readable
   *   1: CSV format for spreadsheet import
   *   2: TODO: Display on Graphical LCD
   *   4: Compact Human-Readable
   */
  void unified_bed_leveling::display_map(const int map_type) {
    #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
      suspend_auto_report = true;
    #endif

    constexpr uint8_t eachsp = 1 + 6 + 1,                           // [-3.567]
                      twixt = eachsp * (GRID_MAX_POINTS_X) - 9 * 2; // Leading 4sp, Coordinates 9sp each

    const bool human = !(map_type & 0x3), csv = map_type == 1, lcd = map_type == 2, comp = map_type & 0x4;

    SERIAL_ECHOPGM("\nBed Topography Report");
    if (human) {
      SERIAL_ECHOLNPGM(":\n");
      serial_echo_xy(4, MESH_MIN_X, MESH_MAX_Y);
      serial_echo_xy(twixt, MESH_MAX_X, MESH_MAX_Y);
      SERIAL_EOL();
      serial_echo_column_labels(eachsp - 2);
    }
    else {
      SERIAL_ECHOPGM(" for ");
      serialprintPGM(csv ? PSTR("CSV:\n") : PSTR("LCD:\n"));
    }

    const float current_xi = get_cell_index_x(current_position[X_AXIS] + (MESH_X_DIST) / 2.0),
                current_yi = get_cell_index_y(current_position[Y_AXIS] + (MESH_Y_DIST) / 2.0);

    if (!lcd) SERIAL_EOL();
    for (int8_t j = GRID_MAX_POINTS_Y - 1; j >= 0; j--) {

      // Row Label (J index)
      if (human) {
        if (j < 10) SERIAL_CHAR(' ');
        SERIAL_ECHO(j);
        SERIAL_ECHOPGM(" |");
      }

      // Row Values (I indexes)
      for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {

        // Opening Brace or Space
        const bool is_current = i == current_xi && j == current_yi;
        if (human) SERIAL_CHAR(is_current ? '[' : ' ');

        // Z Value at current I, J
        const float f = z_values[i][j];
        if (lcd) {
          // TODO: Display on Graphical LCD
        }
        else if (isnan(f))
          serialprintPGM(human ? PSTR("  .   ") : PSTR("NAN"));
        else if (human || csv) {
          if (human && f >= 0.0) SERIAL_CHAR(f > 0 ? '+' : ' ');  // Space for positive ('-' for negative)
          SERIAL_ECHO_F(f, 3);                                    // Positive: 5 digits, Negative: 6 digits
        }
        if (csv && i < GRID_MAX_POINTS_X - 1) SERIAL_CHAR('\t');

        // Closing Brace or Space
        if (human) SERIAL_CHAR(is_current ? ']' : ' ');

        SERIAL_FLUSHTX();
        idle();
      }
      if (!lcd) SERIAL_EOL();

      // A blank line between rows (unless compact)
      if (j && human && !comp) SERIAL_ECHOLNPGM("   |");
    }

    if (human) {
      serial_echo_column_labels(eachsp - 2);
      SERIAL_EOL();
      serial_echo_xy(4, MESH_MIN_X, MESH_MIN_Y);
      serial_echo_xy(twixt, MESH_MAX_X, MESH_MIN_Y);
      SERIAL_EOL();
      SERIAL_EOL();
    }

    #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
      suspend_auto_report = false;
    #endif
  }