Exemplo n.º 1
0
      float Bed_level::bed_level_virt_coord(const uint8_t x, const uint8_t y) {
        uint8_t ep = 0, ip = 1;

        if (!x || x == ABL_TEMP_POINTS_X - 1) {
          if (x) {
            ep = GRID_MAX_POINTS_X - 1;
            ip = GRID_MAX_POINTS_X - 2;
          }
          if (WITHIN(y, 1, ABL_TEMP_POINTS_Y - 2))
            return LINEAR_EXTRAPOLATION(z_values[ep][y - 1], z_values[ip][y - 1]);
          else
            return LINEAR_EXTRAPOLATION(bed_level_virt_coord(ep + 1, y), bed_level_virt_coord(ip + 1, y));
        }
        if (!y || y == ABL_TEMP_POINTS_Y - 1) {
          if (y) {
            ep = GRID_MAX_POINTS_Y - 1;
            ip = GRID_MAX_POINTS_Y - 2;
          }
          if (WITHIN(x, 1, ABL_TEMP_POINTS_X - 2))
            return LINEAR_EXTRAPOLATION(z_values[x - 1][ep], z_values[x - 1][ip]);
          else
            return LINEAR_EXTRAPOLATION(bed_level_virt_coord(x, ep + 1), bed_level_virt_coord(x, ip + 1));
        }
        return z_values[x - 1][y - 1];
      }
Exemplo n.º 2
0
 static float bed_level_virt_2cmr(const uint8_t x, const uint8_t y, const float &tx, const float &ty) {
   float row[4], column[4];
   for (uint8_t i = 0; i < 4; i++) {
     for (uint8_t j = 0; j < 4; j++) {
       column[j] = bed_level_virt_coord(i + x - 1, j + y - 1);
     }
     row[i] = bed_level_virt_cmr(column, 1, ty);
   }
   return bed_level_virt_cmr(row, 1, tx);
 }