Reduce math library code size by 3.4KB (#21575)

This commit is contained in:
Scott Lahteine
2021-04-12 16:49:53 -05:00
committed by GitHub
parent 1742fb8655
commit 24a095c5c1
35 changed files with 141 additions and 145 deletions

View File

@ -32,7 +32,7 @@
namespace FTDI {
void draw_adjuster_value(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, float value, progmem_str units, int8_t width, uint8_t precision) {
char str[width + precision + 10 + (units ? strlen_P((const char*) units) : 0)];
if (isnan(value))
if (ISNAN(value))
strcpy_P(str, PSTR("-"));
else
dtostrf(value, width, precision, str);

View File

@ -31,7 +31,7 @@ void BedMeshBase::_drawMesh(CommandProcessor &cmd, int16_t x, int16_t y, int16_t
constexpr uint8_t cols = GRID_MAX_POINTS_X;
#define VALUE(X,Y) (func ? func(X,Y,data) : 0)
#define ISVAL(X,Y) (func ? !isnan(VALUE(X,Y)) : true)
#define ISVAL(X,Y) (func ? !ISNAN(VALUE(X,Y)) : true)
#define HEIGHT(X,Y) (ISVAL(X,Y) ? (VALUE(X,Y) - val_min) * scale_z : 0)
// Compute the mean, min and max for the points

View File

@ -70,7 +70,7 @@ void BedMeshEditScreen::onEntry() {
float BedMeshEditScreen::getHighlightedValue() {
const float val = ExtUI::getMeshPoint(mydata.highlight);
return (isnan(val) ? 0 : val) + mydata.zAdjustment;
return (ISNAN(val) ? 0 : val) + mydata.zAdjustment;
}
void BedMeshEditScreen::setHighlightedValue(float value) {

View File

@ -421,7 +421,7 @@ namespace ExtUI {
#if AXIS_IS_TMC(Z2)
case Z2: return stepperZ2.getMilliamps();
#endif
default: return NAN;
default: return MFNAN;
};
}
@ -451,7 +451,7 @@ namespace ExtUI {
#if AXIS_IS_TMC(E7)
case E7: return stepperE7.getMilliamps();
#endif
default: return NAN;
default: return MFNAN;
};
}