Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Marlin/src/HAL/HAL_AVR/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,7 @@ inline void HAL_adc_init(void) {

#define HAL_SENSITIVE_PINS 0, 1

// AVR compatibility
#define strtof strtod

#endif // _HAL_AVR_H_
12 changes: 6 additions & 6 deletions Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ char TMC26XStepper::stop(void) {
void TMC26XStepper::setCurrent(unsigned int current) {
unsigned char current_scaling = 0;
//calculate the current scaling from the max current setting (in mA)
double mASetting = (double)current,
resistor_value = (double)this->resistor;
float mASetting = (float)current,
resistor_value = (float)this->resistor;
// remove vsense flag
this->driver_configuration_register_value &= ~(VSENSE);
// Derived from I = (cs + 1) / 32 * (Vsense / Rsense)
Expand Down Expand Up @@ -340,8 +340,8 @@ void TMC26XStepper::setCurrent(unsigned int current) {
unsigned int TMC26XStepper::getCurrent(void) {
// Calculate the current according to the datasheet to be on the safe side.
// This is not the fastest but the most accurate and illustrative way.
double result = (double)(stall_guard2_current_register_value & CURRENT_SCALING_PATTERN),
resistor_value = (double)this->resistor,
float result = (float)(stall_guard2_current_register_value & CURRENT_SCALING_PATTERN),
resistor_value = (float)this->resistor,
voltage = (driver_configuration_register_value & VSENSE) ? 0.165 : 0.31;
result = (result + 1.0) / 32.0 * voltage / resistor_value * sq(1000.0);
return (unsigned int)result;
Expand Down Expand Up @@ -739,8 +739,8 @@ unsigned char TMC26XStepper::getCurrentCSReading(void) {
}

unsigned int TMC26XStepper::getCurrentCurrent(void) {
double result = (double)getCurrentCSReading(),
resistor_value = (double)this->resistor,
float result = (float)getCurrentCSReading(),
resistor_value = (float)this->resistor,
voltage = (driver_configuration_register_value & VSENSE)? 0.165 : 0.31;
result = (result + 1.0) / 32.0 * voltage / resistor_value * sq(1000.0);
return (unsigned int)result;
Expand Down
5 changes: 0 additions & 5 deletions Marlin/src/Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,6 @@ extern volatile bool wait_for_heatup;
extern bool suspend_auto_report;
#endif

#if ENABLED(AUTO_BED_LEVELING_UBL)
typedef struct { double A, B, D; } linear_fit;
linear_fit* lsf_linear_fit(double x[], double y[], double z[], const int);
#endif

// Inactivity shutdown timer
extern millis_t max_inactive_time, stepper_inactive_time;

Expand Down
41 changes: 21 additions & 20 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@
#define CBI32(n,b) (n &= ~_BV32(b))

// Macros for maths shortcuts
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define RADIANS(d) ((d)*M_PI/180.0)
#define DEGREES(r) ((r)*180.0/M_PI)
#undef M_PI
#define M_PI 3.14159265358979323846f

#define RADIANS(d) ((d)*float(M_PI)/180.0f)
Copy link
Member

@thinkyhead thinkyhead Jul 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since M_PI is now defined with f on the end, casting it might be redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically, yes

#define DEGREES(r) ((r)*180.0f/float(M_PI))
#define HYPOT2(x,y) (sq(x)+sq(y))

#define CIRCLE_AREA(R) (M_PI * sq(R))
#define CIRCLE_CIRC(R) (2.0 * M_PI * (R))
#define CIRCLE_AREA(R) (float(M_PI) * sq(float(R)))
#define CIRCLE_CIRC(R) (2 * float(M_PI) * float(R))

#define SIGN(a) ((a>0)-(a<0))
#define IS_POWER_OF_2(x) ((x) && !((x) & ((x) - 1)))
Expand Down Expand Up @@ -200,8 +200,8 @@
#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0)
#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON))

#define MMM_TO_MMS(MM_M) ((MM_M)/60.0)
#define MMS_TO_MMM(MM_S) ((MM_S)*60.0)
#define MMM_TO_MMS(MM_M) ((MM_M)/60.0f)
#define MMS_TO_MMM(MM_S) ((MM_S)*60.0f)

#define NOOP do{} while(0)

Expand Down Expand Up @@ -250,23 +250,24 @@
#define MAX4(a, b, c, d) MAX(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) MAX(MAX4(a, b, c, d), e)

#define UNEAR_ZERO(x) ((x) < 0.000001)
#define NEAR_ZERO(x) WITHIN(x, -0.000001, 0.000001)
#define UNEAR_ZERO(x) ((x) < 0.000001f)
#define NEAR_ZERO(x) WITHIN(x, -0.000001f, 0.000001f)
#define NEAR(x,y) NEAR_ZERO((x)-(y))

#define RECIPROCAL(x) (NEAR_ZERO(x) ? 0.0 : 1.0 / (x))
#define FIXFLOAT(f) (f + (f < 0.0 ? -0.00005 : 0.00005))
#define RECIPROCAL(x) (NEAR_ZERO(x) ? 0 : (1 / float(x)))
#define FIXFLOAT(f) (f + (f < 0 ? -0.00005f : 0.00005f))

//
// Maths macros that can be overridden by HAL
//
#define ATAN2(y, x) atan2(y, x)
#define POW(x, y) pow(x, y)
#define SQRT(x) sqrt(x)
#define CEIL(x) ceil(x)
#define FLOOR(x) floor(x)
#define LROUND(x) lround(x)
#define FMOD(x, y) fmod(x, y)
#define ATAN2(y, x) atan2f(y, x)
#define POW(x, y) powf(x, y)
#define SQRT(x) sqrtf(x)
#define RSQRT(x) (1 / sqrtf(x))
#define CEIL(x) ceilf(x)
#define FLOOR(x) floorf(x)
#define LROUND(x) lroundf(x)
#define FMOD(x, y) fmodf(x, y)
#define HYPOT(x,y) SQRT(HYPOT2(x,y))

#endif //__MACROS_H
4 changes: 2 additions & 2 deletions Marlin/src/core/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ void safe_delay(millis_t ms);
char* ftostr62rj(const float &x);

// Convert float to rj string with 123 or -12 format
FORCE_INLINE char* ftostr3(const float &x) { return itostr3(int(x + (x < 0 ? -0.5 : 0.5))); }
FORCE_INLINE char* ftostr3(const float &x) { return itostr3(int(x + (x < 0 ? -0.5f : 0.5f))); }

#if ENABLED(LCD_DECIMAL_SMALL_XY)
// Convert float to rj string with 1234, _123, 12.3, _1.2, -123, _-12, or -1.2 format
char* ftostr4sign(const float &fx);
#else
// Convert float to rj string with 1234, _123, -123, __12, _-12, ___1, or __-1 format
FORCE_INLINE char* ftostr4sign(const float &x) { return itostr4sign(int(x + (x < 0 ? -0.5 : 0.5))); }
FORCE_INLINE char* ftostr4sign(const float &x) { return itostr4sign(int(x + (x < 0 ? -0.5f : 0.5f))); }
#endif

#endif // ULTRA_LCD
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/I2CPositionEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void I2CPositionEncoder::update() {
if (errPrstIdx >= I2CPE_ERR_PRST_ARRAY_SIZE) {
float sumP = 0;
LOOP_L_N(i, I2CPE_ERR_PRST_ARRAY_SIZE) sumP += errPrst[i];
const int32_t errorP = int32_t(sumP * (1.0 / (I2CPE_ERR_PRST_ARRAY_SIZE)));
const int32_t errorP = int32_t(sumP * (1.0f / (I2CPE_ERR_PRST_ARRAY_SIZE)));
SERIAL_ECHO(axis_codes[encoderAxis]);
SERIAL_ECHOPAIR(" - err detected: ", errorP * planner.steps_to_mm[encoderAxis]);
SERIAL_ECHOLNPGM("mm; correcting!");
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/feature/I2CPositionEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,12 @@ class I2CPositionEncoder {
nextErrorCountTime = 0,
lastErrorTime;

//double positionMm; //calculate

#if ENABLED(I2CPE_ERR_ROLLING_AVERAGE)
uint8_t errIdx = 0, errPrstIdx = 0;
int err[I2CPE_ERR_ARRAY_SIZE] = { 0 },
errPrst[I2CPE_ERR_PRST_ARRAY_SIZE] = { 0 };
#endif

//float positionMm; //calculate

public:
void init(const uint8_t address, const AxisEnum axis);
void reset();
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,22 @@ class mesh_bed_leveling {
}

static int8_t cell_index_x(const float &x) {
int8_t cx = (x - (MESH_MIN_X)) * (1.0 / (MESH_X_DIST));
int8_t cx = (x - (MESH_MIN_X)) * (1.0f / (MESH_X_DIST));
return constrain(cx, 0, (GRID_MAX_POINTS_X) - 2);
}

static int8_t cell_index_y(const float &y) {
int8_t cy = (y - (MESH_MIN_Y)) * (1.0 / (MESH_Y_DIST));
int8_t cy = (y - (MESH_MIN_Y)) * (1.0f / (MESH_Y_DIST));
return constrain(cy, 0, (GRID_MAX_POINTS_Y) - 2);
}

static int8_t probe_index_x(const float &x) {
int8_t px = (x - (MESH_MIN_X) + 0.5 * (MESH_X_DIST)) * (1.0 / (MESH_X_DIST));
int8_t px = (x - (MESH_MIN_X) + 0.5 * (MESH_X_DIST)) * (1.0f / (MESH_X_DIST));
return WITHIN(px, 0, GRID_MAX_POINTS_X - 1) ? px : -1;
}

static int8_t probe_index_y(const float &y) {
int8_t py = (y - (MESH_MIN_Y) + 0.5 * (MESH_Y_DIST)) * (1.0 / (MESH_Y_DIST));
int8_t py = (y - (MESH_MIN_Y) + 0.5 * (MESH_Y_DIST)) * (1.0f / (MESH_Y_DIST));
return WITHIN(py, 0, GRID_MAX_POINTS_Y - 1) ? py : -1;
}

Expand Down
12 changes: 6 additions & 6 deletions Marlin/src/feature/bedlevel/ubl/ubl.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,27 +168,27 @@ class unified_bed_leveling {
FORCE_INLINE static void set_z(const int8_t px, const int8_t py, const float &z) { z_values[px][py] = z; }

static int8_t get_cell_index_x(const float &x) {
const int8_t cx = (x - (MESH_MIN_X)) * (1.0 / (MESH_X_DIST));
const int8_t cx = (x - (MESH_MIN_X)) * (1.0f / (MESH_X_DIST));
return constrain(cx, 0, (GRID_MAX_POINTS_X) - 1); // -1 is appropriate if we want all movement to the X_MAX
} // position. But with this defined this way, it is possible
// to extrapolate off of this point even further out. Probably
// that is OK because something else should be keeping that from
// happening and should not be worried about at this level.
static int8_t get_cell_index_y(const float &y) {
const int8_t cy = (y - (MESH_MIN_Y)) * (1.0 / (MESH_Y_DIST));
const int8_t cy = (y - (MESH_MIN_Y)) * (1.0f / (MESH_Y_DIST));
return constrain(cy, 0, (GRID_MAX_POINTS_Y) - 1); // -1 is appropriate if we want all movement to the Y_MAX
} // position. But with this defined this way, it is possible
// to extrapolate off of this point even further out. Probably
// that is OK because something else should be keeping that from
// happening and should not be worried about at this level.

static int8_t find_closest_x_index(const float &x) {
const int8_t px = (x - (MESH_MIN_X) + (MESH_X_DIST) * 0.5) * (1.0 / (MESH_X_DIST));
const int8_t px = (x - (MESH_MIN_X) + (MESH_X_DIST) * 0.5) * (1.0f / (MESH_X_DIST));
return WITHIN(px, 0, GRID_MAX_POINTS_X - 1) ? px : -1;
}

static int8_t find_closest_y_index(const float &y) {
const int8_t py = (y - (MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) * (1.0 / (MESH_Y_DIST));
const int8_t py = (y - (MESH_MIN_Y) + (MESH_Y_DIST) * 0.5) * (1.0f / (MESH_Y_DIST));
return WITHIN(py, 0, GRID_MAX_POINTS_Y - 1) ? py : -1;
}

Expand Down Expand Up @@ -238,7 +238,7 @@ class unified_bed_leveling {
);
}

const float xratio = (rx0 - mesh_index_to_xpos(x1_i)) * (1.0 / (MESH_X_DIST)),
const float xratio = (rx0 - mesh_index_to_xpos(x1_i)) * (1.0f / (MESH_X_DIST)),
z1 = z_values[x1_i][yi];

return z1 + xratio * (z_values[MIN(x1_i, GRID_MAX_POINTS_X - 2) + 1][yi] - z1); // Don't allow x1_i+1 to be past the end of the array
Expand Down Expand Up @@ -272,7 +272,7 @@ class unified_bed_leveling {
);
}

const float yratio = (ry0 - mesh_index_to_ypos(y1_i)) * (1.0 / (MESH_Y_DIST)),
const float yratio = (ry0 - mesh_index_to_ypos(y1_i)) * (1.0f / (MESH_Y_DIST)),
z1 = z_values[xi][y1_i];

return z1 + yratio * (z_values[xi][MIN(y1_i, GRID_MAX_POINTS_Y - 2) + 1] - z1); // Don't allow y1_i+1 to be past the end of the array
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,8 +874,8 @@

serialprintPGM(parser.seen('B') ? PSTR(MSG_UBL_BC_INSERT) : PSTR(MSG_UBL_BC_INSERT2));

const float z_step = 0.01; // existing behavior: 0.01mm per click, occasionally step
//const float z_step = 1.0 / planner.axis_steps_per_mm[Z_AXIS]; // approx one step each click
const float z_step = 0.01; // existing behavior: 0.01mm per click, occasionally step
//const float z_step = planner.steps_to_mm[Z_AXIS]; // approx one step each click

move_z_with_encoder(z_step);

Expand Down Expand Up @@ -1252,7 +1252,7 @@
// last half of the mesh (when every unprobed mesh point is one index
// from a probed location).

d1 = HYPOT(i - k, j - l) + (1.0 / ((millis() % 47) + 13));
d1 = HYPOT(i - k, j - l) + (1.0f / ((millis() % 47) + 13));

if (d1 < d2) { // found a closer distance from invalid mesh point at (i,j) to defined mesh point at (k,l)
d2 = d1; // found a closer location with
Expand Down
22 changes: 11 additions & 11 deletions Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
FINAL_MOVE:

// The distance is always MESH_X_DIST so multiply by the constant reciprocal.
const float xratio = (end[X_AXIS] - mesh_index_to_xpos(cell_dest_xi)) * (1.0 / (MESH_X_DIST));
const float xratio = (end[X_AXIS] - mesh_index_to_xpos(cell_dest_xi)) * (1.0f / (MESH_X_DIST));

float z1 = z_values[cell_dest_xi ][cell_dest_yi ] + xratio *
(z_values[cell_dest_xi + 1][cell_dest_yi ] - z_values[cell_dest_xi][cell_dest_yi ]),
Expand All @@ -112,7 +112,7 @@
if (cell_dest_xi >= GRID_MAX_POINTS_X - 1) z1 = z2 = 0.0;

// X cell-fraction done. Interpolate the two Z offsets with the Y fraction for the final Z offset.
const float yratio = (end[Y_AXIS] - mesh_index_to_ypos(cell_dest_yi)) * (1.0 / (MESH_Y_DIST)),
const float yratio = (end[Y_AXIS] - mesh_index_to_ypos(cell_dest_yi)) * (1.0f / (MESH_Y_DIST)),
z0 = cell_dest_yi < GRID_MAX_POINTS_Y - 1 ? (z1 + (z2 - z1) * yratio) * planner.fade_scaling_factor_for_z(end[Z_AXIS]) : 0.0;

// Undefined parts of the Mesh in z_values[][] are NAN.
Expand Down Expand Up @@ -440,14 +440,14 @@
#if IS_KINEMATIC
const float seconds = cartesian_xy_mm / feedrate; // seconds to move xy distance at requested rate
uint16_t segments = lroundf(delta_segments_per_second * seconds), // preferred number of segments for distance @ feedrate
seglimit = lroundf(cartesian_xy_mm * (1.0 / (DELTA_SEGMENT_MIN_LENGTH))); // number of segments at minimum segment length
seglimit = lroundf(cartesian_xy_mm * (1.0f / (DELTA_SEGMENT_MIN_LENGTH))); // number of segments at minimum segment length
NOMORE(segments, seglimit); // limit to minimum segment length (fewer segments)
#else
uint16_t segments = lroundf(cartesian_xy_mm * (1.0 / (DELTA_SEGMENT_MIN_LENGTH))); // cartesian fixed segment length
uint16_t segments = lroundf(cartesian_xy_mm * (1.0f / (DELTA_SEGMENT_MIN_LENGTH))); // cartesian fixed segment length
#endif

NOLESS(segments, 1U); // must have at least one segment
const float inv_segments = 1.0 / segments; // divide once, multiply thereafter
const float inv_segments = 1.0f / segments; // divide once, multiply thereafter

#if IS_SCARA // scale the feed rate from mm/s to degrees/s
scara_feed_factor = cartesian_xy_mm * inv_segments * feedrate;
Expand Down Expand Up @@ -500,8 +500,8 @@
// in top of loop and again re-find same adjacent cell and use it, just less efficient
// for mesh inset area.

int8_t cell_xi = (raw[X_AXIS] - (MESH_MIN_X)) * (1.0 / (MESH_X_DIST)),
cell_yi = (raw[Y_AXIS] - (MESH_MIN_Y)) * (1.0 / (MESH_Y_DIST));
int8_t cell_xi = (raw[X_AXIS] - (MESH_MIN_X)) * (1.0f / (MESH_X_DIST)),
cell_yi = (raw[Y_AXIS] - (MESH_MIN_Y)) * (1.0f / (MESH_Y_DIST));

cell_xi = constrain(cell_xi, 0, (GRID_MAX_POINTS_X) - 1);
cell_yi = constrain(cell_yi, 0, (GRID_MAX_POINTS_Y) - 1);
Expand All @@ -522,15 +522,15 @@
float cx = raw[X_AXIS] - x0, // cell-relative x and y
cy = raw[Y_AXIS] - y0;

const float z_xmy0 = (z_x1y0 - z_x0y0) * (1.0 / (MESH_X_DIST)), // z slope per x along y0 (lower left to lower right)
z_xmy1 = (z_x1y1 - z_x0y1) * (1.0 / (MESH_X_DIST)); // z slope per x along y1 (upper left to upper right)
const float z_xmy0 = (z_x1y0 - z_x0y0) * (1.0f / (MESH_X_DIST)), // z slope per x along y0 (lower left to lower right)
z_xmy1 = (z_x1y1 - z_x0y1) * (1.0f / (MESH_X_DIST)); // z slope per x along y1 (upper left to upper right)

float z_cxy0 = z_x0y0 + z_xmy0 * cx; // z height along y0 at cx (changes for each cx in cell)

const float z_cxy1 = z_x0y1 + z_xmy1 * cx, // z height along y1 at cx
z_cxyd = z_cxy1 - z_cxy0; // z height difference along cx from y0 to y1

float z_cxym = z_cxyd * (1.0 / (MESH_Y_DIST)); // z slope per y along cx from y0 to y1 (changes for each cx in cell)
float z_cxym = z_cxyd * (1.0f / (MESH_Y_DIST)); // z slope per y along cx from y0 to y1 (changes for each cx in cell)

// float z_cxcy = z_cxy0 + z_cxym * cy; // interpolated mesh z height along cx at cy (do inside the segment loop)

Expand All @@ -539,7 +539,7 @@
// each change by a constant for fixed segment lengths.

const float z_sxy0 = z_xmy0 * diff[X_AXIS], // per-segment adjustment to z_cxy0
z_sxym = (z_xmy1 - z_xmy0) * (1.0 / (MESH_Y_DIST)) * diff[X_AXIS]; // per-segment adjustment to z_cxym
z_sxym = (z_xmy1 - z_xmy0) * (1.0f / (MESH_Y_DIST)) * diff[X_AXIS]; // per-segment adjustment to z_cxym

for (;;) { // for all segments within this mesh cell

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/dac/stepper_dac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ void dac_current_raw(uint8_t channel, uint16_t val) {
mcp4728_simpleCommand(UPDATE);
}

static float dac_perc(int8_t n) { return 100.0 * mcp4728_getValue(dac_order[n]) * (1.0 / (DAC_STEPPER_MAX)); }
static float dac_amps(int8_t n) { return mcp4728_getDrvPct(dac_order[n]) * (DAC_STEPPER_MAX) * 0.125 * (1.0 / (DAC_STEPPER_SENSE)); }
static float dac_perc(int8_t n) { return 100.0 * mcp4728_getValue(dac_order[n]) * (1.0f / (DAC_STEPPER_MAX)); }
static float dac_amps(int8_t n) { return mcp4728_getDrvPct(dac_order[n]) * (DAC_STEPPER_MAX) * 0.125 * (1.0f / (DAC_STEPPER_SENSE)); }

uint8_t dac_current_get_percent(AxisEnum axis) { return mcp4728_getDrvPct(dac_order[axis]); }
void dac_current_set_percents(const uint8_t pct[XYZE]) {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/digipot/digipot_mcp4018.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static void i2c_send(const uint8_t channel, const byte v) {

// This is for the MCP4018 I2C based digipot
void digipot_i2c_set_current(const uint8_t channel, const float current) {
i2c_send(channel, current_to_wiper(MIN(MAX(current, 0.0f), float(DIGIPOT_A4988_MAX_CURRENT))));
i2c_send(channel, current_to_wiper(MIN(MAX(current, 0), float(DIGIPOT_A4988_MAX_CURRENT))));
}

void digipot_i2c_init() {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/digipot/digipot_mcp4451.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void digipot_i2c_set_current(const uint8_t channel, const float current) {

// Set actual wiper value
byte addresses[4] = { 0x00, 0x10, 0x60, 0x70 };
i2c_send(addr, addresses[channel & 0x3], current_to_wiper(MIN((float) MAX(current, 0.0f), DIGIPOT_I2C_MAX_CURRENT)));
i2c_send(addr, addresses[channel & 0x3], current_to_wiper(MIN((float) MAX(current, 0), DIGIPOT_I2C_MAX_CURRENT)));
}

void digipot_i2c_init() {
Expand Down
Loading