Merge pull request #1015 from mkbel/fix_compiler_warnings

Fix compiler warnings
This commit is contained in:
XPila 2018-08-08 18:37:57 +02:00 committed by GitHub
commit c2f098e263
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 274 additions and 280 deletions

View file

@ -148,7 +148,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#define disable_z() { WRITE(Z_ENABLE_PIN,!Z_ENABLE_ON); WRITE(Z2_ENABLE_PIN,!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }
#else
#define enable_z() WRITE(Z_ENABLE_PIN, Z_ENABLE_ON)
#define disable_z() ;
#define disable_z() {}
#endif
#else
#ifdef Z_DUAL_STEPPER_DRIVERS
@ -160,8 +160,8 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#endif
#endif
#else
#define enable_z() ;
#define disable_z() ;
#define enable_z() {}
#define disable_z() {}
#endif
@ -475,4 +475,4 @@ void M600_load_filament();
void mmu_M600_load_filament(bool automatic);
void M600_load_filament_movements();
void M600_wait_for_user();
void M600_check_state();
void M600_check_state();

View file

@ -803,9 +803,8 @@ void failstats_reset_print()
// Factory reset function
// This function is used to erase parts or whole EEPROM memory which is used for storing calibration and and so on.
// Level input parameter sets depth of reset
// Quiet parameter masks all waitings for user interact.
int er_progress = 0;
void factory_reset(char level, bool quiet)
static void factory_reset(char level)
{
lcd_clear();
switch (level) {
@ -922,7 +921,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
FILE _uartout; //= {0}; Global variable is always zero initialized. No need to explicitly state this.
int uart_putchar(char c, FILE *stream)
int uart_putchar(char c, FILE *)
{
MYSERIAL.write(c);
return 0;
@ -967,7 +966,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
_delay_ms(2000);
char level = reset_menu();
factory_reset(level, false);
factory_reset(level);
switch (level) {
case 0: _delay_ms(0); break;
@ -3077,106 +3076,112 @@ void gcode_M114()
SERIAL_PROTOCOLLN("");
}
void gcode_M600(bool automatic, float x_position, float y_position, float z_shift, float e_shift, float e_shift_late) {
st_synchronize();
float lastpos[4];
static void gcode_M600(bool automatic, float x_position, float y_position, float z_shift, float e_shift, float /*e_shift_late*/)
{
st_synchronize();
float lastpos[4];
if (farm_mode)
{
prusa_statistics(22);
}
if (farm_mode)
{
prusa_statistics(22);
}
//First backup current position and settings
feedmultiplyBckp=feedmultiply;
HotendTempBckp = degTargetHotend(active_extruder);
fanSpeedBckp = fanSpeed;
//First backup current position and settings
feedmultiplyBckp = feedmultiply;
HotendTempBckp = degTargetHotend(active_extruder);
fanSpeedBckp = fanSpeed;
lastpos[X_AXIS]=current_position[X_AXIS];
lastpos[Y_AXIS]=current_position[Y_AXIS];
lastpos[Z_AXIS]=current_position[Z_AXIS];
lastpos[E_AXIS]=current_position[E_AXIS];
lastpos[X_AXIS] = current_position[X_AXIS];
lastpos[Y_AXIS] = current_position[Y_AXIS];
lastpos[Z_AXIS] = current_position[Z_AXIS];
lastpos[E_AXIS] = current_position[E_AXIS];
//Retract E
current_position[E_AXIS]+= e_shift;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
st_synchronize();
//Retract E
current_position[E_AXIS] += e_shift;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
current_position[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
st_synchronize();
//Lift Z
current_position[Z_AXIS]+= z_shift;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder);
st_synchronize();
//Move XY to side
current_position[X_AXIS]= x_position;
current_position[Y_AXIS]= y_position;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder);
st_synchronize();
//Beep, manage nozzle heater and wait for user to start unload filament
if(!automatic) M600_wait_for_user();
lcd_change_fil_state = 0;
// Unload filament
if (mmu_enabled)
extr_unload(); //unload just current filament for multimaterial printers (used also in M702)
else
unload_filament(); //unload filament for single material (used also in M702)
//finish moves
st_synchronize();
//Lift Z
current_position[Z_AXIS] += z_shift;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
current_position[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder);
st_synchronize();
if (!mmu_enabled)
{
KEEPALIVE_STATE(PAUSED_FOR_USER);
lcd_change_fil_state = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Was filament unload successful?"), false, true);////MSG_UNLOAD_SUCCESSFUL c=20 r=2
if (lcd_change_fil_state == 0) lcd_show_fullscreen_message_and_wait_P(_i("Please open idler and remove filament manually."));////MSG_CHECK_IDLER c=20 r=4
lcd_update_enable(true);
}
//Move XY to side
current_position[X_AXIS] = x_position;
current_position[Y_AXIS] = y_position;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
current_position[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder);
st_synchronize();
if (mmu_enabled)
mmu_M600_load_filament(automatic);
else
M600_load_filament();
//Beep, manage nozzle heater and wait for user to start unload filament
if (!automatic) M600_wait_for_user();
if(!automatic) M600_check_state();
lcd_change_fil_state = 0;
//Not let's go back to print
fanSpeed = fanSpeedBckp;
// Unload filament
if (mmu_enabled) extr_unload(); //unload just current filament for multimaterial printers (used also in M702)
else unload_filament(); //unload filament for single material (used also in M702)
//finish moves
st_synchronize();
//Feed a little of filament to stabilize pressure
if (!automatic) {
current_position[E_AXIS] += FILAMENTCHANGE_RECFEED;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_EXFEED, active_extruder);
}
//Move XY back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_XYFEED, active_extruder);
st_synchronize();
//Move Z back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_ZFEED, active_extruder);
st_synchronize();
//Unretract
current_position[E_AXIS]= current_position[E_AXIS] - e_shift;
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], current_position[E_AXIS], FILAMENTCHANGE_RFEED, active_extruder);
st_synchronize();
if (!mmu_enabled)
{
KEEPALIVE_STATE(PAUSED_FOR_USER);
lcd_change_fil_state = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Was filament unload successful?"),
false, true); ////MSG_UNLOAD_SUCCESSFUL c=20 r=2
if (lcd_change_fil_state == 0)
lcd_show_fullscreen_message_and_wait_P(_i("Please open idler and remove filament manually."));////MSG_CHECK_IDLER c=20 r=4
lcd_update_enable(true);
}
//Set E position to original
plan_set_e_position(lastpos[E_AXIS]);
if (mmu_enabled) mmu_M600_load_filament(automatic);
else M600_load_filament();
memcpy(current_position, lastpos, sizeof(lastpos));
memcpy(destination, current_position, sizeof(current_position));
//Recover feed rate
feedmultiply=feedmultiplyBckp;
char cmd[9];
sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp);
enquecommand(cmd);
lcd_setstatuspgm(_T(WELCOME_MSG));
custom_message = false;
custom_message_type = 0;
if (!automatic) M600_check_state();
//Not let's go back to print
fanSpeed = fanSpeedBckp;
//Feed a little of filament to stabilize pressure
if (!automatic)
{
current_position[E_AXIS] += FILAMENTCHANGE_RECFEED;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
current_position[E_AXIS], FILAMENTCHANGE_EXFEED, active_extruder);
}
//Move XY back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS],
FILAMENTCHANGE_XYFEED, active_extruder);
st_synchronize();
//Move Z back
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], current_position[E_AXIS],
FILAMENTCHANGE_ZFEED, active_extruder);
st_synchronize();
//Unretract
current_position[E_AXIS] = current_position[E_AXIS] - e_shift;
plan_buffer_line(lastpos[X_AXIS], lastpos[Y_AXIS], lastpos[Z_AXIS], current_position[E_AXIS],
FILAMENTCHANGE_RFEED, active_extruder);
st_synchronize();
//Set E position to original
plan_set_e_position(lastpos[E_AXIS]);
memcpy(current_position, lastpos, sizeof(lastpos));
memcpy(destination, current_position, sizeof(current_position));
//Recover feed rate
feedmultiply = feedmultiplyBckp;
char cmd[9];
sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp);
enquecommand(cmd);
lcd_setstatuspgm(_T(WELCOME_MSG));
custom_message = false;
custom_message_type = 0;
}
@ -3525,7 +3530,7 @@ void process_commands()
} else if(code_seen("FR")) {
// Factory full reset
factory_reset(0,true);
factory_reset(0);
}
//else if (code_seen('Cal')) {
// lcd_calibration();
@ -6580,8 +6585,8 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
else if (code_seen('S')) { // Sxxx Iyyy - Set compensation ustep value S for compensation table index I
int16_t usteps = code_value();
if (code_seen('I')) {
byte index = code_value();
if ((index >= 0) && (index < 5)) {
uint8_t index = code_value();
if (index < 5) {
EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + index * 2, &usteps);
SERIAL_PROTOCOLLN("OK");
SERIAL_PROTOCOLLN("index, temp, ustep, um");
@ -8991,10 +8996,6 @@ void mmu_load_to_nozzle() {
if (!saved_e_relative_mode) axis_relative_modes[E_AXIS] = false;
}
void mmu_switch_extruder(uint8_t extruder) {
}
void M600_check_state() {
//Wait for user to check the state
lcd_change_fil_state = 0;

View file

@ -288,6 +288,76 @@ void CardReader::getAbsFilename(char *t)
else
t[0]=0;
}
/**
* @brief Dive into subfolder
*
* Method sets curDir to point to root, in case fileName is null.
* Method sets curDir to point to workDir, in case fileName path is relative
* (doesn't start with '/')
* Method sets curDir to point to dir, which is specified by absolute path
* specified by fileName. In such case fileName is updated so it points to
* file name without the path.
*
* @param[in,out] fileName
* expects file name including path
* in case of absolute path, file name without path is returned
* @param[in,out] dir SdFile object to operate with,
* in case of absolute path, curDir is modified to point to dir,
* so it is not possible to create on stack inside this function,
* as curDir would point to destroyed object.
*/
void CardReader::diveSubfolder (const char *fileName, SdFile& dir)
{
curDir=&root;
if (!fileName) return;
const char *dirname_start, *dirname_end;
if (fileName[0] == '/') // absolute path
{
dirname_start = fileName + 1;
while (*dirname_start)
{
dirname_end = strchr(dirname_start, '/');
//SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start-name));
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
if (dirname_end && dirname_end > dirname_start)
{
const size_t maxLen = 12;
char subdirname[maxLen+1];
subdirname[maxLen] = 0;
const size_t len = ((static_cast<size_t>(dirname_end-dirname_start))>maxLen) ? maxLen : (dirname_end-dirname_start);
strncpy(subdirname, dirname_start, len);
SERIAL_ECHOLN(subdirname);
if (!dir.open(curDir, subdirname, O_READ))
{
SERIAL_PROTOCOLRPGM(_T(MSG_SD_OPEN_FILE_FAIL));
SERIAL_PROTOCOL(subdirname);
SERIAL_PROTOCOLLNPGM(".");
return;
}
else
{
//SERIAL_ECHOLN("dive ok");
}
curDir = &dir;
dirname_start = dirname_end + 1;
}
else // the reminder after all /fsa/fdsa/ is the filename
{
fileName = dirname_start;
//SERIAL_ECHOLN("remaider");
//SERIAL_ECHOLN(fname);
break;
}
}
}
else //relative path
{
curDir = &workDir;
}
}
void CardReader::openFile(const char* name,bool read, bool replace_current/*=true*/)
{
@ -340,53 +410,9 @@ void CardReader::openFile(const char* name,bool read, bool replace_current/*=tru
SdFile myDir;
curDir=&root;
const char *fname=name;
char *dirname_start,*dirname_end;
if(name[0]=='/')
{
dirname_start=strchr(name,'/')+1;
while(dirname_start>0)
{
dirname_end=strchr(dirname_start,'/');
//SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start-name));
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
if(dirname_end>0 && dirname_end>dirname_start)
{
char subdirname[13];
strncpy(subdirname, dirname_start, dirname_end-dirname_start);
subdirname[dirname_end-dirname_start]=0;
SERIAL_ECHOLN(subdirname);
if(!myDir.open(curDir,subdirname,O_READ))
{
SERIAL_PROTOCOLRPGM(_T(MSG_SD_OPEN_FILE_FAIL));
SERIAL_PROTOCOL(subdirname);
SERIAL_PROTOCOLLNPGM(".");
return;
}
else
{
//SERIAL_ECHOLN("dive ok");
}
curDir=&myDir;
dirname_start=dirname_end+1;
}
else // the reminder after all /fsa/fdsa/ is the filename
{
fname=dirname_start;
//SERIAL_ECHOLN("remaider");
//SERIAL_ECHOLN(fname);
break;
}
}
}
else //relative path
{
curDir=&workDir;
}
diveSubfolder(fname,myDir);
if(read)
{
if (file.open(curDir, fname, O_READ))
@ -431,60 +457,14 @@ void CardReader::openFile(const char* name,bool read, bool replace_current/*=tru
void CardReader::removeFile(const char* name)
{
if(!cardOK)
return;
file.close();
sdprinting = false;
SdFile myDir;
curDir=&root;
const char *fname=name;
char *dirname_start,*dirname_end;
if(name[0]=='/')
{
dirname_start=strchr(name,'/')+1;
while(dirname_start>0)
{
dirname_end=strchr(dirname_start,'/');
//SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start-name));
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name));
if(dirname_end>0 && dirname_end>dirname_start)
{
char subdirname[13];
strncpy(subdirname, dirname_start, dirname_end-dirname_start);
subdirname[dirname_end-dirname_start]=0;
SERIAL_ECHOLN(subdirname);
if(!myDir.open(curDir,subdirname,O_READ))
{
SERIAL_PROTOCOLRPGM("open failed, File: ");
SERIAL_PROTOCOL(subdirname);
SERIAL_PROTOCOLLNPGM(".");
return;
}
else
{
//SERIAL_ECHOLN("dive ok");
}
curDir=&myDir;
dirname_start=dirname_end+1;
}
else // the reminder after all /fsa/fdsa/ is the filename
{
fname=dirname_start;
//SERIAL_ECHOLN("remaider");
//SERIAL_ECHOLN(fname);
break;
}
}
}
else //relative path
{
curDir=&workDir;
}
if(!cardOK) return;
file.close();
sdprinting = false;
SdFile myDir;
const char *fname=name;
diveSubfolder(fname,myDir);
if (file.remove(curDir, fname))
{
SERIAL_PROTOCOLPGM("File deleted:");

View file

@ -154,6 +154,8 @@ private:
LsAction lsAction; //stored for recursion.
int16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
char* diveDirName;
void diveSubfolder (const char *fileName, SdFile& dir);
void lsDive(const char *prepend, SdFile parent, const char * const match=NULL);
#ifdef SDCARD_SORT_ALPHA
void flush_presort();

View file

@ -221,7 +221,7 @@ static void lcd_begin(uint8_t lines, uint8_t dotsize, uint8_t clear)
lcd_escape[0] = 0;
}
int lcd_putchar(char c, FILE *stream)
int lcd_putchar(char c, FILE *)
{
lcd_write(c);
return 0;
@ -691,7 +691,7 @@ void lcd_beeper_quick_feedback(void)
{
SET_OUTPUT(BEEPER);
//-//
Sound_MakeSound(e_SOUND_CLASS_Echo,e_SOUND_TYPE_ButtonEcho);
Sound_MakeSound(e_SOUND_TYPE_ButtonEcho);
/*
for(int8_t i = 0; i < 10; i++)
{

View file

@ -132,7 +132,7 @@ const float bed_ref_points[] PROGMEM = {
static inline float sqr(float x) { return x * x; }
#ifdef HEATBED_V2
static inline bool point_on_1st_row(const uint8_t i)
static inline bool point_on_1st_row(const uint8_t /*i*/)
{
return false;
}
@ -147,7 +147,7 @@ static inline bool point_on_1st_row(const uint8_t i)
// The first row of points may not be fully reachable
// and the y values may be shortened a bit by the bed carriage
// pulling the belt up.
static inline float point_weight_x(const uint8_t i, const uint8_t npts, const float &y)
static inline float point_weight_x(const uint8_t i, const float &y)
{
float w = 1.f;
if (point_on_1st_row(i)) {
@ -169,7 +169,7 @@ static inline float point_weight_x(const uint8_t i, const uint8_t npts, const fl
// The first row of points may not be fully reachable
// and the y values may be shortened a bit by the bed carriage
// pulling the belt up.
static inline float point_weight_y(const uint8_t i, const uint8_t npts, const float &y)
static inline float point_weight_y(const uint8_t i, const float &y)
{
float w = 1.f;
if (point_on_1st_row(i)) {
@ -209,7 +209,10 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
float *vec_x,
float *vec_y,
float *cntr,
int8_t verbosity_level
int8_t
#ifdef SUPPORT_VERBOSITY
verbosity_level
#endif //SUPPORT_VERBOSITY
)
{
float angleDiff;
@ -291,7 +294,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
(c == 0) ? 1.f :
((c == 2) ? (-s1 * measured_pts[2 * i]) :
(-c2 * measured_pts[2 * i + 1]));
float w = point_weight_x(i, npts, measured_pts[2 * i + 1]);
float w = point_weight_x(i, measured_pts[2 * i + 1]);
acc += a * b * w;
}
// Second for the residuum in the y axis.
@ -306,7 +309,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
(c == 1) ? 1.f :
((c == 2) ? ( c1 * measured_pts[2 * i]) :
(-s2 * measured_pts[2 * i + 1]));
float w = point_weight_y(i, npts, measured_pts[2 * i + 1]);
float w = point_weight_y(i, measured_pts[2 * i + 1]);
acc += a * b * w;
}
}
@ -322,7 +325,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
((r == 2) ? (-s1 * measured_pts[2 * i]) :
(-c2 * measured_pts[2 * i + 1])));
float fx = c1 * measured_pts[2 * i] - s2 * measured_pts[2 * i + 1] + cntr[0] - pgm_read_float(true_pts + i * 2);
float w = point_weight_x(i, npts, measured_pts[2 * i + 1]);
float w = point_weight_x(i, measured_pts[2 * i + 1]);
acc += j * fx * w;
}
{
@ -332,7 +335,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
((r == 2) ? ( c1 * measured_pts[2 * i]) :
(-s2 * measured_pts[2 * i + 1])));
float fy = s1 * measured_pts[2 * i] + c2 * measured_pts[2 * i + 1] + cntr[1] - pgm_read_float(true_pts + i * 2 + 1);
float w = point_weight_y(i, npts, measured_pts[2 * i + 1]);
float w = point_weight_y(i, measured_pts[2 * i + 1]);
acc += j * fy * w;
}
}
@ -453,7 +456,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
#ifdef SUPPORT_VERBOSITY
if(verbosity_level >= 20) SERIAL_ECHOPGM("Point on first row");
#endif // SUPPORT_VERBOSITY
float w = point_weight_y(i, npts, measured_pts[2 * i + 1]);
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)) {
result = BED_SKEW_OFFSET_DETECTION_FITTING_FAILED;
@ -550,7 +553,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
for (int8_t i = 0; i < npts; ++ i) {
float x = vec_x[0] * measured_pts[i * 2] + vec_y[0] * measured_pts[i * 2 + 1];
float y = vec_x[1] * measured_pts[i * 2] + vec_y[1] * measured_pts[i * 2 + 1];
float w = point_weight_x(i, npts, y);
float w = point_weight_x(i, y);
cntr[0] += w * (pgm_read_float(true_pts + i * 2) - x);
wx += w;
#ifdef SUPPORT_VERBOSITY
@ -567,7 +570,7 @@ BedSkewOffsetDetectionResultType calculate_machine_skew_and_offset_LS(
MYSERIAL.print(wx);
}
#endif // SUPPORT_VERBOSITY
w = point_weight_y(i, npts, y);
w = point_weight_y(i, y);
cntr[1] += w * (pgm_read_float(true_pts + i * 2 + 1) - y);
wy += w;
#ifdef SUPPORT_VERBOSITY
@ -960,7 +963,11 @@ static inline void update_current_position_z()
}
// At the current position, find the Z stop.
inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int verbosity_level)
inline bool find_bed_induction_sensor_point_z(float minimum_z, uint8_t n_iter, int
#ifdef SUPPORT_VERBOSITY
verbosity_level
#endif //SUPPORT_VERBOSITY
)
{
#ifdef TMC2130
FORCE_HIGH_POWER_START;
@ -1047,7 +1054,11 @@ extern bool xyzcal_find_bed_induction_sensor_point_xy();
#endif //HEATBED_V2
#ifdef HEATBED_V2
inline bool find_bed_induction_sensor_point_xy(int verbosity_level)
inline bool find_bed_induction_sensor_point_xy(int
#if !defined (NEW_XYZCAL) && defined (SUPPORT_VERBOSITY)
verbosity_level
#endif
)
{
#ifdef NEW_XYZCAL
return xyzcal_find_bed_induction_sensor_point_xy();

View file

@ -21,7 +21,7 @@ static inline bool vec_undef(const float v[2])
return vx[0] == 0x0FFFFFFFF || vx[1] == 0x0FFFFFFFF;
}
void mesh_bed_leveling::get_meas_xy(int ix, int iy, float &x, float &y, bool use_default)
void mesh_bed_leveling::get_meas_xy(int ix, int iy, float &x, float &y, bool /*use_default*/)
{
#if 0
float cntr[2] = {

View file

@ -29,7 +29,11 @@ void extr_mov(float shift, float feed_rate)
}
void change_extr(int extr) { //switches multiplexer for extruders
void change_extr(int
#ifdef SNMM
extr
#endif //SNMM
) { //switches multiplexer for extruders
#ifdef SNMM
st_synchronize();
delay(100);

View file

@ -869,22 +869,22 @@ block->steps_y.wide = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-p
enable_e0();
g_uc_extruder_last_move[0] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[1] == 0) disable_e1();
if(g_uc_extruder_last_move[2] == 0) disable_e2();
if(g_uc_extruder_last_move[1] == 0) {disable_e1();}
if(g_uc_extruder_last_move[2] == 0) {disable_e2();}
break;
case 1:
enable_e1();
g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[0] == 0) disable_e0();
if(g_uc_extruder_last_move[2] == 0) disable_e2();
if(g_uc_extruder_last_move[0] == 0) {disable_e0();}
if(g_uc_extruder_last_move[2] == 0) {disable_e2();}
break;
case 2:
enable_e2();
g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE*2;
if(g_uc_extruder_last_move[0] == 0) disable_e0();
if(g_uc_extruder_last_move[1] == 0) disable_e1();
if(g_uc_extruder_last_move[0] == 0) {disable_e0();}
if(g_uc_extruder_last_move[1] == 0) {disable_e1();}
break;
}
}

