optimisation: Move divison into constexpr

Change in memory:
Flash: -12 bytes
SRAM: 0 bytes
This commit is contained in:
Guðni Már Gilbert 2023-05-06 20:54:42 +00:00 committed by Alex Voinea
parent 6b12be42d9
commit a9d0cc5e56
No known key found for this signature in database
GPG Key ID: 37EDFD565CB33BAD
1 changed files with 4 additions and 2 deletions

View File

@ -2186,12 +2186,14 @@ inline void scan_bed_induction_sensor_point()
float __attribute__((noinline)) BED_X(const uint8_t col)
{
return ((float)col * (BED_Xn - BED_X0) / (MESH_NUM_X_POINTS - 1) + BED_X0);
constexpr float x_mesh_density = (BED_Xn - BED_X0) / (MESH_NUM_X_POINTS - 1);
return ((float)col * x_mesh_density + BED_X0);
}
float __attribute__((noinline)) BED_Y(const uint8_t row)
{
return ((float)row * (BED_Yn - BED_Y0) / (MESH_NUM_Y_POINTS - 1) + BED_Y0);
constexpr float y_mesh_density = (BED_Yn - BED_Y0) / (MESH_NUM_Y_POINTS - 1);
return ((float)row * y_mesh_density + BED_Y0);
}
BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level, uint8_t &too_far_mask)