Merge pull request #3574 from leptun/extra_optimizations
More optimizations for 3.12 to fit
This commit is contained in:
commit
4e7d686b83
@ -641,7 +641,6 @@ void crashdet_detected(uint8_t mask)
|
||||
lcd_setstatus(msg);
|
||||
|
||||
gcode_G28(true, true, false); //home X and Y
|
||||
st_synchronize();
|
||||
|
||||
if (automatic_recovery_after_crash) {
|
||||
enquecommand_P(PSTR("CRASH_RECOVER"));
|
||||
@ -9746,7 +9745,6 @@ if(0)
|
||||
lcd_update_enable(true);
|
||||
*/
|
||||
eFilamentAction=FilamentAction::AutoLoad;
|
||||
bFilamentFirstRun=false;
|
||||
if(target_temperature[0] >= extrude_min_temp){
|
||||
bFilamentPreheatState=true;
|
||||
// mFilamentItem(target_temperature[0],target_temperature_bed);
|
||||
@ -11315,7 +11313,7 @@ void restore_print_from_eeprom(bool mbl_was_active) {
|
||||
int feedmultiply_rec;
|
||||
uint8_t fan_speed_rec;
|
||||
char cmd[48];
|
||||
char filename[13];
|
||||
char filename[FILENAME_LENGTH];
|
||||
uint8_t depth = 0;
|
||||
char dir_name[9];
|
||||
|
||||
|
@ -1015,7 +1015,7 @@ void SdBaseFile::printFatTime( uint16_t fatTime) {
|
||||
* the value zero, false, is returned for failure.
|
||||
*/
|
||||
bool SdBaseFile::printName() {
|
||||
char name[13];
|
||||
char name[FILENAME_LENGTH];
|
||||
if (!getFilename(name)) return false;
|
||||
MYSERIAL.print(name);
|
||||
return true;
|
||||
|
@ -304,7 +304,7 @@ void CardReader::getAbsFilename(char *t)
|
||||
while(*t!=0 && cnt< MAXPATHNAMELENGTH)
|
||||
{t++;cnt++;} //crawl counter forward.
|
||||
}
|
||||
if(cnt<MAXPATHNAMELENGTH-13)
|
||||
if(cnt < MAXPATHNAMELENGTH - FILENAME_LENGTH)
|
||||
file.getFilename(t);
|
||||
else
|
||||
t[0]=0;
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
bool logging;
|
||||
bool sdprinting ;
|
||||
bool cardOK ;
|
||||
char filename[13];
|
||||
char filename[FILENAME_LENGTH];
|
||||
// There are scenarios when simple modification time is not enough (on MS Windows)
|
||||
// Therefore these timestamps hold the most recent one of creation/modification date/times
|
||||
uint16_t crmodTime, crmodDate;
|
||||
|
@ -416,7 +416,7 @@ void get_command()
|
||||
|
||||
// Line numbers must be first in buffer
|
||||
|
||||
if ((strstr(cmdbuffer+bufindw+CMDHDRSIZE, "PRUSA") == NULL) &&
|
||||
if ((strstr_P(cmdbuffer+bufindw+CMDHDRSIZE, PSTR("PRUSA")) == NULL) &&
|
||||
(cmdbuffer[bufindw+CMDHDRSIZE] == 'N')) {
|
||||
|
||||
// Line number met. When sending a G-code over a serial line, each line may be stamped with its index,
|
||||
|
@ -104,7 +104,7 @@ char *ftostr43(const float &x, uint8_t offset)
|
||||
//Float to string with 1.23 format
|
||||
char *ftostr12ns(const float &x)
|
||||
{
|
||||
long xx = x * 100;
|
||||
int xx = x * 100;
|
||||
|
||||
xx = abs(xx);
|
||||
conv[0] = (xx / 100) % 10 + '0';
|
||||
|
@ -418,9 +418,9 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
||||
for (uint8_t i = 0; i < npts; ++i) {
|
||||
float x = vec_x[0] * measured_pts[i * 2] + vec_y[0] * measured_pts[i * 2 + 1] + cntr[0];
|
||||
float y = vec_x[1] * measured_pts[i * 2] + vec_y[1] * measured_pts[i * 2 + 1] + cntr[1];
|
||||
float errX = sqr(pgm_read_float(true_pts + i * 2) - x);
|
||||
float errY = sqr(pgm_read_float(true_pts + i * 2 + 1) - y);
|
||||
float err = sqrt(errX + errY);
|
||||
float errX = pgm_read_float(true_pts + i * 2) - x;
|
||||
float errY = pgm_read_float(true_pts + i * 2 + 1) - y;
|
||||
float err = hypot(errX, errY);
|
||||
#ifdef SUPPORT_VERBOSITY
|
||||
if (verbosity_level >= 10) {
|
||||
SERIAL_ECHOPGM("point #");
|
||||
@ -434,15 +434,15 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
||||
if(verbosity_level >= 20) SERIAL_ECHOPGM("Point on first row");
|
||||
#endif // SUPPORT_VERBOSITY
|
||||
float w = point_weight_y(i, measured_pts[2 * i + 1]);
|
||||
if (sqrt(errX) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_X ||
|
||||
(w != 0.f && sqrt(errY) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_Y)) {
|
||||
if (errX > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_X ||
|
||||
(w != 0.f && errY > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_Y)) {
|
||||
result = BED_SKEW_OFFSET_DETECTION_FITTING_FAILED;
|
||||
#ifdef SUPPORT_VERBOSITY
|
||||
if (verbosity_level >= 20) {
|
||||
SERIAL_ECHOPGM(", weigth Y: ");
|
||||
MYSERIAL.print(w);
|
||||
if (sqrt(errX) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_X) SERIAL_ECHOPGM(", error X > max. error X");
|
||||
if (w != 0.f && sqrt(errY) > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_Y) SERIAL_ECHOPGM(", error Y > max. error Y");
|
||||
if (errX > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_X) SERIAL_ECHOPGM(", error X > max. error X");
|
||||
if (w != 0.f && errY > BED_CALIBRATION_POINT_OFFSET_MAX_1ST_ROW_Y) SERIAL_ECHOPGM(", error Y > max. error Y");
|
||||
}
|
||||
#endif // SUPPORT_VERBOSITY
|
||||
}
|
||||
@ -477,9 +477,9 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
||||
SERIAL_ECHOPGM("error: ");
|
||||
MYSERIAL.print(err);
|
||||
SERIAL_ECHOPGM(", error X: ");
|
||||
MYSERIAL.print(sqrt(errX));
|
||||
MYSERIAL.print(errX);
|
||||
SERIAL_ECHOPGM(", error Y: ");
|
||||
MYSERIAL.print(sqrt(errY));
|
||||
MYSERIAL.print(errY);
|
||||
SERIAL_ECHOLNPGM("");
|
||||
SERIAL_ECHOLNPGM("");
|
||||
}
|
||||
@ -645,7 +645,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
|
||||
SERIAL_ECHOPGM(", ");
|
||||
MYSERIAL.print(pgm_read_float(true_pts + i * 2 + 1), 5);
|
||||
SERIAL_ECHOPGM("), error: ");
|
||||
MYSERIAL.print(sqrt(sqr(measured_pts[i * 2] - x) + sqr(measured_pts[i * 2 + 1] - y)));
|
||||
MYSERIAL.print( hypot(measured_pts[i * 2] - x, measured_pts[i * 2 + 1] - y) );
|
||||
SERIAL_ECHOLNPGM("");
|
||||
}
|
||||
if (verbosity_level >= 20) {
|
||||
@ -810,7 +810,7 @@ void world2machine_read_valid(float vec_x[2], float vec_y[2], float cntr[2])
|
||||
else
|
||||
{
|
||||
// Length of the vec_x shall be close to unity.
|
||||
float l = sqrt(vec_x[0] * vec_x[0] + vec_x[1] * vec_x[1]);
|
||||
float l = hypot(vec_x[0], vec_x[1]);
|
||||
if (l < 0.9 || l > 1.1)
|
||||
{
|
||||
#if 0
|
||||
@ -821,7 +821,7 @@ void world2machine_read_valid(float vec_x[2], float vec_y[2], float cntr[2])
|
||||
reset = true;
|
||||
}
|
||||
// Length of the vec_y shall be close to unity.
|
||||
l = sqrt(vec_y[0] * vec_y[0] + vec_y[1] * vec_y[1]);
|
||||
l = hypot(vec_y[0], vec_y[1]);
|
||||
if (l < 0.9 || l > 1.1)
|
||||
{
|
||||
#if 0
|
||||
@ -832,7 +832,7 @@ void world2machine_read_valid(float vec_x[2], float vec_y[2], float cntr[2])
|
||||
reset = true;
|
||||
}
|
||||
// Correction of the zero point shall be reasonably small.
|
||||
l = sqrt(cntr[0] * cntr[0] + cntr[1] * cntr[1]);
|
||||
l = hypot(cntr[0], cntr[1]);
|
||||
if (l > 15.f)
|
||||
{
|
||||
#if 0
|
||||
@ -1579,7 +1579,7 @@ inline bool improve_bed_induction_sensor_point()
|
||||
// Trim the vector from center_old_[x,y] to destination[x,y] by the bed dimensions.
|
||||
float vx = destination[X_AXIS] - center_old_x;
|
||||
float vy = destination[Y_AXIS] - center_old_y;
|
||||
float l = sqrt(vx*vx+vy*vy);
|
||||
float l = hypot(vx, vy);
|
||||
float t;
|
||||
if (destination[X_AXIS] < X_MIN_POS) {
|
||||
// Exiting the bed at xmin.
|
||||
@ -2441,16 +2441,16 @@ BedSkewOffsetDetectionResultType find_bed_offset_and_skew(int8_t verbosity_level
|
||||
#ifdef SUPPORT_VERBOSITY
|
||||
if (verbosity_level >= 10) {
|
||||
// Length of the vec_x
|
||||
float l = sqrt(vec_x[0] * vec_x[0] + vec_x[1] * vec_x[1]);
|
||||
float l = hypot(vec_x[0], vec_x[1]);
|
||||
SERIAL_ECHOLNPGM("X vector length:");
|
||||
MYSERIAL.println(l);
|
||||
|
||||
// Length of the vec_y
|
||||
l = sqrt(vec_y[0] * vec_y[0] + vec_y[1] * vec_y[1]);
|
||||
l = hypot(vec_y[0], vec_y[1]);
|
||||
SERIAL_ECHOLNPGM("Y vector length:");
|
||||
MYSERIAL.println(l);
|
||||
// Zero point correction
|
||||
l = sqrt(cntr[0] * cntr[0] + cntr[1] * cntr[1]);
|
||||
l = hypot(cntr[0], cntr[1]);
|
||||
SERIAL_ECHOLNPGM("Zero point correction:");
|
||||
MYSERIAL.println(l);
|
||||
|
||||
|
@ -99,8 +99,6 @@ static float previous_speed[NUM_AXIS]; // Speed of previous path line segment
|
||||
static float previous_nominal_speed; // Nominal speed of previous path line segment
|
||||
static float previous_safe_speed; // Exit speed limited by a jerk to full halt of a previous last segment.
|
||||
|
||||
uint8_t maxlimit_status;
|
||||
|
||||
#ifdef AUTOTEMP
|
||||
float autotemp_max=250;
|
||||
float autotemp_min=210;
|
||||
@ -658,7 +656,7 @@ void planner_reset_position()
|
||||
|
||||
// Apply inverse world correction matrix.
|
||||
machine2world(current_position[X_AXIS], current_position[Y_AXIS]);
|
||||
memcpy(destination, current_position, sizeof(destination));
|
||||
set_destination_to_current();
|
||||
#ifdef LIN_ADVANCE
|
||||
memcpy(position_float, current_position, sizeof(position_float));
|
||||
#endif
|
||||
|
@ -1737,7 +1737,7 @@ static void lcd_support_menu()
|
||||
if (((menu_item - 1) == menu_line) && lcd_draw_update) {
|
||||
lcd_set_cursor(2, menu_row);
|
||||
ip4_to_str(_md->ip_str, (uint8_t*)(&_md->ip));
|
||||
lcd_printf_P(PSTR("%s"), _md->ip_str);
|
||||
lcd_print(_md->ip_str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1750,7 +1750,7 @@ static void lcd_support_menu()
|
||||
if (((menu_item - 1) == menu_line) && lcd_draw_update) {
|
||||
lcd_set_cursor(2, menu_row);
|
||||
ip4_to_str(_md->ip_str, (uint8_t*)(&IP_address));
|
||||
lcd_printf_P(PSTR("%s"), _md->ip_str);
|
||||
lcd_print(_md->ip_str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1833,7 +1833,6 @@ void lcd_set_filament_oq_meass()
|
||||
|
||||
|
||||
FilamentAction eFilamentAction=FilamentAction::None; // must be initialized as 'non-autoLoad'
|
||||
bool bFilamentFirstRun;
|
||||
bool bFilamentPreheatState;
|
||||
bool bFilamentAction=false;
|
||||
static bool bFilamentWaitingFlag=false;
|
||||
@ -2343,7 +2342,6 @@ static void lcd_menu_AutoLoadFilament()
|
||||
|
||||
static void preheat_or_continue()
|
||||
{
|
||||
bFilamentFirstRun = false;
|
||||
if (target_temperature[0] >= extrude_min_temp)
|
||||
{
|
||||
bFilamentPreheatState = true;
|
||||
@ -2684,8 +2682,6 @@ static void lcd_babystep_z()
|
||||
lcd_draw_update = 1;
|
||||
//SERIAL_ECHO("Z baby step: ");
|
||||
//SERIAL_ECHO(_md->babystepMem[2]);
|
||||
// Wait 90 seconds before closing the live adjust dialog.
|
||||
lcd_timeoutToStatus.start();
|
||||
}
|
||||
|
||||
if (lcd_encoder != 0)
|
||||
@ -3569,11 +3565,7 @@ void lcd_menu_show_sensors_state() // NOT static due to using ins
|
||||
{
|
||||
lcd_timeoutToStatus.stop();
|
||||
lcd_show_sensors_state();
|
||||
if(LCD_CLICKED)
|
||||
{
|
||||
lcd_timeoutToStatus.start();
|
||||
menu_back();
|
||||
}
|
||||
menu_back_if_clicked();
|
||||
}
|
||||
|
||||
void prusa_statistics_err(char c){
|
||||
@ -5584,7 +5576,6 @@ static void mmu_cut_filament_menu()
|
||||
else
|
||||
{
|
||||
eFilamentAction=FilamentAction::MmuCut;
|
||||
bFilamentFirstRun=false;
|
||||
if(target_temperature[0] >= extrude_min_temp)
|
||||
{
|
||||
bFilamentPreheatState=true;
|
||||
@ -5983,10 +5974,8 @@ static void lcd_main_menu()
|
||||
else
|
||||
#endif //FILAMENT_SENSOR
|
||||
{
|
||||
bFilamentFirstRun=true;
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), lcd_LoadFilament);
|
||||
}
|
||||
bFilamentFirstRun=true;
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament);
|
||||
}
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu);
|
||||
@ -6169,18 +6158,20 @@ static void lcd_tune_menu()
|
||||
|
||||
|
||||
#ifdef TMC2130
|
||||
if(!farm_mode)
|
||||
{
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL) MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_NORMAL), lcd_silent_mode_set);
|
||||
else MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_STEALTH), lcd_silent_mode_set);
|
||||
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL)
|
||||
{
|
||||
if (lcd_crash_detect_enabled()) MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), _T(MSG_ON), crash_mode_switch);
|
||||
else MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), _T(MSG_OFF), crash_mode_switch);
|
||||
}
|
||||
else MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), NULL, lcd_crash_mode_info);
|
||||
}
|
||||
if(!farm_mode)
|
||||
{
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL) {
|
||||
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_NORMAL), lcd_silent_mode_set);
|
||||
if (lcd_crash_detect_enabled()) {
|
||||
MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), _T(MSG_ON), crash_mode_switch);
|
||||
} else {
|
||||
MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), _T(MSG_OFF), crash_mode_switch);
|
||||
}
|
||||
} else {
|
||||
MENU_ITEM_TOGGLE_P(_T(MSG_MODE), _T(MSG_STEALTH), lcd_silent_mode_set);
|
||||
MENU_ITEM_TOGGLE_P(_T(MSG_CRASHDETECT), NULL, lcd_crash_mode_info);
|
||||
}
|
||||
}
|
||||
#else //TMC2130
|
||||
if (!farm_mode) { //dont show in menu if we are in farm mode
|
||||
switch (SilentModeMenu) {
|
||||
|
@ -182,7 +182,6 @@ enum class FilamentAction : uint_least8_t
|
||||
};
|
||||
|
||||
extern FilamentAction eFilamentAction;
|
||||
extern bool bFilamentFirstRun;
|
||||
extern bool bFilamentPreheatState;
|
||||
extern bool bFilamentAction;
|
||||
void mFilamentItem(uint16_t nTemp,uint16_t nTempBed);
|
||||
|
Loading…
Reference in New Issue
Block a user