View file

@ -59,7 +59,7 @@ switch(eSoundMode)
Sound_SaveMode();
}
void Sound_MakeSound(eSOUND_CLASS eSoundClass,eSOUND_TYPE eSoundType)
void Sound_MakeSound(eSOUND_TYPE eSoundType)
{
switch(eSoundMode)
{

View file

@ -26,7 +26,7 @@ extern void Sound_Init(void);
extern void Sound_Default(void);
extern void Sound_Save(void);
extern void Sound_CycleState(void);
extern void Sound_MakeSound(eSOUND_CLASS eSoundClass,eSOUND_TYPE eSoundType);
extern void Sound_MakeSound(eSOUND_TYPE eSoundType);
//static void Sound_DoSound_Echo(void);
//static void Sound_DoSound_Prompt(void);

View file

@ -104,8 +104,6 @@ static bool z_endstop_invert = false;
volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
uint8_t LastStepMask = 0;
#ifdef LIN_ADVANCE
static uint16_t nextMainISR = 0;
@ -714,7 +712,6 @@ FORCE_INLINE void stepper_tick_lowres()
counter_x.lo += current_block->steps_x.lo;
if (counter_x.lo > 0) {
WRITE_NC(X_STEP_PIN, !INVERT_X_STEP_PIN);
LastStepMask |= X_AXIS_MASK;
#ifdef DEBUG_XSTEP_DUP_PIN
WRITE_NC(DEBUG_XSTEP_DUP_PIN,!INVERT_X_STEP_PIN);
#endif //DEBUG_XSTEP_DUP_PIN
@ -729,7 +726,6 @@ FORCE_INLINE void stepper_tick_lowres()
counter_y.lo += current_block->steps_y.lo;
if (counter_y.lo > 0) {
WRITE_NC(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
LastStepMask |= Y_AXIS_MASK;
#ifdef DEBUG_YSTEP_DUP_PIN
WRITE_NC(DEBUG_YSTEP_DUP_PIN,!INVERT_Y_STEP_PIN);
#endif //DEBUG_YSTEP_DUP_PIN
@ -744,7 +740,6 @@ FORCE_INLINE void stepper_tick_lowres()
counter_z.lo += current_block->steps_z.lo;
if (counter_z.lo > 0) {
WRITE_NC(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
LastStepMask |= Z_AXIS_MASK;
counter_z.lo -= current_block->step_event_count.lo;
count_position[Z_AXIS]+=count_direction[Z_AXIS];
WRITE_NC(Z_STEP_PIN, INVERT_Z_STEP_PIN);
@ -779,7 +774,6 @@ FORCE_INLINE void stepper_tick_highres()
counter_x.wide += current_block->steps_x.wide;
if (counter_x.wide > 0) {
WRITE_NC(X_STEP_PIN, !INVERT_X_STEP_PIN);
LastStepMask |= X_AXIS_MASK;
#ifdef DEBUG_XSTEP_DUP_PIN
WRITE_NC(DEBUG_XSTEP_DUP_PIN,!INVERT_X_STEP_PIN);
#endif //DEBUG_XSTEP_DUP_PIN
@ -794,7 +788,6 @@ FORCE_INLINE void stepper_tick_highres()
counter_y.wide += current_block->steps_y.wide;
if (counter_y.wide > 0) {
WRITE_NC(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
LastStepMask |= Y_AXIS_MASK;
#ifdef DEBUG_YSTEP_DUP_PIN
WRITE_NC(DEBUG_YSTEP_DUP_PIN,!INVERT_Y_STEP_PIN);
#endif //DEBUG_YSTEP_DUP_PIN
@ -809,7 +802,6 @@ FORCE_INLINE void stepper_tick_highres()
counter_z.wide += current_block->steps_z.wide;
if (counter_z.wide > 0) {
WRITE_NC(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
LastStepMask |= Z_AXIS_MASK;
counter_z.wide -= current_block->step_event_count.wide;
count_position[Z_AXIS]+=count_direction[Z_AXIS];
WRITE_NC(Z_STEP_PIN, INVERT_Z_STEP_PIN);
@ -847,8 +839,6 @@ FORCE_INLINE void isr() {
if (current_block == NULL)
stepper_next_block();
LastStepMask = 0;
if (current_block != NULL)
{
stepper_check_endstops();
@ -1066,7 +1056,7 @@ FORCE_INLINE void isr() {
}
#ifdef TMC2130
tmc2130_st_isr(LastStepMask);
tmc2130_st_isr();
#endif //TMC2130
//WRITE_NC(LOGIC_ANALYZER_CH0, false);
@ -1421,7 +1411,6 @@ void babystep(const uint8_t axis,const bool direction)
//perform step
WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
LastStepMask |= X_AXIS_MASK;
#ifdef DEBUG_XSTEP_DUP_PIN
WRITE(DEBUG_XSTEP_DUP_PIN,!INVERT_X_STEP_PIN);
#endif //DEBUG_XSTEP_DUP_PIN
@ -1445,7 +1434,6 @@ void babystep(const uint8_t axis,const bool direction)
//perform step
WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
LastStepMask |= Y_AXIS_MASK;
#ifdef DEBUG_YSTEP_DUP_PIN
WRITE(DEBUG_YSTEP_DUP_PIN,!INVERT_Y_STEP_PIN);
#endif //DEBUG_YSTEP_DUP_PIN
@ -1472,7 +1460,6 @@ void babystep(const uint8_t axis,const bool direction)
#endif
//perform step
WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
LastStepMask |= Z_AXIS_MASK;
#ifdef Z_DUAL_STEPPER_DRIVERS
WRITE(Z2_STEP_PIN, !INVERT_Z_STEP_PIN);
#endif
@ -1496,16 +1483,16 @@ void babystep(const uint8_t axis,const bool direction)
}
#endif //BABYSTEPPING
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
void digitalPotWrite(int address, int value) // From Arduino DigitalPotControl example
{
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
digitalWrite(DIGIPOTSS_PIN,LOW); // take the SS pin low to select the chip
SPI.transfer(address); // send in the address and value via SPI:
SPI.transfer(value);
digitalWrite(DIGIPOTSS_PIN,HIGH); // take the SS pin high to de-select the chip:
//delay(10);
#endif
}
#endif
void EEPROM_read_st(int pos, uint8_t* value, uint8_t size)
{
@ -1549,15 +1536,16 @@ uint8_t SilentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
#ifdef MOTOR_CURRENT_PWM_XY_PIN
void st_current_set(uint8_t driver, int current)
{
#ifdef MOTOR_CURRENT_PWM_XY_PIN
if (driver == 0) analogWrite(MOTOR_CURRENT_PWM_XY_PIN, (long)current * 255L / (long)MOTOR_CURRENT_PWM_RANGE);
if (driver == 1) analogWrite(MOTOR_CURRENT_PWM_Z_PIN, (long)current * 255L / (long)MOTOR_CURRENT_PWM_RANGE);
if (driver == 2) analogWrite(MOTOR_CURRENT_PWM_E_PIN, (long)current * 255L / (long)MOTOR_CURRENT_PWM_RANGE);
#endif
}
#else //MOTOR_CURRENT_PWM_XY_PIN
void st_current_set(uint8_t, int ){}
#endif //MOTOR_CURRENT_PWM_XY_PIN
void microstep_init()
{

View file

@ -92,8 +92,9 @@ extern bool y_min_endstop;
extern bool y_max_endstop;
void quickStop();
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
void digitalPotWrite(int address, int value);
#endif //defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2);
void microstep_mode(uint8_t driver, uint8_t stepping);
void st_current_init();

View file

@ -235,7 +235,7 @@ uint8_t tmc2130_sample_diag()
extern bool is_usb_printing;
void tmc2130_st_isr(uint8_t last_step_mask)
void tmc2130_st_isr()
{
if (tmc2130_mode == TMC2130_MODE_SILENT || tmc2130_sg_stop_on_crash == false) return;
uint8_t crash = 0;

View file

@ -53,7 +53,7 @@ extern tmc2130_chopper_config_t tmc2130_chopper_config[4];
//initialize tmc2130
extern void tmc2130_init();
//check diag pins (called from stepper isr)
extern void tmc2130_st_isr(uint8_t last_step_mask);
extern void tmc2130_st_isr();
//update stall guard (called from st_synchronize inside the loop)
extern bool tmc2130_update_sg();
//temperature watching (called from )

View file

@ -16,7 +16,7 @@ uint8_t uart2_ibuf[10] = {0, 0};
FILE _uart2io = {0};
int uart2_putchar(char c, FILE *stream)
int uart2_putchar(char c, FILE *stream __attribute__((unused)))
{
while (!uart2_txready);
UDR2 = c; // transmit byte
@ -25,7 +25,7 @@ int uart2_putchar(char c, FILE *stream)
return 0;
}
int uart2_getchar(FILE *stream)
int uart2_getchar(FILE *stream __attribute__((unused)))
{
if (rbuf_empty(uart2_ibuf)) return -1;
return rbuf_get(uart2_ibuf);

View file

@ -50,7 +50,7 @@ static void lcd_sd_updir();
// State of the currently active menu.
// C Union manages sharing of the static memory by all the menus.
union MenuData menuData = { 0 };
union MenuData menuData;
int8_t ReInitLCD = 0;
@ -187,8 +187,8 @@ static void lcd_delta_calibrate_menu();
/* Different types of actions that can be used in menu items. */
void menu_action_sdfile(const char* filename, char* longFilename);
void menu_action_sddirectory(const char* filename, char* longFilename);
static void menu_action_sdfile(const char* filename);
static void menu_action_sddirectory(const char* filename);
#define ENCODER_FEEDRATE_DEADZONE 10
@ -289,7 +289,7 @@ static inline void lcd_print_time() {
}
void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, char* longFilename)
{
char c;
int enc_dif = lcd_encoder_diff;
@ -341,7 +341,7 @@ void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr,
while(n--)
lcd_print(' ');
}
void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename)
static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* filename, char* longFilename)
{
char c;
uint8_t n = LCD_WIDTH - 1;
@ -361,7 +361,7 @@ void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const cha
while(n--)
lcd_print(' ');
}
void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* filename, char* longFilename)
{
char c;
uint8_t n = LCD_WIDTH - 2;
@ -382,7 +382,7 @@ void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* p
while(n--)
lcd_print(' ');
}
void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, const char* filename, char* longFilename)
static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* filename, char* longFilename)
{
char c;
uint8_t n = LCD_WIDTH - 2;
@ -406,7 +406,7 @@ void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, cons
#define MENU_ITEM_SDDIR(str, str_fn, str_fnl) do { if (menu_item_sddir(str, str_fn, str_fnl)) return; } while (0)
#define MENU_ITEM_SDDIR(str_fn, str_fnl) do { if (menu_item_sddir(str_fn, str_fnl)) return; } while (0)
//#define MENU_ITEM_SDDIR(str, str_fn, str_fnl) MENU_ITEM(sddirectory, str, str_fn, str_fnl)
//extern uint8_t menu_item_sddir(const char* str, const char* str_fn, char* str_fnl);
@ -415,7 +415,7 @@ void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, cons
//extern uint8_t menu_item_sdfile(const char* str, const char* str_fn, char* str_fnl);
uint8_t menu_item_sddir(const char* str, const char* str_fn, char* str_fnl)
uint8_t menu_item_sddir(const char* str_fn, char* str_fnl)
{
#ifdef NEW_SD_MENU
// str_fnl[18] = 0;
@ -446,15 +446,15 @@ uint8_t menu_item_sddir(const char* str, const char* str_fn, char* str_fnl)
if (lcd_draw_update)
{
if (lcd_encoder == menu_item)
lcd_implementation_drawmenu_sddirectory_selected(menu_row, str, str_fn, str_fnl);
lcd_implementation_drawmenu_sddirectory_selected(menu_row, str_fn, str_fnl);
else
lcd_implementation_drawmenu_sddirectory(menu_row, str, str_fn, str_fnl);
lcd_implementation_drawmenu_sddirectory(menu_row, str_fn, str_fnl);
}
if (menu_clicked && (lcd_encoder == menu_item))
{
menu_clicked = false;
lcd_update_enabled = 0;
menu_action_sddirectory(str_fn, str_fnl);
menu_action_sddirectory(str_fn);
lcd_update_enabled = 1;
return menu_item_ret();
}
@ -465,7 +465,11 @@ uint8_t menu_item_sddir(const char* str, const char* str_fn, char* str_fnl)
#endif //NEW_SD_MENU
}
uint8_t menu_item_sdfile(const char* str, const char* str_fn, char* str_fnl)
static uint8_t menu_item_sdfile(const char*
#ifdef NEW_SD_MENU
str
#endif //NEW_SD_MENU
,const char* str_fn, char* str_fnl)
{
#ifdef NEW_SD_MENU
// printf_P(PSTR("menu sdfile\n"));
@ -512,13 +516,13 @@ uint8_t menu_item_sdfile(const char* str, const char* str_fn, char* str_fnl)
if (lcd_draw_update)
{
if (lcd_encoder == menu_item)
lcd_implementation_drawmenu_sdfile_selected(menu_row, str, str_fn, str_fnl);
lcd_implementation_drawmenu_sdfile_selected(menu_row, str_fnl);
else
lcd_implementation_drawmenu_sdfile(menu_row, str, str_fn, str_fnl);
lcd_implementation_drawmenu_sdfile(menu_row, str_fn, str_fnl);
}
if (menu_clicked && (lcd_encoder == menu_item))
{
menu_action_sdfile(str_fn, str_fnl);
menu_action_sdfile(str_fn);
return menu_item_ret();
}
}
@ -3466,7 +3470,7 @@ int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow
}
}
void lcd_bed_calibration_show_result(uint8_t result, uint8_t point_too_far_mask)
void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask)
{
const char *msg = NULL;
if (result == BED_SKEW_OFFSET_DETECTION_POINT_NOT_FOUND) {
@ -5188,7 +5192,7 @@ void unload_filament()
disable_e2();
delay(100);
Sound_MakeSound(e_SOUND_CLASS_Prompt, e_SOUND_TYPE_StandardPrompt);
Sound_MakeSound(e_SOUND_TYPE_StandardPrompt);
uint8_t counterBeep = 0;
while (!lcd_clicked() && (counterBeep < 50)) {
delay_keep_alive(100);
@ -5910,7 +5914,7 @@ void lcd_sdcard_menu()
#endif
if (card.filenameIsDir)
MENU_ITEM_SDDIR(_T(MSG_CARD_MENU), card.filename, card.longFilename);
MENU_ITEM_SDDIR(card.filename, card.longFilename);
else
MENU_ITEM_SDFILE(_T(MSG_CARD_MENU), card.filename, card.longFilename);
} else {
@ -6917,7 +6921,7 @@ static bool check_file(const char* filename) {
}
void menu_action_sdfile(const char* filename, char* longFilename)
static void menu_action_sdfile(const char* filename)
{
loading_flag = false;
char cmd[30];
@ -6962,7 +6966,7 @@ void menu_action_sdfile(const char* filename, char* longFilename)
lcd_return_to_status();
}
void menu_action_sddirectory(const char* filename, char* longFilename)
void menu_action_sddirectory(const char* filename)
{
uint8_t depth = (uint8_t)card.getWorkDirDepth();

View file

@ -5,6 +5,7 @@
#include "lcd.h"
#include "conv2str.h"
#include "menu.h"
#include "mesh_bed_calibration.h"
extern int lcd_puts_P(const char* str);
extern int lcd_printf_P(const char* format, ...);
@ -143,7 +144,7 @@ extern const char* lcd_display_message_fullscreen_P(const char *msg);
#endif
// Show the result of the calibration process on the LCD screen.
extern void lcd_bed_calibration_show_result(uint8_t result, uint8_t point_too_far_mask);
extern void lcd_bed_calibration_show_result(BedSkewOffsetDetectionResultType result, uint8_t point_too_far_mask);
extern void lcd_diag_show_end_stops();

View file

@ -87,7 +87,7 @@ uint8_t check_pinda_1()
uint8_t xyzcal_dm = 0;
void xyzcal_update_pos(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t de)
void xyzcal_update_pos(uint16_t dx, uint16_t dy, uint16_t dz, uint16_t)
{
// DBG(_n("xyzcal_update_pos dx=%d dy=%d dz=%d dir=%02x\n"), dx, dy, dz, xyzcal_dm);
if (xyzcal_dm&1) count_position[0] -= dx; else count_position[0] += dx;
@ -108,11 +108,9 @@ uint16_t xyzcal_sm4_ac2 = (uint32_t)xyzcal_sm4_ac * 1024 / 10000;
//float xyzcal_sm4_vm = 10000;
#endif //SM4_ACCEL_TEST
#ifdef SM4_ACCEL_TEST
uint16_t xyzcal_calc_delay(uint16_t nd, uint16_t dd)
{
return xyzcal_sm4_delay;
#ifdef SM4_ACCEL_TEST
uint16_t del_us = 0;
if (xyzcal_sm4_v & 0xf000) //>=4096
{
@ -138,9 +136,13 @@ uint16_t xyzcal_calc_delay(uint16_t nd, uint16_t dd)
// return xyzcal_sm4_delay;
// DBG(_n("xyzcal_calc_delay nd=%d dd=%d v=%d del_us=%d\n"), nd, dd, xyzcal_sm4_v, del_us);
return 0;
#endif //SM4_ACCEL_TEST
}
#else //SM4_ACCEL_TEST
uint16_t xyzcal_calc_delay(uint16_t, uint16_t)
{
return xyzcal_sm4_delay;
}
#endif //SM4_ACCEL_TEST
bool xyzcal_lineXYZ_to(int16_t x, int16_t y, int16_t z, uint16_t delay_us, int8_t check_pinda)
{