diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 50e7cb5ea..358aacbd2 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3477,18 +3477,20 @@ void process_commands() case 80: #ifdef MK1BP break; -#endif //MK1BP +#else case_G80: { mesh_bed_leveling_flag = true; - int8_t verbosity_level = 0; static bool run = false; + #ifdef SUPPORT_VERBOSITY + int8_t verbosity_level = 0; if (code_seen('V')) { // Just 'V' without a number counts as V1. char c = strchr_pointer[1]; verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short(); } + #endif // Firstly check if we know where we are if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])) { // We don't know where we are! HOME! @@ -3549,6 +3551,8 @@ void process_commands() if (verbosity_level >= 1) { clamped ? SERIAL_PROTOCOLPGM("First calibration point clamped.\n") : SERIAL_PROTOCOLPGM("No clamping for first calibration point.\n"); } + #else + UNUSED(clamped); #endif // SUPPORT_VERBOSITY plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS] / 30, active_extruder); @@ -3604,13 +3608,15 @@ void process_commands() - world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); + clamped = world2machine_clamp(current_position[X_AXIS], current_position[Y_AXIS]); #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 1) { SERIAL_PROTOCOL(mesh_point); clamped ? SERIAL_PROTOCOLPGM(": xy clamped.\n") : SERIAL_PROTOCOLPGM(": no xy clamping\n"); } + #else + UNUSED(clamped); #endif // SUPPORT_VERBOSITY @@ -3801,7 +3807,7 @@ void process_commands() } break; - +#endif //MK1BP /** * G81: Print mesh bed leveling status and bed profile if activated */ diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index 293d3b9a1..4569beb9f 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -143,8 +143,10 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( int8_t verbosity_level ) { - float angleDiff; - #ifdef SUPPORT_VERBOSITY + float angleDiff; + #ifndef SUPPORT_VERBOSITY + UNUSED(verbosity_level); + #else if (verbosity_level >= 10) { SERIAL_ECHOLNPGM("calculate machine skew and offset LS"); @@ -186,7 +188,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS( } delay_keep_alive(100); } - #endif // SUPPORT_VERBOSITY + #endif // SUPPORT_VERBOSITY // Run some iterations of the Gauss-Newton method of non-linear least squares. // Initial set of parameters: @@ -823,6 +825,8 @@ inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, i { #ifdef SUPPORT_VERBOSITY if(verbosity_level >= 10) SERIAL_ECHOLNPGM("find bed induction sensor point z"); + #else + UNUSED(verbosity_level); #endif // SUPPORT_VERBOSITY bool endstops_enabled = enable_endstops(true); bool endstop_z_enabled = enable_z_endstop(false); @@ -880,6 +884,8 @@ inline bool find_bed_induction_sensor_point_xy(int verbosity_level) { #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 10) MYSERIAL.println("find bed induction sensor point xy"); + #else + UNUSED(verbosity_level); #endif // SUPPORT_VERBOSITY float feedrate = homing_feedrate[X_AXIS] / 60.f; bool found = false; @@ -1218,13 +1224,15 @@ inline bool improve_bed_induction_sensor_point2(bool lift_z_on_min_y, int8_t ver } b = current_position[X_AXIS]; if (b - a < MIN_BED_SENSOR_POINT_RESPONSE_DMR) { - #ifdef SUPPORT_VERBOSITY - if (verbosity_level >= 5) { + #ifdef SUPPORT_VERBOSITY + if (verbosity_level >= 5) { SERIAL_ECHOPGM("Point width too small: "); SERIAL_ECHO(b - a); SERIAL_ECHOLNPGM(""); } - #endif // SUPPORT_VERBOSITY + #else + UNUSED(verbosity_level); + #endif // SUPPORT_VERBOSITY // We force the calibration routine to move the Z axis slightly down to make the response more pronounced. if (b - a < 0.5f * MIN_BED_SENSOR_POINT_RESPONSE_DMR) { // Don't use the new X value. @@ -1350,6 +1358,8 @@ inline bool improve_bed_induction_sensor_point3(int verbosity_level) #ifdef SUPPORT_VERBOSITY if (verbosity_level >= 20) MYSERIAL.println("Improve bed induction sensor point3"); + #else + UNUSED(verbosity_level); #endif // SUPPORT_VERBOSITY // Was the sensor point detected too far in the minus Y axis? // If yes, the center of the induction point cannot be reached by the machine. diff --git a/Firmware/stepper.cpp b/Firmware/stepper.cpp index 75a663325..30ce9cc17 100644 --- a/Firmware/stepper.cpp +++ b/Firmware/stepper.cpp @@ -90,8 +90,6 @@ static bool old_z_max_endstop=false; static bool check_endstops = true; static bool check_z_endstop = false; -int8_t SilentMode; - volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0}; volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1}; @@ -1151,23 +1149,11 @@ void digitalPotWrite(int address, int value) // From Arduino DigitalPotControl e #endif } -void EEPROM_read_st(int pos, uint8_t* value, uint8_t size) -{ - do - { - *value = eeprom_read_byte((unsigned char*)pos); - pos++; - value++; - }while(--size); -} - - void digipot_init() //Initialize Digipot Motor Current { - EEPROM_read_st(EEPROM_SILENT,(uint8_t*)&SilentMode,sizeof(SilentMode)); - SilentModeMenu = SilentMode; + SilentModeMenu = eeprom_read_byte((uint8_t*)EEPROM_SILENT); #if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1 - if(SilentMode == 0){ + if(SilentModeMenu == 0){ const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT_LOUD; }else{ const uint8_t digipot_motor_current[] = DIGIPOT_MOTOR_CURRENT; @@ -1182,7 +1168,7 @@ void digipot_init() //Initialize Digipot Motor Current pinMode(MOTOR_CURRENT_PWM_XY_PIN, OUTPUT); pinMode(MOTOR_CURRENT_PWM_Z_PIN, OUTPUT); pinMode(MOTOR_CURRENT_PWM_E_PIN, OUTPUT); - if((SilentMode == 0) || (farm_mode) ){ + if((SilentModeMenu == 0) || (farm_mode) ){ motor_current_setting[0] = motor_current_setting_loud[0]; motor_current_setting[1] = motor_current_setting_loud[1]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e8b10c3ac..d754b9276 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4273,7 +4273,6 @@ void extr_adj(int extruder) //loading filament for SNMM void extr_unload() { //unloads filament float tmp_motor[3] = DEFAULT_PWM_MOTOR_CURRENT; float tmp_motor_loud[3] = DEFAULT_PWM_MOTOR_CURRENT_LOUD; - int8_t SilentMode; if (degHotend0() > EXTRUDE_MINTEMP) { lcd_implementation_clear(); @@ -4320,7 +4319,7 @@ void extr_unload() { //unloads filament plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 500, active_extruder); st_synchronize(); //digipot_init(); - if (SilentMode == 1) digipot_current(2, tmp_motor[2]); //set back to normal operation currents + if (SilentModeMenu == 1) digipot_current(2, tmp_motor[2]); //set back to normal operation currents else digipot_current(2, tmp_motor_loud[2]); lcd_update_enable(true); lcd_return_to_status();